diff options
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 |
commit | 2fd2440d0175ca3e196b01b7541a9e0d4ed9a694 (patch) | |
tree | d87e4314688e65f4c53f04021c8452051d4b31eb /services/camera/libcameraservice/CameraService.h | |
parent | cbcd6e869dd41158076e742a31c1ee410fc0c713 (diff) | |
download | frameworks_av-2fd2440d0175ca3e196b01b7541a9e0d4ed9a694.zip frameworks_av-2fd2440d0175ca3e196b01b7541a9e0d4ed9a694.tar.gz frameworks_av-2fd2440d0175ca3e196b01b7541a9e0d4ed9a694.tar.bz2 |
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 'services/camera/libcameraservice/CameraService.h')
-rw-r--r-- | services/camera/libcameraservice/CameraService.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h index bad41f5..457c79b 100644 --- a/services/camera/libcameraservice/CameraService.h +++ b/services/camera/libcameraservice/CameraService.h @@ -46,7 +46,8 @@ 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<ICamera> connect(const sp<ICameraClient>& cameraClient, int cameraId, + bool force, bool keep); virtual void removeClient(const sp<ICameraClient>& cameraClient); virtual sp<Client> getClientById(int cameraId); @@ -114,7 +115,8 @@ private: const sp<CameraHardwareInterface>& hardware, int cameraId, int cameraFacing, - int clientPid); + int clientPid, + bool keep); ~Client(); // return our camera client @@ -172,12 +174,19 @@ private: const sp<IBinder>& binder, const sp<ANativeWindow>& window); + void disconnectInternal(bool needCheckPid); + bool keep() const; + void waitRelease(int ms); + + // these are initialized in the constructor. sp<CameraService> mCameraService; // immutable after constructor sp<ICameraClient> mCameraClient; int mCameraId; // immutable after constructor int mCameraFacing; // immutable after constructor pid_t mClientPid; + // Client wants to keep the camera from taking by other clients. + bool mKeep; sp<CameraHardwareInterface> mHardware; // cleared after disconnect() int mPreviewCallbackFlag; int mOrientation; // Current display orientation @@ -185,6 +194,8 @@ private: // Ensures atomicity among the public methods mutable Mutex mLock; + // This will get notified when the hardware is released. + Condition mReleaseCondition; // This is a binder of Surface or SurfaceTexture. sp<IBinder> mSurface; sp<ANativeWindow> mPreviewWindow; |