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

Commit d049e2d7 authored by Jay Thomas Sullivan's avatar Jay Thomas Sullivan
Browse files

Add REQUESTED_PERMISSION_IMPLICIT flag

This adds a new permission flag, REQUESTED_PERMISSION_IMPLICIT, which
denotes that a permission is an implicitly-requested permission.

The concept of an implicit permission already existed (we just didn't
have a flag for it) and means that the permission acts as a "requested
permission" despite not being explicitly requested in the
AndroidManifest.xml as a <uses-permission>. For example, split
permissions result in implicit permissions, as well as a few unique
permissions.

Bug: 195016052
Test: atest ImplicitFlagTest
Change-Id: I5aaff487d653767b50fda7860d6fd0434a088dee
parent f3ff4142
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -11521,6 +11521,7 @@ package android.content.pm {
    field public static final int INSTALL_LOCATION_INTERNAL_ONLY = 1; // 0x1
    field public static final int INSTALL_LOCATION_PREFER_EXTERNAL = 2; // 0x2
    field public static final int REQUESTED_PERMISSION_GRANTED = 2; // 0x2
    field public static final int REQUESTED_PERMISSION_IMPLICIT = 4; // 0x4
    field public static final int REQUESTED_PERMISSION_NEVER_FOR_LOCATION = 65536; // 0x10000
    field public android.content.pm.ActivityInfo[] activities;
    field public android.content.pm.ApplicationInfo applicationInfo;
+7 −0
Original line number Diff line number Diff line
@@ -251,6 +251,13 @@ public class PackageInfo implements Parcelable {
     */
    public static final int REQUESTED_PERMISSION_NEVER_FOR_LOCATION = 0x00010000;

    /**
     * Flag for {@link #requestedPermissionsFlags}: the requested permission was
     * not explicitly requested via uses-permission, but was instead implicitly
     * requested (e.g., for version compatibility reasons).
     */
    public static final int REQUESTED_PERMISSION_IMPLICIT = 0x00000004;

    /**
     * Array of all signatures read from the package file. This is only filled
     * in if the flag {@link PackageManager#GET_SIGNATURES} was set. A package
+4 −0
Original line number Diff line number Diff line
@@ -293,6 +293,10 @@ public class PackageInfoWithoutStateUtils {
                        pi.requestedPermissionsFlags[i] |=
                                PackageInfo.REQUESTED_PERMISSION_NEVER_FOR_LOCATION;
                    }
                    if (pkg.getImplicitPermissions().contains(pi.requestedPermissions[i])) {
                        pi.requestedPermissionsFlags[i] |=
                                PackageInfo.REQUESTED_PERMISSION_IMPLICIT;
                    }
                }
            }
        }