OSDN Git Service

Merge "Fix for N4 Video Rotation Bug" into ub-camera-haleakala
[android-x86/packages-apps-Camera2.git] / src / com / android / camera / app / CameraAppUI.java
index 0351824..3a7dac6 100644 (file)
@@ -352,8 +352,20 @@ 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 and module support exposure compensation.
+         * Used only to show exposure button in disabled (greyed out) state.
+         */
+        public boolean isExposureCompensationSupported;
+
         /** Intent UI */
 
         /**
@@ -1255,7 +1267,7 @@ public class CameraAppUI implements ModeListView.ModeSwitchListener,
         mModuleUI = (FrameLayout) mCameraRootView.findViewById(R.id.module_layout);
         mTextureView = (TextureView) mCameraRootView.findViewById(R.id.preview_content);
         mTextureViewHelper = new TextureViewHelper(mTextureView, mCaptureLayoutHelper,
-                mController.getCameraProvider());
+                mController.getCameraProvider(), mController);
         mTextureViewHelper.setSurfaceTextureListener(this);
         mTextureViewHelper.setOnLayoutChangeListener(mPreviewLayoutChangeListener);
 
@@ -2041,11 +2053,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/module 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,
@@ -2058,15 +2073,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);