diff options
author | Alan Newberger <alann@google.com> | 2014-08-26 18:18:48 -0700 |
---|---|---|
committer | Alan Newberger <alann@google.com> | 2014-08-26 18:24:51 -0700 |
commit | 26b224dd3b4391dbbb8ee6ed35c40c431bdbec85 (patch) | |
tree | c4b38333e5c7752fbc35722b54cca8839d5454ff | |
parent | d225ea6074a58021013c8c063abb51eb80b1feb7 (diff) | |
download | android_packages_apps_Camera2-26b224dd3b4391dbbb8ee6ed35c40c431bdbec85.tar.gz android_packages_apps_Camera2-26b224dd3b4391dbbb8ee6ed35c40c431bdbec85.tar.bz2 android_packages_apps_Camera2-26b224dd3b4391dbbb8ee6ed35c40c431bdbec85.zip |
Protect video recording callback from activity/module pauses
This CL should eliminate MediaRecorder start exceptions, which
appear to be due to ending the camera or switching the module.
Storage I/O could take a while during which pauses can occur,
so we check for them and avoid starting video in that case.
Bug: 16298718
Change-Id: I9abca815400e9ce545fed96f6e31cb792860a1d0
-rw-r--r-- | src/com/android/camera/CameraActivity.java | 6 | ||||
-rw-r--r-- | src/com/android/camera/VideoModule.java | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java index af448f498..6772aae12 100644 --- a/src/com/android/camera/CameraActivity.java +++ b/src/com/android/camera/CameraActivity.java @@ -2008,8 +2008,12 @@ public class CameraActivity extends Activity @Override protected void onPostExecute(Long bytes) { updateStorageHint(bytes); - if (callback != null) { + // This callback returns after I/O to check disk, so we could be + // pausing and shutting down. If so, don't bother invoking. + if (callback != null && !mPaused) { callback.onStorageUpdateDone(bytes); + } else { + Log.v(TAG, "ignoring storage callback after activity pause"); } } }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java index 27c9cdba7..4e9238598 100644 --- a/src/com/android/camera/VideoModule.java +++ b/src/com/android/camera/VideoModule.java @@ -1311,6 +1311,10 @@ public class VideoModule extends CameraModule } else { //?? //if (!mCameraDevice.waitDone()) return; + if (mPaused == true) { + Log.v(TAG, "in storage callback after module paused"); + return; + } mCurrentVideoUri = null; initializeRecorder(); |