summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuK1337 <priv.luk@gmail.com>2016-02-26 14:12:55 +0100
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-03-09 16:37:35 -0800
commit0f178afd62e34213f1cfdb0706436b56d33ebbbe (patch)
tree400ceee329916b5abb72ec62c9b3cb3d972c69cf
parente783496c1ef455a2d976f326d404e9f0e2e50cbd (diff)
downloadandroid_packages_apps_Snap-0f178afd62e34213f1cfdb0706436b56d33ebbbe.zip
android_packages_apps_Snap-0f178afd62e34213f1cfdb0706436b56d33ebbbe.tar.gz
android_packages_apps_Snap-0f178afd62e34213f1cfdb0706436b56d33ebbbe.tar.bz2
Snap: Do not crash when cur-focus-scale is null
* Some cameras simply don't set this parameter. * Also set cur-focus-diopter to 0 if it's null. Change-Id: Ib1049012de9a58279560c14ed77f83f52c07fe30
-rw-r--r--src/com/android/camera/PhotoModule.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index b1d1011..8bea633 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -3764,7 +3764,14 @@ public class PhotoModule
final int maxFocusPos = mParameters.getInt(CameraSettings.KEY_MAX_FOCUS_SCALE);
//update mparameters to fetch latest focus position
mParameters = mCameraDevice.getParameters();
- final int CurFocusPos = mParameters.getInt(CameraSettings.KEY_MANUAL_FOCUS_SCALE);
+ int CurFocusPos = minFocusPos;
+
+ try {
+ CurFocusPos = mParameters.getInt(CameraSettings.KEY_MANUAL_FOCUS_SCALE);
+ } catch (NumberFormatException e) {
+ // Do nothing
+ }
+
focusbar.setProgress(CurFocusPos);
focusPositionText.setText("Current focus position is " + CurFocusPos);
@@ -3816,7 +3823,8 @@ public class PhotoModule
//update mparameters to fetch latest focus position
mParameters = mCameraDevice.getParameters();
final String CurFocusPos = mParameters.get(CameraSettings.KEY_MANUAL_FOCUS_DIOPTER);
- focusPositionText.setText("Current focus position is " + CurFocusPos);
+ focusPositionText.setText("Current focus position is " +
+ (CurFocusPos != null ? CurFocusPos : minFocusStr));
linear.addView(input);
linear.addView(focusPositionText);
alert.setView(linear);