Camera: Bring Samsung camera fixes and features to 4.3

Patchset: 17
http://review.cyanogenmod.org/#/c/46287/

Squashed commit of the following:

commit 2f774cdc9f056ee7688f0fbb60624eb1baddb41f
Author: codeworkx <codeworkx@cyanogenmod.org>
Date:   Mon Dec 10 22:50:41 2012 +0100

    camera: add support for samsung and htc camcorder modes

    Change-Id: I68e6995a51dffa3b5851eb4b7a3a72e60d201d5b

commit 2f0e1b5a87b4625280deeed168b4acdca703e729
Author: Steve Kondik <shade@chemlab.org>
Date:   Tue Feb 12 13:30:57 2013 -0500

    camera: Add options to better control video preview size

     * usePreferredPreviewSizeForEffects is needed to fix camcorder effect on
       some MSM8660 devices.
     * Add ignorePreferredPreviewSizeForVideo to use the best size reported
       by the driver instead of the preferred-preview-size-for-video value,
       which may report something really awful.

    Adapted for cm-10.1 from similar commits in jellybean.
      https://github.com/CyanogenMod/android_packages_apps_Camera/commit/5ea90585dfce5a38f0c91d2ae07145770a0ea569
      https://github.com/CyanogenMod/android_packages_apps_Camera/commit/7310af07d00910033adbd2dce6aaf8b04cd1f220

    Change-Id: I58d4f81333a26dbd6d1ce35037b9c32fbd7d5b69

    Conflicts:
    	src/com/android/camera/VideoModule.java

commit 8969fd7025f166ee55c7fe5fe9964690c69b7a10
Author: codeworkx <codeworkx@cyanogenmod.org>
Date:   Mon Dec 10 23:04:04 2012 +0100

    camera: allow setting video-size before recording starts

    Needed for some samsung cameras.

    Change-Id: Ib87071bdd900aa1a42253bf6e2038b0af51f065b

    Conflicts:
    	res/values/config.xml
    	src/com/android/camera/CameraSettings.java
    	src/com/android/camera/Util.java
    	src/com/android/camera/VideoModule.java

commit 7cb706a3e5291b402c537f84ea30f5f8dca58e53
Author: Ricardo Cerqueira <cyanogenmod@cerqueira.org>
Date:   Wed Jul 31 10:02:22 2013 -0400

    Many camera HAL's stop the preview while taking a picture without generating events to upper layers
    Use "previewStopsDuringSnapshot" to avoid sending a stop while it is already stopped

    Forwarded from 10.1 camera - original commit 115d7184ee43703e4fcd3c248beea9b4090d0111

    PatchSet2 : credit original Author
    PatchSet3 : rebase to depend on 4.3 changes commit
    PatchSet4 : remove trailing spaces

    Change-Id: Ie7defc85d31bbbd9d132b8b488014b880cc1640d

commit afe0881439dedcd0fd665a8813c6260882b2a4cf
Author: Shareef Ali <shareefalis@cyanogenmod.org>
Date:   Sun Jul 28 12:37:36 2013 -0500

    Camera: fix derp and upgrade to 4.3 API

    Change-Id: I8079e35e753edbbcfd36d3d8a173e831621a5481

commit 7f11966b79c646c9ddf38634ad0726ad73befe8d
Author: Shareef Ali <shareefalis@cyanogenmod.org>
Date:   Mon Jul 22 03:08:42 2013 -0500

    Camera: HDR: don't reset focus manager when HDR is active.

    HDR takes time to compute. So disable any refernce to zsl except
    for actual take it in zsl command.
    due to a recent commit http://review.cyanogenmod.org/#/c/45730/
    I didn't know it was merged in less than 24 hours as HDR commit.

    Change-Id: I2aa3f4146575329c6fefb259b099371080842dab

commit b2ecd462457040a3408fe88079f6069013c31377
Author: Dheeraj CVR <cvr.dheeraj@gmail.com>
Date:   Thu Jul 18 14:40:48 2013 -0700

    camera: fix image capture review mode when zsl is enabled

    Choosing "Take Photo" to change a contact image doesn't show
    the captured imaged after taking a snap if ZSL is enabled.
    Also observed on apps that use the native camera to capture
    an image like Whatsapp.

    In ZSL mode, the preview is not stopped, due to which the
    review mode (ImageCapture) doesn't show the captured frame.
    Hence stop the preview if ZSL mode is active so that the
    preview can be restarted using the onReviewRetakeClicked().

    Also, reset the autofocus and set the camera to idle only
    when the ZSL mode is active. This fixes issues with non ZSL
    cameras where autofocus works even during the review mode
    after taking the snap since the camera state is set to idle.

    Change-Id: I2aa3f4146575329c6fefb259b09937108084fdab

commit 09a082533d7224443f5f7b0e41cc67a09af2b1d2
Author: Dheeraj CVR <cvr.dheeraj@gmail.com>
Date:   Wed Jul 24 18:34:42 2013 -0700

    camera: dont call cancelAutoFocus if the preview is stopped

    Most sensors cant cancel autofocus when preview
    is stopped.

    Change-Id: I66c2ddcedf3ed42a00e8364daab2b2906ba3301c

