diff options
author | Igor Murashkin <iam@google.com> | 2013-02-27 12:55:20 -0800 |
---|---|---|
committer | Igor Murashkin <iam@google.com> | 2013-02-28 15:55:15 -0800 |
commit | bfc9915f482520eb9676c6d2dbf7f1ac078d937d (patch) | |
tree | 1353c3f2f63777397770edfd1f146c691e5684e2 /services/camera/libcameraservice/CameraService.h | |
parent | 3fa4891f54bbfdbe8ee652930d22c96639964eff (diff) | |
download | frameworks_av-bfc9915f482520eb9676c6d2dbf7f1ac078d937d.zip frameworks_av-bfc9915f482520eb9676c6d2dbf7f1ac078d937d.tar.gz frameworks_av-bfc9915f482520eb9676c6d2dbf7f1ac078d937d.tar.bz2 |
Camera: Drop ProCamera connections when a Camera connection happens
* Also adds an ICameraServiceListener with available/not available statuses
Bug: 8291653
Change-Id: I24680f1a2dc109510caf451cf7c7bd180b670d84
Diffstat (limited to 'services/camera/libcameraservice/CameraService.h')
-rw-r--r-- | services/camera/libcameraservice/CameraService.h | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h index d93aa73..8acc63f 100644 --- a/services/camera/libcameraservice/CameraService.h +++ b/services/camera/libcameraservice/CameraService.h @@ -30,6 +30,8 @@ #include <camera/IProCameraUser.h> #include <camera/IProCameraCallbacks.h> +#include <camera/ICameraServiceListener.h> + /* This needs to be increased if we can have more cameras */ #define MAX_CAMERAS 2 @@ -67,6 +69,10 @@ public: virtual sp<IProCameraUser> connect(const sp<IProCameraCallbacks>& cameraCb, int cameraId, const String16& clientPackageName, int clientUid); + virtual status_t addListener(const sp<ICameraServiceListener>& listener); + virtual status_t removeListener( + const sp<ICameraServiceListener>& listener); + // Extra permissions checks virtual status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags); @@ -263,6 +269,9 @@ public: virtual status_t requestStream(int streamId); virtual status_t cancelStream(int streamId); + // Callbacks from camera service + virtual void onExclusiveLockStolen(); + protected: virtual void notifyError(); @@ -303,11 +312,30 @@ private: camera_module_t *mModule; + Vector<sp<ICameraServiceListener> > + mListenerList; + + // guard only mStatusList and the broadcasting of ICameraServiceListener + Mutex mStatusMutex; + ICameraServiceListener::Status + mStatusList[MAX_CAMERAS]; + + // Broadcast the new status if it changed (locks the service mutex) + void updateStatus( + ICameraServiceListener::Status status, + int32_t cameraId); + // Call this one when the service mutex is already held (idempotent) + void updateStatusUnsafe( + ICameraServiceListener::Status status, + int32_t cameraId); + // IBinder::DeathRecipient implementation - virtual void binderDied(const wp<IBinder> &who); + virtual void binderDied(const wp<IBinder> &who); // Helpers int getDeviceVersion(int cameraId, int* facing); + + bool isValidCameraId(int cameraId); }; } // namespace android |