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 | ceb388d6c03c38b96dc41c0ea4804b749aa077c4 (patch) | |
tree | 0639ba70ce330094a9fa71ba4577eece6d4dadb1 /camera | |
parent | 0894bfb78b7872570b94d0b8d23ebbf6a8b51d35 (diff) | |
download | frameworks_av-ceb388d6c03c38b96dc41c0ea4804b749aa077c4.zip frameworks_av-ceb388d6c03c38b96dc41c0ea4804b749aa077c4.tar.gz frameworks_av-ceb388d6c03c38b96dc41c0ea4804b749aa077c4.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 'camera')
-rw-r--r-- | camera/Camera.cpp | 6 | ||||
-rw-r--r-- | camera/ICameraService.cpp | 14 |
2 files changed, 15 insertions, 5 deletions
diff --git a/camera/Camera.cpp b/camera/Camera.cpp index be395ba..d8dc2a5 100644 --- a/camera/Camera.cpp +++ b/camera/Camera.cpp @@ -19,6 +19,7 @@ #define LOG_TAG "Camera" #include <utils/Log.h> #include <utils/threads.h> +#include <utils/String16.h> #include <binder/IPCThreadState.h> #include <binder/IServiceManager.h> #include <binder/IMemory.h> @@ -116,14 +117,15 @@ status_t Camera::getCameraInfo(int cameraId, return cs->getCameraInfo(cameraId, cameraInfo); } -sp<Camera> Camera::connect(int cameraId) +sp<Camera> Camera::connect(int cameraId, const String16& clientPackageName, + int clientUid) { ALOGV("connect"); sp<Camera> c = new Camera(); sp<ICameraClient> cl = c; const sp<ICameraService>& cs = getCameraService(); if (cs != 0) { - c->mCamera = cs->connect(cl, cameraId); + c->mCamera = cs->connect(cl, cameraId, clientPackageName, clientUid); } if (c->mCamera != 0) { c->mCamera->asBinder()->linkToDeath(c); diff --git a/camera/ICameraService.cpp b/camera/ICameraService.cpp index 8237c66..fdf20ff 100644 --- a/camera/ICameraService.cpp +++ b/camera/ICameraService.cpp @@ -56,12 +56,15 @@ public: } // connect to camera service - virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient, int cameraId) + virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient, int cameraId, + const String16 &clientPackageName, int clientUid) { Parcel data, reply; data.writeInterfaceToken(ICameraService::getInterfaceDescriptor()); data.writeStrongBinder(cameraClient->asBinder()); data.writeInt32(cameraId); + data.writeString16(clientPackageName); + data.writeInt32(clientUid); remote()->transact(BnCameraService::CONNECT, data, &reply); return interface_cast<ICamera>(reply.readStrongBinder()); } @@ -103,8 +106,13 @@ status_t BnCameraService::onTransact( } break; case CONNECT: { CHECK_INTERFACE(ICameraService, data, reply); - sp<ICameraClient> cameraClient = interface_cast<ICameraClient>(data.readStrongBinder()); - sp<ICamera> camera = connect(cameraClient, data.readInt32()); + sp<ICameraClient> cameraClient = + interface_cast<ICameraClient>(data.readStrongBinder()); + int32_t cameraId = data.readInt32(); + const String16 clientName = data.readString16(); + int32_t clientUid = data.readInt32(); + sp<ICamera> camera = connect(cameraClient, cameraId, + clientName, clientUid); reply->writeStrongBinder(camera->asBinder()); return NO_ERROR; } break; |