summaryrefslogtreecommitdiff
path: root/java/src
diff options
context:
space:
mode:
author Joshua Trask <joshtrask@google.com> 2023-03-23 16:26:28 +0000
committer Joshua Trask <joshtrask@google.com> 2023-03-23 16:26:28 +0000
commit90aab48da1198be6a154412b3cd9a44cf97b7764 (patch)
tree94e443a73f179ee143b06fcb5095954d638aa996 /java/src
parent64f9435ffbd82cf2f025aebc05795691aa5e1e08 (diff)
Always terminate Chooser after a refinement flow.
In normal (non-refinement) target selection, if the user selects a suspended target, we attempt to launch it anyways in order to prompt a system message dialog, but we suppress our normal post-launch termination so that the user can try to select a different target. We had similar "bounce-back" logic if a post-refinement launch failed as a result of a suspended target, but the UX doesn't really make sense in the refinement case (and I'm also not 100% confident that our implementation would be technically equipped to handle the re-entry). I've removed the "bounce-back" suppression in the post-refinement case, so if we show the dialog about the package being suspended, that's the end of the session. (Although note, unless the package was suspended *during* refinement, we would've already shown the dialog instead of going to refinement in the first place.) Bug: 273864843 Test: manually tested behavior around suspended targets, and ran CTS to verify no regressions in normal refinement usage. Change-Id: I4e57add285224b7f311c4d0532168dc984ee331b
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/intentresolver/ChooserActivity.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/java/src/com/android/intentresolver/ChooserActivity.java b/java/src/com/android/intentresolver/ChooserActivity.java
index 30ec2b91..71a94e11 100644
--- a/java/src/com/android/intentresolver/ChooserActivity.java
+++ b/java/src/com/android/intentresolver/ChooserActivity.java
@@ -275,9 +275,13 @@ public class ChooserActivity extends ResolverActivity implements
mChooserRequest.getRefinementIntentSender(),
(validatedRefinedTarget) -> {
maybeRemoveSharedText(validatedRefinedTarget);
- if (super.onTargetSelected(validatedRefinedTarget, false)) {
- finish();
- }
+
+ // We already block suspended targets from going to refinement, and we probably
+ // can't recover a Chooser session if that's the reason the refined target fails
+ // to launch now. Fire-and-forget the refined launch; ignore the return value
+ // and just make sure the Sharesheet session gets cleaned up regardless.
+ super.onTargetSelected(validatedRefinedTarget, false);
+ finish();
},
this::finish);