summaryrefslogtreecommitdiff
path: root/java/tests
diff options
context:
space:
mode:
author 1 <mrcasey@google.com> 2023-05-08 15:23:54 +0000
committer 1 <mrcasey@google.com> 2023-05-09 14:08:51 +0000
commit79ca9efe77bf5324bcf6c6ca17f519e2eedbff86 (patch)
treef4d1e497a1622a2c7556c940826e18083b30d268 /java/tests
parentd572ef6c2ba73880edecd66c86835e78763d9400 (diff)
Make app-provided chooser targets only show in the default profile
Previously if, say, a work-profile app injected a chooser target, that target would show in *both* profiles, but showing it in the opposite (personal) profile doesn't really make sense since and uses up direct share space. The placement of this code is highly-suspect but I'm avoiding changing that in this CL given the proximity to release. Bug: 280517912 Test: atest UnbundledChooserActivity Change-Id: Ia73699cde6347cd300eae388a42a2433b3840d63
Diffstat (limited to 'java/tests')
-rw-r--r--java/tests/src/com/android/intentresolver/UnbundledChooserActivityTest.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/java/tests/src/com/android/intentresolver/UnbundledChooserActivityTest.java b/java/tests/src/com/android/intentresolver/UnbundledChooserActivityTest.java
index 7c4838a2..7b925bce 100644
--- a/java/tests/src/com/android/intentresolver/UnbundledChooserActivityTest.java
+++ b/java/tests/src/com/android/intentresolver/UnbundledChooserActivityTest.java
@@ -1651,7 +1651,8 @@ public class UnbundledChooserActivityTest {
// We need app targets for direct targets to get displayed
List<ResolvedComponentInfo> resolvedComponentInfos = createResolvedComponentsForTest(2);
- setupResolverControllers(resolvedComponentInfos);
+ setupResolverControllers(resolvedComponentInfos, resolvedComponentInfos);
+ markWorkProfileUserAvailable();
// set caller-provided target
Intent chooserIntent = Intent.createChooser(createSendTextIntent(), null);
@@ -1707,6 +1708,17 @@ public class UnbundledChooserActivityTest {
"The display label must match",
activeAdapter.getItem(0).getDisplayLabel(),
is(callerTargetLabel));
+
+ // Switch to work profile and ensure that the target *doesn't* show up there.
+ onView(withText(R.string.resolver_work_tab)).perform(click());
+ waitForIdle();
+
+ for (int i = 0; i < activity.getWorkListAdapter().getCount(); i++) {
+ assertThat(
+ "Chooser target should not show up in opposite profile",
+ activity.getWorkListAdapter().getItem(i).getDisplayLabel(),
+ not(callerTargetLabel));
+ }
}
@Test