summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/api/current.txt8
-rw-r--r--core/java/android/hardware/camera2/MultiResolutionImageReader.java10
-rw-r--r--core/java/android/hardware/camera2/params/MultiResolutionStreamInfo.java20
3 files changed, 22 insertions, 16 deletions
diff --git a/core/api/current.txt b/core/api/current.txt
index 41375d56f30c..8196892b550b 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -18437,12 +18437,12 @@ package android.hardware.camera2 {
}
public class MultiResolutionImageReader implements java.lang.AutoCloseable {
+ ctor public MultiResolutionImageReader(@NonNull java.util.Collection<android.hardware.camera2.params.MultiResolutionStreamInfo>, int, @IntRange(from=1) int);
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);
}
@@ -18553,10 +18553,10 @@ package android.hardware.camera2.params {
}
public class MultiResolutionStreamInfo {
- ctor public MultiResolutionStreamInfo(int, int, @NonNull String);
- method public int getHeight();
+ ctor public MultiResolutionStreamInfo(@IntRange(from=1) int, @IntRange(from=1) int, @NonNull String);
+ method @IntRange(from=1) public int getHeight();
method @NonNull public String getPhysicalCameraId();
- method public int getWidth();
+ method @IntRange(from=1) public int getWidth();
}
public final class OisSample {
diff --git a/core/java/android/hardware/camera2/MultiResolutionImageReader.java b/core/java/android/hardware/camera2/MultiResolutionImageReader.java
index c592f19bc45c..bb3d91dbc65c 100644
--- a/core/java/android/hardware/camera2/MultiResolutionImageReader.java
+++ b/core/java/android/hardware/camera2/MultiResolutionImageReader.java
@@ -131,18 +131,10 @@ public class MultiResolutionImageReader implements AutoCloseable {
* @see
* android.hardware.camera2.params.MultiResolutionStreamConfigurationMap
*/
- public static @NonNull MultiResolutionImageReader newInstance(
+ public MultiResolutionImageReader(
@NonNull Collection<MultiResolutionStreamInfo> streams,
@Format int format,
@IntRange(from = 1) int maxImages) {
- return new MultiResolutionImageReader(streams, format, maxImages);
- }
-
- /**
- * @hide
- */
- protected MultiResolutionImageReader(Collection<MultiResolutionStreamInfo> streams,
- int format, int maxImages) {
mFormat = format;
mMaxImages = maxImages;
diff --git a/core/java/android/hardware/camera2/params/MultiResolutionStreamInfo.java b/core/java/android/hardware/camera2/params/MultiResolutionStreamInfo.java
index aa1d1d4aaa18..e2e61ad4d31a 100644
--- a/core/java/android/hardware/camera2/params/MultiResolutionStreamInfo.java
+++ b/core/java/android/hardware/camera2/params/MultiResolutionStreamInfo.java
@@ -17,6 +17,7 @@
package android.hardware.camera2.params;
import android.annotation.NonNull;
+import android.annotation.IntRange;
import java.util.Objects;
@@ -50,9 +51,22 @@ public class MultiResolutionStreamInfo {
* MultiResolutionStreamConfigurationMap#getOutputInfo} or {@link
* MultiResolutionStreamConfigurationMap#getInputInfo} to obtain them for a particular format
* instead.</p>
+ *
+ * @param streamWidth The width in pixels of the camera stream
+ * @param streamHeight The height in pixels of the camera stream
+ * @param physicalCameraId The physical camera Id the camera stream is associated with
+ * @throws IllegalArgumentException if the streamWidth or streamHeight is invalid (either zero
+ * or negative).
*/
- public MultiResolutionStreamInfo(int streamWidth, int streamHeight,
+ public MultiResolutionStreamInfo(@IntRange(from = 1) int streamWidth,
+ @IntRange(from = 1) int streamHeight,
@NonNull String physicalCameraId) {
+ if (streamWidth <= 0) {
+ throw new IllegalArgumentException("Invalid stream width " + streamWidth);
+ }
+ if (streamHeight <= 0) {
+ throw new IllegalArgumentException("Invalid stream height " + streamHeight);
+ }
mStreamWidth = streamWidth;
mStreamHeight = streamHeight;
mPhysicalCameraId = physicalCameraId;
@@ -61,14 +75,14 @@ public class MultiResolutionStreamInfo {
/**
* The width of this particular image buffer stream in pixels.
*/
- public int getWidth() {
+ public @IntRange(from = 1) int getWidth() {
return mStreamWidth;
}
/**
* The height of this particular image buffer stream in pixels.
*/
- public int getHeight() {
+ public @IntRange(from = 1) int getHeight() {
return mStreamHeight;
}