From d83e9b5325bcc4d771b3f4f7afda48a5c1b37d7f Mon Sep 17 00:00:00 2001 From: Jayant Chowdhary Date: Thu, 2 Jun 2022 00:34:53 +0000 Subject: Limit preview stabilization mandatory stream sizes to 1440p (instead of RECORD). Also fix a logic error in an if check while retrieving mandatory streams for preview stabilization. This was not caught by CTS since for devices where preview stabilization was supported, skipped the test. A modification has been made to CTS RobustnessTest to ensure that the preview stabilization support and mandatory streams are in agreement with each other. Bug: 228245412 Test: atest RobustnessTest.java on device supporting preview stabilization Change-Id: I18c7f3c728862866b8f088da3afe222afbad7051 Signed-off-by: Jayant Chowdhary --- .../android/hardware/camera2/CameraDevice.java | 6 +++--- .../camera2/params/MandatoryStreamCombination.java | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/core/java/android/hardware/camera2/CameraDevice.java b/core/java/android/hardware/camera2/CameraDevice.java index 73735edbb2ba..0f1b39c01289 100644 --- a/core/java/android/hardware/camera2/CameraDevice.java +++ b/core/java/android/hardware/camera2/CameraDevice.java @@ -892,9 +892,9 @@ public abstract class CameraDevice implements AutoCloseable { * Preview stabilization guaranteed stream configurations * Target 1Target 2Sample use case(s) * TypeMax sizeTypeMax size - * {@code PRIV / YUV}{@code RECORD} Stabilized preview, GPU video processing, or no-preview stabilized video recording. - * {@code PRIV / YUV}{@code PREVIEW} {@code JPEG / YUV}{@code MAXIMUM }Standard still imaging with stabilized preview. - * {@code PRIV / YUV}{@code PREVIEW} {@code PRIV / YUV}{@code RECORD }High-resolution recording with stabilized preview and recording stream. + * {@code PRIV / YUV}{@code s1440p} Stabilized preview, GPU video processing, or no-preview stabilized video recording. + * {@code PRIV / YUV}{@code s1440p} {@code JPEG / YUV}{@code MAXIMUM }Standard still imaging with stabilized preview. + * {@code PRIV / YUV}{@code PREVIEW} {@code PRIV / YUV}{@code s1440p }High-resolution recording with stabilized preview and recording stream. *
*

* For the maximum size column, PREVIEW refers to the best size match to the device's screen diff --git a/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java b/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java index a3bc66546a6a..e5b9cdb74d3b 100644 --- a/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java +++ b/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java @@ -1265,43 +1265,43 @@ public final class MandatoryStreamCombination { private static StreamCombinationTemplate sPreviewStabilizedStreamCombinations[] = { // 1 stream combinations new StreamCombinationTemplate(new StreamTemplate [] { - new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.RECORD)}, + new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.s1440p)}, "Stabilized preview, GPU video processing, or no-preview stabilized recording"), new StreamCombinationTemplate(new StreamTemplate [] { - new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.RECORD)}, + new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.s1440p)}, "Stabilized preview, GPU video processing, or no-preview stabilized recording"), //2 stream combinations new StreamCombinationTemplate(new StreamTemplate [] { new StreamTemplate(ImageFormat.JPEG, SizeThreshold.MAXIMUM), - new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW)}, + new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.s1440p)}, "Standard JPEG still imaging with stabilized preview"), new StreamCombinationTemplate(new StreamTemplate [] { new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.MAXIMUM), - new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW)}, + new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.s1440p)}, "Standard YUV still imaging with stabilized preview"), new StreamCombinationTemplate(new StreamTemplate [] { new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.MAXIMUM), - new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.PREVIEW)}, + new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.s1440p)}, "Standard YUV still imaging with stabilized in-app image processing stream"), new StreamCombinationTemplate(new StreamTemplate [] { new StreamTemplate(ImageFormat.JPEG, SizeThreshold.MAXIMUM), - new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.PREVIEW)}, + new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.s1440p)}, "Standard JPEG still imaging with stabilized in-app image processing stream"), new StreamCombinationTemplate(new StreamTemplate [] { - new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.RECORD), + new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.s1440p), new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW)}, "High-resolution video recording with preview both streams stabilized"), new StreamCombinationTemplate(new StreamTemplate [] { - new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.RECORD), + new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.s1440p), new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.PREVIEW)}, "High-resolution video recording with preview both streams stabilized"), new StreamCombinationTemplate(new StreamTemplate [] { - new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.RECORD), + new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.s1440p), new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.PREVIEW)}, "High-resolution video recording with preview both streams stabilized"), new StreamCombinationTemplate(new StreamTemplate [] { - new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.RECORD), + new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.s1440p), new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW)}, "High-resolution video recording with preview both streams stabilized"), }; @@ -1430,7 +1430,7 @@ public final class MandatoryStreamCombination { StreamCombinationTemplate []chosenStreamCombinations = sPreviewStabilizedStreamCombinations; - if (mIsPreviewStabilizationSupported) { + if (!mIsPreviewStabilizationSupported) { Log.v(TAG, "Device does not support preview stabilization"); return null; } -- cgit v1.2.3-59-g8ed1b