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

Commit 73266f2f authored by Roshan Pius's avatar Roshan Pius
Browse files

Add a new wifi protection level

Wifi mainline module needs some permissions which are currently only
granted to signature components. Since mainline modules are not going to
be signed with OEM's signature, we need a new protection level to grant
some of these permissions to the wifi mainline APK.

Bug: 142234604
Test: Verified that wifi can get INTERACT_ACROSS_USERS_FULL permission
Change-Id: I26b0edff62497b5e08c2f2f504b0cd5f950682ad
parent 295e9700
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1756,6 +1756,7 @@ package android.content.pm {
    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
    field public static final int PROTECTION_FLAG_WIFI = 8388608; // 0x800000
    field @Nullable public final String backgroundPermission;
    field @StringRes public int requestRes;
  }
+1 −0
Original line number Diff line number Diff line
@@ -773,6 +773,7 @@ package android.content.pm {
    field public static final int PROTECTION_FLAG_TELEPHONY = 4194304; // 0x400000
    field public static final int PROTECTION_FLAG_VENDOR_PRIVILEGED = 32768; // 0x8000
    field public static final int PROTECTION_FLAG_WELLBEING = 131072; // 0x20000
    field public static final int PROTECTION_FLAG_WIFI = 8388608; // 0x800000
    field @Nullable public final String backgroundPermission;
  }

+15 −0
Original line number Diff line number Diff line
@@ -248,6 +248,17 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable {
    @TestApi
    public static final int PROTECTION_FLAG_TELEPHONY = 0x400000;

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

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

+1 −1
Original line number Diff line number Diff line
@@ -2955,7 +2955,7 @@
         @hide
    -->
    <permission android:name="android.permission.INTERNAL_SYSTEM_WINDOW"
        android:protectionLevel="signature|telephony" />
        android:protectionLevel="signature|telephony|wifi" />

    <!-- @SystemApi Allows an application to use
         {@link android.view.WindowManager.LayoutsParams#SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS}
+3 −0
Original line number Diff line number Diff line
@@ -298,6 +298,9 @@
        <!-- Additional flag from base permission type: this permission can be automatically
            granted to the system telephony apps -->
        <flag name="telephony" value="0x400000" />
        <!-- Additional flag from base permission type: this permission can be automatically
            granted to the system wifi app-->
        <flag name="wifi" value="0x800000" />
    </attr>

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