OSDN Git Service

Enable exposure compensation in capture intent.
authorzafir <zafir@google.com>
Sat, 28 Mar 2015 02:07:35 +0000 (19:07 -0700)
committerzafir <zafir@google.com>
Sat, 28 Mar 2015 02:07:35 +0000 (19:07 -0700)
Bug: 19964499
Change-Id: I2f7d43aa421dba0fa873eaf47c46d955136662e5

src/com/android/camera/CaptureModule.java
src/com/android/camera/captureintent/state/StateOpeningCamera.java

index 33ce1a9..02f7a82 100644 (file)
@@ -833,7 +833,6 @@ public class CaptureModule extends CameraModule implements
                     }
                 };
 
-        Log.v(TAG, ">>>>>>>> bottomBarSpec.enableHdr=" + bottomBarSpec.enableHdr);
         return bottomBarSpec;
     }
 
index ae42b80..563507f 100644 (file)
@@ -42,6 +42,7 @@ import com.android.camera.one.OneCameraCaptureSetting;
 import com.android.camera.one.OneCameraCharacteristics;
 import com.android.camera.one.v2.photo.ImageRotationCalculator;
 import com.android.camera.one.v2.photo.ImageRotationCalculatorImpl;
+import com.android.camera.settings.Keys;
 import com.android.camera.settings.SettingsManager;
 import com.android.camera.util.Size;
 import com.google.common.annotations.VisibleForTesting;
@@ -58,6 +59,7 @@ public final class StateOpeningCamera extends StateImpl {
     private final OneCamera.Facing mCameraFacing;
     private final CameraId mCameraId;
     private final OneCameraCharacteristics mCameraCharacteristics;
+    private final String mCameraSettingsScope;
 
     /** The desired picture size. */
     private Size mPictureSize;
@@ -110,6 +112,7 @@ public final class StateOpeningCamera extends StateImpl {
         mCameraId = cameraId;
         mCameraCharacteristics = cameraCharacteristics;
         mIsPaused = false;
+        mCameraSettingsScope = SettingsManager.getCameraSettingScope(mCameraId.getValue());
         registerEventHandlers();
     }
 
@@ -187,7 +190,7 @@ public final class StateOpeningCamera extends StateImpl {
                     mPictureSize,
                     mResourceConstructed.get().getAppController().getSettingsManager(),
                     getHardwareSpec(),
-                    SettingsManager.getCameraSettingScope(mCameraId.getValue()),
+                    mCameraSettingsScope,
                     false);
         } catch (OneCameraAccessException ex) {
             Log.e(TAG, "Failed while open camera", ex);
@@ -268,6 +271,25 @@ public final class StateOpeningCamera extends StateImpl {
         /** Flash button UI spec. */
         bottomBarSpec.enableFlash = mCameraCharacteristics.isFlashSupported();
 
+        /** Setup exposure compensation */
+        bottomBarSpec.isExposureCompensationSupported = mCameraCharacteristics
+                .isExposureCompensationSupported();
+        bottomBarSpec.enableExposureCompensation = bottomBarSpec.isExposureCompensationSupported;
+        bottomBarSpec.minExposureCompensation =
+                mCameraCharacteristics.getMinExposureCompensation();
+        bottomBarSpec.maxExposureCompensation =
+                mCameraCharacteristics.getMaxExposureCompensation();
+        bottomBarSpec.exposureCompensationStep =
+                mCameraCharacteristics.getExposureCompensationStep();
+        bottomBarSpec.exposureCompensationSetCallback =
+                new CameraAppUI.BottomBarUISpec.ExposureCompensationSetCallback() {
+                    @Override
+                    public void setExposure(int value) {
+                        mResourceConstructed.get().getSettingsManager().set(
+                                mCameraSettingsScope, Keys.KEY_EXPOSURE, value);
+                    }
+                };
+
         /** Intent image review UI spec. */
         bottomBarSpec.showCancel = true;
         bottomBarSpec.cancelCallback = new View.OnClickListener() {