summaryrefslogtreecommitdiff
path: root/java/src/com
diff options
context:
space:
mode:
author Joshua Trask <joshtrask@google.com> 2023-03-23 15:02:23 +0000
committer Joshua Trask <joshtrask@google.com> 2023-03-23 15:02:23 +0000
commit7e145c5e1c4be62c47bee591d6e96eb361c9dfdc (patch)
tree41e3e05a0e8c77231b7ebaf5d47291c76e07ff14 /java/src/com
parent3c3755b4ea535df1b5f2a9f3e57b235b660e1fcd (diff)
Skip refinement for suspended targets.
It's just rude to send users into the refinement flow when we expect the launch to fail (with a message dialog indicating that the entire target app was never supposed to work; i.e., we make it clear to users that this failure had nothing to do with their refinement choices). OTOH if we skip refinement, we have some handling to bounce back into a usable Sharesheet session after that dialog appears, so we'd like to take advantage of that. A subsequent CL will "plug all the holes" in our handling of various refinement exit conditions. There's currently an analogous post-refinement "bounce back" for suspended targets, but we won't be able to recover a Sharesheet session at that time, so (TODO) we'll turn that into a hard failure (as with any other refinement problems). Bug: 273864843 Test: manually tested `adb shell cmd package suspend <packagename>` confirm we no longer invoke refinement (and instead trigger the system dialog immediately) when the suspended target is chosen. Change-Id: Iff1cf67f67015c754437726b8f52431deca797e0
Diffstat (limited to 'java/src/com')
-rw-r--r--java/src/com/android/intentresolver/ChooserRefinementManager.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/java/src/com/android/intentresolver/ChooserRefinementManager.java b/java/src/com/android/intentresolver/ChooserRefinementManager.java
index 3ddc1c7c..23cf6ba0 100644
--- a/java/src/com/android/intentresolver/ChooserRefinementManager.java
+++ b/java/src/com/android/intentresolver/ChooserRefinementManager.java
@@ -77,6 +77,13 @@ public final class ChooserRefinementManager {
if (selectedTarget.getAllSourceIntents().isEmpty()) {
return false;
}
+ if (selectedTarget.isSuspended()) {
+ // We expect all launches to fail for this target, so don't make the user go through the
+ // refinement flow first. Besides, the default (non-refinement) handling displays a
+ // warning in this case and recovers the session; we won't be equipped to recover if
+ // problems only come up after refinement.
+ return false;
+ }
destroy(); // Terminate any prior sessions.
mRefinementResultReceiver = new RefinementResultReceiver(