From cfae241ef67e6ffc7d3c95148866bbc0eb188aec Mon Sep 17 00:00:00 2001 From: Wei Lee Date: Wed, 4 Dec 2019 12:48:14 +0800 Subject: [PATCH] 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 --- .../camera/libcameraservice/api1/client2/Parameters.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/services/camera/libcameraservice/api1/client2/Parameters.cpp b/services/camera/libcameraservice/api1/client2/Parameters.cpp index 18addb54bb..20333d1860 100644 --- a/services/camera/libcameraservice/api1/client2/Parameters.cpp +++ b/services/camera/libcameraservice/api1/client2/Parameters.cpp @@ -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; }