Fix BAL via notification.publicVersion

We stripped the token that allows app to retrieve their own notification
and fire their own PI to launch activities from background. But we
forgot to strip the token from notification.publicVersion

Bug: 278558814
Test: NotificationManagerTest#testActivityStartFromRetrievedNotification_isBlocked
Merged-In: I8f25d7a5e47890a0496af023149717e1df482f98
Change-Id: I8f25d7a5e47890a0496af023149717e1df482f98
This commit is contained in:
Nan Wu
2023-06-16 14:42:24 +00:00
parent 920307da3a
commit e79cbff7f8
2 changed files with 6 additions and 3 deletions

View File

@@ -3476,8 +3476,11 @@ public class Notification implements Parcelable
*
* @hide
*/
public void setAllowlistToken(@Nullable IBinder token) {
mAllowlistToken = token;
public void clearAllowlistToken() {
mAllowlistToken = null;
if (publicVersion != null) {
publicVersion.clearAllowlistToken();
}
}
/**

View File

@@ -4442,7 +4442,7 @@ public class NotificationManagerService extends SystemService {
// Remove background token before returning notification to untrusted app, this
// ensures the app isn't able to perform background operations that are
// associated with notification interactions.
notification.setAllowlistToken(null);
notification.clearAllowlistToken();
return new StatusBarNotification(
sbn.getPackageName(),
sbn.getOpPkg(),