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
This commit is contained in:
Zak Cohen committed 2021-03-11 17:14:59 -08:00
1 parent 57e41f9fb7
commit 7575baadb4
1 file changed
+8 -1
@@ -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);
}
}
/**