summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWang Han <416810799@qq.com>2018-11-14 19:47:52 +0800
committerdianlujitao <dianlujitao@lineageos.org>2018-12-19 14:00:02 +0800
commit814db6fddccfb06cd9a648144f2eb02f90a6bcac (patch)
treec88cd4b7f0a2d71ceb7441c6de3528a3713730e4
parent23f0bea774b8679513420e0a4309e9e429f77aa2 (diff)
downloadandroid_packages_apps_Snap-814db6fddccfb06cd9a648144f2eb02f90a6bcac.zip
android_packages_apps_Snap-814db6fddccfb06cd9a648144f2eb02f90a6bcac.tar.gz
android_packages_apps_Snap-814db6fddccfb06cd9a648144f2eb02f90a6bcac.tar.bz2
Snap: Check various feature support before applying
* Fixes crash on devices which does not support it Change-Id: I39b9424ad200db6819a11aac6c319a22542d4131
-rwxr-xr-xsrc/com/android/camera/CaptureModule.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java
index aa5fb17..ec781dd 100755
--- a/src/com/android/camera/CaptureModule.java
+++ b/src/com/android/camera/CaptureModule.java
@@ -685,7 +685,12 @@ public class CaptureModule implements CameraModule, PhotoController,
private void detectHDRMode(CaptureResult result, int id) {
String value = mSettingsManager.getValue(SettingsManager.KEY_SCENE_MODE);
String autoHdr = mSettingsManager.getValue(SettingsManager.KEY_AUTO_HDR);
- Byte hdrScene = result.get(CaptureModule.isHdr);
+ Byte hdrScene = null;
+ try {
+ hdrScene = result.get(CaptureModule.isHdr);
+ } catch (IllegalArgumentException e) {
+ // Ignore exception.
+ }
if (value == null || hdrScene == null) return;
mAutoHdrEnable = false;
if (autoHdr != null && "enable".equals(autoHdr) && "0".equals(value) && hdrScene == 1) {
@@ -768,7 +773,12 @@ public class CaptureModule implements CameraModule, PhotoController,
}
}
if (SettingsManager.getInstance().isStatsVisualizerSupport() == 3) {
- int[] histogramStats = result.get(CaptureModule.histogramStats);
+ int[] histogramStats = null;
+ try {
+ histogramStats = result.get(CaptureModule.histogramStats);
+ } catch (IllegalArgumentException e) {
+ // Ignore exception.
+ }
if (histogramStats != null && mHiston) {
/*The first element in the array stores max hist value . Stats data begin
from second value*/
@@ -5309,6 +5319,8 @@ public class CaptureModule implements CameraModule, PhotoController,
}
private void applyExposureMeteringModes(CaptureRequest.Builder request) {
+ if (!VendorTagUtil.isSupported(request, CaptureModule.exposure_metering))
+ return;
String value = mSettingsManager.getValue(SettingsManager.KEY_EXPOSURE_METERING_MODE);
if (value != null) {
int intValue = Integer.parseInt(value);