summaryrefslogtreecommitdiffstats
path: root/services/camera/libcameraservice/CameraService.h
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2013-02-26 01:40:39 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2013-02-26 01:40:39 +0000
commitb39f30b0a4902ea0f28454885785da4b2629fe25 (patch)
treec4042ba7bf201f8d4ac726e876f30cc168f0d032 /services/camera/libcameraservice/CameraService.h
parentb4ac0ea6c45c04ac3e69d6b2243cfec58e858495 (diff)
parentceb388d6c03c38b96dc41c0ea4804b749aa077c4 (diff)
downloadframeworks_av-b39f30b0a4902ea0f28454885785da4b2629fe25.zip
frameworks_av-b39f30b0a4902ea0f28454885785da4b2629fe25.tar.gz
frameworks_av-b39f30b0a4902ea0f28454885785da4b2629fe25.tar.bz2
am ceb388d6: CameraService and Stagefright: Support AppOps
* commit 'ceb388d6c03c38b96dc41c0ea4804b749aa077c4': CameraService and Stagefright: Support AppOps
Diffstat (limited to 'services/camera/libcameraservice/CameraService.h')
-rw-r--r--services/camera/libcameraservice/CameraService.h57
1 files changed, 50 insertions, 7 deletions
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index 9e0f62a..b017505 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -19,7 +19,9 @@
#define ANDROID_SERVERS_CAMERA_CAMERASERVICE_H
#include <utils/Vector.h>
+#include <binder/AppOpsManager.h>
#include <binder/BinderService.h>
+#include <binder/IAppOpsCallback.h>
#include <camera/ICameraService.h>
#include <hardware/camera.h>
@@ -54,9 +56,11 @@ public:
virtual int32_t getNumberOfCameras();
virtual status_t getCameraInfo(int cameraId,
struct CameraInfo* cameraInfo);
- virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient, int cameraId);
- virtual sp<IProCameraUser>
- connect(const sp<IProCameraCallbacks>& cameraCb, int cameraId);
+
+ virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient, int cameraId,
+ const String16& clientPackageName, int clientUid);
+ virtual sp<IProCameraUser> connect(const sp<IProCameraCallbacks>& cameraCb,
+ int cameraId);
// Extra permissions checks
virtual status_t onTransact(uint32_t code, const Parcel& data,
@@ -100,9 +104,11 @@ public:
protected:
BasicClient(const sp<CameraService>& cameraService,
const sp<IBinder>& remoteCallback,
+ const String16& clientPackageName,
int cameraId,
int cameraFacing,
int clientPid,
+ uid_t clientUid,
int servicePid);
virtual ~BasicClient();
@@ -117,12 +123,41 @@ public:
sp<CameraService> mCameraService; // immutable after constructor
int mCameraId; // immutable after constructor
int mCameraFacing; // immutable after constructor
+ const String16 mClientPackageName;
pid_t mClientPid;
+ uid_t mClientUid; // immutable after constructor
pid_t mServicePid; // immutable after constructor
// - The app-side Binder interface to receive callbacks from us
wp<IBinder> mRemoteCallback; // immutable after constructor
- };
+
+ // permissions management
+ status_t startCameraOps();
+ status_t finishCameraOps();
+
+ // Notify client about a fatal error
+ virtual void notifyError() = 0;
+ private:
+ AppOpsManager mAppOpsManager;
+
+ class OpsCallback : public BnAppOpsCallback {
+ public:
+ OpsCallback(wp<BasicClient> client);
+ virtual void opChanged(int32_t op, const String16& packageName);
+
+ private:
+ wp<BasicClient> mClient;
+
+ }; // class OpsCallback
+
+ sp<OpsCallback> mOpsCallback;
+ // Track whether startCameraOps was called successfully, to avoid
+ // finishing what we didn't start.
+ bool mOpsActive;
+
+ // IAppOpsCallback interface, indirected through opListener
+ virtual void opChanged(int32_t op, const String16& packageName);
+ }; // class BasicClient
class Client : public BnCamera, public BasicClient
{
@@ -153,9 +188,11 @@ public:
// Interface used by CameraService
Client(const sp<CameraService>& cameraService,
const sp<ICameraClient>& cameraClient,
+ const String16& clientPackageName,
int cameraId,
int cameraFacing,
int clientPid,
+ uid_t clientUid,
int servicePid);
~Client();
@@ -169,19 +206,24 @@ public:
// convert client from cookie. Client lock should be acquired before getting Client.
static Client* getClientFromCookie(void* user);
+ virtual void notifyError();
+
// Initialized in constructor
// - The app-side Binder interface to receive callbacks from us
sp<ICameraClient> mCameraClient;
- };
+
+ }; // class Client
class ProClient : public BnProCameraUser, public BasicClient {
public:
ProClient(const sp<CameraService>& cameraService,
const sp<IProCameraCallbacks>& remoteCallback,
+ const String16& clientPackageName,
int cameraId,
int cameraFacing,
int clientPid,
+ uid_t clientUid,
int servicePid);
virtual ~ProClient();
@@ -217,9 +259,10 @@ public:
virtual status_t cancelStream(int streamId);
protected:
- sp<IProCameraCallbacks> mRemoteCallback;
+ virtual void notifyError();
- };
+ sp<IProCameraCallbacks> mRemoteCallback;
+ }; // class ProClient
private: