diff options
author | Eino-Ville Talvala <etalvala@google.com> | 2015-08-20 17:08:32 -0700 |
---|---|---|
committer | Eino-Ville Talvala <etalvala@google.com> | 2015-08-21 17:41:43 -0700 |
commit | 412fe56cd7cf7d73bc5d2bcc3f635bc650d18de9 (patch) | |
tree | 919a0a09510d53e39c23126f7d4760d761d954d6 /services/camera/libcameraservice/CameraService.cpp | |
parent | 37ea1d0de9b7c9ffbfa7cb1895dcbf4a4f92803a (diff) | |
download | frameworks_av-412fe56cd7cf7d73bc5d2bcc3f635bc650d18de9.zip frameworks_av-412fe56cd7cf7d73bc5d2bcc3f635bc650d18de9.tar.gz frameworks_av-412fe56cd7cf7d73bc5d2bcc3f635bc650d18de9.tar.bz2 |
CameraService: Notify camera service proxy of device status
Send the camera proxy service in system server updates to
camera device state: opened/closed/active/idle.
Bug: 23393557
Change-Id: Id7c70f134821efa34af8f6e7b4caa4c2ab128ebc
Diffstat (limited to 'services/camera/libcameraservice/CameraService.cpp')
-rw-r--r-- | services/camera/libcameraservice/CameraService.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp index 43a8ec4..7128df7 100644 --- a/services/camera/libcameraservice/CameraService.cpp +++ b/services/camera/libcameraservice/CameraService.cpp @@ -33,7 +33,6 @@ #include <binder/MemoryBase.h> #include <binder/MemoryHeapBase.h> #include <binder/ProcessInfoService.h> -#include <camera/ICameraServiceProxy.h> #include <cutils/atomic.h> #include <cutils/properties.h> #include <gui/Surface.h> @@ -250,13 +249,19 @@ void CameraService::onFirstRef() CameraService::pingCameraServiceProxy(); } -void CameraService::pingCameraServiceProxy() { +sp<ICameraServiceProxy> CameraService::getCameraServiceProxy() { sp<IServiceManager> sm = defaultServiceManager(); sp<IBinder> binder = sm->getService(String16("media.camera.proxy")); if (binder == nullptr) { - return; + return nullptr; } sp<ICameraServiceProxy> proxyBinder = interface_cast<ICameraServiceProxy>(binder); + return proxyBinder; +} + +void CameraService::pingCameraServiceProxy() { + sp<ICameraServiceProxy> proxyBinder = getCameraServiceProxy(); + if (proxyBinder == nullptr) return; proxyBinder->pingForUserUpdate(); } @@ -1948,6 +1953,10 @@ status_t CameraService::BasicClient::startCameraOps() { mCameraService->updateStatus(ICameraServiceListener::STATUS_NOT_AVAILABLE, String8::format("%d", mCameraId)); + // Transition device state to OPEN + mCameraService->updateProxyDeviceState(ICameraServiceProxy::CAMERA_STATE_OPEN, + String8::format("%d", mCameraId)); + return OK; } @@ -1966,6 +1975,10 @@ status_t CameraService::BasicClient::finishCameraOps() { mCameraService->updateStatus(ICameraServiceListener::STATUS_PRESENT, String8::format("%d", mCameraId), rejected); + // Transition device state to CLOSED + mCameraService->updateProxyDeviceState(ICameraServiceProxy::CAMERA_STATE_CLOSED, + String8::format("%d", mCameraId)); + // Notify flashlight that a camera device is closed. mCameraService->mFlashlight->deviceClosed( String8::format("%d", mCameraId)); @@ -2466,6 +2479,14 @@ void CameraService::updateStatus(ICameraServiceListener::Status status, const St }); } +void CameraService::updateProxyDeviceState(ICameraServiceProxy::CameraState newState, + const String8& cameraId) { + sp<ICameraServiceProxy> proxyBinder = getCameraServiceProxy(); + if (proxyBinder == nullptr) return; + String16 id(cameraId); + proxyBinder->notifyCameraState(id, newState); +} + status_t CameraService::getTorchStatusLocked( const String8& cameraId, ICameraServiceListener::TorchStatus *status) const { |