- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
183 lines
5.8 KiB
Java
183 lines
5.8 KiB
Java
package androidx.core.os;
|
|
|
|
import android.os.Build;
|
|
import android.os.ext.SdkExtensions;
|
|
import androidx.annotation.ChecksSdkIntAtLeast;
|
|
import androidx.annotation.RequiresApi;
|
|
import androidx.annotation.RestrictTo;
|
|
import androidx.annotation.VisibleForTesting;
|
|
import java.lang.annotation.Retention;
|
|
import java.lang.annotation.RetentionPolicy;
|
|
import java.util.Locale;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class BuildCompat {
|
|
|
|
@ChecksSdkIntAtLeast(extension = 1000000)
|
|
public static final int AD_SERVICES_EXTENSION_INT;
|
|
public static final BuildCompat INSTANCE = new BuildCompat();
|
|
|
|
@ChecksSdkIntAtLeast(extension = 30)
|
|
public static final int R_EXTENSION_INT;
|
|
|
|
@ChecksSdkIntAtLeast(extension = 31)
|
|
public static final int S_EXTENSION_INT;
|
|
|
|
@ChecksSdkIntAtLeast(extension = 33)
|
|
public static final int T_EXTENSION_INT;
|
|
|
|
@Retention(RetentionPolicy.CLASS)
|
|
public @interface PrereleaseSdkCheck {
|
|
}
|
|
|
|
@ChecksSdkIntAtLeast(api = 24)
|
|
public static final boolean isAtLeastN() {
|
|
return true;
|
|
}
|
|
|
|
@ChecksSdkIntAtLeast(api = 25)
|
|
public static final boolean isAtLeastNMR1() {
|
|
return true;
|
|
}
|
|
|
|
@ChecksSdkIntAtLeast(api = 26)
|
|
public static final boolean isAtLeastO() {
|
|
return true;
|
|
}
|
|
|
|
@ChecksSdkIntAtLeast(api = 27)
|
|
public static final boolean isAtLeastOMR1() {
|
|
return Build.VERSION.SDK_INT >= 27;
|
|
}
|
|
|
|
@ChecksSdkIntAtLeast(api = 28)
|
|
public static final boolean isAtLeastP() {
|
|
return Build.VERSION.SDK_INT >= 28;
|
|
}
|
|
|
|
@ChecksSdkIntAtLeast(api = 29)
|
|
public static final boolean isAtLeastQ() {
|
|
return Build.VERSION.SDK_INT >= 29;
|
|
}
|
|
|
|
@ChecksSdkIntAtLeast(api = 30)
|
|
public static final boolean isAtLeastR() {
|
|
return Build.VERSION.SDK_INT >= 30;
|
|
}
|
|
|
|
private BuildCompat() {
|
|
}
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY})
|
|
@VisibleForTesting
|
|
public static final boolean isAtLeastPreReleaseCodename(String codename, String buildCodename) {
|
|
Intrinsics.checkNotNullParameter(codename, "codename");
|
|
Intrinsics.checkNotNullParameter(buildCodename, "buildCodename");
|
|
if (Intrinsics.areEqual("REL", buildCodename)) {
|
|
return false;
|
|
}
|
|
Locale locale = Locale.ROOT;
|
|
String upperCase = buildCodename.toUpperCase(locale);
|
|
Intrinsics.checkNotNullExpressionValue(upperCase, "this as java.lang.String).toUpperCase(Locale.ROOT)");
|
|
String upperCase2 = codename.toUpperCase(locale);
|
|
Intrinsics.checkNotNullExpressionValue(upperCase2, "this as java.lang.String).toUpperCase(Locale.ROOT)");
|
|
return upperCase.compareTo(upperCase2) >= 0;
|
|
}
|
|
|
|
@ChecksSdkIntAtLeast(api = 31, codename = "S")
|
|
public static final boolean isAtLeastS() {
|
|
int i = Build.VERSION.SDK_INT;
|
|
if (i < 31) {
|
|
if (i >= 30) {
|
|
String CODENAME = Build.VERSION.CODENAME;
|
|
Intrinsics.checkNotNullExpressionValue(CODENAME, "CODENAME");
|
|
if (isAtLeastPreReleaseCodename("S", CODENAME)) {
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@ChecksSdkIntAtLeast(api = 32, codename = "Sv2")
|
|
public static final boolean isAtLeastSv2() {
|
|
int i = Build.VERSION.SDK_INT;
|
|
if (i < 32) {
|
|
if (i >= 31) {
|
|
String CODENAME = Build.VERSION.CODENAME;
|
|
Intrinsics.checkNotNullExpressionValue(CODENAME, "CODENAME");
|
|
if (isAtLeastPreReleaseCodename("Sv2", CODENAME)) {
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@ChecksSdkIntAtLeast(api = 33, codename = "Tiramisu")
|
|
public static final boolean isAtLeastT() {
|
|
int i = Build.VERSION.SDK_INT;
|
|
if (i < 33) {
|
|
if (i >= 32) {
|
|
String CODENAME = Build.VERSION.CODENAME;
|
|
Intrinsics.checkNotNullExpressionValue(CODENAME, "CODENAME");
|
|
if (isAtLeastPreReleaseCodename("Tiramisu", CODENAME)) {
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@ChecksSdkIntAtLeast(api = 34, codename = "UpsideDownCake")
|
|
public static final boolean isAtLeastU() {
|
|
int i = Build.VERSION.SDK_INT;
|
|
if (i < 34) {
|
|
if (i >= 33) {
|
|
String CODENAME = Build.VERSION.CODENAME;
|
|
Intrinsics.checkNotNullExpressionValue(CODENAME, "CODENAME");
|
|
if (isAtLeastPreReleaseCodename("UpsideDownCake", CODENAME)) {
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@ChecksSdkIntAtLeast(api = 35, codename = "VanillaIceCream")
|
|
public static final boolean isAtLeastV() {
|
|
int i = Build.VERSION.SDK_INT;
|
|
if (i < 35) {
|
|
if (i >= 34) {
|
|
String CODENAME = Build.VERSION.CODENAME;
|
|
Intrinsics.checkNotNullExpressionValue(CODENAME, "CODENAME");
|
|
if (isAtLeastPreReleaseCodename("VanillaIceCream", CODENAME)) {
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
static {
|
|
int i = Build.VERSION.SDK_INT;
|
|
R_EXTENSION_INT = i >= 30 ? Api30Impl.INSTANCE.getExtensionVersion(30) : 0;
|
|
S_EXTENSION_INT = i >= 30 ? Api30Impl.INSTANCE.getExtensionVersion(31) : 0;
|
|
T_EXTENSION_INT = i >= 30 ? Api30Impl.INSTANCE.getExtensionVersion(33) : 0;
|
|
AD_SERVICES_EXTENSION_INT = i >= 30 ? Api30Impl.INSTANCE.getExtensionVersion(1000000) : 0;
|
|
}
|
|
|
|
@RequiresApi(30)
|
|
public static final class Api30Impl {
|
|
public static final Api30Impl INSTANCE = new Api30Impl();
|
|
|
|
private Api30Impl() {
|
|
}
|
|
|
|
public final int getExtensionVersion(int i) {
|
|
return SdkExtensions.getExtensionVersion(i);
|
|
}
|
|
}
|
|
}
|