Implement rate limiting toasts.
We rate limit showing toasts on a per package basis. Each time the app
hits the limit, any further toast attempted to be shown will be
discarded. Specific rate limits are designed in a way such that if the
app continuously posts toasts, the period for which it will be blocked
from posting gradually increases each time it hits the limit.
Test: atest android.widget.cts.ToastTest
Test: atest NotificationManagerServiceTest
Bug: 154198299
Change-Id: I41656745cbd4e6cb6650cf4100ca32a09dc67810
3 files changed