commit 5076f24ac501900692f3aaef6cfa0ba45deaaf6c
Author: Shareef Ali <shareefalis@cyanogenmod.org>
Date:   Fri Jul 19 23:53:01 2013 -0500

    Camera: HDR:  fix rotation issues.

    * fix fake rotate with real rotate by replacing the image with actual rotated image.
    * ps2: add more rotation mode

    Change-Id: I751cee4b9694180912d3bb0509fd12e295fbcb18

commit 41222dc4557a7e57f22149db7a9d80f61701682a
Author: Shareef Ali <shareefalis@cyanogenmod.org>
Date:   Sat Jul 13 22:29:23 2013 -0500

    Camera: HDR: fix low exposure on samsung hardware.

    /* samsung actually speficify max HDR range via exposure compinsation */
    Change-Id: I48b31965cf5acb6b9abcd2a62b1d341bfcab649c

commit de966f526165c3482445a6b506ab2184caff5a12
Author: Shareef Ali <shareefalis@cyanogenmod.org>
Date:   Thu Jul 4 02:45:09 2013 -0500

    Camera: HDR: convert YUV422P / YV16 format to JPEG

    Change-Id: I6310793e5e2d10e2d5e3d374aafe9761273259fc

commit 178ef452b7d2d9140a12eedf9f93e11a9c76465b
Author: Shareef Ali <shareefalis@cyanogenmod.org>
Date:   Tue Jun 25 18:39:36 2013 -0500

    camera: reset camera surface on previewstart()

    fixes aspect ratio on camera switch bug

    JIRA: CYAN-1085

    Change-Id: Ic91e0454588a987e72e5336ab9d01bdd249f13e6

    Conflicts:
    	src/com/android/camera/PhotoController.java
    	src/com/android/camera/PhotoModule.java
    	src/com/android/camera/Util.java
    	src/com/android/camera/VideoController.java
    	src/com/android/camera/VideoModule.java

commit 3fc823f6b47228ab9843d828dd983bc2b1dd8e3e
Author: Jorge Ruesga <jorge@ruesga.com>
Date:   Sat May 25 21:46:43 2013 +0200

    Camera: Wait for camera initialization

    Patchset 2: Capture specific exceptions instead of a generic exception

    Change-Id: Id62d0dedc630c3815dca7b101fdbf731154be3ca
    JIRA: CYAN-1190
    Issue: https://jira.cyanogenmod.org/browse/CYAN-1190
    Signed-off-by: Jorge Ruesga <jorge@ruesga.com>

commit 65dd92063dcdede7e053ca0ec36f4f453c3d4391
Author: Steve Kondik <shade@chemlab.org>
Date:   Wed May 8 11:35:20 2013 -0700

    camera: Fix hang when changing picture size

    Change-Id: I46d060d470b96be56d84f273accf54702e72b321

commit 66003f2c1f73ce7857ca3aee52db1c8870ac8a8e
Author: Steve Kondik <shade@chemlab.org>
Date:   Sat May 4 03:17:08 2013 -0700

    camera: Add support for ZSL on new Samsung devices

     * The camera driver on new Samsung devices requires that we send a
       magic command to the hardware in order to get ZSL behavior with
       continuous preview. On previous devices, this worked as long as the
       "cam_mode" parameter was zero (instead of null) and "camera-mode" is
       set to 1. On JF, we need to do all of these things.
     * The command we need to send is 1508, but I do not know what this
       value actually corresponds to. It was discovered by reverse
       engineering.

    Change-Id: I6bccc9cd228784045eef81719892121749af4fa5

commit 57f2a7a15eaa1979a17fe0f074c258c03e90baee
Author: Steve Kondik <shade@chemlab.org>
Date:   Wed Feb 29 12:59:19 2012 -0800

    camera: Restart the preview if record size changes

      * Needed to release the buffers on many cameras when the record size
        changes but the preview size does not. Without releasing the buffers,
        we can run out of ION space and end up with a mangled recording.

    Change-Id: I3ebee850b3e20b3920368c8e052a428f6dd9e3e5

commit c359b9edc7a089965a425efe80a59a9a268fce5a
Author: Steve Kondik <shade@chemlab.org>
Date:   Sat Dec 15 20:31:59 2012 -0800

    camera: Add ZSL support for Samsung/Qualcomm cameras

     * Preview management for Samsung/Qualcomm cameras
     * Add workaround for broken face detection on front camera

    Change-Id: Ib36bd21c9a76b45bced3eee2f25acc35b5d82b30

commit 637e1c973abc0b231722c9eb177abb108da50cad
Author: Ricardo Cerqueira <github@cerqueira.org>
Date:   Mon Dec 10 10:15:22 2012 +0700

    Camera: Allow a device to request the focus modes at build time

    By default, if a HAL supports touch-to-focus, mode selection is
    disabled. Make that an option for devices where manual modes
    work better without TTF (Macro, for instance)

Change-Id: Id47fba2a9d156b157440485a0fa516871076d9f9