From 6ded7a41465032691396d6329c6ea4b5ecb0e2a0 Mon Sep 17 00:00:00 2001 From: Joshua Trask Date: Tue, 24 Aug 2021 16:57:33 -0400 Subject: [PATCH] Remove ChooserTargetServiceConnection from adapter In the new flow, ChooserListAdapter didn't actually depend on this data for anything (and ChooserActivity only ever sent an empty list). In preparation for removing the (internal) ChooserTargetServiceConnection class altogether, this CL removes it from the ChooserListAdapter API: the only reference outside of ChooserActivity. Test: compiles. Change-Id: I2c379562e47fba405714b08632118af2e16d8a40 --- .../android/internal/app/ChooserActivity.java | 6 +++--- .../internal/app/ChooserListAdapter.java | 4 +--- .../internal/app/ChooserActivityTest.java | 18 ++++++------------ 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java index c5c7e25da1d0f..35d25caead0b7 100644 --- a/core/java/com/android/internal/app/ChooserActivity.java +++ b/core/java/com/android/internal/app/ChooserActivity.java @@ -495,7 +495,7 @@ public class ChooserActivity extends ResolverActivity implements if (adapterForUserHandle != null) { adapterForUserHandle.addServiceResults(sri.originalTarget, sri.resultTargets, TARGET_TYPE_CHOOSER_TARGET, - /* directShareShortcutInfoCache */ null, mServiceConnections); + /* directShareShortcutInfoCache */ null); if (!sri.resultTargets.isEmpty() && sri.originalTarget != null) { mChooserTargetComponentNameCache.put( sri.resultTargets.get(0).getComponentName(), @@ -528,7 +528,7 @@ public class ChooserActivity extends ResolverActivity implements if (adapterForUserHandle != null) { adapterForUserHandle.addServiceResults( resultInfo.originalTarget, resultInfo.resultTargets, msg.arg1, - mDirectShareShortcutInfoCache, mServiceConnections); + mDirectShareShortcutInfoCache); } } break; @@ -1649,7 +1649,7 @@ public class ChooserActivity extends ResolverActivity implements /* origTarget */ null, Lists.newArrayList(mCallerChooserTargets), TARGET_TYPE_DEFAULT, - /* directShareShortcutInfoCache */ null, mServiceConnections); + /* directShareShortcutInfoCache */ null); } } diff --git a/core/java/com/android/internal/app/ChooserListAdapter.java b/core/java/com/android/internal/app/ChooserListAdapter.java index 87737ca9c3af0..07c4050531375 100644 --- a/core/java/com/android/internal/app/ChooserListAdapter.java +++ b/core/java/com/android/internal/app/ChooserListAdapter.java @@ -491,9 +491,7 @@ public class ChooserListAdapter extends ResolverListAdapter { */ public void addServiceResults(DisplayResolveInfo origTarget, List targets, @ChooserActivity.ShareTargetType int targetType, - Map directShareToShortcutInfos, - List - pendingChooserTargetServiceConnections) { + Map directShareToShortcutInfos) { if (DEBUG) { Log.d(TAG, "addServiceResults " + origTarget.getResolvedComponentName() + ", " + targets.size() diff --git a/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java b/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java index 6e34a3322e35e..a064af95f48d9 100644 --- a/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java +++ b/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java @@ -1162,8 +1162,7 @@ public class ChooserActivityTest { /* resolveInfoPresentationGetter */ null), serviceTargets, TARGET_TYPE_CHOOSER_TARGET, - directShareToShortcutInfos, - List.of()) + directShareToShortcutInfos) ); // Thread.sleep shouldn't be a thing in an integration test but it's @@ -1234,8 +1233,7 @@ public class ChooserActivityTest { /* resolveInfoPresentationGetter */ null), serviceTargets, TARGET_TYPE_CHOOSER_TARGET, - directShareToShortcutInfos, - List.of()) + directShareToShortcutInfos) ); // Thread.sleep shouldn't be a thing in an integration test but it's // necessary here because of the way the code is structured @@ -1305,8 +1303,7 @@ public class ChooserActivityTest { /* resolveInfoPresentationGetter */ null), serviceTargets, TARGET_TYPE_SHORTCUTS_FROM_PREDICTION_SERVICE, - directShareToShortcutInfos, - List.of()) + directShareToShortcutInfos) ); // Thread.sleep shouldn't be a thing in an integration test but it's // necessary here because of the way the code is structured @@ -1366,8 +1363,7 @@ public class ChooserActivityTest { /* resolveInfoPresentationGetter */ null), serviceTargets, TARGET_TYPE_SHORTCUTS_FROM_PREDICTION_SERVICE, - directShareToShortcutInfos, - List.of()) + directShareToShortcutInfos) ); // Thread.sleep shouldn't be a thing in an integration test but it's // necessary here because of the way the code is structured @@ -1442,8 +1438,7 @@ public class ChooserActivityTest { /* resolveInfoPresentationGetter */ null), serviceTargets, TARGET_TYPE_CHOOSER_TARGET, - directShareToShortcutInfos, - List.of()) + directShareToShortcutInfos) ); // Thread.sleep shouldn't be a thing in an integration test but it's // necessary here because of the way the code is structured @@ -1806,8 +1801,7 @@ public class ChooserActivityTest { /* resolveInfoPresentationGetter */ null), serviceTargets, TARGET_TYPE_CHOOSER_TARGET, - directShareToShortcutInfos, - null) + directShareToShortcutInfos) ); // Thread.sleep shouldn't be a thing in an integration test but it's // necessary here because of the way the code is structured