summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mårten Kongstad <amhk@google.com> 2024-06-25 11:04:15 +0200
committer Mårten Kongstad <amhk@google.com> 2024-09-10 12:39:19 +0200
commitec350061a322e3a5a6612372df36bcde7b89621f (patch)
treebeeb3d3784f2c818a293d4110284329db3f5474c
parent4cc911dd5c1dae6ea644361791e0545f274ce2cf (diff)
Add SDK_MINOR_INT
Introduce Build.VERSION.SDK_MINOR_INT. This functions like SDK_INT, but represents the minor version of the Android API level; SDK_INT corresponds to the major version. Yearly dessert releases will increment SDK_INT and set SDK_MINOR_INT to zero. In-between desserts there may be additional, minor, releases where SDK_INT is kept the same and SDK_MINOR_INT is incremented. A minor release may include new APIs and resources, but must not introduce any back compat changes. Specifically, this means that minor releases are optional and guaranteed to not require developers to rebuild their apps. Bug: 350458259 Test: m Flag: android.sdk.major_minor_versioning_scheme Change-Id: I10d39f33ecfbd463753585224d674ceaefe83b22
-rw-r--r--core/api/current.txt1
-rw-r--r--core/java/android/os/Build.java25
2 files changed, 26 insertions, 0 deletions
diff --git a/core/api/current.txt b/core/api/current.txt
index 5e8febebee0e..9875c0276bf0 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -32771,6 +32771,7 @@ package android.os {
field @NonNull public static final String RELEASE_OR_PREVIEW_DISPLAY;
field @Deprecated public static final String SDK;
field public static final int SDK_INT;
+ field @FlaggedApi("android.sdk.major_minor_versioning_scheme") public static final int SDK_MINOR_INT;
field public static final String SECURITY_PATCH;
}
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index 30d2dec8b4c4..a8267d1c9d8c 100644
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -17,6 +17,7 @@
package android.os;
import android.Manifest;
+import android.annotation.FlaggedApi;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
@@ -28,6 +29,7 @@ import android.app.Application;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.ravenwood.annotation.RavenwoodKeepWholeClass;
+import android.sdk.Flags;
import android.sysprop.DeviceProperties;
import android.sysprop.SocProperties;
import android.sysprop.TelephonyProperties;
@@ -399,12 +401,35 @@ public class Build {
* device. This value never changes while a device is booted, but it may
* increase when the hardware manufacturer provides an OTA update.
* <p>
+ * Together with {@link SDK_MINOR_INT}, this constant defines the
+ * <pre>major.minor</pre> version of Android. <pre>SDK_INT</pre> is
+ * increased and <pre>SDK_MINOR_INT</pre> is set to 0 on new Android
+ * dessert releases. Between these, Android may also release so called
+ * minor releases where <pre>SDK_INT</pre> remains unchanged and
+ * <pre>SDK_MINOR_INT</pre> is increased. Minor releases can add new
+ * APIs, and have stricter guarantees around backwards compatibility
+ * (e.g. no changes gated by <pre>targetSdkVersion</pre>) compared to
+ * major releases.
+ * <p>
* Possible values are defined in {@link Build.VERSION_CODES}.
*/
public static final int SDK_INT = SystemProperties.getInt(
"ro.build.version.sdk", 0);
/**
+ * The minor SDK version of the software currently running on this hardware
+ * device. This value never changes while a device is booted, but it may
+ * increase when the hardware manufacturer provides an OTA update.
+ * <p>
+ * Together with {@link SDK_INT}, this constant defines the
+ * <pre>major.minor</pre> version of Android. See {@link SDK_INT} for
+ * more information.
+ */
+ @FlaggedApi(Flags.FLAG_MAJOR_MINOR_VERSIONING_SCHEME)
+ public static final int SDK_MINOR_INT = SystemProperties.getInt(
+ "ro.build.version.sdk_minor", 0);
+
+ /**
* The SDK version of the software that <em>initially</em> shipped on
* this hardware device. It <em>never</em> changes during the lifetime
* of the device, even when {@link #SDK_INT} increases due to an OTA