summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2013-06-14 09:11:20 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-06-14 09:11:20 -0700
commitc0c13c0cd4d21877e1de6a83504c1804a90c149f (patch)
treed863ca21a29251867ac20321ae96215735b52156 /services
parent224309a0f21e37d58fa62ed2aef8b444421cdc0f (diff)
parente4a453d4b7563d1dab674df6ce52c291e63c6ca7 (diff)
downloadframeworks_av-c0c13c0cd4d21877e1de6a83504c1804a90c149f.zip
frameworks_av-c0c13c0cd4d21877e1de6a83504c1804a90c149f.tar.gz
frameworks_av-c0c13c0cd4d21877e1de6a83504c1804a90c149f.tar.bz2
am e4a453d4: am 214a17fd: Camera3: Always close HAL device even in face of errors.
* commit 'e4a453d4b7563d1dab674df6ce52c291e63c6ca7': Camera3: Always close HAL device even in face of errors.
Diffstat (limited to 'services')
-rw-r--r--services/camera/libcameraservice/Camera3Device.cpp30
1 files changed, 20 insertions, 10 deletions
diff --git a/services/camera/libcameraservice/Camera3Device.cpp b/services/camera/libcameraservice/Camera3Device.cpp
index da18c70..73bf30c 100644
--- a/services/camera/libcameraservice/Camera3Device.cpp
+++ b/services/camera/libcameraservice/Camera3Device.cpp
@@ -186,24 +186,29 @@ status_t Camera3Device::disconnect() {
ALOGV("%s: E", __FUNCTION__);
- status_t res;
- if (mStatus == STATUS_UNINITIALIZED) return OK;
+ status_t res = OK;
+ if (mStatus == STATUS_UNINITIALIZED) return res;
if (mStatus == STATUS_ACTIVE ||
(mStatus == STATUS_ERROR && mRequestThread != NULL)) {
res = mRequestThread->clearRepeatingRequests();
if (res != OK) {
SET_ERR_L("Can't stop streaming");
- return res;
- }
- res = waitUntilDrainedLocked();
- if (res != OK) {
- SET_ERR_L("Timeout waiting for HAL to drain");
- return res;
+ // Continue to close device even in case of error
+ } else {
+ res = waitUntilDrainedLocked();
+ if (res != OK) {
+ SET_ERR_L("Timeout waiting for HAL to drain");
+ // Continue to close device even in case of error
+ }
}
}
assert(mStatus == STATUS_IDLE || mStatus == STATUS_ERROR);
+ if (mStatus == STATUS_ERROR) {
+ CLOGE("Shutting down in an error state");
+ }
+
if (mRequestThread != NULL) {
mRequestThread->requestExit();
}
@@ -212,7 +217,12 @@ status_t Camera3Device::disconnect() {
mInputStream.clear();
if (mRequestThread != NULL) {
- mRequestThread->join();
+ if (mStatus != STATUS_ERROR) {
+ // HAL may be in a bad state, so waiting for request thread
+ // (which may be stuck in the HAL processCaptureRequest call)
+ // could be dangerous.
+ mRequestThread->join();
+ }
mRequestThread.clear();
}
@@ -224,7 +234,7 @@ status_t Camera3Device::disconnect() {
mStatus = STATUS_UNINITIALIZED;
ALOGV("%s: X", __FUNCTION__);
- return OK;
+ return res;
}
status_t Camera3Device::dump(int fd, const Vector<String16> &args) {