Camera2: fix camera carsh when mPieRender is null

The autofocus maybe called before onCameraOpened, and mPieRender is
not initialize which lead to camera crash.

Check null when show focus ui.

CRs-Fixed: 712850

Change-Id: If3d51c8ea31f4a755e26fe4730e85428373e6446
Camera2: Fix video duration is wrong issue

When mMediaRecorderPausing is true, video duration
is equal to mRecordingTotalTime, which can fix video
duration is wrong issue if use pause/resume.

Change-Id: I71d41414bba11564cfe84166fbc18608636a73d1
Camera2: fix a camera status bug

After a picture is taken for MMS app, the preview has been stopped in
onPictureTaken() but the camera state is subsequently set to IDLE in
ZSL mode. Add a check before assignment.

Change-Id: I0610a58dbccffdba4b94140d74942c2ff60c7882
CRs-Fixed: 675176
Camera2: Do not restart preview to update flip params during orientation change.

When there was a orientation change flip paramter had to be changed.
Currently all parameters are set again and preview is being restarted.
so preview will not be smooth when user rotae the device.

This change makes sure only necessary params are updated and
preview will not be restarted.

CRs-Fixed: 710129

Change-Id: I564431ef8cedaf68c9d12e2a84a3a430c845ab6d
Camera: Disable HDR when scene mode is other than auto

- HDR option is enabled even when scene mode is not auto.
  Due to this preview and snapshot are still remain in previous
  scene mode after enabling HDR.

- Fix is to disable the HDR when scene mode is other than auto.

Change-Id: Icec96816a7ed6f3daacc8b79841dee5db6b4b04a
CRs-Fixed: 648847
Camera2: Still popup tips when change scene to other after turn off HDR

The toast popup or not depend on the value of hdr and scene mode,
but now the value mHdrOn status is not uniform with the actual hdr
value, which lead to popup toast incorrect.

Get the value of scene mode or hdr from the preference directly rather
than a new variable. So the mHdrOn is not used and delete it.

CRs-Fixed: 674521

Change-Id: I1c6926e0ba295e9869109b7412a7413323d3bd1c
Camera: open Camera and start Preview in a seperate thread.

Start openCamera and start preview in a separate thread so that
UI initialization and preview can run parallely. This is to
improve camera cold start latency.

Change-Id: I57af45bc90a4db1630c73449d543c3ff0992e55c
Merge commit 'refs/changes/47/74747/4' of http://review.cyanogenmod.org/CyanogenMod/android_packages_apps_Camera2 into cm-11.0
Merge commit 'refs/changes/33/74733/4' of http://review.cyanogenmod.org/CyanogenMod/android_packages_apps_Camera2 into cm-11.0
Merge commit 'refs/changes/39/74739/3' of http://review.cyanogenmod.org/CyanogenMod/android_packages_apps_Camera2 into cm-11.0
Merge commit 'refs/changes/35/74735/3' of http://review.cyanogenmod.org/CyanogenMod/android_packages_apps_Camera2 into cm-11.0
Merge commit 'refs/changes/34/74734/3' of http://review.cyanogenmod.org/CyanogenMod/android_packages_apps_Camera2 into cm-11.0