Android 10(API 29)Camera2 API广角相机FOV异常回归问题咨询
Yes, this is a known behavior change introduced in Android 10 for the Pixel 3 XL's dual front cameras—not a regression bug, but a deliberate system adjustment that’s caught many developers off guard. Let’s break this down:
What’s Causing the FOV Match?
Starting with Android 10, Google modified how the Pixel 3 XL’s logical dual front camera handles output from the wide-angle sensor. By default, the system now crops the wide-angle camera’s feed to match the field of view (FOV) of the regular front camera. This was intended to create a more consistent visual experience when switching between sensors, but it overrides the natural wider FOV you relied on in Android 9.
Have Other Developers Encountered This?
Absolutely. When Android 10 launched, numerous developers using the Camera2 API for dual-camera setups on the Pixel 3 XL reported exactly this issue. It’s a common pain point because code that worked as expected on Android 9 suddenly loses the wide-angle’s signature field of view after the OS update.
How to Restore the Original Wide-Angle FOV
To get back the wider FOV from your wide-angle sensor on Android 10, you need to explicitly configure the physical camera’s output instead of relying on the logical camera’s default settings. Here’s what you can do:
Target Physical Camera Parameters Directly
When building yourCaptureRequest, set parameters specific to each physical camera using their IDs. Use the focal length difference you already detect in yourfindShortLongCameraPairfunction to calculate the required zoom ratio for the wide-angle sensor.For example, if your regular camera has a focal length of
f1and the wide-angle hasf2(wheref2 < f1), the zoom ratio to restore the original wide FOV would bef1 / f2. Apply this to the wide-angle camera’s capture request:val wideAngleCameraId = dualCamera.physicalId2 // Adjust based on your pairing logic val zoomRatio = focalLengths1.max()!! / focalLengths2.min()!! // From your existing focal length check val captureRequest = session.device.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW).apply { addTarget(surface1) // Regular camera surface addTarget(surface2) // Wide-angle camera surface // Bind the zoom ratio to the specific wide-angle physical camera setPhysicalCameraParameter(wideAngleCameraId, CaptureRequest.CONTROL_ZOOM_RATIO, zoomRatio) }.build()Verify Uncropped Output Sizes
Ensure you’re using output sizes natively supported by the wide-angle camera. The logical camera may force a cropped size by default—check theSCALER_STREAM_CONFIGURATION_MAPfor the physical wide-angle camera to get its full-resolution, uncropped output sizes.Check Zoom Constraints
Confirm the wide-angle camera’sSCALER_AVAILABLE_MAX_DIGITAL_ZOOMis sufficient to allow your calculated zoom ratio. If not, adjust your output resolution to a size that supports the required FOV.
Key Takeaway
Your original code isn’t broken—Android 10 just applies a default crop to align the two sensors’ outputs. By explicitly targeting physical camera parameters, you can override this default and restore the wide-angle FOV you expect.
内容的提问来源于stack exchange,提问作者Levon Shirakyan

