Adding BuildCompat.isAtleastR() for development

Test: ./gradlew updateApi

Bug: 140585410
Change-Id: Ifbb926795e23241b570d39b347646650ccc0852a
diff --git a/core/core/api/1.2.0-alpha04.txt b/core/core/api/1.2.0-alpha04.txt
index 06d3842..ddd3bcd 100644
--- a/core/core/api/1.2.0-alpha04.txt
+++ b/core/core/api/1.2.0-alpha04.txt
@@ -1281,6 +1281,7 @@
     method @Deprecated public static boolean isAtLeastOMR1();
     method @Deprecated public static boolean isAtLeastP();
     method @Deprecated public static boolean isAtLeastQ();
+    method public static boolean isAtLeastR();
   }
 
   public final class CancellationSignal {
diff --git a/core/core/api/current.txt b/core/core/api/current.txt
index 06d3842..ddd3bcd 100644
--- a/core/core/api/current.txt
+++ b/core/core/api/current.txt
@@ -1281,6 +1281,7 @@
     method @Deprecated public static boolean isAtLeastOMR1();
     method @Deprecated public static boolean isAtLeastP();
     method @Deprecated public static boolean isAtLeastQ();
+    method public static boolean isAtLeastR();
   }
 
   public final class CancellationSignal {
diff --git a/core/core/api/public_plus_experimental_1.2.0-alpha04.txt b/core/core/api/public_plus_experimental_1.2.0-alpha04.txt
index 06d3842..ddd3bcd 100644
--- a/core/core/api/public_plus_experimental_1.2.0-alpha04.txt
+++ b/core/core/api/public_plus_experimental_1.2.0-alpha04.txt
@@ -1281,6 +1281,7 @@
     method @Deprecated public static boolean isAtLeastOMR1();
     method @Deprecated public static boolean isAtLeastP();
     method @Deprecated public static boolean isAtLeastQ();
+    method public static boolean isAtLeastR();
   }
 
   public final class CancellationSignal {
diff --git a/core/core/api/public_plus_experimental_current.txt b/core/core/api/public_plus_experimental_current.txt
index 06d3842..ddd3bcd 100644
--- a/core/core/api/public_plus_experimental_current.txt
+++ b/core/core/api/public_plus_experimental_current.txt
@@ -1281,6 +1281,7 @@
     method @Deprecated public static boolean isAtLeastOMR1();
     method @Deprecated public static boolean isAtLeastP();
     method @Deprecated public static boolean isAtLeastQ();
+    method public static boolean isAtLeastR();
   }
 
   public final class CancellationSignal {
diff --git a/core/core/api/restricted_1.2.0-alpha04.txt b/core/core/api/restricted_1.2.0-alpha04.txt
index 5da72ac..918fd9e 100644
--- a/core/core/api/restricted_1.2.0-alpha04.txt
+++ b/core/core/api/restricted_1.2.0-alpha04.txt
@@ -1586,6 +1586,7 @@
     method @Deprecated public static boolean isAtLeastOMR1();
     method @Deprecated public static boolean isAtLeastP();
     method @Deprecated public static boolean isAtLeastQ();
+    method public static boolean isAtLeastR();
   }
 
   public final class CancellationSignal {
diff --git a/core/core/api/restricted_current.txt b/core/core/api/restricted_current.txt
index 5da72ac..918fd9e 100644
--- a/core/core/api/restricted_current.txt
+++ b/core/core/api/restricted_current.txt
@@ -1586,6 +1586,7 @@
     method @Deprecated public static boolean isAtLeastOMR1();
     method @Deprecated public static boolean isAtLeastP();
     method @Deprecated public static boolean isAtLeastQ();
+    method public static boolean isAtLeastR();
   }
 
   public final class CancellationSignal {
diff --git a/core/core/src/main/java/androidx/core/os/BuildCompat.java b/core/core/src/main/java/androidx/core/os/BuildCompat.java
index 4b0a60b..8de2514 100644
--- a/core/core/src/main/java/androidx/core/os/BuildCompat.java
+++ b/core/core/src/main/java/androidx/core/os/BuildCompat.java
@@ -103,4 +103,19 @@
     public static boolean isAtLeastQ() {
         return VERSION.SDK_INT >= 29;
     }
+
+    /**
+     * Checks if the device is running on a pre-release version of Android R or newer.
+     * <p>
+     * <strong>Note:</strong> This method will return {@code false} on devices running release
+     * versions of Android. When Android R is finalized for release, this method will be deprecated
+     * and all calls should be replaced with {@code Build.VERSION.SDK_INT >= Build.VERSION_CODES.R}.
+     *
+     * @return {@code true} if R APIs are available for use, {@code false} otherwise
+     */
+    public static boolean isAtLeastR() {
+        return VERSION.CODENAME.length() == 1
+                && VERSION.CODENAME.charAt(0) >= 'R'
+                && VERSION.CODENAME.charAt(0) <= 'Z';
+    }
 }