OSDN Git Service

Hiding manual exposure button in N6. The button was previously disabled.
authorzafir <zafir@google.com>
Tue, 24 Mar 2015 01:13:35 +0000 (18:13 -0700)
committerzafir <zafir@google.com>
Tue, 24 Mar 2015 01:36:37 +0000 (18:36 -0700)
Bug: 18523154
Change-Id: Id08cef46fc4a67e50ce4b1acd185c5ae6efa94ad

src/com/android/camera/CaptureModule.java
src/com/android/camera/app/CameraAppUI.java

index de10929..e2ff2e9 100644 (file)
@@ -724,6 +724,9 @@ public class CaptureModule extends CameraModule implements
         bottomBarSpec.hdrCallback = getHdrButtonCallback();
         bottomBarSpec.enableSelfTimer = true;
         bottomBarSpec.showSelfTimer = true;
+        bottomBarSpec.isExposureCompensationSupported = mCameraCharacteristics
+                .isExposureCompensationSupported();
+        bottomBarSpec.enableExposureCompensation = bottomBarSpec.isExposureCompensationSupported;
 
         // We must read the key from the settings because the button callback
         // is not executed until after this method is called.
@@ -743,7 +746,6 @@ public class CaptureModule extends CameraModule implements
             // flash supported property and manual exposure supported property
             // for this camera.
             bottomBarSpec.enableFlash = mCameraCharacteristics.isFlashSupported();
-            bottomBarSpec.enableExposureCompensation = mCameraCharacteristics.isExposureCompensationSupported();
         }
 
         bottomBarSpec.minExposureCompensation =
index 0b6c359..f5b7004 100644 (file)
@@ -352,8 +352,19 @@ public class CameraAppUI implements ModeListView.ModeSwitchListener,
          */
         public boolean enablePanoOrientation;
 
+        /**
+         * Set true if manual exposure compensation should be visible.
+         *
+         * This option is not constrained by hardware limitations.
+         * For example, this is false in HDR+ mode.
+         */
         public boolean enableExposureCompensation;
 
+        /**
+         * Set true if the device supports exposure compensation.
+         */
+        public boolean isExposureCompensationSupported;
+
         /** Intent UI */
 
         /**
@@ -2052,11 +2063,14 @@ public class CameraAppUI implements ModeListView.ModeSwitchListener,
             buttonManager.initializePanoOrientationButtons(bottomBarSpec.panoOrientationCallback);
         }
 
-        // If manual exposure is enabled and HDR is not enabled, then show the
-        // exposure button.
-        // If manual exposure is enabled and HDR is enabled, then disable the
-        // exposure button.
-        // If manual exposure is not enabled, then hide the exposure button.
+
+
+        // If manual exposure is enabled both in SettingsManager and
+        // BottomBarSpec,then show the exposure button.
+        // If manual exposure is disabled in the BottomBarSpec (eg. HDR+
+        // enabled), but the device has the feature, then disable the exposure
+        // button.
+        // Otherwise, hide the button.
         if (bottomBarSpec.enableExposureCompensation
                 && !(bottomBarSpec.minExposureCompensation == 0 && bottomBarSpec.maxExposureCompensation == 0)
                 && mController.getSettingsManager().getBoolean(SettingsManager.SCOPE_GLOBAL,
@@ -2069,15 +2083,16 @@ public class CameraAppUI implements ModeListView.ModeSwitchListener,
                         }
                     });
             buttonManager.setExposureCompensationParameters(
-                bottomBarSpec.minExposureCompensation,
-                bottomBarSpec.maxExposureCompensation,
-                bottomBarSpec.exposureCompensationStep);
+                    bottomBarSpec.minExposureCompensation,
+                    bottomBarSpec.maxExposureCompensation,
+                    bottomBarSpec.exposureCompensationStep);
 
             buttonManager.setExposureCompensationCallback(
                     bottomBarSpec.exposureCompensationSetCallback);
             buttonManager.updateExposureButtons();
         } else if (mController.getSettingsManager().getBoolean(SettingsManager.SCOPE_GLOBAL,
-                Keys.KEY_EXPOSURE_COMPENSATION_ENABLED)) {
+                Keys.KEY_EXPOSURE_COMPENSATION_ENABLED)
+                && bottomBarSpec.isExposureCompensationSupported) {
             buttonManager.disableButton(ButtonManager.BUTTON_EXPOSURE_COMPENSATION);
         } else {
             buttonManager.hideButton(ButtonManager.BUTTON_EXPOSURE_COMPENSATION);