Camera: Set focal length for external camera if the information is provided

Currently, we will set -1.0 as the default focal length for external
camera even if camera HAL provides the information. We should respect
the information if it is provided.

Bug: 141517606
Test: cts-tradefed run commandAndExit cts -m CtsCameraTestCases -t
android.hardware.cts.CameraTest#testJpegExif

Change-Id: Iae38ed0243a386187e29c5c4549d92ca24f58d0d
gugelfrei
Wei Lee 5 years ago
parent e3c93d02f7
commit cfae241ef6

@ -2454,12 +2454,9 @@ status_t Parameters::getDefaultFocalLength(CameraDeviceBase *device) {
camera_metadata_ro_entry_t availableFocalLengths =
staticInfo(ANDROID_LENS_INFO_AVAILABLE_FOCAL_LENGTHS, 0, 0, /*required*/false);
if (!availableFocalLengths.count && !fastInfo.isExternalCamera) return NO_INIT;
// Find focal length in PREVIEW template to use as default focal length.
if (fastInfo.isExternalCamera) {
fastInfo.defaultFocalLength = -1.0;
} else {
if (availableFocalLengths.count) {
// Find smallest (widest-angle) focal length to use as basis of still
// picture FOV reporting.
fastInfo.defaultFocalLength = availableFocalLengths.data.f[0];
@ -2481,6 +2478,10 @@ status_t Parameters::getDefaultFocalLength(CameraDeviceBase *device) {
if (entry.count != 0) {
fastInfo.defaultFocalLength = entry.data.f[0];
}
} else if (fastInfo.isExternalCamera) {
fastInfo.defaultFocalLength = -1.0;
} else {
return NO_INIT;
}
return OK;
}

Loading…
Cancel
Save