From 73a873f23510713002ba038f22df1104b4320e61 Mon Sep 17 00:00:00 2001 From: Matt Pietal Date: Fri, 15 Mar 2019 08:46:20 -0400 Subject: [PATCH] Sharesheet - Profile switching & permissions Need to make sure all content uris have the userid prepended in them, otherwise when switching profiles the chooser will be denied access. This is needed for content preview in the chooser itself. Bug: 128597855 Test: atest ChooserActivityTest Change-Id: Id835c7b443c1c5a83a8bf61d0545d86e32e92bfc --- core/java/com/android/internal/app/ChooserActivity.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java index f250666012f68..faf0c7dbed375 100644 --- a/core/java/com/android/internal/app/ChooserActivity.java +++ b/core/java/com/android/internal/app/ChooserActivity.java @@ -680,7 +680,7 @@ public class ChooserActivity extends ResolverActivity { & DocumentsContract.Document.FLAG_SUPPORTS_THUMBNAIL) != 0; } } - } catch (SecurityException e) { + } catch (SecurityException | NullPointerException e) { Log.w(TAG, "Error loading file preview", e); } @@ -918,6 +918,8 @@ public class ChooserActivity extends ResolverActivity { if (isSendAction(in)) { in.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT | Intent.FLAG_ACTIVITY_MULTIPLE_TASK); + + in.fixUris(getUserId()); } }