android/os/Build: allow overriding SDK_INT

This commit is contained in:
Mis012 2025-03-26 20:22:12 +01:00
parent 340fae107e
commit ebbbc517a8

View file

@ -107,6 +107,11 @@ public class Build {
* Various version strings. * Various version strings.
*/ */
public static class VERSION { public static class VERSION {
static {
String SDK_INT_str = System.getProperty("Build.VERSION.SDK_INT");
SDK_INT = (SDK_INT_str != null) ? Integer.parseInt(SDK_INT_str) : Build.VERSION_CODES.GINGERBREAD;
}
/** /**
* The internal value used by the underlying source control to * The internal value used by the underlying source control to
* represent this build. E.g., a perforce changelist number * represent this build. E.g., a perforce changelist number
@ -123,7 +128,7 @@ public class Build {
* The user-visible SDK version of the framework; its possible * The user-visible SDK version of the framework; its possible
* values are defined in {@link Build.VERSION_CODES}. * values are defined in {@link Build.VERSION_CODES}.
*/ */
public static final int SDK_INT = Build.VERSION_CODES.GINGERBREAD; public static final int SDK_INT;
/** /**
* The user-visible SDK version of the framework in its raw String * The user-visible SDK version of the framework in its raw String