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

Commit 3e9b3064 authored by Shuzhen Wang's avatar Shuzhen Wang Committed by android-build-merger
Browse files

Merge "Camera: Handle hidden physical camera without camcorder profile" into qt-dev am: 3960d223

am: 0c65fb09

Change-Id: I6cb53a63265dbbe77a12b5e7d4030594d620fcbd
parents ce4e793d 0c65fb09
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -857,8 +857,10 @@ public final class CameraManager {
     *
     *
     * @param cameraId a non-{@code null} camera identifier
     * @param cameraId a non-{@code null} camera identifier
     * @return {@code true} if cameraId is a hidden physical camera device
     * @return {@code true} if cameraId is a hidden physical camera device
     *
     * @hide
     */
     */
    private boolean isHiddenPhysicalCamera(String cameraId) {
    public static boolean isHiddenPhysicalCamera(String cameraId) {
        try {
        try {
            ICameraService cameraService = CameraManagerGlobal.get().getCameraService();
            ICameraService cameraService = CameraManagerGlobal.get().getCameraService();
            // If no camera service, no support
            // If no camera service, no support
+10 −4
Original line number Original line Diff line number Diff line
@@ -28,6 +28,7 @@ import android.graphics.ImageFormat.Format;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraCharacteristics.Key;
import android.hardware.camera2.CameraCharacteristics.Key;
import android.hardware.camera2.CameraDevice;
import android.hardware.camera2.CameraDevice;
import android.hardware.camera2.CameraManager;
import android.hardware.camera2.CameraMetadata;
import android.hardware.camera2.CameraMetadata;
import android.hardware.camera2.params.StreamConfigurationMap;
import android.hardware.camera2.params.StreamConfigurationMap;
import android.hardware.camera2.utils.HashCodeHelpers;
import android.hardware.camera2.utils.HashCodeHelpers;
@@ -661,6 +662,7 @@ public final class MandatoryStreamCombination {
        private List<Integer> mCapabilities;
        private List<Integer> mCapabilities;
        private int mHwLevel, mCameraId;
        private int mHwLevel, mCameraId;
        private StreamConfigurationMap mStreamConfigMap;
        private StreamConfigurationMap mStreamConfigMap;
        private boolean mIsHiddenPhysicalCamera;


        private final Size kPreviewSizeBound = new Size(1920, 1088);
        private final Size kPreviewSizeBound = new Size(1920, 1088);


@@ -680,6 +682,8 @@ public final class MandatoryStreamCombination {
            mCapabilities = capabilities;
            mCapabilities = capabilities;
            mStreamConfigMap = sm;
            mStreamConfigMap = sm;
            mHwLevel = hwLevel;
            mHwLevel = hwLevel;
            mIsHiddenPhysicalCamera =
                    CameraManager.isHiddenPhysicalCamera(Integer.toString(mCameraId));
        }
        }


        /**
        /**
@@ -893,8 +897,10 @@ public final class MandatoryStreamCombination {
            Size recordingMaxSize = new Size(0, 0);
            Size recordingMaxSize = new Size(0, 0);
            Size previewMaxSize = new Size(0, 0);
            Size previewMaxSize = new Size(0, 0);
            Size vgaSize = new Size(640, 480);
            Size vgaSize = new Size(640, 480);
            if (isExternalCamera()) {
            // For external camera, or hidden physical camera, CamcorderProfile may not be
                recordingMaxSize = getMaxExternalRecordingSize();
            // available, so get maximum recording size using stream configuration map.
            if (isExternalCamera() || mIsHiddenPhysicalCamera) {
                recordingMaxSize = getMaxCameraRecordingSize();
            } else {
            } else {
                recordingMaxSize = getMaxRecordingSize();
                recordingMaxSize = getMaxRecordingSize();
            }
            }
@@ -1123,12 +1129,12 @@ public final class MandatoryStreamCombination {
        }
        }


        /**
        /**
         * Return the maximum supported video size for external cameras using data from
         * Return the maximum supported video size for cameras using data from
         * the stream configuration map.
         * the stream configuration map.
         *
         *
         * @return Maximum supported video size.
         * @return Maximum supported video size.
         */
         */
        private @NonNull Size getMaxExternalRecordingSize() {
        private @NonNull Size getMaxCameraRecordingSize() {
            final Size FULLHD = new Size(1920, 1080);
            final Size FULLHD = new Size(1920, 1080);


            Size[] videoSizeArr = mStreamConfigMap.getOutputSizes(
            Size[] videoSizeArr = mStreamConfigMap.getOutputSizes(