From 07d0e4df96d0215970a84a8f1a0369a034bb4b3c Mon Sep 17 00:00:00 2001 From: Ashwini Oruganti Date: Sun, 6 Dec 2020 20:35:52 -0800 Subject: [PATCH] NotificationManagerServiceTest: Mark unaudited PendingIntents with FLAG_MUTABLE_UNAUDITED These PIs need an explicit mutability flag. This temporay flag is being used to mark these points in code and should be replaced ASAP. See go/immutable-pendingintents for more context. Bug: 160794467 Test: TH Exempt-From-Owner-Approval: noop change Change-Id: Ice453974aafd943722c0ad44e017fdf1ca3237a9 --- .../NotificationManagerServiceTest.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java index 762ec93712cbd..849477c924bbc 100755 --- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java @@ -790,7 +790,10 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { .setName("bubblebot") .build(); RemoteInput remoteInput = new RemoteInput.Builder("reply_key").setLabel("reply").build(); - PendingIntent inputIntent = PendingIntent.getActivity(mContext, 0, new Intent(), 0); + // TODO(b/174965245) Please replace FLAG_MUTABLE_UNAUDITED below + // with either FLAG_IMMUTABLE (recommended) or FLAG_MUTABLE. + PendingIntent inputIntent = PendingIntent.getActivity(mContext, 0, new Intent(), + PendingIntent.FLAG_MUTABLE_UNAUDITED); Icon icon = Icon.createWithResource(mContext, android.R.drawable.sym_def_app_icon); Notification.Action replyAction = new Notification.Action.Builder(icon, "Reply", inputIntent).addRemoteInput(remoteInput) @@ -7366,7 +7369,10 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { NotificationRecord r = generateNotificationRecord(mTestNotificationChannel); ArrayList extraAction = new ArrayList<>(); RemoteInput remoteInput = new RemoteInput.Builder("reply_key").setLabel("reply").build(); - PendingIntent inputIntent = PendingIntent.getActivity(mContext, 0, new Intent(), 0); + // TODO(b/174965245) Please replace FLAG_MUTABLE_UNAUDITED below + // with either FLAG_IMMUTABLE (recommended) or FLAG_MUTABLE. + PendingIntent inputIntent = PendingIntent.getActivity(mContext, 0, new Intent(), + PendingIntent.FLAG_MUTABLE_UNAUDITED); Icon icon = Icon.createWithResource(mContext, android.R.drawable.sym_def_app_icon); Notification.Action replyAction = new Notification.Action.Builder(icon, "Reply", inputIntent).addRemoteInput(remoteInput) @@ -7396,7 +7402,10 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { NotificationRecord r = generateNotificationRecord(mTestNotificationChannel); ArrayList extraAction = new ArrayList<>(); RemoteInput remoteInput = new RemoteInput.Builder("reply_key").setLabel("reply").build(); - PendingIntent inputIntent = PendingIntent.getActivity(mContext, 0, new Intent(), 0); + // TODO(b/174965245) Please replace FLAG_MUTABLE_UNAUDITED below + // with either FLAG_IMMUTABLE (recommended) or FLAG_MUTABLE. + PendingIntent inputIntent = PendingIntent.getActivity(mContext, 0, new Intent(), + PendingIntent.FLAG_MUTABLE_UNAUDITED); Icon icon = Icon.createWithResource(mContext, android.R.drawable.sym_def_app_icon); Notification.Action replyAction = new Notification.Action.Builder(icon, "Reply", inputIntent).addRemoteInput(remoteInput)