Loading core/java/android/hardware/camera2/CameraManager.java +3 −1 Original line number Original line Diff line number Diff line Loading @@ -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 Loading core/java/android/hardware/camera2/params/MandatoryStreamCombination.java +10 −4 Original line number Original line Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); Loading @@ -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)); } } /** /** Loading Loading @@ -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(); } } Loading Loading @@ -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( Loading Loading
core/java/android/hardware/camera2/CameraManager.java +3 −1 Original line number Original line Diff line number Diff line Loading @@ -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 Loading
core/java/android/hardware/camera2/params/MandatoryStreamCombination.java +10 −4 Original line number Original line Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); Loading @@ -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)); } } /** /** Loading Loading @@ -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(); } } Loading Loading @@ -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( Loading