diff options
author | Chien-Yu Chen <cychen@google.com> | 2015-04-07 15:11:31 -0700 |
---|---|---|
committer | Chien-Yu Chen <cychen@google.com> | 2015-04-15 16:32:59 -0700 |
commit | f6463fc62a09b8aad8e811a9abbe9f4d9f2688f9 (patch) | |
tree | c13c1d8ab68d7e6e49f420dc79e9d7de7edda097 /services | |
parent | 3249558196082087fb8bd0a847ef5c6000c8b925 (diff) | |
download | frameworks_av-f6463fc62a09b8aad8e811a9abbe9f4d9f2688f9.zip frameworks_av-f6463fc62a09b8aad8e811a9abbe9f4d9f2688f9.tar.gz frameworks_av-f6463fc62a09b8aad8e811a9abbe9f4d9f2688f9.tar.bz2 |
camera2: remove unnecessary flashlight error messages
Bug: 20069129
Change-Id: I0e721bfad1f0218744d3554397e3ec9b8bc07a19
Diffstat (limited to 'services')
-rw-r--r-- | services/camera/libcameraservice/CameraService.cpp | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp index 414d563..529855f 100644 --- a/services/camera/libcameraservice/CameraService.cpp +++ b/services/camera/libcameraservice/CameraService.cpp @@ -299,12 +299,11 @@ void CameraService::onTorchStatusChangedLocked(const String8& cameraId, ICameraServiceListener::TorchStatus status; status_t res = getTorchStatusLocked(cameraId, &status); if (res) { - ALOGE("%s: cannot get torch status of camera %s", cameraId.string()); + ALOGE("%s: cannot get torch status of camera %s: %s (%d)", + __FUNCTION__, cameraId.string(), strerror(-res), res); return; } if (status == newStatus) { - ALOGE("%s: Torch state transition to the same status 0x%x not allowed", - __FUNCTION__, (uint32_t)newStatus); return; } @@ -1139,14 +1138,14 @@ status_t CameraService::setTorchMode(const String16& cameraId, bool enabled, // verify id is valid. auto state = getCameraState(id); if (state == nullptr) { - ALOGE("%s: camera id is invalid %s", id.string()); + ALOGE("%s: camera id is invalid %s", __FUNCTION__, id.string()); return -EINVAL; } ICameraServiceListener::Status cameraStatus = state->getStatus(); if (cameraStatus != ICameraServiceListener::STATUS_PRESENT && cameraStatus != ICameraServiceListener::STATUS_NOT_AVAILABLE) { - ALOGE("%s: camera id is invalid %s", id.string()); + ALOGE("%s: camera id is invalid %s", __FUNCTION__, id.string()); return -EINVAL; } @@ -2204,16 +2203,20 @@ void CameraService::updateStatus(ICameraServiceListener::Status status, const St state->updateStatus(status, cameraId, rejectSourceStates, [this] (const String8& cameraId, ICameraServiceListener::Status status) { - // Update torch status - if (status == ICameraServiceListener::STATUS_NOT_PRESENT || - status == ICameraServiceListener::STATUS_NOT_AVAILABLE) { - // Update torch status to not available when the camera device becomes not present - // or not available. - onTorchStatusChanged(cameraId, ICameraServiceListener::TORCH_STATUS_NOT_AVAILABLE); - } else if (status == ICameraServiceListener::STATUS_PRESENT) { - // Update torch status to available when the camera device becomes present or - // available - onTorchStatusChanged(cameraId, ICameraServiceListener::TORCH_STATUS_AVAILABLE_OFF); + if (status != ICameraServiceListener::STATUS_ENUMERATING) { + // Update torch status if it has a flash unit. + Mutex::Autolock al(mTorchStatusMutex); + ICameraServiceListener::TorchStatus torchStatus; + if (getTorchStatusLocked(cameraId, &torchStatus) != + NAME_NOT_FOUND) { + ICameraServiceListener::TorchStatus newTorchStatus = + status == ICameraServiceListener::STATUS_PRESENT ? + ICameraServiceListener::TORCH_STATUS_AVAILABLE_OFF : + ICameraServiceListener::TORCH_STATUS_NOT_AVAILABLE; + if (torchStatus != newTorchStatus) { + onTorchStatusChangedLocked(cameraId, newTorchStatus); + } + } } Mutex::Autolock lock(mStatusListenerLock); |