From 7575baadb48bce1529d3c924962c61234608fd8e Mon Sep 17 00:00:00 2001 From: Zak Cohen Date: Fri, 5 Feb 2021 17:04:27 -0800 Subject: [PATCH] Overview - make drag share targets work with Work Profile Start the destination as the correct user, and fix the uris as its leaving. Bug: 179162353 Test: flash with WP and regular, test both targets Change-Id: I49c980c5d08843ad221a9b92816351a22ea58990 --- .../src/com/android/quickstep/util/ImageActionUtils.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/util/ImageActionUtils.java b/quickstep/src/com/android/quickstep/util/ImageActionUtils.java index d022085877..0f2d778623 100644 --- a/quickstep/src/com/android/quickstep/util/ImageActionUtils.java +++ b/quickstep/src/com/android/quickstep/util/ImageActionUtils.java @@ -99,7 +99,14 @@ public class ImageActionUtils { .putExtra(Intent.EXTRA_STREAM, uri) .putExtra(Intent.EXTRA_SHORTCUT_ID, shortcutInfo.getId()) .setClipData(clipdata); - context.startActivity(intent); + + if (context.getUserId() != appTarget.getUser().getIdentifier()) { + intent.prepareToLeaveUser(context.getUserId()); + intent.fixUris(context.getUserId()); + context.startActivityAsUser(intent, appTarget.getUser()); + } else { + context.startActivity(intent); + } } /**