summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2014-09-26 08:28:28 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-09-26 08:28:29 +0000
commit5f5d0544454f062c1f37acad1a72d8c47b4a32b2 (patch)
treedbbc8fc86de106a08d9bb89103dda48d09bc17e3 /services
parent0ed72488feba74904d25ebc91bda60c6b1d0af55 (diff)
parentb5bd1df2d6c78f8db5e7f6b416353ca8a93b7119 (diff)
downloadframeworks_av-5f5d0544454f062c1f37acad1a72d8c47b4a32b2.zip
frameworks_av-5f5d0544454f062c1f37acad1a72d8c47b4a32b2.tar.gz
frameworks_av-5f5d0544454f062c1f37acad1a72d8c47b4a32b2.tar.bz2
Merge "Camera1 shim: If there's no flash, the keys need to be null." into lmp-dev
Diffstat (limited to 'services')
-rw-r--r--services/camera/libcameraservice/api1/client2/Parameters.cpp23
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) ?