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

Commit d7087b25 authored by Evan Severson's avatar Evan Severson
Browse files

Introduce new permissionFlag

The new permission flag is for restricted permissions which the
installer is not able to exempt.

Test: Install test app
Bug: 158311343
Change-Id: I7340948690ea69750ef479d1b8f0ac8a6177c98c
parent 4f30e0ba
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -12345,6 +12345,7 @@ package android.content.pm {
    field public static final int FLAG_HARD_RESTRICTED = 4; // 0x4
    field public static final int FLAG_IMMUTABLY_RESTRICTED = 16; // 0x10
    field public static final int FLAG_INSTALLED = 1073741824; // 0x40000000
    field public static final int FLAG_INSTALLER_EXEMPT_IGNORED = 32; // 0x20
    field public static final int FLAG_SOFT_RESTRICTED = 8; // 0x8
    field public static final int PROTECTION_DANGEROUS = 1; // 0x1
    field public static final int PROTECTION_FLAG_APPOP = 64; // 0x40
+13 −0
Original line number Diff line number Diff line
@@ -376,6 +376,14 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable {
     */
    public static final int FLAG_IMMUTABLY_RESTRICTED = 1<<4;

    /**
     * Flag for {@link #flags}, corresponding to <code>installerExemptIgnored</code>
     * value of {@link android.R.attr#permissionFlags}.
     *
     * <p> Modifier for permission restriction. This permission cannot be exempted by the installer.
     */
    public static final int FLAG_INSTALLER_EXEMPT_IGNORED = 1 << 5;

    /**
     * Flag for {@link #flags}, indicating that this permission has been
     * installed into the system's globally defined permissions.
@@ -655,6 +663,11 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable {
        return isHardRestricted() || isSoftRestricted();
    }

    /** @hide */
    public boolean isInstallerExemptIgnored() {
        return (flags & PermissionInfo.FLAG_INSTALLER_EXEMPT_IGNORED) != 0;
    }

    /** @hide */
    public boolean isAppOp() {
        return (protectionLevel & PermissionInfo.PROTECTION_FLAG_APPOP) != 0;
+2 −2
Original line number Diff line number Diff line
@@ -1254,7 +1254,7 @@
        android:permissionGroup="android.permission-group.UNDEFINED"
        android:label="@string/permlab_recordBackgroundAudio"
        android:description="@string/permdesc_recordBackgroundAudio"
        android:permissionFlags="hardRestricted"
        android:permissionFlags="hardRestricted|installerExemptIgnored"
        android:protectionLevel="dangerous" />

    <!-- ====================================================================== -->
@@ -1334,7 +1334,7 @@
            android:permissionGroup="android.permission-group.UNDEFINED"
            android:label="@string/permlab_backgroundCamera"
            android:description="@string/permdesc_backgroundCamera"
            android:permissionFlags="hardRestricted"
            android:permissionFlags="hardRestricted|installerExemptIgnored"
            android:protectionLevel="dangerous" />

    <!-- @SystemApi Required in addition to android.permission.CAMERA to be able to access
+5 −0
Original line number Diff line number Diff line
@@ -344,6 +344,11 @@
             the app is uninstalled.
        -->
        <flag name="immutablyRestricted" value="0x10" />
        <!--
             Modifier for permission restriction. This permission cannot
             be exempted by the installer.
        -->
        <flag name="installerExemptIgnored" value="0x20" />
    </attr>

    <!-- Specified the name of a group that this permission is associated
+1 −0
Original line number Diff line number Diff line
@@ -12345,6 +12345,7 @@ package android.content.pm {
    field public static final int FLAG_HARD_RESTRICTED = 4; // 0x4
    field public static final int FLAG_IMMUTABLY_RESTRICTED = 16; // 0x10
    field public static final int FLAG_INSTALLED = 1073741824; // 0x40000000
    field public static final int FLAG_INSTALLER_EXEMPT_IGNORED = 32; // 0x20
    field public static final int FLAG_SOFT_RESTRICTED = 8; // 0x8
    field public static final int PROTECTION_DANGEROUS = 1; // 0x1
    field public static final int PROTECTION_FLAG_APPOP = 64; // 0x40
Loading