diff options
| author | Bernardo Rufino <brufino@google.com> | 2021-05-26 16:25:39 +0100 |
|---|---|---|
| committer | Bernardo Rufino <brufino@google.com> | 2021-05-26 16:25:39 +0100 |
| commit | 5fbeff59df3ea1441c3843aa1834616876ef1985 (patch) | |
| tree | 218104eca5d76769005e10d3cb4dce089b6ef47a /core/java | |
| parent | 5044308999beb63b1ee9148a99e136b212e41170 (diff) | |
Fix background bypass via notifications
Apps were able to bypass BAL and BG-FGS restrictions by retrieving their
own notifications and firing their PI since those were allowlisted for
those operations.
Now we strip the token that granted them that ability
from notifications returned via NM.getActiveNotifications(), which
returns the notifications of the caller.
Notifications returned via notification listener APIs still contain such
token, as they should.
Bug: 185388103
Bug: 169821287
Test: atest -d android.app.cts.NotificationManagerTest#testActivityStartFromRetrievedNotification_isBlocked
Change-Id: I2ede0d639a560f6acacec3864a0a7d23af152ba5
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/app/Notification.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 18651411cf13..6c68d97d5d15 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -3314,6 +3314,19 @@ public class Notification implements Parcelable } /** + * Sets the token used for background operations for the pending intents associated with this + * notification. + * + * This token is automatically set during deserialization for you, you usually won't need to + * call this unless you want to change the existing token, if any. + * + * @hide + */ + public void setAllowlistToken(@Nullable IBinder token) { + mAllowlistToken = token; + } + + /** * @hide */ public static void addFieldsFromContext(Context context, Notification notification) { |
