From c57f0cb7f210fdc63d0515311c9fff41e5742b24 Mon Sep 17 00:00:00 2001 From: Matt Casey Date: Wed, 20 May 2020 14:56:28 -0400 Subject: [PATCH] Ensure screenshot edit action gets permissions for current user Previously, edit action intent was sent to ActionProxyReceiver with the SYSTEM user. It had the FLAG_GRANT_READ_URI_PERMISSION flag, but when the current user wasn't the system user, the system user wouldn't have permissions to read that URI so it didn't work. This caused Markup to fail to open the screenshot since it wasn't given permission. Bug: 148128165 Test: Validate that Markup can read/write/delete screenshot w/ secondary user. Change-Id: Ifa1d8fd195d5f777ab51972183ed6db4e6735ffd --- .../systemui/screenshot/SaveImageInBackgroundTask.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/SaveImageInBackgroundTask.java b/packages/SystemUI/src/com/android/systemui/screenshot/SaveImageInBackgroundTask.java index bc3c33d68b673..e88ce5a96f87e 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/SaveImageInBackgroundTask.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/SaveImageInBackgroundTask.java @@ -331,7 +331,7 @@ class SaveImageInBackgroundTask extends AsyncTask { int requestCode = mContext.getUserId(); // Create a edit action - PendingIntent editAction = PendingIntent.getBroadcastAsUser(context, requestCode, + PendingIntent editAction = PendingIntent.getBroadcast(context, requestCode, new Intent(context, GlobalScreenshot.ActionProxyReceiver.class) .putExtra(GlobalScreenshot.EXTRA_ACTION_INTENT, editIntent) .putExtra(GlobalScreenshot.EXTRA_CANCEL_NOTIFICATION, @@ -341,7 +341,7 @@ class SaveImageInBackgroundTask extends AsyncTask { mSmartActionsEnabled) .setAction(Intent.ACTION_EDIT) .addFlags(Intent.FLAG_RECEIVER_FOREGROUND), - PendingIntent.FLAG_CANCEL_CURRENT, UserHandle.SYSTEM); + PendingIntent.FLAG_CANCEL_CURRENT); Notification.Action.Builder editActionBuilder = new Notification.Action.Builder( Icon.createWithResource(r, R.drawable.ic_screenshot_edit), r.getString(com.android.internal.R.string.screenshot_edit), editAction);