diff options
-rw-r--r-- | services/camera/libcameraservice/CameraService.cpp | 27 | ||||
-rw-r--r-- | services/camera/libcameraservice/CameraService.h | 6 |
2 files changed, 15 insertions, 18 deletions
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp index b68725d845..fcccd262fe 100644 --- a/services/camera/libcameraservice/CameraService.cpp +++ b/services/camera/libcameraservice/CameraService.cpp @@ -252,8 +252,14 @@ void CameraService::pingCameraServiceProxy() { proxyBinder->pingForUserUpdate(); } -void CameraService::broadcastTorchModeStatus(const String8& cameraId, TorchModeStatus status, - SystemCameraKind systemCameraKind) { +void CameraService::broadcastTorchModeStatus(const String8& cameraId, TorchModeStatus status) { + SystemCameraKind systemCameraKind = SystemCameraKind::PUBLIC; + status_t res = getSystemCameraKind(cameraId, &systemCameraKind); + if (res != OK) { + ALOGE("%s: Could not get system camera kind for camera id %s", __FUNCTION__, + cameraId.string()); + return; + } Mutex::Autolock lock(mStatusListenerLock); for (auto& i : mListenerList) { if (shouldSkipStatusUpdates(systemCameraKind, i->isVendorListener(), i->getListenerPid(), @@ -347,7 +353,7 @@ void CameraService::addStates(const String8 id) { Mutex::Autolock al(mTorchStatusMutex); mTorchStatusMap.add(id, TorchModeStatus::AVAILABLE_OFF); - broadcastTorchModeStatus(id, TorchModeStatus::AVAILABLE_OFF, deviceKind); + broadcastTorchModeStatus(id, TorchModeStatus::AVAILABLE_OFF); } updateCameraNumAndIds(); @@ -508,19 +514,12 @@ void CameraService::disconnectClient(const String8& id, sp<BasicClient> clientTo void CameraService::onTorchStatusChanged(const String8& cameraId, TorchModeStatus newStatus) { - SystemCameraKind systemCameraKind = SystemCameraKind::PUBLIC; - status_t res = getSystemCameraKind(cameraId, &systemCameraKind); - if (res != OK) { - ALOGE("%s: Could not get system camera kind for camera id %s", __FUNCTION__, - cameraId.string()); - return; - } Mutex::Autolock al(mTorchStatusMutex); - onTorchStatusChangedLocked(cameraId, newStatus, systemCameraKind); + onTorchStatusChangedLocked(cameraId, newStatus); } void CameraService::onTorchStatusChangedLocked(const String8& cameraId, - TorchModeStatus newStatus, SystemCameraKind systemCameraKind) { + TorchModeStatus newStatus) { ALOGI("%s: Torch status changed for cameraId=%s, newStatus=%d", __FUNCTION__, cameraId.string(), newStatus); @@ -569,7 +568,7 @@ void CameraService::onTorchStatusChangedLocked(const String8& cameraId, } } } - broadcastTorchModeStatus(cameraId, newStatus, systemCameraKind); + broadcastTorchModeStatus(cameraId, newStatus); } static bool hasPermissionsForSystemCamera(int callingPid, int callingUid) { @@ -3806,7 +3805,7 @@ void CameraService::updateStatus(StatusInternal status, const String8& cameraId, TorchModeStatus::AVAILABLE_OFF : TorchModeStatus::NOT_AVAILABLE; if (torchStatus != newTorchStatus) { - onTorchStatusChangedLocked(cameraId, newTorchStatus, deviceKind); + onTorchStatusChangedLocked(cameraId, newTorchStatus); } } } diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h index 5c4c96bae7..685ed5ee1d 100644 --- a/services/camera/libcameraservice/CameraService.h +++ b/services/camera/libcameraservice/CameraService.h @@ -995,8 +995,7 @@ private: // handle torch mode status change and invoke callbacks. mTorchStatusMutex // should be locked. void onTorchStatusChangedLocked(const String8& cameraId, - hardware::camera::common::V1_0::TorchModeStatus newStatus, - SystemCameraKind systemCameraKind); + hardware::camera::common::V1_0::TorchModeStatus newStatus); // get a camera's torch status. mTorchStatusMutex should be locked. status_t getTorchStatusLocked(const String8 &cameraId, @@ -1085,8 +1084,7 @@ private: static void pingCameraServiceProxy(); void broadcastTorchModeStatus(const String8& cameraId, - hardware::camera::common::V1_0::TorchModeStatus status, - SystemCameraKind systemCameraKind); + hardware::camera::common::V1_0::TorchModeStatus status); void disconnectClient(const String8& id, sp<BasicClient> clientToDisconnect); |