summaryrefslogtreecommitdiff
path: root/libs/camera/ICameraService.cpp
diff options
context:
space:
mode:
author Wu-cheng Li <wuchengli@google.com> 2012-02-23 19:01:00 -0800
committer Wu-cheng Li <wuchengli@google.com> 2012-03-15 14:50:48 +0800
commita1c41e13b521cdd611a8fc46e43b5ae0a2c00238 (patch)
tree48877fa91b94c62482519f040e966997a9d214d2 /libs/camera/ICameraService.cpp
parent5571ffdd9d419e3b1e050501e6f8dbfb04159b5d (diff)
Add a new camera open API that allows taking the ownership.
The purpose is to let face unlock always get the camera successfully. What happened was the camera applications may have opened the camera in onResume under the lock screen. This API lets face unlock take the camera from the camera application. A new permission will be added, so other applicatoins won't be able to take the camera from the face unlock. bug:5584464 Change-Id: Ib3d9dcbc2161815b68db42327dc01148453704c6
Diffstat (limited to 'libs/camera/ICameraService.cpp')
-rw-r--r--libs/camera/ICameraService.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/libs/camera/ICameraService.cpp b/libs/camera/ICameraService.cpp
index 85f1a29feb1a..c74298a84bb9 100644
--- a/libs/camera/ICameraService.cpp
+++ b/libs/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,
+ bool force, bool keep)
{
Parcel data, reply;
data.writeInterfaceToken(ICameraService::getInterfaceDescriptor());
data.writeStrongBinder(cameraClient->asBinder());
data.writeInt32(cameraId);
+ data.writeInt32(force);
+ data.writeInt32(keep);
remote()->transact(BnCameraService::CONNECT, data, &reply);
return interface_cast<ICamera>(reply.readStrongBinder());
}
@@ -93,7 +96,10 @@ status_t BnCameraService::onTransact(
case CONNECT: {
CHECK_INTERFACE(ICameraService, data, reply);
sp<ICameraClient> cameraClient = interface_cast<ICameraClient>(data.readStrongBinder());
- sp<ICamera> camera = connect(cameraClient, data.readInt32());
+ const int cameraId = data.readInt32();
+ const int force = data.readInt32();
+ const int keep = data.readInt32();
+ sp<ICamera> camera = connect(cameraClient, cameraId, force, keep);
reply->writeStrongBinder(camera->asBinder());
return NO_ERROR;
} break;
@@ -105,4 +111,3 @@ status_t BnCameraService::onTransact(
// ----------------------------------------------------------------------------
}; // namespace android
-