summaryrefslogtreecommitdiffstats
path: root/services/camera
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2015-11-02 17:39:38 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2015-11-02 17:39:38 -0800
commitf140e521f51b2d48c1f983c2790f4ab55b6dfac9 (patch)
treeeb942f448e041c1b884514d4b9bb229ebe970607 /services/camera
parent57b1d0550ae889ecd4d858ee24bc50cced2dd451 (diff)
parent4f33629b62ad90687973c8496d9b60f4f18e26b1 (diff)
downloadframeworks_av-f140e521f51b2d48c1f983c2790f4ab55b6dfac9.zip
frameworks_av-f140e521f51b2d48c1f983c2790f4ab55b6dfac9.tar.gz
frameworks_av-f140e521f51b2d48c1f983c2790f4ab55b6dfac9.tar.bz2
Merge "DO NOT MERGE: CameraService: Link to client binder death at end of connect"
Diffstat (limited to 'services/camera')
-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 9a1101a..e4f792d 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -935,6 +935,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,
@@ -1874,11 +1884,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 b56c161..b29317e 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -861,11 +861,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