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

Commit 810d4844 authored by Svet Ganov's avatar Svet Ganov Committed by Todd Kennedy
Browse files

Add an API for launching intent to view permission usage.

Adding a new intent acttion for the permission controller to ask an
app to show its permission usage to help the user understand what
and why is being used. We are adding a permission to protect this
action to prevent apps trampolining into other apps when asked to
show their permission usge.

Test: compiles

bug:131760942

Change-Id: I5217d6319fd98d40c8879bdd7af5fe466bf9143e
parent a49ff8b6
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -143,6 +143,7 @@ package android {
    field public static final String SET_WALLPAPER_HINTS = "android.permission.SET_WALLPAPER_HINTS";
    field public static final String SIGNAL_PERSISTENT_PROCESSES = "android.permission.SIGNAL_PERSISTENT_PROCESSES";
    field public static final String SMS_FINANCIAL_TRANSACTIONS = "android.permission.SMS_FINANCIAL_TRANSACTIONS";
    field public static final String START_VIEW_PERMISSION_USAGE = "android.permission.START_VIEW_PERMISSION_USAGE";
    field public static final String STATUS_BAR = "android.permission.STATUS_BAR";
    field public static final String SYSTEM_ALERT_WINDOW = "android.permission.SYSTEM_ALERT_WINDOW";
    field public static final String TRANSMIT_IR = "android.permission.TRANSMIT_IR";
@@ -10326,6 +10327,7 @@ package android.content {
    field public static final String ACTION_USER_UNLOCKED = "android.intent.action.USER_UNLOCKED";
    field public static final String ACTION_VIEW = "android.intent.action.VIEW";
    field public static final String ACTION_VIEW_LOCUS = "android.intent.action.VIEW_LOCUS";
    field @RequiresPermission(android.Manifest.permission.START_VIEW_PERMISSION_USAGE) public static final String ACTION_VIEW_PERMISSION_USAGE = "android.intent.action.VIEW_PERMISSION_USAGE";
    field public static final String ACTION_VOICE_COMMAND = "android.intent.action.VOICE_COMMAND";
    field @Deprecated public static final String ACTION_WALLPAPER_CHANGED = "android.intent.action.WALLPAPER_CHANGED";
    field public static final String ACTION_WEB_SEARCH = "android.intent.action.WEB_SEARCH";
+25 −0
Original line number Diff line number Diff line
@@ -1880,6 +1880,31 @@ public class Intent implements Parcelable, Cloneable {
    public static final String ACTION_REVIEW_PERMISSIONS =
            "android.intent.action.REVIEW_PERMISSIONS";

    /**
     * Activity action: Launch UI to show information about the usage
     * of a given permission. This action would be handled by apps that
     * want to show details about how and why given permission is being
     * used.
     * <p>
     * <strong>Important:</strong>You must protect the activity that handles
     * this action with the {@link android.Manifest.permission#START_VIEW_PERMISSION_USAGE
     *  START_VIEW_PERMISSION_USAGE} permission to ensure that only the
     * system can launch this activity. The system will not launch
     * activities that are not properly protected.
     *
     * <p>
     * Input: {@code android.intent.extra.PERMISSION_NAME} specifies the permission
     * for which the launched UI would be targeted.
     * </p>
     * <p>
     * Output: Nothing.
     * </p>
     */
    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    @RequiresPermission(android.Manifest.permission.START_VIEW_PERMISSION_USAGE)
    public static final String ACTION_VIEW_PERMISSION_USAGE =
            "android.intent.action.VIEW_PERMISSION_USAGE";

    /**
     * Activity action: Launch UI to manage a default app.
     * <p>
+9 −0
Original line number Diff line number Diff line
@@ -4212,6 +4212,15 @@
        android:description="@string/permdesc_bindCarrierServices"
        android:protectionLevel="signature|privileged" />

    <!--
        Allows the holder to start the permission usage screen for an app.
        <p>Protection level: signature|installer
    -->
    <permission android:name="android.permission.START_VIEW_PERMISSION_USAGE"
        android:label="@string/permlab_startViewPermissionUsage"
        android:description="@string/permdesc_startViewPermissionUsage"
        android:protectionLevel="signature|installer" />

    <!-- Allows an application to query whether DO_NOT_ASK_CREDENTIALS_ON_BOOT
         flag is set.
         @hide -->
+5 −0
Original line number Diff line number Diff line
@@ -1726,6 +1726,11 @@
    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
    <string name="permdesc_access_notification_policy">Allows the app to read and write Do Not Disturb configuration.</string>

    <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
    <string name="permlab_startViewPermissionUsage">start view permission usage</string>
    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
    <string name="permdesc_startViewPermissionUsage">Allows the holder to start the permission usage for an app. Should never be needed for normal apps.</string>

    <!-- Policy administration -->

    <!-- Title of policy access to limiting the user's password choices -->