summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/hardware/camera2/CameraDevice.java4
-rw-r--r--core/java/android/hardware/camera2/params/MandatoryStreamCombination.java27
2 files changed, 29 insertions, 2 deletions
diff --git a/core/java/android/hardware/camera2/CameraDevice.java b/core/java/android/hardware/camera2/CameraDevice.java
index 0f1b39c01289..17dcc80dd797 100644
--- a/core/java/android/hardware/camera2/CameraDevice.java
+++ b/core/java/android/hardware/camera2/CameraDevice.java
@@ -826,7 +826,9 @@ public abstract class CameraDevice implements AutoCloseable {
* <p> Here, SC Map, refers to the {@link StreamConfigurationMap}, the target stream sizes must
* be chosen from. {@code DEFAULT} refers to the default sensor pixel mode {@link
* StreamConfigurationMap} and {@code MAX_RES} refers to the maximum resolution {@link
- * StreamConfigurationMap}. The same capture request must not mix targets from
+ * StreamConfigurationMap}. For {@code MAX_RES} streams, {@code MAX} in the {@code Max size} column refers to the maximum size from
+ * {@link StreamConfigurationMap#getOutputSizes} and {@link StreamConfigurationMap#getHighResolutionOutputSizes}.
+ * Note: The same capture request must not mix targets from
* {@link StreamConfigurationMap}s corresponding to different sensor pixel modes. </p>
*
* <p> 10-bit output capable
diff --git a/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java b/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java
index e5b9cdb74d3b..956a474401ba 100644
--- a/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java
+++ b/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java
@@ -1723,7 +1723,17 @@ public final class MandatoryStreamCombination {
}
if (isUltraHighResolution) {
- sizes.add(getMaxSize(sm.getOutputSizes(formatChosen)));
+ Size [] outputSizes = sm.getOutputSizes(formatChosen);
+ Size [] highResolutionOutputSizes =
+ sm.getHighResolutionOutputSizes(formatChosen);
+ Size maxBurstSize = getMaxSizeOrNull(outputSizes);
+ Size maxHighResolutionSize = getMaxSizeOrNull(highResolutionOutputSizes);
+ Size chosenMaxSize =
+ maxBurstSize != null ? maxBurstSize : maxHighResolutionSize;
+ if (maxBurstSize != null && maxHighResolutionSize != null) {
+ chosenMaxSize = getMaxSize(maxBurstSize, maxHighResolutionSize);
+ }
+ sizes.add(chosenMaxSize);
} else {
if (formatChosen == ImageFormat.RAW_SENSOR) {
// RAW_SENSOR always has MAXIMUM threshold.
@@ -2126,6 +2136,21 @@ public final class MandatoryStreamCombination {
}
/**
+ * Get the largest size by area.
+ *
+ * @param sizes an array of sizes
+ *
+ * @return Largest Size or null if sizes was null or had 0 elements
+ */
+ public static @Nullable Size getMaxSizeOrNull(Size... sizes) {
+ if (sizes == null || sizes.length == 0) {
+ return null;
+ }
+
+ return getMaxSize(sizes);
+ }
+
+ /**
* Whether or not the hardware level reported by android.info.supportedHardwareLevel is
* at least the desired one (but could be higher)
*/