Introduce @TestApi BUGREPORT_MODE_MAX_VALUE

This cl introduces test API BUGREPORT_MODE_MAX_VALUE to make
bugreport mode validation more stable.

CtsCarrierApiTestCases has a test case to validate the supported
bugreport mode in AOSP. Without a reference to the range of supported
bugreport modes, the  test case can only use a hard-coded value which
is prone of failure when new mode is introduced.

Bug: 297892537
Test: atest BugreportManagerTest
Change-Id: I9369367ee4fcfb274f14c96bf501e9cd3eb98cbf
diff --git a/core/api/test-current.txt b/core/api/test-current.txt
index cff5e40..29a67d5 100644
--- a/core/api/test-current.txt
+++ b/core/api/test-current.txt
@@ -2245,6 +2245,10 @@
     method @RequiresPermission(android.Manifest.permission.DEVICE_POWER) public void unplugBattery(boolean);
   }
 
+  public final class BugreportParams {
+    field public static final int BUGREPORT_MODE_MAX_VALUE = 7; // 0x7
+  }
+
   public class Build {
     method public static boolean is64BitAbi(String);
     method public static boolean isDebuggable();
diff --git a/core/java/android/os/BugreportParams.java b/core/java/android/os/BugreportParams.java
index 0456a33..f10467f 100644
--- a/core/java/android/os/BugreportParams.java
+++ b/core/java/android/os/BugreportParams.java
@@ -18,6 +18,7 @@
 
 import android.annotation.IntDef;
 import android.annotation.SystemApi;
+import android.annotation.TestApi;
 
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -127,6 +128,13 @@
     public static final int BUGREPORT_MODE_ONBOARDING = IDumpstate.BUGREPORT_MODE_ONBOARDING;
 
     /**
+     * The maximum value of supported bugreport mode.
+     * @hide
+     */
+    @TestApi
+    public static final int BUGREPORT_MODE_MAX_VALUE = BUGREPORT_MODE_ONBOARDING;
+
+    /**
      * Defines acceptable flags for customizing bugreport requests.
      * @hide
      */