Merge "Camera: fix recursive lock in CameraDevice 1.0" into oc-dev am: eed6653f2a
am: 2ff1f7e687
Change-Id: I0cf1590eadb4965c03474ded10898a40af344755
This commit is contained in:
commit
883bb1be80
2 changed files with 9 additions and 4 deletions
|
@ -116,7 +116,7 @@ CameraDevice::~CameraDevice() {
|
|||
Mutex::Autolock _l(mLock);
|
||||
if (mDevice != nullptr) {
|
||||
ALOGW("%s: camera %s is deleted while open", __FUNCTION__, mCameraId.c_str());
|
||||
close();
|
||||
closeLocked();
|
||||
}
|
||||
mHalPreviewWindow.cleanUpCirculatingBuffers();
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ void CameraDevice::setConnectionStatus(bool connected) {
|
|||
}
|
||||
if (!connected) {
|
||||
ALOGW("%s: camera %s is disconneted. Closing", __FUNCTION__, mCameraId.c_str());
|
||||
close();
|
||||
closeLocked();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -982,8 +982,13 @@ Return<Status> CameraDevice::sendCommand(CommandType cmd, int32_t arg1, int32_t
|
|||
}
|
||||
|
||||
Return<void> CameraDevice::close() {
|
||||
ALOGI("Closing camera %s", mCameraId.c_str());
|
||||
Mutex::Autolock _l(mLock);
|
||||
closeLocked();
|
||||
return Void();
|
||||
}
|
||||
|
||||
void CameraDevice::closeLocked() {
|
||||
ALOGI("Closing camera %s", mCameraId.c_str());
|
||||
if(mDevice) {
|
||||
int rc = mDevice->common.close(&mDevice->common);
|
||||
if (rc != OK) {
|
||||
|
@ -991,7 +996,6 @@ Return<void> CameraDevice::close() {
|
|||
}
|
||||
mDevice = nullptr;
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
|
|
|
@ -222,6 +222,7 @@ private:
|
|||
static status_t getStatusT(const Status& s);
|
||||
|
||||
Status initStatus() const;
|
||||
void closeLocked();
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
|
|
Loading…
Reference in a new issue