summaryrefslogtreecommitdiff
path: root/libs/androidfw/FileStream.cpp
diff options
context:
space:
mode:
author Matías Hernández <matiashe@google.com> 2023-06-28 17:46:04 +0200
committer Matías Hernández <matiashe@google.com> 2023-07-06 12:30:59 +0200
commit761c4439361a103322e50ca0a4a8f1eb51a8e46d (patch)
treeb4edd423c9d25766f1e522b423f6e801c7c8247d /libs/androidfw/FileStream.cpp
parentf0958868dde3d4c8451506c0b904e8588a520fa2 (diff)
Fix collection of Notification allPendingIntents
Notification.writeToParcel calls PendingIntent.setOnMarshaledListener() in order to "collect" all PendingIntents included anywhere inside it while serializing. This means that if _another notification_ is also serialized as part of this process, then the listener is overwritten -- and any fields written to the parcel after it will not participate in this collection. Notifications can contain other notifications (most obviously as their publicVersion, but also potentially inside any Bundle such as extras). There are two approaches to fixing this: 1) Make setOnMarshaledListener() *add* a listener instead of replacing it (renaming to add/remove). This will collect every PendingIntent wherever it is located, including recursively in other Notification objects. 2) Keep listeners exclusive but have writeToParcel() restore the previous one when exiting. This will not include other Notification objects, but also won't let those "break" the collection of their container. This CL goes with #1 because it seems the original intent of this code, collecting every PendingIntent (instead of an explicit list like contentIntent, deleteIntent, actions, etc). It also now collects the publicVersion's intents which is a bugfix. It will continue to collect PendingIntents present in whatever apps decide to stuff into extras -- but now including Notifications put in there too. Tests are added for the fixed behavior and to verify the allowlist calls from NotificationManagerService as well. Fixes: 282229007 Fixes: 289198162 Test: atest NotificationTest NotificationManagerServiceTest Change-Id: I836685c6aebe30276945e33a3dfdccd236fe89ec
Diffstat (limited to 'libs/androidfw/FileStream.cpp')
0 files changed, 0 insertions, 0 deletions