summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkati <dkatikaridis@gmail.com>2018-06-27 23:58:31 +0300
committerRashed Abdel-Tawab <rashedabdeltawab@gmail.com>2018-08-19 03:33:58 +0200
commit159d79bdcbdaca805cb9286ac9ab2f0ad9cbd86e (patch)
tree8c50f5907fb67569c7397a71ac80307be346a8f8
parent516483bf052d3285063e84ab185799e55d725890 (diff)
downloadandroid_packages_apps_Snap-159d79bdcbdaca805cb9286ac9ab2f0ad9cbd86e.zip
android_packages_apps_Snap-159d79bdcbdaca805cb9286ac9ab2f0ad9cbd86e.tar.gz
android_packages_apps_Snap-159d79bdcbdaca805cb9286ac9ab2f0ad9cbd86e.tar.bz2
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
-rw-r--r--src/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 210e110..73f8ddb 100644
--- a/src/com/android/camera/CameraSettings.java
+++ b/src/com/android/camera/CameraSettings.java
@@ -772,10 +772,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;
}