summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorzhuw <zhuw@codeaurora.org>2017-12-21 17:01:21 +0800
committerGerrit - the friendly Code Review server <code-review@localhost>2017-12-24 21:40:59 -0800
commite0ed91a89fcd0f5dd36e5abf816897f1e9a7152f (patch)
treece4995ba6aaf25eaca28e4c2c6b8e26fe21be4de /src
parent7680c51aaa84db22367e442c605c136bc82e33bd (diff)
downloadandroid_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-xsrc/com/android/camera/CaptureModule.java10
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()) {