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

Commit 8126b1fe authored by wayneyang's avatar wayneyang
Browse files

Added a new "retailDemo" protection level.

Permissions that have the new wellbeing protection flag will be granted
to the retail demo app, as defined by the OEM in the system resource.

The PACAKGE_USAGE_STATS permission is updated to use the retailDemo
flag.

Bug: 146043112
Test: atest CtsPermission2TestCases:PermissionPolicyTest
Change-Id: I30b451e6e88a4d65af5e5f774bcd30a14721a8a9
parent a7050d47
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2303,6 +2303,7 @@ package android.content.pm {
    field public static final int PROTECTION_FLAG_DOCUMENTER = 262144; // 0x40000
    field public static final int PROTECTION_FLAG_INCIDENT_REPORT_APPROVER = 1048576; // 0x100000
    field public static final int PROTECTION_FLAG_OEM = 16384; // 0x4000
    field public static final int PROTECTION_FLAG_RETAIL_DEMO = 16777216; // 0x1000000
    field public static final int PROTECTION_FLAG_SYSTEM_TEXT_CLASSIFIER = 65536; // 0x10000
    field public static final int PROTECTION_FLAG_TELEPHONY = 4194304; // 0x400000
    field public static final int PROTECTION_FLAG_WELLBEING = 131072; // 0x20000
+1 −0
Original line number Diff line number Diff line
@@ -878,6 +878,7 @@ package android.content.pm {
    field public static final int PROTECTION_FLAG_DOCUMENTER = 262144; // 0x40000
    field public static final int PROTECTION_FLAG_INCIDENT_REPORT_APPROVER = 1048576; // 0x100000
    field public static final int PROTECTION_FLAG_OEM = 16384; // 0x4000
    field public static final int PROTECTION_FLAG_RETAIL_DEMO = 16777216; // 0x1000000
    field public static final int PROTECTION_FLAG_SYSTEM_TEXT_CLASSIFIER = 65536; // 0x10000
    field public static final int PROTECTION_FLAG_TELEPHONY = 4194304; // 0x400000
    field public static final int PROTECTION_FLAG_VENDOR_PRIVILEGED = 32768; // 0x8000
+15 −0
Original line number Diff line number Diff line
@@ -259,6 +259,17 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable {
    @TestApi
    public static final int PROTECTION_FLAG_COMPANION = 0x800000;

    /**
     * Additional flag for {@link #protectionLevel}, corresponding
     * to the <code>retailDemo</code> value of
     * {@link android.R.attr#protectionLevel}.
     *
     * @hide
     */
    @SystemApi
    @TestApi
    public static final int PROTECTION_FLAG_RETAIL_DEMO = 0x1000000;

    /** @hide */
    @IntDef(flag = true, prefix = { "PROTECTION_FLAG_" }, value = {
            PROTECTION_FLAG_PRIVILEGED,
@@ -282,6 +293,7 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable {
            PROTECTION_FLAG_APP_PREDICTOR,
            PROTECTION_FLAG_TELEPHONY,
            PROTECTION_FLAG_COMPANION,
            PROTECTION_FLAG_RETAIL_DEMO,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface ProtectionFlags {}
@@ -528,6 +540,9 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable {
        if ((level & PermissionInfo.PROTECTION_FLAG_TELEPHONY) != 0) {
            protLevel += "|telephony";
        }
        if ((level & PermissionInfo.PROTECTION_FLAG_RETAIL_DEMO) != 0) {
            protLevel += "|retailDemo";
        }
        return protLevel;
    }

+2 −2
Original line number Diff line number Diff line
@@ -4014,9 +4014,9 @@
         statistics
         <p>Declaring the permission implies intention to use the API and the user of the
         device can grant permission through the Settings application.
         <p>Protection level: signature|privileged|development|appop -->
         <p>Protection level: signature|privileged|development|appop|retailDemo -->
    <permission android:name="android.permission.PACKAGE_USAGE_STATS"
        android:protectionLevel="signature|privileged|development|appop" />
        android:protectionLevel="signature|privileged|development|appop|retailDemo" />
    <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" />

    <!-- @hide @SystemApi Allows an application to observe usage time of apps. The app can register
+3 −0
Original line number Diff line number Diff line
@@ -301,6 +301,9 @@
        <!-- Additional flag from base permission type: this permission can be automatically
            granted to the system companion device manager service -->
        <flag name="companion" value="0x800000" />
        <!-- Additional flag from base permission type: this permission will be granted to the
             retail demo app, as defined by the OEM. -->
        <flag name="retailDemo" value="0x1000000" />
    </attr>

    <!-- Flags indicating more context for a permission group. -->
Loading