summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
Diffstat (limited to 'services')
-rw-r--r--services/camera/libcameraservice/camera2/Parameters.cpp40
1 files changed, 30 insertions, 10 deletions
diff --git a/services/camera/libcameraservice/camera2/Parameters.cpp b/services/camera/libcameraservice/camera2/Parameters.cpp
index e5942dc..f490b2a 100644
--- a/services/camera/libcameraservice/camera2/Parameters.cpp
+++ b/services/camera/libcameraservice/camera2/Parameters.cpp
@@ -1360,17 +1360,23 @@ status_t Parameters::updateRequest(CameraMetadata *request) const {
&antibandingMode, 1);
if (res != OK) return res;
- uint8_t reqControlMode =
- (sceneMode == ANDROID_CONTROL_SCENE_MODE_UNSUPPORTED) ?
- ANDROID_CONTROL_AUTO : ANDROID_CONTROL_USE_SCENE_MODE;
+ // android.hardware.Camera requires that when face detect is enabled, the
+ // camera is in a face-priority mode. HAL2 splits this into separate parts
+ // (face detection statistics and face priority scene mode). Map from other
+ // to the other.
+ uint8_t reqControlMode = ANDROID_CONTROL_AUTO;
+ if (enableFaceDetect || sceneMode != ANDROID_CONTROL_SCENE_MODE_UNSUPPORTED) {
+ reqControlMode = ANDROID_CONTROL_USE_SCENE_MODE;
+ }
res = request->update(ANDROID_CONTROL_MODE,
&reqControlMode, 1);
if (res != OK) return res;
- if (reqControlMode == ANDROID_CONTROL_USE_SCENE_MODE) {
- res = request->update(ANDROID_CONTROL_SCENE_MODE,
- &sceneMode, 1);
- if (res != OK) return res;
- }
+
+ uint8_t reqSceneMode = enableFaceDetect ?
+ (uint8_t)ANDROID_CONTROL_SCENE_MODE_FACE_PRIORITY : sceneMode;
+ res = request->update(ANDROID_CONTROL_SCENE_MODE,
+ &reqSceneMode, 1);
+ if (res != OK) return res;
uint8_t reqFlashMode = ANDROID_FLASH_OFF;
uint8_t reqAeMode;
@@ -1515,8 +1521,6 @@ status_t Parameters::updateRequest(CameraMetadata *request) const {
reqCropRegion, 3);
if (res != OK) return res;
- // TODO: Decide how to map recordingHint, or whether just to ignore it
-
uint8_t reqVstabMode = videoStabilization ?
ANDROID_CONTROL_VIDEO_STABILIZATION_ON :
ANDROID_CONTROL_VIDEO_STABILIZATION_OFF;
@@ -1553,6 +1557,8 @@ const char* Parameters::getStateName(State state) {
int Parameters::formatStringToEnum(const char *format) {
return
+ !format ?
+ HAL_PIXEL_FORMAT_YCrCb_420_SP :
!strcmp(format, CameraParameters::PIXEL_FORMAT_YUV422SP) ?
HAL_PIXEL_FORMAT_YCbCr_422_SP : // NV16
!strcmp(format, CameraParameters::PIXEL_FORMAT_YUV420SP) ?
@@ -1606,6 +1612,8 @@ const char* Parameters::formatEnumToString(int format) {
int Parameters::wbModeStringToEnum(const char *wbMode) {
return
+ !wbMode ?
+ ANDROID_CONTROL_AWB_AUTO :
!strcmp(wbMode, CameraParameters::WHITE_BALANCE_AUTO) ?
ANDROID_CONTROL_AWB_AUTO :
!strcmp(wbMode, CameraParameters::WHITE_BALANCE_INCANDESCENT) ?
@@ -1627,6 +1635,8 @@ int Parameters::wbModeStringToEnum(const char *wbMode) {
int Parameters::effectModeStringToEnum(const char *effectMode) {
return
+ !effectMode ?
+ ANDROID_CONTROL_EFFECT_OFF :
!strcmp(effectMode, CameraParameters::EFFECT_NONE) ?
ANDROID_CONTROL_EFFECT_OFF :
!strcmp(effectMode, CameraParameters::EFFECT_MONO) ?
@@ -1650,6 +1660,8 @@ int Parameters::effectModeStringToEnum(const char *effectMode) {
int Parameters::abModeStringToEnum(const char *abMode) {
return
+ !abMode ?
+ ANDROID_CONTROL_AE_ANTIBANDING_AUTO :
!strcmp(abMode, CameraParameters::ANTIBANDING_AUTO) ?
ANDROID_CONTROL_AE_ANTIBANDING_AUTO :
!strcmp(abMode, CameraParameters::ANTIBANDING_OFF) ?
@@ -1663,6 +1675,8 @@ int Parameters::abModeStringToEnum(const char *abMode) {
int Parameters::sceneModeStringToEnum(const char *sceneMode) {
return
+ !sceneMode ?
+ ANDROID_CONTROL_SCENE_MODE_UNSUPPORTED :
!strcmp(sceneMode, CameraParameters::SCENE_MODE_AUTO) ?
ANDROID_CONTROL_SCENE_MODE_UNSUPPORTED :
!strcmp(sceneMode, CameraParameters::SCENE_MODE_ACTION) ?
@@ -1701,6 +1715,8 @@ int Parameters::sceneModeStringToEnum(const char *sceneMode) {
Parameters::Parameters::flashMode_t Parameters::flashModeStringToEnum(
const char *flashMode) {
return
+ !flashMode ?
+ Parameters::FLASH_MODE_INVALID :
!strcmp(flashMode, CameraParameters::FLASH_MODE_OFF) ?
Parameters::FLASH_MODE_OFF :
!strcmp(flashMode, CameraParameters::FLASH_MODE_AUTO) ?
@@ -1717,6 +1733,8 @@ Parameters::Parameters::flashMode_t Parameters::flashModeStringToEnum(
Parameters::Parameters::focusMode_t Parameters::focusModeStringToEnum(
const char *focusMode) {
return
+ !focusMode ?
+ Parameters::FOCUS_MODE_INVALID :
!strcmp(focusMode, CameraParameters::FOCUS_MODE_AUTO) ?
Parameters::FOCUS_MODE_AUTO :
!strcmp(focusMode, CameraParameters::FOCUS_MODE_INFINITY) ?
@@ -1737,6 +1755,8 @@ Parameters::Parameters::focusMode_t Parameters::focusModeStringToEnum(
Parameters::Parameters::lightFxMode_t Parameters::lightFxStringToEnum(
const char *lightFxMode) {
return
+ !lightFxMode ?
+ Parameters::LIGHTFX_NONE :
!strcmp(lightFxMode, CameraParameters::LIGHTFX_LOWLIGHT) ?
Parameters::LIGHTFX_LOWLIGHT :
!strcmp(lightFxMode, CameraParameters::LIGHTFX_HDR) ?