diff options
| author | 2024-04-19 14:27:39 -0400 | |
|---|---|---|
| committer | 2024-04-23 16:51:41 -0400 | |
| commit | d1b19e513ade6007688ff3afd55b531cff9219be (patch) | |
| tree | a0843e88384a4b63477eb033888d7d640cb3e312 /java/src | |
| parent | b4b571d55554ce2d0c1120f920195d792d3cfccd (diff) | |
Fix incorrect cross-profile share check.
When this code was updated for new profiles infrastructure (ag/26444390)
a mistake was made in the interpretation of (tabOwnerUserHandleForLaunch),
mistaking it for 'tabOwner', ie: the user of the tab being presented. It
is not. This value represents the user which launched share sheet.
As a result, since this CL, no cross-profile "Blocked by IT" messages
would appear when no targets are available for cross-profile sharing.
The resulting UI would show an empty tab, or fall back to the "No Apps"
UI message.
While the UI has test coverage for this, the tests are run by forcing
calls to the reponsible component to return true or false, without
validation of the user ids provided.
Bug: 335142494
Test: atest IntentResolver-tests-unit
Flag: NONE
Change-Id: I32f455611e6ae6307d49c86d480962e3426b54c3
Diffstat (limited to 'java/src')
| -rw-r--r-- | java/src/com/android/intentresolver/ResolverListAdapter.java | 2 | ||||
| -rw-r--r-- | java/src/com/android/intentresolver/emptystate/NoCrossProfileEmptyStateProvider.java | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/java/src/com/android/intentresolver/ResolverListAdapter.java b/java/src/com/android/intentresolver/ResolverListAdapter.java index 9843cf8d..2a8fcfa4 100644 --- a/java/src/com/android/intentresolver/ResolverListAdapter.java +++ b/java/src/com/android/intentresolver/ResolverListAdapter.java @@ -840,7 +840,7 @@ public class ResolverListAdapter extends BaseAdapter { userHandle); } - public final List<Intent> getIntents() { + public List<Intent> getIntents() { // TODO: immutable copy? return mIntents; } diff --git a/java/src/com/android/intentresolver/emptystate/NoCrossProfileEmptyStateProvider.java b/java/src/com/android/intentresolver/emptystate/NoCrossProfileEmptyStateProvider.java index e6d5d1c4..2b4a7ada 100644 --- a/java/src/com/android/intentresolver/emptystate/NoCrossProfileEmptyStateProvider.java +++ b/java/src/com/android/intentresolver/emptystate/NoCrossProfileEmptyStateProvider.java @@ -34,8 +34,8 @@ import com.android.intentresolver.shared.model.User; import java.util.List; /** - * Empty state provider that does not allow cross profile sharing, it will return a blocker - * in case if the profile of the current tab is not the same as the profile of the calling app. + * Empty state provider that informs about a lack of cross profile sharing. It will return + * an empty state in case there are no intents which can be forwarded to another profile. */ public class NoCrossProfileEmptyStateProvider implements EmptyStateProvider { @@ -79,7 +79,8 @@ public class NoCrossProfileEmptyStateProvider implements EmptyStateProvider { // Allow access to the tab when launched by the same user as the tab owner // or when there is at least one target which is permitted for cross-profile. - if (launchedAsSameUser || anyCrossProfileAllowedIntents(adapter, tabOwnerHandle)) { + if (launchedAsSameUser || anyCrossProfileAllowedIntents(adapter, + /* source = */ launchedAs.getHandle())) { return null; } |