Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit beaf39ba authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add some @IntRange"

parents 3e1e92ae 24faae95
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;
+6 −4
Original line number Diff line number Diff line
@@ -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);
        }