summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUma Mehta <umamehta@codeaurora.org>2016-07-04 10:55:04 +0530
committerSteve Kondik <steve@cyngn.com>2016-08-25 21:55:20 -0700
commitda621f4cfb1d6c10136d26950baae6ac56bab049 (patch)
tree80b160bef2c9ee99983eafa6011caed40d90e690
parentb0b89fc2e74b518586d43a3023cde7dd33960ff7 (diff)
downloadandroid_packages_apps_Snap-da621f4cfb1d6c10136d26950baae6ac56bab049.zip
android_packages_apps_Snap-da621f4cfb1d6c10136d26950baae6ac56bab049.tar.gz
android_packages_apps_Snap-da621f4cfb1d6c10136d26950baae6ac56bab049.tar.bz2
SnapdragonCamera: Use resume/start based on the SDK version
For camcorder to resume after pause use mediarecorder's resume() API in N and later versions and for the rest of older versions call start() API Change-Id: I01e761215c31e03c87b98149f13cd5c3f2482d05
-rwxr-xr-x[-rw-r--r--]src/com/android/camera/VideoModule.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index bdfc78b..71b4566 100644..100755
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -79,6 +79,7 @@ import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.HashMap;
+import java.lang.reflect.Method;
public class VideoModule implements CameraModule,
VideoController,
@@ -106,6 +107,9 @@ public class VideoModule implements CameraModule,
private static final long SHUTTER_BUTTON_TIMEOUT = 0L; // 0ms
+ public static final boolean HAS_RESUME_SUPPORTED =
+ Build.VERSION.SDK_INT > Build.VERSION_CODES.M;
+
/**
* An unpublished intent flag requesting to start recording straight away
* and return as soon as recording is stopped.
@@ -2053,7 +2057,16 @@ public class VideoModule implements CameraModule,
mMediaRecorderPausing = false;
mRecordingStartTime = SystemClock.uptimeMillis();
updateRecordingTime();
- mMediaRecorder.start();
+ if (!HAS_RESUME_SUPPORTED){
+ mMediaRecorder.start();
+ } else {
+ try {
+ Method resumeRec = Class.forName("android.media.MediaRecorder").getMethod("resume");
+ resumeRec.invoke(mMediaRecorder);
+ } catch (Exception e) {
+ Log.v(TAG, "resume method not implemented");
+ }
+ }
}
private boolean stopVideoRecording() {