diff options
| -rw-r--r-- | api/current.txt | 4 | ||||
| -rw-r--r-- | core/java/android/hardware/HardwareBuffer.java | 10 |
2 files changed, 8 insertions, 6 deletions
diff --git a/api/current.txt b/api/current.txt index 2b560a4de7ae..39b6ceaa4f8d 100644 --- a/api/current.txt +++ b/api/current.txt @@ -16212,7 +16212,7 @@ package android.hardware { public final class HardwareBuffer implements java.lang.AutoCloseable android.os.Parcelable { method public void close(); - method @NonNull public static android.hardware.HardwareBuffer create(int, int, int, int, long); + method @NonNull public static android.hardware.HardwareBuffer create(@IntRange(from=1) int, @IntRange(from=1) int, int, @IntRange(from=1) int, long); method public int describeContents(); method public int getFormat(); method public int getHeight(); @@ -16220,7 +16220,7 @@ package android.hardware { method public long getUsage(); method public int getWidth(); method public boolean isClosed(); - method public static boolean isSupported(int, int, int, int, long); + method public static boolean isSupported(@IntRange(from=1) int, @IntRange(from=1) int, int, @IntRange(from=1) int, long); method public void writeToParcel(android.os.Parcel, int); field public static final int BLOB = 33; // 0x21 field public static final android.os.Parcelable.Creator<android.hardware.HardwareBuffer> CREATOR; diff --git a/core/java/android/hardware/HardwareBuffer.java b/core/java/android/hardware/HardwareBuffer.java index 475be49aea6c..87cffc928c85 100644 --- a/core/java/android/hardware/HardwareBuffer.java +++ b/core/java/android/hardware/HardwareBuffer.java @@ -17,6 +17,7 @@ package android.hardware; import android.annotation.IntDef; +import android.annotation.IntRange; import android.annotation.LongDef; import android.annotation.NonNull; import android.annotation.UnsupportedAppUsage; @@ -156,8 +157,9 @@ public final class HardwareBuffer implements Parcelable, AutoCloseable { * is less than one or not supported, or if the passed usage flags are not a supported set. */ @NonNull - public static HardwareBuffer create(int width, int height, @Format int format, int layers, - @Usage long usage) { + public static HardwareBuffer create( + @IntRange(from = 1) int width, @IntRange(from = 1) int height, + @Format int format, @IntRange(from = 1) int layers, @Usage long usage) { if (!HardwareBuffer.isSupportedFormat(format)) { throw new IllegalArgumentException("Invalid pixel format " + format); } @@ -194,8 +196,8 @@ public final class HardwareBuffer implements Parcelable, AutoCloseable { * @param usage The @Usage flags describing how the buffer will be used * @return True if the combination is supported, false otherwise. */ - public static boolean isSupported(int width, int height, @Format int format, int layers, - @Usage long usage) { + public static boolean isSupported(@IntRange(from = 1) int width, @IntRange(from = 1) int height, + @Format int format, @IntRange(from = 1) int layers, @Usage long usage) { if (!HardwareBuffer.isSupportedFormat(format)) { throw new IllegalArgumentException("Invalid pixel format " + format); } |