summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/notification/NotificationManagerUtils.java
AgeCommit message (Collapse)Author
2017-08-15Add a rate limiter for Dialer notificationssail
Android only allows apps to post a maximum of 50 notifications. After this limit is exhausted no more notifications are allowed. This breaks features like incoming phone calls. This CL works around the issue by adding a rate limiter for all cases where a feature posts more than one notification: - call quality feedbakc notifications - missed call notifications - visual vociemail notifications - spam notifications The rate limit is applied on a per group basis. Each group is allowed a maximum of 10 notifications. When the limit is exceeded older notifications are cancelled until we're under the threshold. Some things to note: - the "group summary" for bundles don't count as a notification - because we're not implementing a global rate limiter it could be possible to exceed the maximum system limit. For example, if all features post their maximum number of notifications and all the "one off" notifications are shown then we could potentially be above the limit. - this CL adds groups for spam and feedback notifications. Those notifications don't have a group summary so the UI is unchanged. To enforce all of the above, all notifications must now be posted using the DialerNotificationManager class. This is a thin wrapper around the system NotificationManager API. Using the system API directly is now forbidden. Bug: 62937258 Test: NotificationRateLimiterTest PiperOrigin-RevId: 165289368 Change-Id: I40e688bea3af40d829fd32d985cf04d22f7e384a