Loading camera/aidl/android/hardware/ICameraService.aidl +7 −0 Original line number Diff line number Diff line Loading @@ -173,6 +173,13 @@ interface ICameraService void setTorchMode(String cameraId, boolean enabled, IBinder clientBinder); // Change the brightness level of the flash unit associated with cameraId to strengthLevel. // If the torch is in OFF state and strengthLevel > 0 then the torch will also be turned ON. void turnOnTorchWithStrengthLevel(String cameraId, int strengthLevel, IBinder clientBinder); // Get the brightness level of the flash unit associated with cameraId. int getTorchStrengthLevel(String cameraId); /** * Notify the camera service of a system event. Should only be called from system_server. * Loading camera/aidl/android/hardware/ICameraServiceListener.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,8 @@ interface ICameraServiceListener oneway void onTorchStatusChanged(int status, String cameraId); oneway void onTorchStrengthLevelChanged(String cameraId, int newTorchStrength); /** * Notify registered clients about camera access priority changes. * Clients which were previously unable to open a certain camera device Loading camera/ndk/impl/ACameraManager.h +3 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,9 @@ class CameraManagerGlobal final : public RefBase { virtual binder::Status onTorchStatusChanged(int32_t, const String16&) { return binder::Status::ok(); } virtual binder::Status onTorchStrengthLevelChanged(const String16&, int32_t) { return binder::Status::ok(); } virtual binder::Status onCameraAccessPrioritiesChanged(); virtual binder::Status onCameraOpened(const String16&, const String16&) { Loading camera/tests/CameraBinderTests.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -96,6 +96,12 @@ public: return binder::Status::ok(); }; virtual binder::Status onTorchStrengthLevelChanged(const String16& /*cameraId*/, int32_t /*torchStrength*/) { // No op return binder::Status::ok(); } virtual binder::Status onCameraAccessPrioritiesChanged() { // No op return binder::Status::ok(); Loading services/camera/libcameraservice/CameraFlashlight.cpp +69 −0 Original line number Diff line number Diff line Loading @@ -119,6 +119,59 @@ status_t CameraFlashlight::setTorchMode(const String8& cameraId, bool enabled) { return res; } status_t CameraFlashlight::turnOnTorchWithStrengthLevel(const String8& cameraId, int32_t torchStrength) { if (!mFlashlightMapInitialized) { ALOGE("%s: findFlashUnits() must be called before this method.", __FUNCTION__); return NO_INIT; } ALOGV("%s: set torch strength of camera %s to %d", __FUNCTION__, cameraId.string(), torchStrength); status_t res = OK; Mutex::Autolock l(mLock); if (mOpenedCameraIds.indexOf(cameraId) != NAME_NOT_FOUND) { ALOGE("%s: Camera device %s is in use, cannot be turned ON.", __FUNCTION__, cameraId.string()); return -EBUSY; } if (mFlashControl == NULL) { res = createFlashlightControl(cameraId); if (res) { return res; } } res = mFlashControl->turnOnTorchWithStrengthLevel(cameraId, torchStrength); return res; } status_t CameraFlashlight::getTorchStrengthLevel(const String8& cameraId, int32_t* torchStrength) { status_t res = OK; if (!mFlashlightMapInitialized) { ALOGE("%s: findFlashUnits() must be called before this method.", __FUNCTION__); return false; } Mutex::Autolock l(mLock); if (mFlashControl == NULL) { res = createFlashlightControl(cameraId); if (res) { return res; } } res = mFlashControl->getTorchStrengthLevel(cameraId, torchStrength); return res; } status_t CameraFlashlight::findFlashUnits() { Mutex::Autolock l(mLock); status_t res; Loading Loading @@ -306,6 +359,22 @@ status_t ProviderFlashControl::setTorchMode(const String8& cameraId, bool enable return mProviderManager->setTorchMode(cameraId.string(), enabled); } status_t ProviderFlashControl::turnOnTorchWithStrengthLevel(const String8& cameraId, int32_t torchStrength) { ALOGV("%s: change torch strength level of camera %s to %d", __FUNCTION__, cameraId.string(), torchStrength); return mProviderManager->turnOnTorchWithStrengthLevel(cameraId.string(), torchStrength); } status_t ProviderFlashControl::getTorchStrengthLevel(const String8& cameraId, int32_t* torchStrength) { ALOGV("%s: get torch strength level of camera %s", __FUNCTION__, cameraId.string()); return mProviderManager->getTorchStrengthLevel(cameraId.string(), torchStrength); } // ProviderFlashControl implementation ends } Loading
camera/aidl/android/hardware/ICameraService.aidl +7 −0 Original line number Diff line number Diff line Loading @@ -173,6 +173,13 @@ interface ICameraService void setTorchMode(String cameraId, boolean enabled, IBinder clientBinder); // Change the brightness level of the flash unit associated with cameraId to strengthLevel. // If the torch is in OFF state and strengthLevel > 0 then the torch will also be turned ON. void turnOnTorchWithStrengthLevel(String cameraId, int strengthLevel, IBinder clientBinder); // Get the brightness level of the flash unit associated with cameraId. int getTorchStrengthLevel(String cameraId); /** * Notify the camera service of a system event. Should only be called from system_server. * Loading
camera/aidl/android/hardware/ICameraServiceListener.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,8 @@ interface ICameraServiceListener oneway void onTorchStatusChanged(int status, String cameraId); oneway void onTorchStrengthLevelChanged(String cameraId, int newTorchStrength); /** * Notify registered clients about camera access priority changes. * Clients which were previously unable to open a certain camera device Loading
camera/ndk/impl/ACameraManager.h +3 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,9 @@ class CameraManagerGlobal final : public RefBase { virtual binder::Status onTorchStatusChanged(int32_t, const String16&) { return binder::Status::ok(); } virtual binder::Status onTorchStrengthLevelChanged(const String16&, int32_t) { return binder::Status::ok(); } virtual binder::Status onCameraAccessPrioritiesChanged(); virtual binder::Status onCameraOpened(const String16&, const String16&) { Loading
camera/tests/CameraBinderTests.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -96,6 +96,12 @@ public: return binder::Status::ok(); }; virtual binder::Status onTorchStrengthLevelChanged(const String16& /*cameraId*/, int32_t /*torchStrength*/) { // No op return binder::Status::ok(); } virtual binder::Status onCameraAccessPrioritiesChanged() { // No op return binder::Status::ok(); Loading
services/camera/libcameraservice/CameraFlashlight.cpp +69 −0 Original line number Diff line number Diff line Loading @@ -119,6 +119,59 @@ status_t CameraFlashlight::setTorchMode(const String8& cameraId, bool enabled) { return res; } status_t CameraFlashlight::turnOnTorchWithStrengthLevel(const String8& cameraId, int32_t torchStrength) { if (!mFlashlightMapInitialized) { ALOGE("%s: findFlashUnits() must be called before this method.", __FUNCTION__); return NO_INIT; } ALOGV("%s: set torch strength of camera %s to %d", __FUNCTION__, cameraId.string(), torchStrength); status_t res = OK; Mutex::Autolock l(mLock); if (mOpenedCameraIds.indexOf(cameraId) != NAME_NOT_FOUND) { ALOGE("%s: Camera device %s is in use, cannot be turned ON.", __FUNCTION__, cameraId.string()); return -EBUSY; } if (mFlashControl == NULL) { res = createFlashlightControl(cameraId); if (res) { return res; } } res = mFlashControl->turnOnTorchWithStrengthLevel(cameraId, torchStrength); return res; } status_t CameraFlashlight::getTorchStrengthLevel(const String8& cameraId, int32_t* torchStrength) { status_t res = OK; if (!mFlashlightMapInitialized) { ALOGE("%s: findFlashUnits() must be called before this method.", __FUNCTION__); return false; } Mutex::Autolock l(mLock); if (mFlashControl == NULL) { res = createFlashlightControl(cameraId); if (res) { return res; } } res = mFlashControl->getTorchStrengthLevel(cameraId, torchStrength); return res; } status_t CameraFlashlight::findFlashUnits() { Mutex::Autolock l(mLock); status_t res; Loading Loading @@ -306,6 +359,22 @@ status_t ProviderFlashControl::setTorchMode(const String8& cameraId, bool enable return mProviderManager->setTorchMode(cameraId.string(), enabled); } status_t ProviderFlashControl::turnOnTorchWithStrengthLevel(const String8& cameraId, int32_t torchStrength) { ALOGV("%s: change torch strength level of camera %s to %d", __FUNCTION__, cameraId.string(), torchStrength); return mProviderManager->turnOnTorchWithStrengthLevel(cameraId.string(), torchStrength); } status_t ProviderFlashControl::getTorchStrengthLevel(const String8& cameraId, int32_t* torchStrength) { ALOGV("%s: get torch strength level of camera %s", __FUNCTION__, cameraId.string()); return mProviderManager->getTorchStrengthLevel(cameraId.string(), torchStrength); } // ProviderFlashControl implementation ends }