summaryrefslogtreecommitdiffstats
path: root/services/camera/libcameraservice/CameraService.h
diff options
context:
space:
mode:
authorIgor Murashkin <iam@google.com>2012-10-02 16:05:11 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-10-03 11:39:08 -0700
commitecf17e82505fdb60d59e00b6dd59036df93de655 (patch)
tree4f03c5ed7a8596537815a5e46550abd1daed20b8 /services/camera/libcameraservice/CameraService.h
parent22d58d37db6b5f48a10b3a19f69ffda09943c125 (diff)
downloadframeworks_av-ecf17e82505fdb60d59e00b6dd59036df93de655.zip
frameworks_av-ecf17e82505fdb60d59e00b6dd59036df93de655.tar.gz
frameworks_av-ecf17e82505fdb60d59e00b6dd59036df93de655.tar.bz2
Camera2: Handle client processes dying by closing camera resources
CameraService now subscribes to binder death notifications for each client, and disconnects the client if the death happened without cleanly shutting down the client first. Bug: 7258314 Change-Id: I7803836b589fd8f0dfe00f6c28a707b82012e751
Diffstat (limited to 'services/camera/libcameraservice/CameraService.h')
-rw-r--r--services/camera/libcameraservice/CameraService.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index 630fca7..f1e7df6 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -34,7 +34,8 @@ class MediaPlayer;
class CameraService :
public BinderService<CameraService>,
- public BnCameraService
+ public BnCameraService,
+ public IBinder::DeathRecipient
{
friend class BinderService<CameraService>;
public:
@@ -54,6 +55,8 @@ public:
virtual Client* getClientByIdUnsafe(int cameraId);
virtual Mutex* getClientLockById(int cameraId);
+ virtual sp<Client> getClientByRemote(const sp<ICameraClient>& cameraClient);
+
virtual status_t dump(int fd, const Vector<String16>& args);
virtual status_t onTransact(uint32_t code, const Parcel& data,
Parcel* reply, uint32_t flags);
@@ -100,7 +103,8 @@ public:
const sp<ICameraClient>& cameraClient,
int cameraId,
int cameraFacing,
- int clientPid);
+ int clientPid,
+ int servicePid);
~Client();
// return our camera client
@@ -128,6 +132,7 @@ public:
int mCameraId; // immutable after constructor
int mCameraFacing; // immutable after constructor
pid_t mClientPid;
+ pid_t mServicePid; // immutable after constructor
};
@@ -137,6 +142,9 @@ private:
Mutex mClientLock[MAX_CAMERAS]; // prevent Client destruction inside callbacks
int mNumberOfCameras;
+ // needs to be called with mServiceLock held
+ sp<Client> findClientUnsafe(const sp<ICameraClient>& cameraClient, int& outIndex);
+
// atomics to record whether the hardware is allocated to some client.
volatile int32_t mBusy[MAX_CAMERAS];
void setCameraBusy(int cameraId);
@@ -150,6 +158,9 @@ private:
int mSoundRef; // reference count (release all MediaPlayer when 0)
camera_module_t *mModule;
+
+ // IBinder::DeathRecipient implementation
+ virtual void binderDied(const wp<IBinder> &who);
};
} // namespace android