summaryrefslogtreecommitdiff
path: root/java/src/com
diff options
context:
space:
mode:
author Anthony Alridge <anthonyalridge@google.com> 2023-05-02 09:30:05 +0000
committer Anthony Alridge <anthonyalridge@google.com> 2023-05-10 16:01:11 +0000
commit0e19f669c3703a6c29baece731b09011e01e1790 (patch)
tree8a03ce121ba8eecad1c2adc918d8705db635eebd /java/src/com
parentb6db5913d41b01476ef027d7e40f032f4f3c4ed9 (diff)
Remove auto-launching for single target, multiple tabs
This can lead to poor UX when auto-launching across tabs. If the intent picker should be shown (e.g dev calls startActivity), and there is only a single app to handle the intent, then this has no affect. It is handled in either IntentForwarderActivity, or in ResolverActivity (mini-resolver). However, if the dev calls Intent.createChooser/ACTION_CHOOSER, without an ACTION_SEND intent (ChooserActivity), then we show something that looks like an intent picker, which has this incorrect auto-launching logic. For now we simply remove the logic because it doesn't make sesnse in an actual sharing context, and if ACTION_SEND is not used it leads to a security vulnerability and very poor UX (b/270700718). In a future release we can hopefully improve this and treat this case in-line with the intent-picker (e.g., showing the mini-resolver). Bug: 272208024 Bug: 270700718 Test: atest ResolverActivityTest Test: atest UnbundledChoserActivityTest Test: Manually tested, attached screenshots in bug Change-Id: I1a340cab94230cada1e7e805195070b032e7c5ff
Diffstat (limited to 'java/src/com')
-rw-r--r--java/src/com/android/intentresolver/ResolverActivity.java23
1 files changed, 4 insertions, 19 deletions
diff --git a/java/src/com/android/intentresolver/ResolverActivity.java b/java/src/com/android/intentresolver/ResolverActivity.java
index aea6c2c9..06a1d90c 100644
--- a/java/src/com/android/intentresolver/ResolverActivity.java
+++ b/java/src/com/android/intentresolver/ResolverActivity.java
@@ -1864,8 +1864,10 @@ public class ResolverActivity extends FragmentActivity implements
} else if (numberOfProfiles == 2
&& mMultiProfilePagerAdapter.getActiveListAdapter().isTabLoaded()
&& mMultiProfilePagerAdapter.getInactiveListAdapter().isTabLoaded()
- && (maybeAutolaunchIfNoAppsOnInactiveTab()
- || maybeAutolaunchIfCrossProfileSupported())) {
+ && maybeAutolaunchIfCrossProfileSupported()) {
+ // TODO(b/280988288): If the ChooserActivity is shown we should consider showing the
+ // correct intent-picker UIs (e.g., mini-resolver) if it was launched without
+ // ACTION_SEND.
return true;
}
return false;
@@ -1892,23 +1894,6 @@ public class ResolverActivity extends FragmentActivity implements
return false;
}
- private boolean maybeAutolaunchIfNoAppsOnInactiveTab() {
- int count = mMultiProfilePagerAdapter.getActiveListAdapter().getUnfilteredCount();
- if (count != 1) {
- return false;
- }
- ResolverListAdapter inactiveListAdapter =
- mMultiProfilePagerAdapter.getInactiveListAdapter();
- if (inactiveListAdapter.getUnfilteredCount() != 0) {
- return false;
- }
- TargetInfo target = mMultiProfilePagerAdapter.getActiveListAdapter()
- .targetInfoForPosition(0, false);
- safelyStartActivity(target);
- finish();
- return true;
- }
-
/**
* When we have a personal and a work profile, we auto launch in the following scenario:
* - There is 1 resolved target on each profile