diff options
author | zhuw <zhuw@codeaurora.org> | 2017-12-21 17:01:21 +0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-12-24 21:40:59 -0800 |
commit | e0ed91a89fcd0f5dd36e5abf816897f1e9a7152f (patch) | |
tree | ce4995ba6aaf25eaca28e4c2c6b8e26fe21be4de /src | |
parent | 7680c51aaa84db22367e442c605c136bc82e33bd (diff) | |
download | android_packages_apps_Snap-e0ed91a89fcd0f5dd36e5abf816897f1e9a7152f.tar.gz android_packages_apps_Snap-e0ed91a89fcd0f5dd36e5abf816897f1e9a7152f.tar.bz2 android_packages_apps_Snap-e0ed91a89fcd0f5dd36e5abf816897f1e9a7152f.zip |
SnapdragonCamera: Fix fc when lunch camera in lock screen
don't create session if camera has been closed
Change-Id: I68aef69151d0876c76cfc9ac12abb7b6e32298ae
CRs-Fixed: 2142847
Diffstat (limited to 'src')
-rwxr-xr-x | src/com/android/camera/CaptureModule.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java index 4fa1de0ea..93ad6cfe9 100755 --- a/src/com/android/camera/CaptureModule.java +++ b/src/com/android/camera/CaptureModule.java @@ -1007,10 +1007,13 @@ public class CaptureModule implements CameraModule, PhotoController, return builder; } - private void waitForPreviewSurfaceReady() { + private boolean waitForPreviewSurfaceReady() { try { if (!mSurfaceReady) { if (!mSurfaceReadyLock.tryAcquire(2000, TimeUnit.MILLISECONDS)) { + if (mPaused) { + return true;// camera has closed, don'r create session + } Log.d(TAG, "Time out waiting for surface."); throw new RuntimeException("Time out waiting for surface."); } @@ -1019,6 +1022,7 @@ public class CaptureModule implements CameraModule, PhotoController, } catch (InterruptedException e) { e.printStackTrace(); } + return false; } private void updatePreviewSurfaceReadyState(boolean rdy) { @@ -1118,7 +1122,9 @@ public class CaptureModule implements CameraModule, PhotoController, Log.d(TAG, "cameracapturesession - onClosed"); } }; - waitForPreviewSurfaceReady(); + if (waitForPreviewSurfaceReady()) { + return;//if camera closed, don't create session + } Surface surface = getPreviewSurfaceForSession(id); if(id == getMainCameraId()) { |