summaryrefslogtreecommitdiffstats
path: root/core/java/android/hardware/camera2
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2014-09-23 18:18:07 -0700
committerEino-Ville Talvala <etalvala@google.com>2014-09-26 15:37:26 -0700
commit56fbbeab7931386af7ad9701fad9b62c170abd77 (patch)
treed9c4f84972b9b59fa72b8f060dbd3ce77d7f459e /core/java/android/hardware/camera2
parent381d22f706f347c681885c0114917d8fe2373be8 (diff)
downloadframeworks_base-56fbbeab7931386af7ad9701fad9b62c170abd77.zip
frameworks_base-56fbbeab7931386af7ad9701fad9b62c170abd77.tar.gz
frameworks_base-56fbbeab7931386af7ad9701fad9b62c170abd77.tar.bz2
Camera2: Fix parallel session and device close() exception
It's possible for the device to have close() called on it during the session close sequence such that the session still tries to do a stream reconfiguration on the closed device. Handle the exception thrown by this attempt. Bug: 17661765 Change-Id: Iee63c5c559405abe5c044ae251ad56edd1fb3e79
Diffstat (limited to 'core/java/android/hardware/camera2')
-rw-r--r--core/java/android/hardware/camera2/impl/CameraCaptureSessionImpl.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/java/android/hardware/camera2/impl/CameraCaptureSessionImpl.java b/core/java/android/hardware/camera2/impl/CameraCaptureSessionImpl.java
index 68926d0..5bc7f71 100644
--- a/core/java/android/hardware/camera2/impl/CameraCaptureSessionImpl.java
+++ b/core/java/android/hardware/camera2/impl/CameraCaptureSessionImpl.java
@@ -657,9 +657,9 @@ public class CameraCaptureSessionImpl extends CameraCaptureSession {
}
// Slow path: #close was called explicitly on this session; unconfigure first
+ mUnconfigureDrainer.taskStarted();
try {
- mUnconfigureDrainer.taskStarted();
mDeviceImpl
.configureOutputsChecked(null); // begin transition to unconfigured
} catch (CameraAccessException e) {
@@ -667,6 +667,11 @@ public class CameraCaptureSessionImpl extends CameraCaptureSession {
Log.e(TAG, mIdString + "Exception while configuring outputs: ", e);
// TODO: call onError instead of onClosed if this happens
+ } catch (IllegalStateException e) {
+ // Camera is already closed, so go straight to the close callback
+ if (VERBOSE) Log.v(TAG, mIdString +
+ "Camera was already closed or busy, skipping unconfigure");
+ mUnconfigureDrainer.taskFinished();
}
mUnconfigureDrainer.beginDrain();