Merge "Camera: Address some API review comments for MultiResolutionImageReader" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-03-18 03:36:00 +00:00
committed by Android (Google) Code Review
3 changed files with 22 additions and 16 deletions

View File

@@ -18438,12 +18438,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);
}
@@ -18554,10 +18554,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 {

View File

@@ -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;

View File

@@ -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;
}