@@ -283,8 +283,10 @@ Notification.Action createShareAction(Context context, Resources r, Uri uri) {
283283 .addFlags (Intent .FLAG_GRANT_READ_URI_PERMISSION );
284284
285285 // cancel current pending intent (if any) since clipData isn't used for matching
286- PendingIntent pendingIntent = PendingIntent .getActivityAsUser (context , 0 ,
287- sharingChooserIntent , PendingIntent .FLAG_CANCEL_CURRENT , null , UserHandle .CURRENT );
286+ PendingIntent pendingIntent = PendingIntent .getActivityAsUser (
287+ context , 0 , sharingChooserIntent ,
288+ PendingIntent .FLAG_CANCEL_CURRENT | PendingIntent .FLAG_IMMUTABLE ,
289+ null , UserHandle .CURRENT );
288290
289291 // Create a share action for the notification
290292 PendingIntent shareAction = PendingIntent .getBroadcastAsUser (context , requestCode ,
@@ -296,7 +298,8 @@ Notification.Action createShareAction(Context context, Resources r, Uri uri) {
296298 mSmartActionsEnabled )
297299 .setAction (Intent .ACTION_SEND )
298300 .addFlags (Intent .FLAG_RECEIVER_FOREGROUND ),
299- PendingIntent .FLAG_CANCEL_CURRENT , UserHandle .SYSTEM );
301+ PendingIntent .FLAG_CANCEL_CURRENT | PendingIntent .FLAG_IMMUTABLE ,
302+ UserHandle .SYSTEM );
300303
301304 Notification .Action .Builder shareActionBuilder = new Notification .Action .Builder (
302305 Icon .createWithResource (r , R .drawable .ic_screenshot_share ),
@@ -325,7 +328,7 @@ Notification.Action createEditAction(Context context, Resources r, Uri uri) {
325328 editIntent .addFlags (Intent .FLAG_ACTIVITY_NEW_TASK | Intent .FLAG_ACTIVITY_CLEAR_TASK );
326329
327330 PendingIntent pendingIntent = PendingIntent .getActivityAsUser (context , 0 ,
328- editIntent , 0 , null , UserHandle .CURRENT );
331+ editIntent , PendingIntent . FLAG_IMMUTABLE , null , UserHandle .CURRENT );
329332
330333 // Make sure pending intents for the system user are still unique across users
331334 // by setting the (otherwise unused) request code to the current user id.
@@ -342,7 +345,8 @@ Notification.Action createEditAction(Context context, Resources r, Uri uri) {
342345 mSmartActionsEnabled )
343346 .setAction (Intent .ACTION_EDIT )
344347 .addFlags (Intent .FLAG_RECEIVER_FOREGROUND ),
345- PendingIntent .FLAG_CANCEL_CURRENT , UserHandle .SYSTEM );
348+ PendingIntent .FLAG_CANCEL_CURRENT | PendingIntent .FLAG_IMMUTABLE ,
349+ UserHandle .SYSTEM );
346350 Notification .Action .Builder editActionBuilder = new Notification .Action .Builder (
347351 Icon .createWithResource (r , R .drawable .ic_screenshot_edit ),
348352 r .getString (com .android .internal .R .string .screenshot_edit ), editAction );
@@ -364,7 +368,9 @@ Notification.Action createDeleteAction(Context context, Resources r, Uri uri) {
364368 .putExtra (GlobalScreenshot .EXTRA_SMART_ACTIONS_ENABLED ,
365369 mSmartActionsEnabled )
366370 .addFlags (Intent .FLAG_RECEIVER_FOREGROUND ),
367- PendingIntent .FLAG_CANCEL_CURRENT | PendingIntent .FLAG_ONE_SHOT );
371+ PendingIntent .FLAG_CANCEL_CURRENT
372+ | PendingIntent .FLAG_ONE_SHOT
373+ | PendingIntent .FLAG_IMMUTABLE );
368374 Notification .Action .Builder deleteActionBuilder = new Notification .Action .Builder (
369375 Icon .createWithResource (r , R .drawable .ic_screenshot_delete ),
370376 r .getString (com .android .internal .R .string .delete ), deleteAction );
@@ -405,7 +411,7 @@ private List<Notification.Action> buildSmartActions(
405411 PendingIntent broadcastIntent = PendingIntent .getBroadcast (context ,
406412 mRandom .nextInt (),
407413 intent ,
408- PendingIntent .FLAG_CANCEL_CURRENT );
414+ PendingIntent .FLAG_CANCEL_CURRENT | PendingIntent . FLAG_IMMUTABLE );
409415 broadcastActions .add (new Notification .Action .Builder (action .getIcon (), action .title ,
410416 broadcastIntent ).setContextual (true ).addExtras (extras ).build ());
411417 }
0 commit comments