Camera: separate settings for color effects

Store color effect settings for the camera and
video camera in their own separate preferences.

Change-Id: I8faa59b8663154737910b338906d27f9736d5ad9
camera: add support for samsung and htc camcorder modes

Change-Id: I68e6995a51dffa3b5851eb4b7a3a72e60d201d5b
Camera: Avoid animating cature with decoded jpeg in long shot

Decoding full jpeg image and animating capture
with that is causing lot of delays which effects
long shot stability.This change avoids that.

CRs-Fixed: 586568

Change-Id: I0133cc55e5efcc801dd9a98c289dec965aa35984
Camera: Add support for 4K camcorder

In case 4k is enabled,
 (a) set the preview resoultion same as video resolution.
 (b) set the preview format same as video format.

Change-Id: Iebc4c7d47ddca6e03a72f3af7b4660e93c9a1b8e
 Camera: Remove AF UI when faces are detected in photo ui

 AF window does not go away when faces are detected while
 capturing the images.This is because AF is not cleared
 when faces are detected in photo ui.

 The fix is to clear AF window by calling AF succeed
 when faces are detected in photo ui.

 CRs-Fixed: 555139

Change-Id: If0f10296a8fa232829e80a07778f78f158a55bf5
Camcorder: Switch video torch when preview focused

- Currently, video torch switching is not determined
  properly. When user enables and disables flash mode
  checkbox, nothing happens. Also, if video torch
  is enabled and switching to Camera and back to
  Camcorder mode, torch doesn't lights up.

- Adding a local variable mPreviewFocused to track
  the preview window focus state should fix the issue.

Change-Id: Ia134b86885eda1ad50d510e67e5595a391326d10
CRs-fixed: 567295
Camera: Don't do cancel_af till all CBs are received in burst shot

Doing cancel_af in the first jpeg CB while
burst shot is going on, is changing the
camera state to IDLE and allowing next
takePicture() which is resulting in crash
as this call reaches HAL when camera is in
picture taking state.

Change-Id: Idd146060a73161bcc30c34756fb53662bb1f0902
CRs-Fixed: 593352
Camera2 : Reset mSnapshotInProgress if recording stopped.

If recording stops while snapshot is in progress, we might not get
jpeg callback because cameraservice will disable picture related
messages. Hence reset mSnapshotInProgress flag so that we can take
liveshots in the next recording session.

Change-Id: I6a639eb0b9444e4915786c65f64d3b95b064267c
CRs-Fixed: 588698
Camera: Dont reset camera state while capture is in progress.

While capture is in progress and if we get autofocus event,
currently we reset the camera state to IDLE blindly. This is
resulting in app exception because it will trigger another
takepicture and lower layers will return error.

( cherrypicked from commit 1bed537bb0848b6a1f64f9eb245b1c256999ebad )

Change-Id: Ia595dbad246759870371b749c0aa2def221560c5
CRs-Fixed: 550417
Camera2: override Saturation&Contrast item when enable scence mode

When HDR or any other scene mode is enabled, should disable the
saturation and contrast items into gray.

( cherrypicked from commit aceeee3ef5812836265127ed784adb4ab5ed57fb )

Change-Id: Ia4e20e0ee2f80661c8b72bf81aeee6fa96dcdf1f
CRs-Fixed: 526617
Camera2:stop recording from camcorder app in case of error

This change makes sure that stopvideoRecording is called
for all error returns to the video recording app.

( cherrypicked from commit 9d65272083d0a78ca4adefbffc38f98b44cfa489 )

Change-Id: I88c4ac92f065e5008c16a7697a84301e1ff5e98f
CRs-Fixed: 517351
Camera2: Fix concurrency issues with camera messages

Without this, multiple threads are
trying to access same data and
resulting in crash.

( cherrypicked from commit d11040c561e9add30768947aa93235ff08de03b1 )

Change-Id: Ib09950d6640afcd7962cba9ea5385d778f022abe
CRs-Fixed: 542706
Camera2: Check mCameradevice before setting skinToneEnhancement

Null pointer exception in app is observed when we open camera
and immediately press home/back button. This is because
mCameradevice will be null by the time handler thread gets a
message to setskinToneEnhancement parameter.

( cherrypicked from commit 06fee777df529fa53ac5c5305e7324ad1baf085d )

Change-Id: I7f216a11a29b6b205be4c2d0ca8f1c346284c294
CRs-Fixed: 547522
Camera2: Synchronize access to camera parameters

- Concurrent access between the main handler
  thread and the camera start-up thread w.r.t.
  'mParameters' is possible. This change will
  synchronize the two threads in order to avoid
  any exceptions.

( cherrypicked from commit e988411c441410f270fe0b98dfd0d9b1f033503f )

Change-Id: I290452723b3687eba5240f451cc94aef175a9fc4
CRs-Fixed: 539634
Camera: Prevent callling of resize  before camera is initialized

Prevent callling of resizeForPreviewAspectRatio
before camera is initialized

( cherrypicked from commit 57698f01193a75948505d0d6c098364e155c6a5b )

Change-Id: I400dbf30c30f5e2a458eac8fe05449ee055cb0f4
CRs-Fixed: 598600
Camera: Add checker for null pointer exception during camera release

In current code, handler will still try to execute command even
camera is closed, so add null point checker to skip these commands

( cherrypicked from commit 63ae64c56b00f44956502822a0ddb96307ae7270 )

Change-Id: I71c30a5293364e084de650e92d9d0926e7e3d7c1
CRs-Fixed: 598600
Update settings pref values when BSM is not auto.

When BSM mode is set to a value other than auto, flash mode, white
balance and few more settings will not be based on user preferred
settings. So mParameter object will have default values. Updating
those values in the list will over write the preferences.
To preserve settings from preferences, we need to pass the same
values.

CRs-Fixed: 573584
Change-Id: Ic62dc537250468f189374fae9a897ee46d40e3a1
Camera2: Added pause button in Camcorder

- Added pause button in camcorder app.so that user pause
  recording and resume later which results in a single
  recorded clip.
CRs-Fixed: 587051

Change-Id: I2a7d8af7fcea74fe8af62c44119c3c1fa0c13e85
Camera: Add a filter to remove unsupported hfr modes in camcorder

Some sensors don't support some hfr modes, so in camera setting,
a filter should be used to block unnecessary menu items.

( cherrypicked from commit a7536c35e22148ee1def337d36fce0682a347c92 )

Change-Id: I5b243e59c99f4daaa36022867d19782b6e2395eb
CRs-Fixed: 598600
Camera2: Calculate UI aspect ratio based on preview size

- This reverts change If4047860.

- Simply using preview size instead of picture size
  at all to calculate the UI aspect ratio,
  avoiding tricky overwriting aspect ratio.

- Will fix issues when surface texture transform
  is calculated based sometimes on preview size
  ratio and sometimes on picture size ratio.

CRs-Fixed: 601495
Change-Id: I8e054c9eaafc9fb54dac2bff2c67e39f0a1fe64c