From 864524af17bb8ffd2ecbbc721add6b678b63d686 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Tue, 20 Oct 2020 16:20:52 -0600 Subject: Apply FLAG_IMMUTABLE to various PendingIntents. Some careful spot-checking has revealed common cases where it's reasonable to blanket apply the new FLAG_IMMUTABLE option to newly created PendingIntents. Specifically these situations: -- Simple notification content clicks are immutable; there's no need to communicate customized data back to the creator -- Simple notification action clicks are immutable; there's no need to communicate customized data back to the creator -- Broadcast intents sent by AlarmManager are immutable; the system dispatches them without customization. Bug: 170165227, 170424283, 170425388, 170425877 Bug: 169791183, 170771965, 170226088, 170224928, 170767530 Test: none Change-Id: I5ed68710d2ccad4635a30fd91136a9e6ad76a01d --- packages/Shell/src/com/android/shell/BugreportProgressService.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'packages/Shell/src') diff --git a/packages/Shell/src/com/android/shell/BugreportProgressService.java b/packages/Shell/src/com/android/shell/BugreportProgressService.java index 0eac4add7b09..02751e27874d 100644 --- a/packages/Shell/src/com/android/shell/BugreportProgressService.java +++ b/packages/Shell/src/com/android/shell/BugreportProgressService.java @@ -737,18 +737,20 @@ public class BugreportProgressService extends Service { final Intent infoIntent = new Intent(mContext, BugreportProgressService.class); infoIntent.setAction(INTENT_BUGREPORT_INFO_LAUNCH); infoIntent.putExtra(EXTRA_ID, info.id); + // Simple notification action button clicks are immutable final PendingIntent infoPendingIntent = PendingIntent.getService(mContext, info.id, infoIntent, - PendingIntent.FLAG_UPDATE_CURRENT); + PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE); final Action infoAction = new Action.Builder(null, mContext.getString(R.string.bugreport_info_action), infoPendingIntent).build(); final Intent screenshotIntent = new Intent(mContext, BugreportProgressService.class); screenshotIntent.setAction(INTENT_BUGREPORT_SCREENSHOT); screenshotIntent.putExtra(EXTRA_ID, info.id); + // Simple notification action button clicks are immutable PendingIntent screenshotPendingIntent = mTakingScreenshot ? null : PendingIntent .getService(mContext, info.id, screenshotIntent, - PendingIntent.FLAG_UPDATE_CURRENT); + PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE); final Action screenshotAction = new Action.Builder(null, mContext.getString(R.string.bugreport_screenshot_action), screenshotPendingIntent).build(); -- cgit v1.2.3-59-g8ed1b