Camera: fix deadlock with flush

Test: CTS, run testReprocessAbort 50 times
Bug: 63701864
Change-Id: Id41b68da143c9292437f35f8960ce4f80b9d59f7
gugelfrei
Yin-Chia Yeh 7 years ago
parent 4f771e05db
commit 657c1877d8

@ -851,12 +851,14 @@ status_t Camera3Device::submitRequestsHelper(
hardware::Return<void> Camera3Device::processCaptureResult(
const hardware::hidl_vec<
hardware::camera::device::V3_2::CaptureResult>& results) {
{
Mutex::Autolock l(mLock);
if (mStatus == STATUS_ERROR) {
// Per API contract, HAL should act as closed after device error
ALOGW("%s: received capture result in error state!", __FUNCTION__);
}
// Ideally we should grab mLock, but that can lead to deadlock, and
// it's not super important to get up to date value of mStatus for this
// warning print, hence skipping the lock here
if (mStatus == STATUS_ERROR) {
// Per API contract, HAL should act as closed after device error
// But mStatus can be set to error by framework as well, so just log
// a warning here.
ALOGW("%s: received capture result in error state.", __FUNCTION__);
}
if (mProcessCaptureResultLock.tryLock() != OK) {
@ -989,13 +991,16 @@ void Camera3Device::processOneCaptureResultLocked(
hardware::Return<void> Camera3Device::notify(
const hardware::hidl_vec<hardware::camera::device::V3_2::NotifyMsg>& msgs) {
{
Mutex::Autolock l(mLock);
if (mStatus == STATUS_ERROR) {
// Per API contract, HAL should act as closed after device error
ALOGW("%s: received notify message in error state!", __FUNCTION__);
}
// Ideally we should grab mLock, but that can lead to deadlock, and
// it's not super important to get up to date value of mStatus for this
// warning print, hence skipping the lock here
if (mStatus == STATUS_ERROR) {
// Per API contract, HAL should act as closed after device error
// But mStatus can be set to error by framework as well, so just log
// a warning here.
ALOGW("%s: received notify message in error state.", __FUNCTION__);
}
for (const auto& msg : msgs) {
notify(msg);
}

Loading…
Cancel
Save