summaryrefslogtreecommitdiffstats
path: root/services/camera/libcameraservice
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2015-09-05 00:18:57 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-09-05 00:18:57 +0000
commitc85dc0548dcc59aebc39251aa66b8c5df956c76f (patch)
tree7ab270afa8be22e59076689b6f8c98983dd1a0b5 /services/camera/libcameraservice
parent4abef9bf7cfb98930044c75354f5200b811d099f (diff)
parent24901c86e10a0923fe10f5e9bce5e6dba061a289 (diff)
downloadframeworks_av-c85dc0548dcc59aebc39251aa66b8c5df956c76f.zip
frameworks_av-c85dc0548dcc59aebc39251aa66b8c5df956c76f.tar.gz
frameworks_av-c85dc0548dcc59aebc39251aa66b8c5df956c76f.tar.bz2
Merge "CameraService: Link to client binder death at end of connect" into mnc-dr-dev
Diffstat (limited to 'services/camera/libcameraservice')
-rw-r--r--services/camera/libcameraservice/CameraService.cpp14
-rw-r--r--services/camera/libcameraservice/CameraService.h5
2 files changed, 11 insertions, 8 deletions
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index f5a0887..9230994 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -945,6 +945,16 @@ void CameraService::finishConnectLocked(const sp<BasicClient>& client,
LOG_ALWAYS_FATAL("%s: Invalid state for CameraService, clients not evicted properly",
__FUNCTION__);
}
+
+ // And register a death notification for the client callback. Do
+ // this last to avoid Binder policy where a nested Binder
+ // transaction might be pre-empted to service the client death
+ // notification if the client process dies before linkToDeath is
+ // invoked.
+ sp<IBinder> remoteCallback = client->getRemote();
+ if (remoteCallback != nullptr) {
+ remoteCallback->linkToDeath(this);
+ }
}
status_t CameraService::handleEvictionsLocked(const String8& cameraId, int clientPid,
@@ -1884,11 +1894,9 @@ CameraService::BasicClient::~BasicClient() {
void CameraService::BasicClient::disconnect() {
if (mDisconnected) {
- ALOGE("%s: Disconnect called on already disconnected client for device %d", __FUNCTION__,
- mCameraId);
return;
}
- mDisconnected = true;;
+ mDisconnected = true;
mCameraService->removeByClient(this);
mCameraService->logDisconnected(String8::format("%d", mCameraId), mClientPid,
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index 330a19d..cd97b08 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -873,11 +873,6 @@ status_t CameraService::connectHelper(const sp<CALLBACK>& cameraCb, const String
return ret;
}
- sp<IBinder> remoteCallback = client->getRemote();
- if (remoteCallback != nullptr) {
- remoteCallback->linkToDeath(this);
- }
-
// Update shim paremeters for legacy clients
if (effectiveApiLevel == API_1) {
// Assume we have always received a Client subclass for API1