summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2016-07-30 21:37:36 -0700
committerSteve Kondik <steve@cyngn.com>2016-08-03 16:22:12 -0700
commit81110deb708bfb96b3b8be1e0549652955e05103 (patch)
treeba388e872ec878cae08a6509a65b247ea772f393
parent1ccf3728c2b2b9d5b382f580be2cd9fe4125d25a (diff)
downloadandroid_packages_apps_Snap-81110deb708bfb96b3b8be1e0549652955e05103.zip
android_packages_apps_Snap-81110deb708bfb96b3b8be1e0549652955e05103.tar.gz
android_packages_apps_Snap-81110deb708bfb96b3b8be1e0549652955e05103.tar.bz2
snap: Additional fixes for auto-HDR mode
Change-Id: I0d9b982dc9d817b40d59fc5fa58d542a213a3d1f
-rw-r--r--src/com/android/camera/PhotoModule.java39
1 files changed, 30 insertions, 9 deletions
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index b2e67ed..8db4d2e 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -92,6 +92,7 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
+import java.util.Arrays;
import java.util.List;
import java.util.Vector;
import java.util.HashMap;
@@ -1116,6 +1117,11 @@ public class PhotoModule
for (int i =0;i<3;i++) {
metadata[i] = byteToInt( (byte []) data, i*4);
}
+ if (metadata[0] != 3) {
+ Log.d(TAG, "Unhandled metadata callback: [" +
+ Arrays.toString(metadata) + "]");
+ return;
+ }
final boolean autoHdrEnabled = metadata[2] == 1;
mActivity.runOnUiThread(new Runnable() {
@Override
@@ -3388,15 +3394,6 @@ public class PhotoModule
String zsl = mPreferences.getString(CameraSettings.KEY_ZSL,
mActivity.getString(R.string.pref_camera_zsl_default));
- String auto_hdr = mPreferences.getString(CameraSettings.KEY_AUTO_HDR,
- mActivity.getString(R.string.pref_camera_auto_hdr_default));
- if (CameraUtil.isAutoHDRSupported(mParameters)) {
- mParameters.set("auto-hdr-enable",auto_hdr);
- if (auto_hdr.equals("enable")) {
- mParameters.setSceneMode("asd");
- mCameraDevice.setMetadataCb(mMetaDataCallback);
- }
- }
mParameters.setZSLMode(zsl);
if(zsl.equals("on")) {
//Switch on ZSL Camera mode
@@ -3445,6 +3442,8 @@ public class PhotoModule
}
}
+ updateAutoHDR();
+
//Set Histogram
String histogram = mPreferences.getString(
CameraSettings.KEY_HISTOGRAM,
@@ -3494,6 +3493,28 @@ public class PhotoModule
}
}
+ private void updateAutoHDR() {
+ String autoHdr = mPreferences.getString(CameraSettings.KEY_AUTO_HDR,
+ mActivity.getString(R.string.pref_camera_auto_hdr_default));
+ String advancedFeature = mPreferences.getString(
+ CameraSettings.KEY_ADVANCED_FEATURES,
+ mActivity.getString(R.string.pref_camera_advanced_feature_default));
+
+ if (CameraUtil.isAutoHDRSupported(mParameters)) {
+ if (autoHdr.equals("enable") &&
+ ("asd".equals(mSceneMode) || "auto".equals(mSceneMode)) &&
+ CameraUtil.isSupported("asd", mParameters.getSupportedSceneModes()) &&
+ (advancedFeature == null || "none".equals(advancedFeature))) {
+ mParameters.setSceneMode(Parameters.SCENE_MODE_ASD);
+ mCameraDevice.setMetadataCb(mMetaDataCallback);
+ mParameters.set("auto-hdr-enable", "enable");
+ return;
+ }
+ mCameraDevice.setMetadataCb(null);
+ mParameters.set("auto-hdr-enable", "disable");
+ }
+ }
+
private void setFlipValue() {
// Read Flip mode from adb command
//value: 0(default) - FLIP_MODE_OFF