Add missing formats from hardware_buffer.h to java AHB

Bug: 292545615
Test: Build
Change-Id: I9a0b42984c3cc8284eb184f412b092a2201a6e4a
diff --git a/core/api/current.txt b/core/api/current.txt
index cce8329..947cf88 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -18192,12 +18192,16 @@
     field public static final int D_16 = 48; // 0x30
     field public static final int D_24 = 49; // 0x31
     field public static final int D_FP32 = 51; // 0x33
+    field @FlaggedApi("com.android.graphics.hwui.flags.requested_formats_v") public static final int RGBA_10101010 = 59; // 0x3b
     field public static final int RGBA_1010102 = 43; // 0x2b
     field public static final int RGBA_8888 = 1; // 0x1
     field public static final int RGBA_FP16 = 22; // 0x16
     field public static final int RGBX_8888 = 2; // 0x2
     field public static final int RGB_565 = 4; // 0x4
     field public static final int RGB_888 = 3; // 0x3
+    field @FlaggedApi("com.android.graphics.hwui.flags.requested_formats_v") public static final int RG_1616_UINT = 58; // 0x3a
+    field @FlaggedApi("com.android.graphics.hwui.flags.requested_formats_v") public static final int R_16_UINT = 57; // 0x39
+    field @FlaggedApi("com.android.graphics.hwui.flags.requested_formats_v") public static final int R_8 = 56; // 0x38
     field public static final int S_UI8 = 53; // 0x35
     field public static final long USAGE_COMPOSER_OVERLAY = 2048L; // 0x800L
     field public static final long USAGE_CPU_READ_OFTEN = 3L; // 0x3L
diff --git a/core/java/android/hardware/HardwareBuffer.java b/core/java/android/hardware/HardwareBuffer.java
index 5ff0e7a..e714887 100644
--- a/core/java/android/hardware/HardwareBuffer.java
+++ b/core/java/android/hardware/HardwareBuffer.java
@@ -16,6 +16,7 @@
 
 package android.hardware;
 
+import android.annotation.FlaggedApi;
 import android.annotation.IntDef;
 import android.annotation.IntRange;
 import android.annotation.LongDef;
@@ -65,6 +66,10 @@
             DS_FP32UI8,
             S_UI8,
             YCBCR_P010,
+            R_8,
+            R_16_UINT,
+            RG_1616_UINT,
+            RGBA_10101010,
     })
     public @interface Format {
     }
@@ -105,7 +110,19 @@
      * followed by a Wx(H/2) CbCr plane. Each sample is represented by a 16-bit
      * little-endian value, with the lower 6 bits set to zero.
      */
-    public static final int YCBCR_P010 = 0x36;
+    public static final int YCBCR_P010    = 0x36;
+    /** Format: 8 bits red */
+    @FlaggedApi(com.android.graphics.hwui.flags.Flags.FLAG_REQUESTED_FORMATS_V)
+    public static final int R_8           = 0x38;
+    /** Format: 16 bits red */
+    @FlaggedApi(com.android.graphics.hwui.flags.Flags.FLAG_REQUESTED_FORMATS_V)
+    public static final int R_16_UINT     = 0x39;
+    /** Format: 16 bits each red, green */
+    @FlaggedApi(com.android.graphics.hwui.flags.Flags.FLAG_REQUESTED_FORMATS_V)
+    public static final int RG_1616_UINT  = 0x3a;
+    /** Format: 10 bits each red, green, blue, alpha */
+    @FlaggedApi(com.android.graphics.hwui.flags.Flags.FLAG_REQUESTED_FORMATS_V)
+    public static final int RGBA_10101010 = 0x3b;
 
     // Note: do not rename, this field is used by native code
     @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
diff --git a/libs/hwui/aconfig/hwui_flags.aconfig b/libs/hwui/aconfig/hwui_flags.aconfig
index e986c38..78a6479 100644
--- a/libs/hwui/aconfig/hwui_flags.aconfig
+++ b/libs/hwui/aconfig/hwui_flags.aconfig
@@ -34,3 +34,10 @@
   description: "Clip z-above surfaceviews to global clip rect"
   bug: "298621623"
 }
+
+flag {
+  name: "requested_formats_v"
+  namespace: "core_graphics"
+  description: "Enable r_8, r_16_uint, rg_1616_uint, and rgba_10101010 in the SDK"
+  bug: "292545615"
+}