Commit 28f13f5a authored by Shimi Zhang's avatar Shimi Zhang Committed by Chromium LUCI CQ

Android: Update BuildInfo.isAtLeastS

Update the BuildInfo.java with the latest support library implementation
for feature development.

Bug: None
Change-Id: Id02f13a2f67a7bca8458a4f30b387291070d26c0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2570691Reviewed-by: default avatarRichard Coles <torne@chromium.org>
Commit-Queue: Shimi Zhang <ctzsm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#834284}
parent 5d05d93c
......@@ -12,6 +12,8 @@ import android.os.Build;
import android.os.Build.VERSION;
import android.text.TextUtils;
import androidx.annotation.ChecksSdkIntAtLeast;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.compat.ApiHelperForP;
......@@ -201,33 +203,51 @@ public class BuildInfo {
// The markers Begin:BuildCompat and End:BuildCompat delimit code
// that is autogenerated from Android sources.
// Begin:BuildCompat Q,R
// Begin:BuildCompat Q,R,S
/**
* Checks if the device is running on a pre-release version of Android Q or newer.
* Checks if the device is running on release version of Android Q or newer.
* <p>
* @return {@code true} if Q APIs are available for use, {@code false} otherwise
* @deprecated Android Q is a finalized release and this method is no longer necessary. It
* will be removed in a future release of the Support Library. Instead, use
* {@code Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q}.
*/
@ChecksSdkIntAtLeast(api = Build.VERSION_CODES.Q)
@Deprecated
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.
* Checks if the device is running on release version of Android R or newer.
* <p>
* @return {@code true} if R APIs are available for use, {@code false} otherwise
* @deprecated Android R is a finalized release and this method is no longer necessary. It
* will be removed in a future release of the Support Library. Instead, use
* {@code Build.VERSION.SDK_INT >= Build.VERSION_CODES.R}.
*/
@ChecksSdkIntAtLeast(api = Build.VERSION_CODES.R)
@Deprecated
public static boolean isAtLeastR() {
return VERSION.SDK_INT >= 30;
}
/**
* Checks if the device is running on a pre-release version of Android S or a release version of
* Android S or newer.
* <p>
* <strong>Note:</strong> When Android S is finalized for release, this method will be
* deprecated and all calls should be replaced with {@code Build.VERSION.SDK_INT >=
* Build.VERSION_CODES.S}.
*
* @return {@code true} if S APIs are available for use, {@code false} otherwise
*/
@ChecksSdkIntAtLeast(codename = "S")
public static boolean isAtLeastS() {
return VERSION.CODENAME.equals("S");
}
/**
* Checks if the application targets at least released SDK Q
*/
......@@ -237,12 +257,22 @@ public class BuildInfo {
}
/**
* Checks if the application targets pre-release SDK R
* Checks if the application targets at least released SDK R
*/
@Deprecated
public static boolean targetsAtLeastR() {
return ContextUtils.getApplicationContext().getApplicationInfo().targetSdkVersion >= 30;
}
/**
* Checks if the application targets pre-release SDK S
*/
public static boolean targetsAtLeastS() {
return isAtLeastS()
&& ContextUtils.getApplicationContext().getApplicationInfo().targetSdkVersion
== Build.VERSION_CODES.CUR_DEVELOPMENT;
}
// End:BuildCompat
public static void setFirebaseAppId(String id) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment