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

Commit 71ecb60a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Camera: Add multi-resolution image reader and reprocessing support" into sc-dev

parents 55f70194 80fc5cad
Loading
Loading
Loading
Loading
+30 −1
Original line number Diff line number Diff line
@@ -17771,6 +17771,7 @@ package android.hardware.camera2 {
    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Size> SCALER_DEFAULT_SECURE_IMAGE_SIZE;
    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.MandatoryStreamCombination[]> SCALER_MANDATORY_CONCURRENT_STREAM_COMBINATIONS;
    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.MandatoryStreamCombination[]> SCALER_MANDATORY_STREAM_COMBINATIONS;
    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.MultiResolutionStreamConfigurationMap> SCALER_MULTI_RESOLUTION_STREAM_CONFIGURATION_MAP;
    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.StreamConfigurationMap> SCALER_STREAM_CONFIGURATION_MAP;
    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> SENSOR_AVAILABLE_TEST_PATTERN_MODES;
    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.BlackLevelPattern> SENSOR_BLACK_LEVEL_PATTERN;
@@ -18375,9 +18376,20 @@ package android.hardware.camera2 {
    field public static final int MAX_THUMBNAIL_DIMENSION = 256; // 0x100
  }
  public class MultiResolutionImageReader implements java.lang.AutoCloseable {
    method public void close();
    method protected void finalize();
    method public void flush();
    method @NonNull public android.hardware.camera2.params.MultiResolutionStreamInfo getStreamInfoForImageReader(@NonNull android.media.ImageReader);
    method @NonNull public android.view.Surface getSurface();
    method @NonNull public static android.hardware.camera2.MultiResolutionImageReader newInstance(@NonNull java.util.Collection<android.hardware.camera2.params.MultiResolutionStreamInfo>, int, @IntRange(from=1) int);
    method public void setOnImageAvailableListener(@Nullable android.media.ImageReader.OnImageAvailableListener, @Nullable java.util.concurrent.Executor);
  }
  public final class TotalCaptureResult extends android.hardware.camera2.CaptureResult {
    method @NonNull public java.util.List<android.hardware.camera2.CaptureResult> getPartialResults();
    method public java.util.Map<java.lang.String,android.hardware.camera2.CaptureResult> getPhysicalCameraResults();
    method @Deprecated public java.util.Map<java.lang.String,android.hardware.camera2.CaptureResult> getPhysicalCameraResults();
    method @NonNull public java.util.Map<java.lang.String,android.hardware.camera2.TotalCaptureResult> getPhysicalCameraTotalResults();
  }
}
@@ -18426,9 +18438,11 @@ package android.hardware.camera2.params {
  public final class InputConfiguration {
    ctor public InputConfiguration(int, int, int);
    ctor public InputConfiguration(@NonNull java.util.Collection<android.hardware.camera2.params.MultiResolutionStreamInfo>, int);
    method public int getFormat();
    method public int getHeight();
    method public int getWidth();
    method public boolean isMultiResolution();
  }
  public final class LensShadingMap {
@@ -18471,6 +18485,20 @@ package android.hardware.camera2.params {
    field public static final int METERING_WEIGHT_MIN = 0; // 0x0
  }
  public final class MultiResolutionStreamConfigurationMap {
    method @NonNull public int[] getInputFormats();
    method @NonNull public java.util.Collection<android.hardware.camera2.params.MultiResolutionStreamInfo> getInputInfo(int);
    method @NonNull public int[] getOutputFormats();
    method @NonNull public java.util.Collection<android.hardware.camera2.params.MultiResolutionStreamInfo> getOutputInfo(int);
  }
  public class MultiResolutionStreamInfo {
    ctor public MultiResolutionStreamInfo(int, int, @NonNull String);
    method public int getHeight();
    method @NonNull public String getPhysicalCameraId();
    method public int getWidth();
  }
  public final class OisSample {
    ctor public OisSample(long, float, float);
    method public long getTimestamp();
@@ -18483,6 +18511,7 @@ package android.hardware.camera2.params {
    ctor public OutputConfiguration(int, @NonNull android.view.Surface);
    ctor public OutputConfiguration(@NonNull android.util.Size, @NonNull Class<T>);
    method public void addSurface(@NonNull android.view.Surface);
    method @NonNull public static java.util.Collection<android.hardware.camera2.params.OutputConfiguration> createInstancesForMultiResolutionOutput(@NonNull android.hardware.camera2.MultiResolutionImageReader);
    method public int describeContents();
    method public void enableSurfaceSharing();
    method public int getMaxSharedSurfaceCount();
+69 −23
Original line number Diff line number Diff line
@@ -24,13 +24,11 @@ import android.hardware.camera2.impl.PublicKey;
import android.hardware.camera2.impl.SyntheticKey;
import android.hardware.camera2.params.RecommendedStreamConfigurationMap;
import android.hardware.camera2.params.SessionConfiguration;
import android.hardware.camera2.utils.ArrayUtils;
import android.hardware.camera2.utils.TypeReference;
import android.os.Build;
import android.util.Rational;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@@ -641,27 +639,7 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
     */
    @NonNull
    public Set<String> getPhysicalCameraIds() {
        int[] availableCapabilities = get(REQUEST_AVAILABLE_CAPABILITIES);
        if (availableCapabilities == null) {
            throw new AssertionError("android.request.availableCapabilities must be non-null "
                        + "in the characteristics");
        }

        if (!ArrayUtils.contains(availableCapabilities,
                REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA)) {
            return Collections.emptySet();
        }
        byte[] physicalCamIds = get(LOGICAL_MULTI_CAMERA_PHYSICAL_IDS);

        String physicalCamIdString = null;
        try {
            physicalCamIdString = new String(physicalCamIds, "UTF-8");
        } catch (java.io.UnsupportedEncodingException e) {
            throw new AssertionError("android.logicalCam.physicalIds must be UTF-8 string");
        }
        String[] physicalCameraIdArray = physicalCamIdString.split("\0");

        return Collections.unmodifiableSet(new HashSet<String>(Arrays.asList(physicalCameraIdArray)));
        return mProperties.getPhysicalCameraIds();
    }

    /*@O~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~
@@ -2930,6 +2908,74 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
    public static final Key<android.util.Size> SCALER_DEFAULT_SECURE_IMAGE_SIZE =
            new Key<android.util.Size>("android.scaler.defaultSecureImageSize", android.util.Size.class);

    /**
     * <p>The available multi-resolution stream configurations that this
     * physical camera device supports
     * (i.e. format, width, height, output/input stream).</p>
     * <p>This list contains a subset of the parent logical camera's multi-resolution stream
     * configurations which belong to this physical camera, and it will advertise and will only
     * advertise the maximum supported resolutions for a particular format.</p>
     * <p>If this camera device isn't a physical camera device constituting a logical camera,
     * but a standalone ULTRA_HIGH_RESOLUTION_SENSOR camera, this field represents the
     * multi-resolution input/output stream configurations of default mode and max resolution
     * modes. The sizes will be the maximum resolution of a particular format for default mode
     * and max resolution mode.</p>
     * <p>This field will only be advertised if the device is a physical camera of a
     * logical multi-camera device or an ultra high resolution sensor camera. For a logical
     * multi-camera, the camera API will derive the logical camera’s multi-resolution stream
     * configurations from all physical cameras. For an ultra high resolution sensor camera, this
     * is used directly as the camera’s multi-resolution stream configurations.</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
     * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
     *
     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
     * @hide
     */
    public static final Key<android.hardware.camera2.params.StreamConfiguration[]> SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS =
            new Key<android.hardware.camera2.params.StreamConfiguration[]>("android.scaler.physicalCameraMultiResolutionStreamConfigurations", android.hardware.camera2.params.StreamConfiguration[].class);

    /**
     * <p>The multi-resolution stream configurations supported by this logical camera
     * or ultra high resolution sensor camera device.</p>
     * <p>Multi-resolution streams can be used by a LOGICAL_MULTI_CAMERA or an
     * ULTRA_HIGH_RESOLUTION_SENSOR camera where the images sent or received can vary in
     * resolution per frame. This is useful in cases where the camera device's effective full
     * resolution changes depending on factors such as the current zoom level, lighting
     * condition, focus distance, or pixel mode.</p>
     * <ul>
     * <li>For a logical multi-camera implementing optical zoom, at different zoom level, a
     * different physical camera may be active, resulting in different full-resolution image
     * sizes.</li>
     * <li>For an ultra high resolution camera, depending on whether the camera operates in default
     * mode, or maximum resolution mode, the output full-size images may be of either binned
     * resolution or maximum resolution.</li>
     * </ul>
     * <p>To use multi-resolution output streams, the supported formats can be queried by {@link android.hardware.camera2.params.MultiResolutionStreamConfigurationMap#getOutputFormats }.
     * A {@link android.hardware.camera2.MultiResolutionImageReader } can then be created for a
     * supported format with the MultiResolutionStreamInfo group queried by {@link android.hardware.camera2.params.MultiResolutionStreamConfigurationMap#getOutputInfo }.</p>
     * <p>If a camera device supports multi-resolution output streams for a particular format, for
     * each of its mandatory stream combinations, the camera device will support using a
     * MultiResolutionImageReader for the MAXIMUM stream of supported formats. Refer to
     * {@link android.hardware.camera2.CameraDevice#createCaptureSession } for additional details.</p>
     * <p>To use multi-resolution input streams, the supported formats can be queried by {@link android.hardware.camera2.params.MultiResolutionStreamConfigurationMap#getInputFormats }.
     * A reprocessable CameraCaptureSession can then be created using an {@link android.hardware.camera2.params.InputConfiguration InputConfiguration} constructed with
     * the input MultiResolutionStreamInfo group, queried by {@link android.hardware.camera2.params.MultiResolutionStreamConfigurationMap#getInputInfo }.</p>
     * <p>If a camera device supports multi-resolution {@code YUV} input and multi-resolution
     * {@code YUV} output, or multi-resolution {@code PRIVATE} input and multi-resolution
     * {@code PRIVATE} output, {@code JPEG} and {@code YUV} are guaranteed to be supported
     * multi-resolution output stream formats. Refer to
     * {@link android.hardware.camera2.CameraDevice#createCaptureSession } for
     * details about the additional mandatory stream combinations in this case.</p>
     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
     */
    @PublicKey
    @NonNull
    @SyntheticKey
    public static final Key<android.hardware.camera2.params.MultiResolutionStreamConfigurationMap> SCALER_MULTI_RESOLUTION_STREAM_CONFIGURATION_MAP =
            new Key<android.hardware.camera2.params.MultiResolutionStreamConfigurationMap>("android.scaler.multiResolutionStreamConfigurationMap", android.hardware.camera2.params.MultiResolutionStreamConfigurationMap.class);

    /**
     * <p>The area of the image sensor which corresponds to active pixels after any geometric
     * distortion correction has been applied.</p>
+55 −2
Original line number Diff line number Diff line
@@ -770,6 +770,8 @@ public abstract class CameraDevice implements AutoCloseable {
     * streams with {@code Y8} in all guaranteed stream combinations for the device's hardware level
     * and capabilities.</p>
     *
     * <p>Clients can access the above mandatory stream combination tables via
     * {@link android.hardware.camera2.params.MandatoryStreamCombination}.</p>
     *
     * <p>Devices capable of outputting HEIC formats ({@link StreamConfigurationMap#getOutputFormats}
     * contains {@link android.graphics.ImageFormat#HEIC}) will support substituting {@code JPEG}
@@ -777,8 +779,33 @@ public abstract class CameraDevice implements AutoCloseable {
     * level and capabilities. Calling createCaptureSession with both JPEG and HEIC outputs is not
     * supported.</p>
     *
     * <p>Clients can access the above mandatory stream combination tables via
     * {@link android.hardware.camera2.params.MandatoryStreamCombination}.</p>
     * <p>Devices capable of multi-resolution output for a particular format (
     * {@link android.hardware.camera2.params.MultiResolutionStreamConfigurationMap#getOutputInfo}
     * returns a non-empty list) support using {@link MultiResolutionImageReader} for MAXIMUM
     * resolution streams of that format for all mandatory stream combinations. For example,
     * if a LIMITED camera device supports multi-resolution output streams for both {@code JPEG} and
     * {@code PRIVATE}, in addition to the stream configurations
     * in the LIMITED and Legacy table above, the camera device supports the following guaranteed
     * stream combinations ({@code MULTI_RES} in the Max size column refers to a {@link
     * MultiResolutionImageReader} created based on the variable max resolutions supported):
     *
     * <table>
     * <tr><th colspan="7">LEGACY-level additional guaranteed combinations with MultiResolutionoutputs</th></tr>
     * <tr> <th colspan="2" id="rb">Target 1</th> <th colspan="2" id="rb">Target 2</th>  <th colspan="2" id="rb">Target 3</th> <th rowspan="2">Sample use case(s)</th> </tr>
     * <tr> <th>Type</th><th id="rb">Max size</th> <th>Type</th><th id="rb">Max size</th> <th>Type</th><th id="rb">Max size</th></tr>
     * <tr> <td>{@code PRIV}</td><td id="rb">{@code MULTI_RES}</td> <td colspan="2" id="rb"></td> <td colspan="2" id="rb"></td> <td>Simple preview, GPU video processing, or no-preview video recording.</td> </tr>
     * <tr> <td>{@code JPEG}</td><td id="rb">{@code MULTI_RES}</td> <td colspan="2" id="rb"></td> <td colspan="2" id="rb"></td> <td>No-viewfinder still image capture.</td> </tr>
     * <tr> <td>{@code PRIV}</td><td id="rb">{@code PREVIEW}</td> <td>{@code JPEG}</td><td id="rb">{@code MULTI_RES}</td> <td colspan="2" id="rb"></td> <td>Standard still imaging.</td> </tr>
     * <tr> <td>{@code PRIV}</td><td id="rb">{@code PREVIEW}</td> <td>{@code YUV }</td><td id="rb">{@code PREVIEW}</td> <td>{@code JPEG}</td><td id="rb">{@code MULTI_RES}</td> <td>Still capture plus in-app processing.</td> </tr>
     * </table><br>
     * <table>
     * <tr><th colspan="7">LIMITED-level additional guaranteed configurations with MultiResolutionoutputs</th></tr>
     * <tr><th colspan="2" id="rb">Target 1</th><th colspan="2" id="rb">Target 2</th><th colspan="2" id="rb">Target 3</th> <th rowspan="2">Sample use case(s)</th> </tr>
     * <tr><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th></tr>
     * <tr> <td>{@code YUV }</td><td id="rb">{@code PREVIEW}</td> <td>{@code YUV }</td><td id="rb">{@code PREVIEW}</td> <td>{@code JPEG}</td><td id="rb">{@code MULTI_RES}</td> <td>Two-input in-app processing with still capture.</td> </tr>
     * </table><br>
     * The same logic applies to other hardware levels and capabilities.
     * </p>
     *
     * <p>Since the capabilities of camera devices vary greatly, a given camera device may support
     * target combinations with sizes outside of these guarantees, but this can only be tested for
@@ -939,6 +966,32 @@ public abstract class CameraDevice implements AutoCloseable {
     * </table><br>
     * </p>
     *
     * <p>If a camera device supports multi-resolution {@code YUV} input and multi-resolution
     * {@code YUV} output or supports multi-resolution {@code PRIVATE} input and multi-resolution
     * {@code PRIVATE} output, the additional mandatory stream combinations for LIMITED and FULL devices are listed
     * below ({@code MULTI_RES} in the Max size column refers to a
     * {@link MultiResolutionImageReader} for output, and a multi-resolution
     * {@link InputConfiguration} for input):
     * <table>
     * <tr><th colspan="11">LIMITED-level additional guaranteed configurations for creating a reprocessable capture session with multi-resolution input and multi-resolution outputs<br>({@code PRIV} input is guaranteed only if PRIVATE reprocessing is supported. {@code YUV} input is guaranteed only if YUV reprocessing is supported)</th></tr>
     * <tr><th colspan="2" id="rb">Input</th><th colspan="2" id="rb">Target 1</th><th colspan="2" id="rb">Target 2</th><th colspan="2" id="rb">Target 3</th><th colspan="2" id="rb">Target 4</th><th rowspan="2">Sample use case(s)</th> </tr>
     * <tr><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th></tr>
     * <tr> <td>{@code PRIV}/{@code YUV}</td><td id="rb">{@code MULTI_RES}</td> <td>Same as input</td><td id="rb">{@code MULTI_RES}</td> <td>{@code JPEG}</td><td id="rb">{@code MULTI_RES}</td> <td></td><td id="rb"></td> <td></td><td id="rb"></td> <td>No-viewfinder still image reprocessing.</td> </tr>
     * <tr> <td>{@code PRIV}/{@code YUV}</td><td id="rb">{@code MULTI_RES}</td> <td>Same as input</td><td id="rb">{@code MULTI_RES}</td> <td>{@code PRIV}</td><td id="rb">{@code PREVIEW}</td> <td>{@code JPEG}</td><td id="rb">{@code MULTI_RES}</td> <td></td><td id="rb"></td> <td>ZSL(Zero-Shutter-Lag) still imaging.</td> </tr>
     * <tr> <td>{@code PRIV}/{@code YUV}</td><td id="rb">{@code MULTI_RES}</td> <td>Same as input</td><td id="rb">{@code MULTI_RES}</td> <td>{@code YUV}</td><td id="rb">{@code PREVIEW}</td> <td>{@code JPEG}</td><td id="rb">{@code MULTI_RES}</td> <td></td><td id="rb"></td> <td>ZSL still and in-app processing imaging.</td> </tr>
     * <tr> <td>{@code PRIV}/{@code YUV}</td><td id="rb">{@code MULTI_RES}</td> <td>Same as input</td><td id="rb">{@code MULTI_RES}</td> <td>{@code YUV}</td><td id="rb">{@code PREVIEW}</td> <td>{@code YUV}</td><td id="rb">{@code PREVIEW}</td> <td>{@code JPEG}</td><td id="rb">{@code MULTI_RES}</td> <td>ZSL in-app processing with still capture.</td> </tr>
     * </table><br>
     * <table>
     * <tr><th colspan="11">FULL-level additional guaranteed configurations for creating a reprocessable capture session with multi-resolution input and multi-resolution outputs<br>({@code PRIV} input is guaranteed only if PRIVATE reprocessing is supported. {@code YUV} input is guaranteed only if YUV reprocessing is supported)</th></tr>
     * <tr><th colspan="2" id="rb">Input</th><th colspan="2" id="rb">Target 1</th><th colspan="2" id="rb">Target 2</th><th colspan="2" id="rb">Target 3</th><th colspan="2" id="rb">Target 4</th><th rowspan="2">Sample use case(s)</th> </tr>
     * <tr><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th></tr>
     * <tr> <td>{@code PRIV}</td><td id="rb">{@code MULTI_RES}</td> <td>{@code PRIV}</td><td id="rb">{@code MULTI_RES}</td> <td>{@code PRIV}</td><td id="rb">{@code PREVIEW}</td> <td>{@code YUV}</td><td id="rb">{@code MULTI_RES}</td> <td></td><td id="rb"></td> <td>Maximum-resolution ZSL in-app processing with regular preview.</td> </tr>
     * <tr> <td>{@code PRIV}</td><td id="rb">{@code MULTI_RES}</td> <td>{@code PRIV}</td><td id="rb">{@code MULTI_RES}</td> <td>{@code YUV}</td><td id="rb">{@code PREVIEW}</td> <td>{@code YUV}</td><td id="rb">{@code MULTI_RES}</td> <td></td><td id="rb"></td> <td>Maximum-resolution two-input ZSL in-app processing.</td> </tr>
     * <tr> <td>{@code PRIV}/{@code YUV}</td><td id="rb">{@code MULTI_RES}</td> <td>Same as input</td><td id="rb">{@code MULTI_RES}</td> <td>{@code PRIV}</td><td id="rb">{@code PREVIEW}</td> <td>{@code YUV}</td><td id="rb">{@code PREVIEW}</td> <td>{@code JPEG}</td><td id="rb">{@code MULTI_RES}</td> <td>ZSL still capture and in-app processing.</td> </tr>
     * </table><br>
     * No additional mandatory stream combinations for RAW capability and LEVEL-3 hardware level.
     * </p>
     *
     * <h3>Constrained high-speed recording</h3>
     *
     * <p>The application can use a
+51 −1
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.hardware.camera2.impl.CameraDeviceImpl;
import android.hardware.camera2.impl.CameraMetadataNative;
import android.hardware.camera2.params.ExtensionSessionConfiguration;
import android.hardware.camera2.params.SessionConfiguration;
import android.hardware.camera2.params.StreamConfiguration;
import android.hardware.camera2.utils.CameraIdAndSessionConfiguration;
import android.hardware.camera2.utils.ConcurrentCameraIdCombination;
import android.hardware.display.DisplayManager;
@@ -51,6 +52,7 @@ import android.view.Display;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Executor;
@@ -371,6 +373,47 @@ public final class CameraManager {
        return ret;
    }

    /**
     * Get all physical cameras' multi-resolution stream configuration map
     *
     * <p>For a logical multi-camera, query the map between physical camera id and
     * the physical camera's multi-resolution stream configuration. This map is in turn
     * combined to form the logical camera's multi-resolution stream configuration map.</p>
     */
    private Map<String, StreamConfiguration[]> getPhysicalCameraMultiResolutionConfigs(
            CameraMetadataNative info, ICameraService cameraService)
            throws CameraAccessException {
        HashMap<String, StreamConfiguration[]> multiResolutionStreamConfigurations =
                new HashMap<String, StreamConfiguration[]>();

        // Query the characteristics of all physical sub-cameras, and combine the multi-resolution
        // stream configurations. Note that framework derived formats such as HEIC and DEPTH_JPEG
        // aren't supported as multi-resolution input or output formats.
        Set<String> physicalCameraIds = info.getPhysicalCameraIds();
        try {
            for (String physicalCameraId : physicalCameraIds) {
                CameraMetadataNative physicalCameraInfo =
                        cameraService.getCameraCharacteristics(physicalCameraId);
                StreamConfiguration[] configs = physicalCameraInfo.get(
                        CameraCharacteristics.
                                SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS);
                if (configs != null) {
                    multiResolutionStreamConfigurations.put(physicalCameraId, configs);
                }
            }

            // TODO: If this is an ultra high resolution sensor camera, combine the multi-resolution
            // stream combination from "info" as well.
        } catch (RemoteException e) {
            ServiceSpecificException sse = new ServiceSpecificException(
                    ICameraService.ERROR_DISCONNECTED,
                    "Camera service is currently unavailable");
            throwAsPublicException(sse);
        }

        return multiResolutionStreamConfigurations;
    }

    /**
     * <p>Query the capabilities of a camera device. These capabilities are
     * immutable for a given camera.</p>
@@ -418,12 +461,19 @@ public final class CameraManager {
                } catch (NumberFormatException e) {
                    Log.v(TAG, "Failed to parse camera Id " + cameraId + " to integer");
                }

                boolean hasConcurrentStreams =
                        CameraManagerGlobal.get().cameraIdHasConcurrentStreamsLocked(cameraId);
                info.setHasMandatoryConcurrentStreams(hasConcurrentStreams);
                info.setDisplaySize(displaySize);
                characteristics = new CameraCharacteristics(info);

                Map<String, StreamConfiguration[]> multiResolutionSizeMap =
                        getPhysicalCameraMultiResolutionConfigs(info, cameraService);
                if (multiResolutionSizeMap.size() > 0) {
                    info.setMultiResolutionStreamConfigurationMap(multiResolutionSizeMap);
                }

                characteristics = new CameraCharacteristics(info);
            } catch (ServiceSpecificException e) {
                throwAsPublicException(e);
            } catch (RemoteException e) {
+309 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading