summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-11-06 20:00:40 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-11-06 20:00:40 +0000
commit5ef6e007409827d5676c7e5d9adb8734feffda29 (patch)
treed63ab1c79bc80ee063b3a02835f885967e5fb657
parenta71bfbe8c8bd7f05d20abe3904ac916547bb38be (diff)
parent9114929c0447250b868a2ad184481de1c96dbc5e (diff)
Merge "Add getBackportedFixStatus to android.os.Build" into main
-rw-r--r--core/api/current.txt5
-rw-r--r--core/java/android/os/Build.java55
2 files changed, 60 insertions, 0 deletions
diff --git a/core/api/current.txt b/core/api/current.txt
index 15eebbe2be0e..cbae74640013 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -32953,11 +32953,16 @@ package android.os {
public class Build {
ctor public Build();
+ method @FlaggedApi("android.os.api_for_backported_fixes") public static int getBackportedFixStatus(long);
method @NonNull public static java.util.List<android.os.Build.Partition> getFingerprintedPartitions();
method @FlaggedApi("android.sdk.major_minor_versioning_scheme") public static int getMajorSdkVersion(int);
method @FlaggedApi("android.sdk.major_minor_versioning_scheme") public static int getMinorSdkVersion(int);
method public static String getRadioVersion();
method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public static String getSerial();
+ field @FlaggedApi("android.os.api_for_backported_fixes") public static final int BACKPORTED_FIX_STATUS_FIXED = 1; // 0x1
+ field @FlaggedApi("android.os.api_for_backported_fixes") public static final int BACKPORTED_FIX_STATUS_NOT_APPLICABLE = 2; // 0x2
+ field @FlaggedApi("android.os.api_for_backported_fixes") public static final int BACKPORTED_FIX_STATUS_NOT_FIXED = 3; // 0x3
+ field @FlaggedApi("android.os.api_for_backported_fixes") public static final int BACKPORTED_FIX_STATUS_UNKNOWN = 0; // 0x0
field public static final String BOARD;
field public static final String BOOTLOADER;
field public static final String BRAND;
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index b3aebad1b160..102bdd0b625c 100644
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -1565,6 +1565,61 @@ public class Build {
/** A string that uniquely identifies this build. Do not attempt to parse this value. */
public static final String FINGERPRINT = deriveFingerprint();
+ /** The status of the known issue on this device is not known. */
+ @FlaggedApi(android.os.Flags.FLAG_API_FOR_BACKPORTED_FIXES)
+ public static final int BACKPORTED_FIX_STATUS_UNKNOWN = 0;
+ /** The known issue is fixed on this device. */
+ @FlaggedApi(android.os.Flags.FLAG_API_FOR_BACKPORTED_FIXES)
+ public static final int BACKPORTED_FIX_STATUS_FIXED = 1;
+ /**
+ * The known issue is not applicable to this device.
+ *
+ * <p>For example if the issue only affects a specific brand, devices
+ * from other brands would report not applicable.
+ */
+ @FlaggedApi(android.os.Flags.FLAG_API_FOR_BACKPORTED_FIXES)
+ public static final int BACKPORTED_FIX_STATUS_NOT_APPLICABLE = 2;
+ /** The known issue is not fixed on this device. */
+ @FlaggedApi(android.os.Flags.FLAG_API_FOR_BACKPORTED_FIXES)
+ public static final int BACKPORTED_FIX_STATUS_NOT_FIXED = 3;
+
+ /**
+ * The status of the backported fix for a known issue on this device.
+ *
+ * @hide
+ */
+ @IntDef(
+ prefix = {"BACKPORTED_FIX_STATUS_"},
+ value = {
+ BACKPORTED_FIX_STATUS_UNKNOWN,
+ BACKPORTED_FIX_STATUS_FIXED,
+ BACKPORTED_FIX_STATUS_NOT_APPLICABLE,
+ BACKPORTED_FIX_STATUS_NOT_FIXED,
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface BackportedFixStatus {
+ }
+
+ /**
+ * The status of the backported fix for a known issue on this device.
+ *
+ * @param id The id of the known issue to check.
+ * @return {@link #BACKPORTED_FIX_STATUS_FIXED} if the known issue is
+ * fixed on this device,
+ * {@link #BACKPORTED_FIX_STATUS_NOT_FIXED} if the known issue is not
+ * fixed on this device,
+ * {@link #BACKPORTED_FIX_STATUS_NOT_APPLICABLE} if the known issue is
+ * is not applicable on this device,
+ * otherwise {@link #BACKPORTED_FIX_STATUS_UNKNOWN}.
+ */
+
+ @FlaggedApi(android.os.Flags.FLAG_API_FOR_BACKPORTED_FIXES)
+ public static @BackportedFixStatus int getBackportedFixStatus(long id) {
+ // TODO: b/308461809 - query aliases from system prop
+ // TODO: b/372518979 - use backported fix datastore.
+ return BACKPORTED_FIX_STATUS_UNKNOWN;
+ }
+
/**
* Some devices split the fingerprint components between multiple
* partitions, so we might derive the fingerprint at runtime.