Start gcam module directly when handling capture intent.

Bug: 11609971

- Prior behavior for capture intents when in HDR+ mode was
  to resume into the PhotoModule and switch to the GcamModule.
  Following this change, we resume directly into the GcamModule.

- Fixes the bad lockscreen behavior caused by the sequence:
  onResume->switch to GcamModule(queue GcamModule onPause and onResume)->
  onPause->onResume, where handler queuing order could get in a
  state where the GcamModule onResume is called twice in a row,
  resulting in duplicate requests being queued for each capture.

Change-Id: Ibd632d74836224288270f5342e45e523e25ca429
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index 29bf408..84c54a8 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -1096,8 +1096,14 @@
             moduleIndex = ModuleSwitcher.VIDEO_MODULE_INDEX;
         } else if (MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA.equals(getIntent().getAction())
                 || MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE.equals(getIntent()
-                        .getAction())
-                || MediaStore.ACTION_IMAGE_CAPTURE.equals(getIntent().getAction())
+                        .getAction())) {
+            moduleIndex = ModuleSwitcher.PHOTO_MODULE_INDEX;
+            SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
+            if (prefs.getInt(CameraSettings.KEY_STARTUP_MODULE_INDEX, -1)
+                        == ModuleSwitcher.GCAM_MODULE_INDEX && GcamHelper.hasGcamCapture()) {
+                moduleIndex = ModuleSwitcher.GCAM_MODULE_INDEX;
+            }
+        } else if (MediaStore.ACTION_IMAGE_CAPTURE.equals(getIntent().getAction())
                 || MediaStore.ACTION_IMAGE_CAPTURE_SECURE.equals(getIntent().getAction())) {
             moduleIndex = ModuleSwitcher.PHOTO_MODULE_INDEX;
         } else {