From e7ee7637747371635a85fedd24d2190bb1f38651 Mon Sep 17 00:00:00 2001 From: Igor Murashkin Date: Tue, 11 Jun 2013 18:10:18 -0700 Subject: Initial implementation of android.hardware.photography.CameraDevice (service) * Verified preview streaming requests * Other things *should* work but unverified / unimplemented in client side Missing: * CameraService needs to return static camera info metadata Bug: 9213377 Change-Id: I71568560fcf18d0e2b408ed1c4d0066647314868 --- services/camera/libcameraservice/CameraService.h | 32 ++++++++++++++++++------ 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'services/camera/libcameraservice/CameraService.h') diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h index eaa316a..cab804e 100644 --- a/services/camera/libcameraservice/CameraService.h +++ b/services/camera/libcameraservice/CameraService.h @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include @@ -74,6 +76,11 @@ public: const String16& clientPackageName, int clientUid); virtual sp connect(const sp& cameraCb, int cameraId, const String16& clientPackageName, int clientUid); + virtual sp connect( + const sp& cameraCb, + int cameraId, + const String16& clientPackageName, + int clientUid); virtual status_t addListener(const sp& listener); virtual status_t removeListener( @@ -105,7 +112,7 @@ public: // returns plain pointer of client. Note that mClientLock should be acquired to // prevent the client from destruction. The result can be NULL. - virtual Client* getClientByIdUnsafe(int cameraId); + virtual BasicClient* getClientByIdUnsafe(int cameraId); virtual Mutex* getClientLockById(int cameraId); class BasicClient : public virtual RefBase { @@ -114,11 +121,17 @@ public: virtual void disconnect() = 0; + // because we can't virtually inherit IInterface, which breaks + // virtual inheritance + virtual sp asBinderWrapper() = 0; + // Return the remote callback binder object (e.g. IProCameraCallbacks) - wp getRemote() { + sp getRemote() { return mRemoteBinder; } + virtual status_t dump(int fd, const Vector& args) = 0; + protected: BasicClient(const sp& cameraService, const sp& remoteCallback, @@ -147,7 +160,7 @@ public: pid_t mServicePid; // immutable after constructor // - The app-side Binder interface to receive callbacks from us - wp mRemoteBinder; // immutable after constructor + sp mRemoteBinder; // immutable after constructor // permissions management status_t startCameraOps(); @@ -223,6 +236,10 @@ public: return mRemoteCallback; } + virtual sp asBinderWrapper() { + return asBinder(); + } + protected: static Mutex* getClientLockFromCookie(void* user); // convert client from cookie. Client lock should be acquired before getting Client. @@ -296,16 +313,17 @@ private: const String16& clientPackageName, const sp& remoteCallback, /*out*/ - sp &client); + sp &client); // When connection is successful, initialize client and track its death bool connectFinishUnsafe(const sp& client, - const sp& clientBinder); + const sp& remoteCallback); virtual sp getClientByRemote(const wp& cameraClient); Mutex mServiceLock; - wp mClient[MAX_CAMERAS]; // protected by mServiceLock + // either a Client or CameraDeviceClient + wp mClient[MAX_CAMERAS]; // protected by mServiceLock Mutex mClientLock[MAX_CAMERAS]; // prevent Client destruction inside callbacks int mNumberOfCameras; @@ -313,7 +331,7 @@ private: Vector mProClientList[MAX_CAMERAS]; // needs to be called with mServiceLock held - sp findClientUnsafe(const wp& cameraClient, int& outIndex); + sp findClientUnsafe(const wp& cameraClient, int& outIndex); sp findProClientUnsafe( const wp& cameraCallbacksRemote); -- cgit v1.1