diff options
author | Eino-Ville Talvala <etalvala@google.com> | 2013-02-19 10:40:14 -0800 |
---|---|---|
committer | Eino-Ville Talvala <etalvala@google.com> | 2013-02-25 16:11:41 -0800 |
commit | 48af7e8dd40883d6154e7029d9500072b551b5fa (patch) | |
tree | ce8b71d67a3313dc19c0691bc1b26d1244a106b4 /include/camera | |
parent | 68e6e24cb6cdd66c2209774c4871a2c47e8bbc8b (diff) | |
download | frameworks_av-48af7e8dd40883d6154e7029d9500072b551b5fa.zip frameworks_av-48af7e8dd40883d6154e7029d9500072b551b5fa.tar.gz frameworks_av-48af7e8dd40883d6154e7029d9500072b551b5fa.tar.bz2 |
CameraService and Stagefright: Support AppOps
Camera:
- Signal to AppOpsService when camera usage starts and stops
- Listen to permissions revocations and act on them
- Currently just kill camera connection when permissions lost
Stagefright:
- Pass on client name, UID to camera as needed
Bug: 8181262
Change-Id: I9e33c9d05e9daa77dbb2d795045d08eb887ec8f0
Diffstat (limited to 'include/camera')
-rw-r--r-- | include/camera/Camera.h | 10 | ||||
-rw-r--r-- | include/camera/ICameraService.h | 20 |
2 files changed, 24 insertions, 6 deletions
diff --git a/include/camera/Camera.h b/include/camera/Camera.h index 8b87de6..be2b7f4 100644 --- a/include/camera/Camera.h +++ b/include/camera/Camera.h @@ -53,6 +53,7 @@ class ICamera; class Surface; class Mutex; class String8; +class String16; // ref-counted object for callbacks class CameraListener: virtual public RefBase @@ -67,12 +68,19 @@ public: class Camera : public BnCameraClient, public IBinder::DeathRecipient { public: + enum { + USE_CALLING_UID = -1 + }; + // construct a camera client from an existing remote static sp<Camera> create(const sp<ICamera>& camera); static int32_t getNumberOfCameras(); static status_t getCameraInfo(int cameraId, struct CameraInfo* cameraInfo); - static sp<Camera> connect(int cameraId); + static sp<Camera> connect(int cameraId, + const String16& clientPackageName, + int clientUid); + virtual ~Camera(); void init(); diff --git a/include/camera/ICameraService.h b/include/camera/ICameraService.h index 11d7b65..aa64243 100644 --- a/include/camera/ICameraService.h +++ b/include/camera/ICameraService.h @@ -37,18 +37,28 @@ public: CONNECT_PRO }; + enum { + USE_CALLING_UID = -1 + }; + public: DECLARE_META_INTERFACE(CameraService); virtual int32_t getNumberOfCameras() = 0; virtual status_t getCameraInfo(int cameraId, struct CameraInfo* cameraInfo) = 0; - virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient, - int cameraId) = 0; + /** + * clientPackageName and clientUid are used for permissions checking. if + * clientUid == USE_CALLING_UID, then the calling UID is used instead. Only + * trusted callers can set a clientUid other than USE_CALLING_UID. + */ + virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient, + int cameraId, + const String16& clientPackageName, + int clientUid) = 0; - virtual sp<IProCameraUser> - connect(const sp<IProCameraCallbacks>& cameraCb, - int cameraId) = 0; + virtual sp<IProCameraUser> connect(const sp<IProCameraCallbacks>& cameraCb, + int cameraId) = 0; }; // ---------------------------------------------------------------------------- |