diff options
author | Eino-Ville Talvala <etalvala@google.com> | 2014-09-26 09:49:54 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-09-26 09:49:54 +0000 |
commit | bedf4b8b4b971e480e671e0762da467cdcad7867 (patch) | |
tree | 9d2378c791fc014e987a416e68d7f49f18a01729 | |
parent | 18e10cb19395ba8758d484cb962c9f38e30adba4 (diff) | |
parent | 5f5d0544454f062c1f37acad1a72d8c47b4a32b2 (diff) | |
download | frameworks_av-bedf4b8b4b971e480e671e0762da467cdcad7867.zip frameworks_av-bedf4b8b4b971e480e671e0762da467cdcad7867.tar.gz frameworks_av-bedf4b8b4b971e480e671e0762da467cdcad7867.tar.bz2 |
am 5f5d0544: Merge "Camera1 shim: If there\'s no flash, the keys need to be null." into lmp-dev
* commit '5f5d0544454f062c1f37acad1a72d8c47b4a32b2':
Camera1 shim: If there's no flash, the keys need to be null.
-rw-r--r-- | services/camera/libcameraservice/api1/client2/Parameters.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/services/camera/libcameraservice/api1/client2/Parameters.cpp b/services/camera/libcameraservice/api1/client2/Parameters.cpp index aa9d746..9818c96 100644 --- a/services/camera/libcameraservice/api1/client2/Parameters.cpp +++ b/services/camera/libcameraservice/api1/client2/Parameters.cpp @@ -643,11 +643,10 @@ status_t Parameters::initialize(const CameraMetadata *info, int deviceVersion) { params.set(CameraParameters::KEY_SUPPORTED_FLASH_MODES, supportedFlashModes); } else { - flashMode = Parameters::FLASH_MODE_OFF; - params.set(CameraParameters::KEY_FLASH_MODE, - CameraParameters::FLASH_MODE_OFF); - params.set(CameraParameters::KEY_SUPPORTED_FLASH_MODES, - CameraParameters::FLASH_MODE_OFF); + // No flash means null flash mode and supported flash modes keys, so + // remove them just to be safe + params.remove(CameraParameters::KEY_FLASH_MODE); + params.remove(CameraParameters::KEY_SUPPORTED_FLASH_MODES); } camera_metadata_ro_entry_t minFocusDistance = @@ -1617,7 +1616,9 @@ status_t Parameters::set(const String8& paramString) { if (validatedParams.flashMode != flashMode) { camera_metadata_ro_entry_t flashAvailable = staticInfo(ANDROID_FLASH_INFO_AVAILABLE, 1, 1); - if (!flashAvailable.data.u8[0] && + bool isFlashAvailable = + flashAvailable.data.u8[0] == ANDROID_FLASH_INFO_AVAILABLE_TRUE; + if (!isFlashAvailable && validatedParams.flashMode != Parameters::FLASH_MODE_OFF) { ALOGE("%s: Requested flash mode \"%s\" is not supported: " "No flash on device", __FUNCTION__, @@ -1642,9 +1643,11 @@ status_t Parameters::set(const String8& paramString) { newParams.get(CameraParameters::KEY_FLASH_MODE)); return BAD_VALUE; } - // Update in case of override - newParams.set(CameraParameters::KEY_FLASH_MODE, - flashModeEnumToString(validatedParams.flashMode)); + // Update in case of override, but only if flash is supported + if (isFlashAvailable) { + newParams.set(CameraParameters::KEY_FLASH_MODE, + flashModeEnumToString(validatedParams.flashMode)); + } } // WHITE_BALANCE @@ -2386,7 +2389,7 @@ Parameters::Parameters::flashMode_t Parameters::flashModeStringToEnum( const char *flashMode) { return !flashMode ? - Parameters::FLASH_MODE_INVALID : + Parameters::FLASH_MODE_OFF : !strcmp(flashMode, CameraParameters::FLASH_MODE_OFF) ? Parameters::FLASH_MODE_OFF : !strcmp(flashMode, CameraParameters::FLASH_MODE_AUTO) ? |