summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkati <dkatikaridis@gmail.com>2018-06-27 23:58:31 +0300
committerBruno Martins <bgcngm@gmail.com>2018-11-20 12:32:17 +0000
commit47131ce195b984023e6bab0f2d4f8d65b0d798b4 (patch)
treef333899eefcf28a07e5596d901887e0127ca2ca6
parent92c8afd1be3dcb536474158414fbbd70ffd136da (diff)
downloadandroid_packages_apps_Snap-47131ce195b984023e6bab0f2d4f8d65b0d798b4.tar.gz
android_packages_apps_Snap-47131ce195b984023e6bab0f2d4f8d65b0d798b4.tar.bz2
android_packages_apps_Snap-47131ce195b984023e6bab0f2d4f8d65b0d798b4.zip
CameraSettings: Do not crash if zoom ratios are not exposed
* On some devices, wrappers do not expose the zoom ratios, so the list of zoomRatios is empty. So the .add() method cant run from a null class. If zoom rations are not exposed, simply return an empty list and the camera will take the default HAL's zoom ratios -This fixes front camera photo shoot on jfltexx Change-Id: Ic64e41a8c5a2d51966ec95d4b020e5d3951eac0e
-rwxr-xr-xsrc/com/android/camera/CameraSettings.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java
index 2653e4455..0e27d2eb4 100755
--- a/src/com/android/camera/CameraSettings.java
+++ b/src/com/android/camera/CameraSettings.java
@@ -811,10 +811,11 @@ public class CameraSettings {
ArrayList<String> supported = new ArrayList<String>();
int zoomMaxIdx = params.getMaxZoom();
List <Integer> zoomRatios = params.getZoomRatios();
- int zoomMax = zoomRatios.get(zoomMaxIdx)/100;
-
- for (int zoomLevel = 0; zoomLevel <= zoomMax; zoomLevel++) {
- supported.add(String.valueOf(zoomLevel));
+ if (zoomRatios != null ) {
+ int zoomMax = zoomRatios.get(zoomMaxIdx)/100;
+ for (int zoomLevel = 0; zoomLevel <= zoomMax; zoomLevel++) {
+ supported.add(String.valueOf(zoomLevel));
+ }
}
return supported;
}