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

Commit 9d42d213 authored by Gaurav Gupta's avatar Gaurav Gupta Committed by Android (Google) Code Review
Browse files

Merge "Add RAPID_CLEAR_NOTIFICATIONS_BY_LISTENER AppOp for notification cancelling" into main

parents 67494dd1 079ad11d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -656,6 +656,7 @@ package android.app {
    field public static final String OPSTR_PLAY_AUDIO = "android:play_audio";
    field public static final String OPSTR_POST_NOTIFICATION = "android:post_notification";
    field public static final String OPSTR_PROJECT_MEDIA = "android:project_media";
    field @FlaggedApi("android.view.contentprotection.flags.rapid_clear_notifications_by_listener_app_op_enabled") public static final String OPSTR_RAPID_CLEAR_NOTIFICATIONS_BY_LISTENER = "android:rapid_clear_notifications_by_listener";
    field public static final String OPSTR_READ_CLIPBOARD = "android:read_clipboard";
    field public static final String OPSTR_READ_ICC_SMS = "android:read_icc_sms";
    field public static final String OPSTR_READ_MEDIA_AUDIO = "android:read_media_audio";
+27 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.app;

import static android.permission.flags.Flags.FLAG_OP_ENABLE_MOBILE_DATA_BY_USER;
import static android.view.contentprotection.flags.Flags.FLAG_CREATE_ACCESSIBILITY_OVERLAY_APP_OP_ENABLED;
import static android.view.contentprotection.flags.Flags.FLAG_RAPID_CLEAR_NOTIFICATIONS_BY_LISTENER_APP_OP_ENABLED;

import static java.lang.Long.max;

@@ -1508,6 +1509,7 @@ public class AppOpsManager {
     */
    public static final int OP_CREATE_ACCESSIBILITY_OVERLAY =
            AppProtoEnums.APP_OP_CREATE_ACCESSIBILITY_OVERLAY;

    /**
     * Indicate that the user has enabled or disabled mobile data
     * @hide
@@ -1529,9 +1531,17 @@ public class AppOpsManager {
     */
    public static final int OP_RESERVED_FOR_TESTING = AppProtoEnums.APP_OP_RESERVED_FOR_TESTING;

    /**
     * Rapid clearing of notifications by a notification listener, see b/289080543 for details
     *
     * @hide
     */
    public static final int OP_RAPID_CLEAR_NOTIFICATIONS_BY_LISTENER =
            AppProtoEnums.APP_OP_RAPID_CLEAR_NOTIFICATIONS_BY_LISTENER;

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

    /**
     * All app ops represented as strings.
@@ -1680,6 +1690,7 @@ public class AppOpsManager {
            OPSTR_MEDIA_ROUTING_CONTROL,
            OPSTR_ENABLE_MOBILE_DATA_BY_USER,
            OPSTR_RESERVED_FOR_TESTING,
            OPSTR_RAPID_CLEAR_NOTIFICATIONS_BY_LISTENER,
    })
    public @interface AppOpString {}

@@ -2330,6 +2341,7 @@ public class AppOpsManager {
    @FlaggedApi(FLAG_CREATE_ACCESSIBILITY_OVERLAY_APP_OP_ENABLED)
    public static final String OPSTR_CREATE_ACCESSIBILITY_OVERLAY =
            "android:create_accessibility_overlay";

    /**
     * Indicate that the user has enabled or disabled mobile data
     * @hide
@@ -2350,6 +2362,16 @@ public class AppOpsManager {
    public static final String OPSTR_RESERVED_FOR_TESTING =
            "android:reserved_for_testing";

    /**
     * Rapid clearing of notifications by a notification listener, see b/289080543 for details
     *
     * @hide
     */
    @SystemApi
    @FlaggedApi(FLAG_RAPID_CLEAR_NOTIFICATIONS_BY_LISTENER_APP_OP_ENABLED)
    public static final String OPSTR_RAPID_CLEAR_NOTIFICATIONS_BY_LISTENER =
            "android:rapid_clear_notifications_by_listener";

    /** {@link #sAppOpsToNote} not initialized yet for this op */
    private static final byte SHOULD_COLLECT_NOTE_OP_NOT_INITIALIZED = 0;
    /** Should not collect noting of this app-op in {@link #sAppOpsToNote} */
@@ -2909,6 +2931,10 @@ public class AppOpsManager {
                "ENABLE_MOBILE_DATA_BY_USER").setDefaultMode(AppOpsManager.MODE_ALLOWED).build(),
        new AppOpInfo.Builder(OP_RESERVED_FOR_TESTING, OPSTR_RESERVED_FOR_TESTING,
                "OP_RESERVED_FOR_TESTING").setDefaultMode(AppOpsManager.MODE_ALLOWED).build(),
        new AppOpInfo.Builder(OP_RAPID_CLEAR_NOTIFICATIONS_BY_LISTENER,
                OPSTR_RAPID_CLEAR_NOTIFICATIONS_BY_LISTENER,
                "RAPID_CLEAR_NOTIFICATIONS_BY_LISTENER")
                .setDefaultMode(AppOpsManager.MODE_ALLOWED).build(),
    };

    // The number of longs needed to form a full bitmask of app ops
+7 −0
Original line number Diff line number Diff line
@@ -27,3 +27,10 @@ flag {
    description: "If true, an appop is logged on creation of accessibility overlays."
    bug: "289081465"
}

flag {
    name: "rapid_clear_notifications_by_listener_app_op_enabled"
    namespace: "content_protection"
    description: "If true, an appop is logged when a notification is rapidly cleared by a notification listener."
    bug: "289080543"
}