Enable switching within CaptureModule to HDR+ and back.

  Bug: 16945820

Change-Id: If92371129c5bf2a78b7623d745a8b86d218d32e1
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index 45002f2..1f3c8f5 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -527,7 +527,14 @@
             }, createAspectRatioDialogCallback());
         } else {
             // App upgrade. Only show aspect ratio selection.
-            mUI.showAspectRatioDialog(createAspectRatioDialogCallback());
+            boolean wasShown = mUI.showAspectRatioDialog(createAspectRatioDialogCallback());
+            if (!wasShown) {
+                // If the dialog was not shown, set this flag to true so that we
+                // never have to check for it again. It means that we don't need
+                // to show the dialog on this device.
+                mActivity.getSettingsManager().set(SettingsManager.SCOPE_GLOBAL,
+                        Keys.KEY_USER_SELECTED_ASPECT_RATIO, true);
+            }
         }
     }
 
@@ -654,6 +661,7 @@
         Log.i(TAG, "Start to switch camera. id=" + mPendingSwitchCameraId);
         closeCamera();
         mCameraId = mPendingSwitchCameraId;
+
         settingsManager.set(mAppController.getModuleScope(), Keys.KEY_CAMERA_ID, mCameraId);
         requestCameraOpen();
         mUI.clearFaces();
@@ -714,7 +722,7 @@
                 @Override
                 public void onStateChanged(int state) {
                     SettingsManager settingsManager = mActivity.getSettingsManager();
-                    if (GcamHelper.hasGcamCapture()) {
+                    if (GcamHelper.hasGcamAsSeparateModule()) {
                         // Set the camera setting to default backfacing.
                         settingsManager.setToDefault(mAppController.getModuleScope(),
                                                      Keys.KEY_CAMERA_ID);
@@ -763,7 +771,7 @@
         // PhotoModule should hard reset HDR+ to off,
         // and HDR to off if HDR+ is supported.
         settingsManager.set(SettingsManager.SCOPE_GLOBAL, Keys.KEY_CAMERA_HDR_PLUS, false);
-        if (GcamHelper.hasGcamCapture()) {
+        if (GcamHelper.hasGcamAsSeparateModule()) {
             settingsManager.set(SettingsManager.SCOPE_GLOBAL, Keys.KEY_CAMERA_HDR, false);
         }
     }