summaryrefslogtreecommitdiffstats
path: root/services/camera/libcameraservice/CameraService.cpp
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2013-04-23 15:16:57 -0700
committerIgor Murashkin <iam@google.com>2013-04-26 11:13:22 -0700
commitd09801b99503b57c35e321ad9afa7e861e012813 (patch)
tree62787f87bab856acffb5cb271dd6c2287d001c0b /services/camera/libcameraservice/CameraService.cpp
parentec77122351b4e78c1fe5b60a208f76baf8c67591 (diff)
downloadframeworks_av-d09801b99503b57c35e321ad9afa7e861e012813.zip
frameworks_av-d09801b99503b57c35e321ad9afa7e861e012813.tar.gz
frameworks_av-d09801b99503b57c35e321ad9afa7e861e012813.tar.bz2
Camera2: Fix deadlock on shutdown due to client getting killed.
When the binder connection dies and is the only holder of a strong pointer to the Camera2Client, disconnect is called from the destructor. At this point, all weak pointers to Camera2Client are no longer promotable, and lots of cleanup code paths are broken as a result. Rework all such code paths to not need the client pointer, and to discard image buffers that arrive during shutdown. Bug: 8696047 Change-Id: Ic0672ecde7c1baaf65079f925a45bd5be45f1fb3
Diffstat (limited to 'services/camera/libcameraservice/CameraService.cpp')
-rw-r--r--services/camera/libcameraservice/CameraService.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index 2db5224..cdeb92e 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -793,6 +793,7 @@ CameraService::Client::Client(const sp<CameraService>& cameraService,
// tear down the client
CameraService::Client::~Client() {
+ ALOGV("~Client");
mDestructionStarted = true;
mCameraService->releaseSound();
@@ -820,10 +821,12 @@ CameraService::BasicClient::BasicClient(const sp<CameraService>& cameraService,
}
CameraService::BasicClient::~BasicClient() {
+ ALOGV("~BasicClient");
mDestructionStarted = true;
}
void CameraService::BasicClient::disconnect() {
+ ALOGV("BasicClient::disconnect");
mCameraService->removeClientByRemote(mRemoteBinder);
// client shouldn't be able to call into us anymore
mClientPid = 0;
@@ -922,6 +925,7 @@ void CameraService::Client::notifyError() {
// NOTE: function is idempotent
void CameraService::Client::disconnect() {
+ ALOGV("Client::disconnect");
BasicClient::disconnect();
mCameraService->setCameraFree(mCameraId);
mCameraService->updateStatus(ICameraServiceListener::STATUS_PRESENT,