From 90aab48da1198be6a154412b3cd9a44cf97b7764 Mon Sep 17 00:00:00 2001 From: Joshua Trask Date: Thu, 23 Mar 2023 16:26:28 +0000 Subject: 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 --- java/src/com/android/intentresolver/ChooserActivity.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'java/src') 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); -- cgit v1.2.3-59-g8ed1b