diff options
author | Camera Software Integration <camswint@localhost> | 2016-07-01 06:39:01 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-07-01 06:39:01 -0700 |
commit | e6f2656b1b59abb679e7e06b45b7276843389d99 (patch) | |
tree | 8c1a24e72ea25b5b49941043a7cefd6e3cc70fab | |
parent | 3434de4234c215669f14d39a07747806497c535e (diff) | |
parent | 3a3070221c4c402485617cfabcffa8a1239752a1 (diff) | |
download | android_packages_apps_Snap-e6f2656b1b59abb679e7e06b45b7276843389d99.tar.gz android_packages_apps_Snap-e6f2656b1b59abb679e7e06b45b7276843389d99.tar.bz2 android_packages_apps_Snap-e6f2656b1b59abb679e7e06b45b7276843389d99.zip |
Merge "SnapdragonCamera: Reorder logic when closing cameras" into camera.lnx.1.0-dev.1.0
-rw-r--r-- | src/com/android/camera/CaptureModule.java | 64 |
1 files changed, 34 insertions, 30 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java index ba576306c..5178d49d2 100644 --- a/src/com/android/camera/CaptureModule.java +++ b/src/com/android/camera/CaptureModule.java @@ -1185,46 +1185,50 @@ public class CaptureModule implements CameraModule, PhotoController, */ private void closeCamera() { Log.d(TAG, "closeCamera"); - try { - mCameraOpenCloseLock.acquire(); - if(mPostProcessor != null) { - mPostProcessor.onClose(); - } - if(mFrameProcessor != null) { - mFrameProcessor.onClose(); - } - for (int i = 0; i < MAX_NUM_CAM; i++) { - if (null != mCaptureSession[i]) { - if (mIsLinked) { - unLinkBayerMono(i); - try { - mCaptureSession[i].capture(mPreviewRequestBuilder[i].build(), null, - mCameraHandler); - } catch (CameraAccessException e) { - e.printStackTrace(); - } + if(mPostProcessor != null) { + mPostProcessor.onClose(); + } + + if(mFrameProcessor != null) { + mFrameProcessor.onClose(); + } + + for (int i = 0; i < MAX_NUM_CAM; i++) { + if (null != mCaptureSession[i]) { + if (mIsLinked) { + unLinkBayerMono(i); + try { + mCaptureSession[i].capture(mPreviewRequestBuilder[i].build(), null, + mCameraHandler); + } catch (CameraAccessException e) { + e.printStackTrace(); } - mCaptureSession[i].close(); - mCaptureSession[i] = null; } + mCaptureSession[i].close(); + mCaptureSession[i] = null; + } - if (null != mImageReader[i]) { - mImageReader[i].close(); - mImageReader[i] = null; - } + if (null != mImageReader[i]) { + mImageReader[i].close(); + mImageReader[i] = null; + } + } + /* no need to set this in the callback and handle asynchronously. This is the same + reason as why we release the semaphore here, not in camera close callback function + as we don't have to protect the case where camera open() gets called during camera + close(). The low level framework/HAL handles the synchronization for open() + happens after close() */ + mIsLinked = false; + try { + mCameraOpenCloseLock.acquire(); + for (int i = 0; i < MAX_NUM_CAM; i++) { if (null != mCameraDevice[i]) { mCameraDevice[i].close(); mCameraDevice[i] = null; mCameraOpened[i] = false; } } - /* no need to set this in the callback and handle asynchronously. This is the same - reason as why we release the semaphore here, not in camera close callback function - as we don't have to protect the case where camera open() gets called during camera - close(). The low level framework/HAL handles the synchronization for open() - happens after close() */ - mIsLinked = false; } catch (InterruptedException e) { mCameraOpenCloseLock.release(); throw new RuntimeException("Interrupted while trying to lock camera closing.", e); |