Loading camera/aidl/android/hardware/ICameraServiceProxy.aidl +7 −1 Original line number Diff line number Diff line Loading @@ -45,9 +45,15 @@ interface ICameraServiceProxy const int CAMERA_FACING_FRONT = 1; const int CAMERA_FACING_EXTERNAL = 2; /** * Values for notifyCameraState api level */ const int CAMERA_API_LEVEL_1 = 1; const int CAMERA_API_LEVEL_2 = 2; /** * Update the status of a camera device. */ oneway void notifyCameraState(String cameraId, int facing, int newCameraState, String clientName); String clientName, int apiLevel); } services/camera/libcameraservice/CameraService.cpp +12 −4 Original line number Diff line number Diff line Loading @@ -2239,9 +2239,13 @@ status_t CameraService::BasicClient::startCameraOps() { // Transition device availability listeners from PRESENT -> NOT_AVAILABLE sCameraService->updateStatus(StatusInternal::NOT_AVAILABLE, mCameraIdStr); int apiLevel = hardware::ICameraServiceProxy::CAMERA_API_LEVEL_1; if (canCastToApiClient(API_2)) { apiLevel = hardware::ICameraServiceProxy::CAMERA_API_LEVEL_2; } // Transition device state to OPEN sCameraService->updateProxyDeviceState(ICameraServiceProxy::CAMERA_STATE_OPEN, mCameraIdStr, mCameraFacing, mClientPackageName); mCameraIdStr, mCameraFacing, mClientPackageName, apiLevel); return OK; } Loading @@ -2266,9 +2270,13 @@ status_t CameraService::BasicClient::finishCameraOps() { sCameraService->updateStatus(StatusInternal::PRESENT, mCameraIdStr, rejected); int apiLevel = hardware::ICameraServiceProxy::CAMERA_API_LEVEL_1; if (canCastToApiClient(API_2)) { apiLevel = hardware::ICameraServiceProxy::CAMERA_API_LEVEL_2; } // Transition device state to CLOSED sCameraService->updateProxyDeviceState(ICameraServiceProxy::CAMERA_STATE_CLOSED, mCameraIdStr, mCameraFacing, mClientPackageName); mCameraIdStr, mCameraFacing, mClientPackageName, apiLevel); } // Always stop watching, even if no camera op is active if (mOpsCallback != NULL) { Loading Loading @@ -2884,11 +2892,11 @@ void CameraService::CameraState::updateStatus(StatusInternal status, } void CameraService::updateProxyDeviceState(int newState, const String8& cameraId, int facing, const String16& clientName) { const String8& cameraId, int facing, const String16& clientName, int apiLevel) { sp<ICameraServiceProxy> proxyBinder = getCameraServiceProxy(); if (proxyBinder == nullptr) return; String16 id(cameraId); proxyBinder->notifyCameraState(id, newState, facing, clientName); proxyBinder->notifyCameraState(id, newState, facing, clientName, apiLevel); } status_t CameraService::getTorchStatusLocked( Loading services/camera/libcameraservice/CameraService.h +2 −1 Original line number Diff line number Diff line Loading @@ -189,7 +189,8 @@ public: int newState, const String8& cameraId, int facing, const String16& clientName); const String16& clientName, int apiLevel); ///////////////////////////////////////////////////////////////////// // CameraDeviceFactory functionality Loading services/camera/libcameraservice/api1/CameraClient.cpp +8 −4 Original line number Diff line number Diff line Loading @@ -263,7 +263,8 @@ binder::Status CameraClient::disconnect() { mHardware->stopPreview(); sCameraService->updateProxyDeviceState( hardware::ICameraServiceProxy::CAMERA_STATE_IDLE, mCameraIdStr, mCameraFacing, mClientPackageName); mCameraIdStr, mCameraFacing, mClientPackageName, hardware::ICameraServiceProxy::CAMERA_API_LEVEL_1); mHardware->cancelPicture(); // Release the hardware resources. mHardware->release(); Loading Loading @@ -425,7 +426,8 @@ status_t CameraClient::startPreviewMode() { if (result == NO_ERROR) { sCameraService->updateProxyDeviceState( hardware::ICameraServiceProxy::CAMERA_STATE_ACTIVE, mCameraIdStr, mCameraFacing, mClientPackageName); mCameraIdStr, mCameraFacing, mClientPackageName, hardware::ICameraServiceProxy::CAMERA_API_LEVEL_1); } return result; } Loading Loading @@ -468,7 +470,8 @@ void CameraClient::stopPreview() { mHardware->stopPreview(); sCameraService->updateProxyDeviceState( hardware::ICameraServiceProxy::CAMERA_STATE_IDLE, mCameraIdStr, mCameraFacing, mClientPackageName); mCameraIdStr, mCameraFacing, mClientPackageName, hardware::ICameraServiceProxy::CAMERA_API_LEVEL_1); mPreviewBuffer.clear(); } Loading Loading @@ -974,7 +977,8 @@ void CameraClient::handleShutter(void) { // idle now, until preview is restarted sCameraService->updateProxyDeviceState( hardware::ICameraServiceProxy::CAMERA_STATE_IDLE, mCameraIdStr, mCameraFacing, mClientPackageName); mCameraIdStr, mCameraFacing, mClientPackageName, hardware::ICameraServiceProxy::CAMERA_API_LEVEL_1); mLock.unlock(); } Loading services/camera/libcameraservice/common/Camera2ClientBase.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -253,7 +253,9 @@ void Camera2ClientBase<TClientBase>::notifyIdle() { if (mDeviceActive) { getCameraService()->updateProxyDeviceState( hardware::ICameraServiceProxy::CAMERA_STATE_IDLE, TClientBase::mCameraIdStr, TClientBase::mCameraFacing, TClientBase::mClientPackageName); TClientBase::mCameraFacing, TClientBase::mClientPackageName, ((mApi1CameraId < 0) ? hardware::ICameraServiceProxy::CAMERA_API_LEVEL_2 : hardware::ICameraServiceProxy::CAMERA_API_LEVEL_1)); } mDeviceActive = false; Loading @@ -269,7 +271,9 @@ void Camera2ClientBase<TClientBase>::notifyShutter(const CaptureResultExtras& re if (!mDeviceActive) { getCameraService()->updateProxyDeviceState( hardware::ICameraServiceProxy::CAMERA_STATE_ACTIVE, TClientBase::mCameraIdStr, TClientBase::mCameraFacing, TClientBase::mClientPackageName); TClientBase::mCameraFacing, TClientBase::mClientPackageName, ((mApi1CameraId < 0) ? hardware::ICameraServiceProxy::CAMERA_API_LEVEL_2 : hardware::ICameraServiceProxy::CAMERA_API_LEVEL_1)); } mDeviceActive = true; Loading Loading
camera/aidl/android/hardware/ICameraServiceProxy.aidl +7 −1 Original line number Diff line number Diff line Loading @@ -45,9 +45,15 @@ interface ICameraServiceProxy const int CAMERA_FACING_FRONT = 1; const int CAMERA_FACING_EXTERNAL = 2; /** * Values for notifyCameraState api level */ const int CAMERA_API_LEVEL_1 = 1; const int CAMERA_API_LEVEL_2 = 2; /** * Update the status of a camera device. */ oneway void notifyCameraState(String cameraId, int facing, int newCameraState, String clientName); String clientName, int apiLevel); }
services/camera/libcameraservice/CameraService.cpp +12 −4 Original line number Diff line number Diff line Loading @@ -2239,9 +2239,13 @@ status_t CameraService::BasicClient::startCameraOps() { // Transition device availability listeners from PRESENT -> NOT_AVAILABLE sCameraService->updateStatus(StatusInternal::NOT_AVAILABLE, mCameraIdStr); int apiLevel = hardware::ICameraServiceProxy::CAMERA_API_LEVEL_1; if (canCastToApiClient(API_2)) { apiLevel = hardware::ICameraServiceProxy::CAMERA_API_LEVEL_2; } // Transition device state to OPEN sCameraService->updateProxyDeviceState(ICameraServiceProxy::CAMERA_STATE_OPEN, mCameraIdStr, mCameraFacing, mClientPackageName); mCameraIdStr, mCameraFacing, mClientPackageName, apiLevel); return OK; } Loading @@ -2266,9 +2270,13 @@ status_t CameraService::BasicClient::finishCameraOps() { sCameraService->updateStatus(StatusInternal::PRESENT, mCameraIdStr, rejected); int apiLevel = hardware::ICameraServiceProxy::CAMERA_API_LEVEL_1; if (canCastToApiClient(API_2)) { apiLevel = hardware::ICameraServiceProxy::CAMERA_API_LEVEL_2; } // Transition device state to CLOSED sCameraService->updateProxyDeviceState(ICameraServiceProxy::CAMERA_STATE_CLOSED, mCameraIdStr, mCameraFacing, mClientPackageName); mCameraIdStr, mCameraFacing, mClientPackageName, apiLevel); } // Always stop watching, even if no camera op is active if (mOpsCallback != NULL) { Loading Loading @@ -2884,11 +2892,11 @@ void CameraService::CameraState::updateStatus(StatusInternal status, } void CameraService::updateProxyDeviceState(int newState, const String8& cameraId, int facing, const String16& clientName) { const String8& cameraId, int facing, const String16& clientName, int apiLevel) { sp<ICameraServiceProxy> proxyBinder = getCameraServiceProxy(); if (proxyBinder == nullptr) return; String16 id(cameraId); proxyBinder->notifyCameraState(id, newState, facing, clientName); proxyBinder->notifyCameraState(id, newState, facing, clientName, apiLevel); } status_t CameraService::getTorchStatusLocked( Loading
services/camera/libcameraservice/CameraService.h +2 −1 Original line number Diff line number Diff line Loading @@ -189,7 +189,8 @@ public: int newState, const String8& cameraId, int facing, const String16& clientName); const String16& clientName, int apiLevel); ///////////////////////////////////////////////////////////////////// // CameraDeviceFactory functionality Loading
services/camera/libcameraservice/api1/CameraClient.cpp +8 −4 Original line number Diff line number Diff line Loading @@ -263,7 +263,8 @@ binder::Status CameraClient::disconnect() { mHardware->stopPreview(); sCameraService->updateProxyDeviceState( hardware::ICameraServiceProxy::CAMERA_STATE_IDLE, mCameraIdStr, mCameraFacing, mClientPackageName); mCameraIdStr, mCameraFacing, mClientPackageName, hardware::ICameraServiceProxy::CAMERA_API_LEVEL_1); mHardware->cancelPicture(); // Release the hardware resources. mHardware->release(); Loading Loading @@ -425,7 +426,8 @@ status_t CameraClient::startPreviewMode() { if (result == NO_ERROR) { sCameraService->updateProxyDeviceState( hardware::ICameraServiceProxy::CAMERA_STATE_ACTIVE, mCameraIdStr, mCameraFacing, mClientPackageName); mCameraIdStr, mCameraFacing, mClientPackageName, hardware::ICameraServiceProxy::CAMERA_API_LEVEL_1); } return result; } Loading Loading @@ -468,7 +470,8 @@ void CameraClient::stopPreview() { mHardware->stopPreview(); sCameraService->updateProxyDeviceState( hardware::ICameraServiceProxy::CAMERA_STATE_IDLE, mCameraIdStr, mCameraFacing, mClientPackageName); mCameraIdStr, mCameraFacing, mClientPackageName, hardware::ICameraServiceProxy::CAMERA_API_LEVEL_1); mPreviewBuffer.clear(); } Loading Loading @@ -974,7 +977,8 @@ void CameraClient::handleShutter(void) { // idle now, until preview is restarted sCameraService->updateProxyDeviceState( hardware::ICameraServiceProxy::CAMERA_STATE_IDLE, mCameraIdStr, mCameraFacing, mClientPackageName); mCameraIdStr, mCameraFacing, mClientPackageName, hardware::ICameraServiceProxy::CAMERA_API_LEVEL_1); mLock.unlock(); } Loading
services/camera/libcameraservice/common/Camera2ClientBase.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -253,7 +253,9 @@ void Camera2ClientBase<TClientBase>::notifyIdle() { if (mDeviceActive) { getCameraService()->updateProxyDeviceState( hardware::ICameraServiceProxy::CAMERA_STATE_IDLE, TClientBase::mCameraIdStr, TClientBase::mCameraFacing, TClientBase::mClientPackageName); TClientBase::mCameraFacing, TClientBase::mClientPackageName, ((mApi1CameraId < 0) ? hardware::ICameraServiceProxy::CAMERA_API_LEVEL_2 : hardware::ICameraServiceProxy::CAMERA_API_LEVEL_1)); } mDeviceActive = false; Loading @@ -269,7 +271,9 @@ void Camera2ClientBase<TClientBase>::notifyShutter(const CaptureResultExtras& re if (!mDeviceActive) { getCameraService()->updateProxyDeviceState( hardware::ICameraServiceProxy::CAMERA_STATE_ACTIVE, TClientBase::mCameraIdStr, TClientBase::mCameraFacing, TClientBase::mClientPackageName); TClientBase::mCameraFacing, TClientBase::mClientPackageName, ((mApi1CameraId < 0) ? hardware::ICameraServiceProxy::CAMERA_API_LEVEL_2 : hardware::ICameraServiceProxy::CAMERA_API_LEVEL_1)); } mDeviceActive = true; Loading