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

Commit a965e847 authored by Alison Cichowlas's avatar Alison Cichowlas
Browse files

Add appop permission for Promoted Notifications/Live Updates.

Flag: android.app.api_rich_ongoing_permission
Test: CTS tests in topic
Bug: 410619264

Change-Id: I001965f5fa7f399f1300c37732b9c41d1cd67766
parent 4119f012
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -244,6 +244,7 @@ package android {
    field public static final String PACKAGE_USAGE_STATS = "android.permission.PACKAGE_USAGE_STATS";
    field @Deprecated public static final String PERSISTENT_ACTIVITY = "android.permission.PERSISTENT_ACTIVITY";
    field public static final String POST_NOTIFICATIONS = "android.permission.POST_NOTIFICATIONS";
    field @FlaggedApi("android.app.api_rich_ongoing_permission") public static final String POST_PROMOTED_NOTIFICATIONS = "android.permission.POST_PROMOTED_NOTIFICATIONS";
    field @Deprecated public static final String PROCESS_OUTGOING_CALLS = "android.permission.PROCESS_OUTGOING_CALLS";
    field public static final String PROVIDE_OWN_AUTOFILL_SUGGESTIONS = "android.permission.PROVIDE_OWN_AUTOFILL_SUGGESTIONS";
    field public static final String PROVIDE_REMOTE_CREDENTIALS = "android.permission.PROVIDE_REMOTE_CREDENTIALS";
+31 −2
Original line number Diff line number Diff line
@@ -1505,6 +1505,15 @@ public class AppOpsManager {
     */
    public static final int OP_USE_FULL_SCREEN_INTENT = AppOpEnums.APP_OP_USE_FULL_SCREEN_INTENT;

    /**
     * Post promoted notifications in the notification shade and status bar chips.
     *
     * @hide
     */
    public static final int OP_POST_PROMOTED_NOTIFICATIONS =
            AppOpEnums.APP_OP_POST_PROMOTED_NOTIFICATIONS;


    /**
     * Hides camera indicator for sandboxed detection apps that directly access the service.
     *
@@ -1708,7 +1717,7 @@ public class AppOpsManager {

    /** @hide */
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    public static final int _NUM_OP = 163;
    public static final int _NUM_OP = 164;

    /**
     * All app ops represented as strings.
@@ -1875,6 +1884,7 @@ public class AppOpsManager {
            OPSTR_HEAD_TRACKING,
            OPSTR_SCENE_UNDERSTANDING_COARSE,
            OPSTR_SCENE_UNDERSTANDING_FINE,
            OPSTR_POST_PROMOTED_NOTIFICATIONS
    })
    public @interface AppOpString {}

@@ -2517,6 +2527,14 @@ public class AppOpsManager {
     */
    public static final String OPSTR_USE_FULL_SCREEN_INTENT = "android:use_full_screen_intent";

    /**
     * Permission to post promoted notifications.
     *
     * @hide
     */
    public static final String OPSTR_POST_PROMOTED_NOTIFICATIONS =
            "android:post_promoted_notifications";

    /**
     * Allows the assistant app to be voice-triggered by detected hotwords from a trusted detection
     * service.
@@ -2798,6 +2816,8 @@ public class AppOpsManager {
            OP_MEDIA_ROUTING_CONTROL,
            OP_READ_SYSTEM_GRAMMATICAL_GENDER,
            OP_WRITE_SYSTEM_PREFERENCES,
            android.app.Flags.apiRichOngoingPermission()
                    ? OP_POST_PROMOTED_NOTIFICATIONS : OP_NONE,
    };

    @SuppressWarnings("FlaggedApi")
@@ -3329,6 +3349,11 @@ public class AppOpsManager {
                .setPermission(android.xr.Flags.xrManifestEntries()
                    ? Manifest.permission.SCENE_UNDERSTANDING_FINE : null)
                .build(),
        new AppOpInfo.Builder(OP_POST_PROMOTED_NOTIFICATIONS, OPSTR_POST_PROMOTED_NOTIFICATIONS,
                "POST_PROMOTED_NOTIFICATIONS")
                .setPermission(android.app.Flags.apiRichOngoingPermission()
                        ? Manifest.permission.POST_PROMOTED_NOTIFICATIONS : null)
                .build(),
    };

    // The number of longs needed to form a full bitmask of app ops
@@ -3396,6 +3421,10 @@ public class AppOpsManager {
            }
        }
        for (int op : APP_OP_PERMISSION_UID_OPS) {
            if (op == OP_NONE) {
                // Skip ops with a disabled feature flag.
                continue;
            }
            if (sAppOpInfos[op].permission != null) {
                sPermToOp.put(sAppOpInfos[op].permission, op);
            }
@@ -3590,7 +3619,7 @@ public class AppOpsManager {
     * @hide
     */
    public static boolean opIsUidAppOpPermission(int op) {
        return ArrayUtils.contains(APP_OP_PERMISSION_UID_OPS, op);
        return op != OP_NONE && ArrayUtils.contains(APP_OP_PERMISSION_UID_OPS, op);
    }

    /**
+8 −0
Original line number Diff line number Diff line
@@ -305,6 +305,14 @@ flag {
  bug: "337261753"
}

flag {
  name: "api_rich_ongoing_permission"
  namespace: "systemui"
  description: "[RONs] Guards new Q4 permission for RONs API"
  bug: "337261753"
  is_exported: true
}

flag {
  name: "ui_rich_ongoing"
  is_exported: true
+10 −0
Original line number Diff line number Diff line
@@ -8178,6 +8178,16 @@
                android:description="@string/permdesc_fullScreenIntent"
                android:protectionLevel="normal|appop" />

    <!-- Required for apps to post promoted notifications.
         <p>Protection level: normal|appops
         @FlaggedApi(android.app.Flags.FLAG_API_RICH_ONGOING_PERMISSION)
         -->
    <permission android:name="android.permission.POST_PROMOTED_NOTIFICATIONS"
        android:label="@string/permlab_postPromotedNotifications"
        android:description="@string/permdesc_postPromotedNotifications"
        android:protectionLevel="normal|appop"
        android:featureFlag="android.app.api_rich_ongoing_permission"/>

    <!-- @SystemApi Required for the privileged assistant apps targeting
         {@link android.os.Build.VERSION_CODES#VANILLA_ICE_CREAM}
         that receive voice trigger from a sandboxed {@link HotwordDetectionService}.
+5 −0
Original line number Diff line number Diff line
@@ -1095,6 +1095,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_fullScreenIntent">Allows the app to display notifications as full screen activities on a locked device</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_postPromotedNotifications">Show live updates</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_postPromotedNotifications">Allows the app to display ongoing, time-sensitive notifications on the status bar and lock screen</string>
    <!-- Title of an application permission, listed so the user can install application shortcuts
    in their Launcher -->
    <string name="permlab_install_shortcut">install shortcuts</string>
Loading