Allow Intent.ACSD for notification action trampolines for targetSdk < S
This is the major use-case for Intent.ACTION_CLOSE_SYSTEM_DIALOGS
internally. That is, since the notification shade is not automatically
closed when the user taps a notification action whose pending intent
(PI) is not an activity PI, the app sends Intent.ACSD before starting
the activity in the trampoline. This is a legit use-case with a lot of
usages internally (and even externally if we use Stack Overflow as a
proxy), so we will allow this case for apps targeting SDK level < S.
For targetSdk S+, trampolines are blocked, so there is no valid use for
sending Intent.ACSD.
In the implementation we piggy-back on the trampoline callback, but in
this case since we're *allowing* instead of *blocking*, we allow the app
to close system dialogs when any of the tokens that allow activity
starts is the notification token, meaning that if we consider that the
app is processing a notification broadcast receiver or service, we allow
it to send Intent.ACSD assuming trampolines are not blocked (ie. that
the app targets SDK level < S).
Bug: 159105552
Test: atest CtsAppTestCases:android.app.cts.CloseSystemDialogsTest
Change-Id: Id29991ad8c7f2c6c3dca0d2d689b903de8b0ec81
4 files changed