Merge "Add some @IntRange"
diff --git a/api/current.txt b/api/current.txt
index 2b560a4..39b6cea 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -16212,7 +16212,7 @@
 
   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 @@
     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 475be49..87cffc9 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 @@
      *     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 @@
      * @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);
         }