diff options
author | weijiew <weijiew@codeaurora.org> | 2016-09-05 14:04:48 +0800 |
---|---|---|
committer | weijiew <weijiew@codeaurora.org> | 2016-09-07 10:35:14 +0800 |
commit | 610e7ac947d7a71e41b4221e4ccb8157e868d982 (patch) | |
tree | aa21efeef6a0149818b26b53fa2a6c5ff3ae9068 /src/com/android/camera/VideoModule.java | |
parent | 9159ebde9c1bc74e531bd0cc5e7e9379d1d235e6 (diff) | |
download | android_packages_apps_Snap-610e7ac947d7a71e41b4221e4ccb8157e868d982.tar.gz android_packages_apps_Snap-610e7ac947d7a71e41b4221e4ccb8157e868d982.tar.bz2 android_packages_apps_Snap-610e7ac947d7a71e41b4221e4ccb8157e868d982.zip |
SnapdragonCamera:Force close when set video high framerate as HSR240
Camera can't support all the video high framerate. When it's not supported,
the value of framerate getting from camera device is "off".It will cause
number format exception when parsing "off" to integer.
Change-Id: Ie6d4840f96de4eeecad4bcf6a71ca2404ff8834a
CRs-Fixed: 1063218
Diffstat (limited to 'src/com/android/camera/VideoModule.java')
-rw-r--r-- | src/com/android/camera/VideoModule.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java index bae16bde6..bbe4c421a 100644 --- a/src/com/android/camera/VideoModule.java +++ b/src/com/android/camera/VideoModule.java @@ -80,6 +80,7 @@ import java.util.Iterator; import java.util.List; import java.util.HashMap; import java.lang.reflect.Method; +import java.util.regex.Pattern; public class VideoModule implements CameraModule, VideoController, @@ -2547,10 +2548,9 @@ public class VideoModule implements CameraModule, mActivity.getString(R.string.pref_video_time_lapse_frame_interval_default)); int timeLapseInterval = Integer.parseInt(frameIntervalStr); int rate = 0; - if (!hfr.equals("off")) - rate = Integer.parseInt(hfr); - else - rate = Integer.parseInt(hsr); + if ( isDigit(highFrameRate.substring(3)) ) { + rate = Integer.parseInt(highFrameRate.substring(3)); + } Log.v(TAG, "rate = "+rate); if ( (timeLapseInterval != 0) || (disMode.equals("enable") && (rate > PERSIST_EIS_MAX_FPS)) || @@ -2604,6 +2604,12 @@ public class VideoModule implements CameraModule, } } + private boolean isDigit(String input) { + String ruler = "[1-9][0-9]*"; + Pattern pattern = Pattern.compile(ruler); + return pattern.matcher(input).matches(); + } + @SuppressWarnings("deprecation") private void setCameraParameters(boolean isFlashDelay) { Log.d(TAG,"Preview dimension in App->"+mDesiredPreviewWidth+"X"+mDesiredPreviewHeight); |