Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2da73f42 authored by Shuzhen Wang's avatar Shuzhen Wang
Browse files

Camera: Relax logical camera stream combination requirement

Depending on hardware capability, a logical camera may not support
concurrent physical streams. Relax the requirement for stream
combination accordingly.

Also fix missing MANDATORY_STREAM_COMBINATIONS issue for hidden physical
camera.

Test: Updated camera CTS, ITS
Bug: 119325664
Change-Id: Iddbef330d7e091d55ac44124a03fca5a932ae13a
parent 643ba186
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -2680,10 +2680,12 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
     * MAXIMUM resolutions and anything smaller from the list given by
     * {@link android.hardware.camera2.params.StreamConfigurationMap#getOutputSizes } are
     * guaranteed to work.
     * The mandatory stream combination array will be {@code null} in case the device is a
     * physical camera not independently exposed in
     * {@link android.hardware.camera2.CameraManager#getCameraIdList } or is not backward
     * compatible.</p>
     * For a physical camera not independently exposed in
     * {@link android.hardware.camera2.CameraManager#getCameraIdList }, the mandatory stream
     * combinations for that physical camera Id are also generated, so that the application can
     * configure them as physical streams via the logical camera.
     * The mandatory stream combination array will be {@code null} in case the device is not
     * backward compatible.</p>
     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
     * <p><b>Limited capability</b> -
     * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
@@ -3894,6 +3896,8 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
     * <p>In both cases, all images generated for a particular capture request still carry the same
     * timestamps, so that they can be used to look up the matching frame number and
     * onCaptureStarted callback.</p>
     * <p>This tag is only applicable if the logical camera device supports concurrent physical
     * streams from different physical cameras.</p>
     * <p><b>Possible values:</b>
     * <ul>
     *   <li>{@link #LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_APPROXIMATE APPROXIMATE}</li>
+4 −6
Original line number Diff line number Diff line
@@ -314,13 +314,11 @@ public final class CameraManager {
                } else {
                    // Normal path: Get the camera characteristics directly from the camera service
                    CameraMetadataNative info = cameraService.getCameraCharacteristics(cameraId);
                    if (!isHiddenPhysicalCamera(cameraId)) {
                    try {
                        info.setCameraId(Integer.parseInt(cameraId));
                    } catch (NumberFormatException e) {
                        Log.e(TAG, "Failed to parse camera Id " + cameraId + " to integer");
                    }
                    }
                    info.setDisplaySize(displaySize);

                    characteristics = new CameraCharacteristics(info);
+17 −26
Original line number Diff line number Diff line
@@ -825,14 +825,23 @@ public abstract class CameraMetadata<TKey> {
    public static final int REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING = 10;

    /**
     * <p>The camera device is a logical camera backed by two or more physical cameras. In
     * API level 28, the physical cameras must also be exposed to the application via
     * {@link android.hardware.camera2.CameraManager#getCameraIdList }. Starting from API
     * level 29, some or all physical cameras may not be independently exposed to the
     * application, in which case the physical camera IDs will not be available in
     * {@link android.hardware.camera2.CameraManager#getCameraIdList }. But the application
     * can still query the physical cameras' characteristics by calling
     * {@link android.hardware.camera2.CameraManager#getCameraCharacteristics }.</p>
     * <p>The camera device is a logical camera backed by two or more physical cameras.</p>
     * <p>In API level 28, the physical cameras must also be exposed to the application via
     * {@link android.hardware.camera2.CameraManager#getCameraIdList }.</p>
     * <p>Starting from API level 29, some or all physical cameras may not be independently
     * exposed to the application, in which case the physical camera IDs will not be
     * available in {@link android.hardware.camera2.CameraManager#getCameraIdList }. But the
     * application can still query the physical cameras' characteristics by calling
     * {@link android.hardware.camera2.CameraManager#getCameraCharacteristics }. Additionally,
     * if a physical camera is hidden from camera ID list, the mandatory stream combinations
     * for that physical camera must be supported through the logical camera using physical
     * streams.</p>
     * <p>Combinations of logical and physical streams, or physical streams from different
     * physical cameras are not guaranteed. However, if the camera device supports
     * {@link CameraDevice#isSessionConfigurationSupported },
     * application must be able to query whether a stream combination involving physical
     * streams is supported by calling
     * {@link CameraDevice#isSessionConfigurationSupported }.</p>
     * <p>Camera application shouldn't assume that there are at most 1 rear camera and 1 front
     * camera in the system. For an application that switches between front and back cameras,
     * the recommendation is to switch between the first rear camera and the first front
@@ -857,24 +866,6 @@ public abstract class CameraMetadata<TKey> {
     *   the same.</li>
     * <li>The logical camera must be LIMITED or higher device.</li>
     * </ul>
     * <p>Both the logical camera device and its underlying physical devices support the
     * mandatory stream combinations required for their device levels.</p>
     * <p>Additionally, for each guaranteed stream combination, the logical camera supports:</p>
     * <ul>
     * <li>For each guaranteed stream combination, the logical camera supports replacing one
     *   logical {@link android.graphics.ImageFormat#YUV_420_888 YUV_420_888}
     *   or raw stream with two physical streams of the same size and format, each from a
     *   separate physical camera, given that the size and format are supported by both
     *   physical cameras.</li>
     * <li>If the logical camera doesn't advertise RAW capability, but the underlying physical
     *   cameras do, the logical camera will support guaranteed stream combinations for RAW
     *   capability, except that the RAW streams will be physical streams, each from a separate
     *   physical camera. This is usually the case when the physical cameras have different
     *   sensor sizes.</li>
     * </ul>
     * <p>Using physical streams in place of a logical stream of the same size and format will
     * not slow down the frame rate of the capture, as long as the minimum frame duration
     * of the physical and logical streams are the same.</p>
     * <p>A logical camera device's dynamic metadata may contain
     * {@link CaptureResult#LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_ID android.logicalMultiCamera.activePhysicalId} to notify the application of the current
     * active physical camera Id. An active physical camera is the physical camera from which