Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9114929c authored by Nick Chalko's avatar Nick Chalko
Browse files

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
parent e38ff355
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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;
+55 −0
Original line number Diff line number Diff line
@@ -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.