Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6c454f67 authored by Winson Chung's avatar Winson Chung
Browse files

Ensure the ActionProxyReceiver runs as the system user

- Secondary users have a SysUI process but no status bar, so we need to
  actually call executeRunnableDismissingKeyguard() from the system user.
  (The actual call to start the proxied activity will still be handled as
  the current user though)

Bug: 72459081
Test: Switch to secondary user, take screenshot and then try to share/edit
Change-Id: Id7bcd6f9090412902d90566de074d1c2f235b8d6
parent 191f146b
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -301,11 +301,11 @@ class SaveImageInBackgroundTask extends AsyncTask<Void, Void, Void> {
                    .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);

            // Create a share action for the notification
            PendingIntent shareAction = PendingIntent.getBroadcast(context, 0,
            PendingIntent shareAction = PendingIntent.getBroadcastAsUser(context, 0,
                    new Intent(context, GlobalScreenshot.ActionProxyReceiver.class)
                            .putExtra(EXTRA_ACTION_INTENT, sharingChooserIntent)
                            .putExtra(EXTRA_DISALLOW_ENTER_PIP, true),
                    PendingIntent.FLAG_CANCEL_CURRENT);
                    PendingIntent.FLAG_CANCEL_CURRENT, UserHandle.SYSTEM);
            Notification.Action.Builder shareActionBuilder = new Notification.Action.Builder(
                    R.drawable.ic_screenshot_share,
                    r.getString(com.android.internal.R.string.share), shareAction);
@@ -324,11 +324,11 @@ class SaveImageInBackgroundTask extends AsyncTask<Void, Void, Void> {
            editIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);

            // Create a edit action
            PendingIntent editAction = PendingIntent.getBroadcast(context, 1,
            PendingIntent editAction = PendingIntent.getBroadcastAsUser(context, 1,
                    new Intent(context, GlobalScreenshot.ActionProxyReceiver.class)
                            .putExtra(EXTRA_ACTION_INTENT, editIntent)
                            .putExtra(EXTRA_CANCEL_NOTIFICATION, editIntent.getComponent() != null),
                    PendingIntent.FLAG_CANCEL_CURRENT);
                    PendingIntent.FLAG_CANCEL_CURRENT, UserHandle.SYSTEM);
            Notification.Action.Builder editActionBuilder = new Notification.Action.Builder(
                    R.drawable.ic_screenshot_edit,
                    r.getString(com.android.internal.R.string.screenshot_edit), editAction);