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

Commit db3a0b49 authored by Jan Tomljanovic's avatar Jan Tomljanovic Committed by Android (Google) Code Review
Browse files

Merge "Switch to controling if toast rate limiting is enabled using TestApi."

parents a55149d9 5bf3a60e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android {
    field public static final String MANAGE_CRATES = "android.permission.MANAGE_CRATES";
    field public static final String MANAGE_NOTIFICATION_LISTENERS = "android.permission.MANAGE_NOTIFICATION_LISTENERS";
    field public static final String MANAGE_ROLLBACKS = "android.permission.MANAGE_ROLLBACKS";
    field public static final String MANAGE_TOAST_RATE_LIMITING = "android.permission.MANAGE_TOAST_RATE_LIMITING";
    field public static final String MODIFY_REFRESH_RATE_SWITCHING_TYPE = "android.permission.MODIFY_REFRESH_RATE_SWITCHING_TYPE";
    field public static final String NETWORK_SETTINGS = "android.permission.NETWORK_SETTINGS";
    field public static final String NETWORK_STACK = "android.permission.NETWORK_STACK";
@@ -274,6 +275,7 @@ package android.app {
    method public boolean isNotificationPolicyAccessGrantedForPackage(@NonNull String);
    method public boolean matchesCallFilter(android.os.Bundle);
    method @RequiresPermission(android.Manifest.permission.MANAGE_NOTIFICATION_LISTENERS) public void setNotificationListenerAccessGranted(@NonNull android.content.ComponentName, boolean, boolean);
    method @RequiresPermission(android.Manifest.permission.MANAGE_TOAST_RATE_LIMITING) public void setToastRateLimitingEnabled(boolean);
    method public void updateNotificationChannel(@NonNull String, int, @NonNull android.app.NotificationChannel);
  }

+2 −0
Original line number Diff line number Diff line
@@ -228,4 +228,6 @@ interface INotificationManager

    NotificationListenerFilter getListenerFilter(in ComponentName cn, int userId);
    void setListenerFilter(in ComponentName cn, int userId, in NotificationListenerFilter nlf);

    void setToastRateLimitingEnabled(boolean enable);
}
+17 −0
Original line number Diff line number Diff line
@@ -1729,6 +1729,23 @@ public class NotificationManager {
        }
    }

    /**
     * Controls whether toast rate limiting is enabled for the calling uid.
     *
     * @param enable true to enable toast rate limiting, false to disable it
     * @hide
     */
    @TestApi
    @RequiresPermission(android.Manifest.permission.MANAGE_TOAST_RATE_LIMITING)
    public void setToastRateLimitingEnabled(boolean enable) {
        INotificationManager service = getService();
        try {
            service.setToastRateLimitingEnabled(enable);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Notification policy configuration.  Represents user-preferences for notification
     * filtering.
+6 −0
Original line number Diff line number Diff line
@@ -5317,6 +5317,12 @@
    <permission android:name="android.permission.BIND_IMPRESSION_ATTESTATION_SERVICE"
        android:protectionLevel="signature" />

    <!-- @hide @TestApi Allows an application to enable/disable toast rate limiting.
         <p>Not for use by third-party applications.
    -->
    <permission android:name="android.permission.MANAGE_TOAST_RATE_LIMITING"
                android:protectionLevel="signature" />

    <!-- Attribution for Geofencing service. -->
    <attribution android:tag="GeofencingService" android:label="@string/geofencing_service"/>
    <!-- Attribution for Country Detector. -->
+3 −0
Original line number Diff line number Diff line
@@ -379,6 +379,9 @@
    <uses-permission android:name="android.permission.WIFI_ACCESS_COEX_UNSAFE_CHANNELS" />
    <uses-permission android:name="android.permission.WIFI_UPDATE_COEX_UNSAFE_CHANNELS" />

    <!-- Permission required for CTS tests to enable/disable rate limiting toasts. -->
    <uses-permission android:name="android.permission.MANAGE_TOAST_RATE_LIMITING" />

    <application android:label="@string/app_label"
                android:theme="@android:style/Theme.DeviceDefault.DayNight"
                android:defaultToDeviceProtectedStorage="true"
Loading