diff options
| author | 2024-06-26 11:34:43 -0700 | |
|---|---|---|
| committer | 2024-11-05 09:16:20 -0800 | |
| commit | 9114929c0447250b868a2ad184481de1c96dbc5e (patch) | |
| tree | b077f28726a62cfa24888b0b39a2c4a9d6f230d3 | |
| parent | e38ff355b92be403dede7878c37703382ab4aec9 (diff) | |
Add getBackportedFixStatus to android.os.Build
This is a public API app developers use to check if a known issue is fixed
on a device.
Flag: android.os.api_for_backported_fixes
Bug: 308461809
Test: atest CtsOsTestCases:android.os.cts.BuildTest CtsOsTestCases:android.os.cts.CriticalIssuesTest
Change-Id: Ic0dea51d1b5b1746b55f76e0e39d2fca8f73ee70
| -rw-r--r-- | core/api/current.txt | 5 | ||||
| -rw-r--r-- | core/java/android/os/Build.java | 55 |
2 files changed, 60 insertions, 0 deletions
diff --git a/core/api/current.txt b/core/api/current.txt index 73b35b211f25..0406759fd318 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -32787,11 +32787,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 a89483394611..dbaa1a57c482 100644 --- a/core/java/android/os/Build.java +++ b/core/java/android/os/Build.java @@ -1559,6 +1559,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. |