diff options
author | Wang Han <416810799@qq.com> | 2018-11-14 19:47:52 +0800 |
---|---|---|
committer | Michael Bestas <mkbestas@lineageos.org> | 2019-11-09 22:47:37 +0200 |
commit | d7863012f81814119c9d6309df75829472f74cbb (patch) | |
tree | 6ec9141ded904b9e78452e80bc44132b79fd72de | |
parent | 03ea8f1957dcfdc2fefbecfb254b043c778b9d40 (diff) | |
download | android_packages_apps_Snap-d7863012f81814119c9d6309df75829472f74cbb.tar.gz android_packages_apps_Snap-d7863012f81814119c9d6309df75829472f74cbb.tar.bz2 android_packages_apps_Snap-d7863012f81814119c9d6309df75829472f74cbb.zip |
Snap: Check various feature support before applying
* Fixes crash on devices which does not support it
Change-Id: I39b9424ad200db6819a11aac6c319a22542d4131
-rwxr-xr-x | src/com/android/camera/CaptureModule.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java index 11017f717..5cc20e03f 100755 --- a/src/com/android/camera/CaptureModule.java +++ b/src/com/android/camera/CaptureModule.java @@ -744,7 +744,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) { @@ -841,7 +846,12 @@ public class CaptureModule implements CameraModule, PhotoController, private void updateStatsView(String stats_visualizer,CaptureResult result) { int r, g, b, index; if (stats_visualizer.contains("2")) { - 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*/ @@ -5991,6 +6001,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); |