summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
author 1 <mrcasey@google.com> 2023-05-09 15:17:36 +0000
committer 1 <mrcasey@google.com> 2023-05-09 15:24:22 +0000
commit736dda233c2937cbbf51142ba2023c969912a7e0 (patch)
tree6673ed5855989bfad7bf64990c9aea456c61a42e /java
parent79ca9efe77bf5324bcf6c6ca17f519e2eedbff86 (diff)
Add caller ChooserTargets every time the list is rebuilt.
The list gets rebuilt when the screen goes off and on, but the weird place where the custom targets were being inserted was not getting called. Notes: 1. This removes the override of ResolverActivity.addUseDifferentAppLabelIfNecessary(). I could keep an empty override to be risk-adverse, but looking at the ResolverActivity implementation, it only does anything when ResolverListAdapter.mFilterLastUsed is true, which is only in ResolverActivity. 2. I verified that multiple calls to addServiceResults() do get deduped if they happen (see ShortcutSelectionLogic.insertServiceTarget()) Test: atest UnbundledChooserActivityTest Test: Sharing from photos, turn screen off and on and verify that custom target properly reappears. Bug: 280517911 Change-Id: Ie2854ef06ead4fd8085d93c348f31467fd21656e
Diffstat (limited to 'java')
-rw-r--r--java/src/com/android/intentresolver/ChooserActivity.java9
1 files changed, 4 insertions, 5 deletions
diff --git a/java/src/com/android/intentresolver/ChooserActivity.java b/java/src/com/android/intentresolver/ChooserActivity.java
index 95c93696..dcdc798c 100644
--- a/java/src/com/android/intentresolver/ChooserActivity.java
+++ b/java/src/com/android/intentresolver/ChooserActivity.java
@@ -805,16 +805,14 @@ public class ChooserActivity extends ResolverActivity implements
}
}
- @Override
- public void addUseDifferentAppLabelIfNecessary(ResolverListAdapter adapter) {
+ private void addCallerChooserTargets() {
if (!mChooserRequest.getCallerChooserTargets().isEmpty()) {
// Send the caller's chooser targets only to the default profile.
UserHandle defaultUser = (findSelectedProfile() == PROFILE_WORK)
? getAnnotatedUserHandles().workProfileUserHandle
: getAnnotatedUserHandles().personalProfileUserHandle;
- ChooserListAdapter chooserAdapter = (ChooserListAdapter) adapter;
- if (chooserAdapter.getUserHandle() == defaultUser) {
- chooserAdapter.addServiceResults(
+ if (mChooserMultiProfilePagerAdapter.getCurrentUserHandle() == defaultUser) {
+ mChooserMultiProfilePagerAdapter.getActiveListAdapter().addServiceResults(
/* origTarget */ null,
new ArrayList<>(mChooserRequest.getCallerChooserTargets()),
TARGET_TYPE_DEFAULT,
@@ -1543,6 +1541,7 @@ public class ChooserActivity extends ResolverActivity implements
}
if (rebuildComplete) {
+ addCallerChooserTargets();
getChooserActivityLogger().logSharesheetAppLoadComplete();
maybeQueryAdditionalPostProcessingTargets(chooserListAdapter);
mLatencyTracker.onActionEnd(ACTION_LOAD_SHARE_SHEET);