summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjt1134 <jt1134@gmail.com>2014-01-04 20:55:04 -0600
committerMichael Bestas <mikeioannina@gmail.com>2015-09-17 23:26:02 +0300
commit8c66754ec9e4c88af913ef75b28030f1345a4b5b (patch)
treeaa09fc5847b5624fc1b63e7a1f160fece3bd7b94
parentfb4957c0017b1aa47fa643c1c6fa9179fe8ebd29 (diff)
downloadandroid_packages_apps_Snap-8c66754ec9e4c88af913ef75b28030f1345a4b5b.zip
android_packages_apps_Snap-8c66754ec9e4c88af913ef75b28030f1345a4b5b.tar.gz
android_packages_apps_Snap-8c66754ec9e4c88af913ef75b28030f1345a4b5b.tar.bz2
Camera2: implement exposure compensation settings in video mode
Change-Id: I83a2675e109dc7924cdd9240b26051ac218f532a
-rw-r--r--res/xml/video_preferences.xml5
-rw-r--r--src/com/android/camera/VideoMenu.java2
-rw-r--r--src/com/android/camera/VideoModule.java22
-rw-r--r--src/com/android/camera/VideoUI.java2
4 files changed, 31 insertions, 0 deletions
diff --git a/res/xml/video_preferences.xml b/res/xml/video_preferences.xml
index 259ad81..f147ed2 100644
--- a/res/xml/video_preferences.xml
+++ b/res/xml/video_preferences.xml
@@ -64,6 +64,11 @@
camera:labelList="@array/pref_camera_video_flashmode_labels"
camera:entryValues="@array/pref_camera_video_flashmode_entryvalues"/>
<IconListPreference
+ camera:key="pref_camera_exposure_key"
+ camera:defaultValue="@string/pref_exposure_default"
+ camera:title="@string/pref_exposure_title"
+ camera:singleIcon="@drawable/ic_exposure_holo_light" />
+ <IconListPreference
camera:key="pref_camera_whitebalance_key"
camera:defaultValue="@string/pref_camera_whitebalance_default"
camera:title="@string/pref_camera_whitebalance_title"
diff --git a/src/com/android/camera/VideoMenu.java b/src/com/android/camera/VideoMenu.java
index d4c3320..d10c817 100644
--- a/src/com/android/camera/VideoMenu.java
+++ b/src/com/android/camera/VideoMenu.java
@@ -111,6 +111,7 @@ public class VideoMenu extends MenuController
CameraSettings.KEY_VIDEO_QUALITY,
CameraSettings.KEY_RECORD_LOCATION,
CameraSettings.KEY_CAMERA_SAVEPATH,
+ CameraSettings.KEY_EXPOSURE,
CameraSettings.KEY_WHITE_BALANCE,
CameraSettings.KEY_VIDEO_HIGH_FRAME_RATE
};
@@ -119,6 +120,7 @@ public class VideoMenu extends MenuController
CameraSettings.KEY_VIDEO_QUALITY,
CameraSettings.KEY_RECORD_LOCATION,
CameraSettings.KEY_CAMERA_SAVEPATH,
+ CameraSettings.KEY_EXPOSURE,
CameraSettings.KEY_WHITE_BALANCE,
CameraSettings.KEY_VIDEO_HIGH_FRAME_RATE,
CameraSettings.KEY_SEE_MORE,
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index e509549..61e0092 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -434,6 +434,8 @@ public class VideoModule implements CameraModule,
mPreferences.setLocalId(mActivity, mCameraId);
CameraSettings.upgradeLocalPreferences(mPreferences.getLocal());
+ // we need to reset exposure for the preview
+ resetExposureCompensation();
mOrientationManager = new OrientationManager(mActivity);
@@ -927,6 +929,16 @@ public class VideoModule implements CameraModule,
". mDesiredPreviewHeight=" + mDesiredPreviewHeight);
}
+ private void resetExposureCompensation() {
+ String value = mPreferences.getString(CameraSettings.KEY_EXPOSURE,
+ CameraSettings.EXPOSURE_DEFAULT_VALUE);
+ if (!CameraSettings.EXPOSURE_DEFAULT_VALUE.equals(value)) {
+ Editor editor = mPreferences.edit();
+ editor.putString(CameraSettings.KEY_EXPOSURE, "0");
+ editor.apply();
+ }
+ }
+
void setPreviewFrameLayoutCameraOrientation(){
CameraInfo info = CameraHolder.instance().getCameraInfo()[mCameraId];
@@ -971,6 +983,7 @@ public class VideoModule implements CameraModule,
public void onResumeAfterSuper() {
mUI.enableShutter(false);
mZoomValue = 0;
+ resetExposureCompensation();
showVideoSnapshotUI(false);
@@ -2324,6 +2337,15 @@ public class VideoModule implements CameraModule,
if (CameraUtil.isSupported(mParameters, "video-size")) {
mParameters.set("video-size", recordSize);
}
+ // Set exposure compensation
+ int value = CameraSettings.readExposure(mPreferences);
+ int max = mParameters.getMaxExposureCompensation();
+ int min = mParameters.getMinExposureCompensation();
+ if (value >= min && value <= max) {
+ mParameters.setExposureCompensation(value);
+ } else {
+ Log.w(TAG, "invalid exposure range: " + value);
+ }
// Set white balance parameter.
String whiteBalance = mPreferences.getString(
CameraSettings.KEY_WHITE_BALANCE,
diff --git a/src/com/android/camera/VideoUI.java b/src/com/android/camera/VideoUI.java
index 2db7133..321f6d5 100644
--- a/src/com/android/camera/VideoUI.java
+++ b/src/com/android/camera/VideoUI.java
@@ -617,6 +617,8 @@ public class VideoUI implements PieRenderer.PieListener,
}
public void updateOnScreenIndicators(Parameters param, ComboPreferences prefs) {
+ mOnScreenIndicators.updateExposureOnScreenIndicator(param,
+ CameraSettings.readExposure(prefs));
mOnScreenIndicators.updateFlashOnScreenIndicator(param.getFlashMode());
boolean location = RecordLocationPreference.get(
prefs, mActivity.getContentResolver());