HDR: disable flash when HDR is active

Change-Id: I1ae2a9c2d33f6069dc1d69eceafeb3467cd0d8cc
Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
diff --git a/assets/dependency.json b/assets/dependency.json
index 344bc99..4af2a9b 100755
--- a/assets/dependency.json
+++ b/assets/dependency.json
@@ -75,7 +75,8 @@
     "18":
     {"pref_camera2_coloreffect_key":"0",
       "pref_camera2_zsl_key":"disable",
-      "pref_camera2_picture_format_key":"0"}
+      "pref_camera2_picture_format_key":"0",
+      "pref_camera2_flashmode_key":"off"}
     ,
     "100":
     {"pref_camera2_longshot_key":"off",
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java
index 67a65d3..46df35c 100755
--- a/src/com/android/camera/CaptureModule.java
+++ b/src/com/android/camera/CaptureModule.java
@@ -6529,6 +6529,12 @@
 
             request.set(CaptureRequest.CONTROL_AE_MODE,
                     CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE);
+        } else if (isHDREnable()) {
+            mIsRedEyeRemovalEnabled = false;
+
+            // when HDR is on, disable flash
+            request.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON);
+            request.set(CaptureRequest.FLASH_MODE, CaptureRequest.FLASH_MODE_OFF);
         } else {
             mIsRedEyeRemovalEnabled = false;
 
@@ -6871,8 +6877,7 @@
                     updateVideoFlash();
                     return;
                 case SettingsManager.KEY_FLASH_MODE:
-                    applyFlashForUIChange(mPreviewRequestBuilder[getMainCameraId()],
-                            getMainCameraId());
+                    applyFlashForUIChange(mPreviewRequestBuilder[getMainCameraId()], getMainCameraId());
                     // When enable APP-ZSL, run restartSession
                     if (SettingsManager.getInstance().isZSLInAppEnabled()) {
                         if (count == 0) restartSession(false);