Simplify SelectableTargetInfo dependencies
Remove “functional” (Context, PackageManager, and
SelectableTargetInfoCommunicator) and obsolete dependencies from
SelectableTargetInfo.
Changes to SelectableTargetInfo:
1. Fields mBadgeIcon, mBadgeContentDescriptor were never read and thus
removed.
2. Values previously provided by SelectableTargetInfoCommunicator are
inlined or pre-calculated:
- getTargetIntent() used in the resolved intent calculation replaced
with a pre-calculated resolved intent value (we can do it as target
intent does not change);
- getReferrerFillInIntent() passed as an argument (we can do it as the
value does not change).
3. As ChooserListAdapter.LoadDirectShareIconTask was the only place that
invoked SelectableTargetInfo#loadIcon(), icon loading logic,
SelectableTargetInfo#getChooserTargetIconDrawable method, is moved
over there and the related code is deleted from SelectableTargetInfo.
4. SelectableTargetInfo.SelectableTargetInfoCommunicator
#makePresentatinGetter() removed as not used.
Changes to TargetInfo (and related classes):
1. TargetInfo#setDrawableIcon() is added to the interface as a way for
ChooserListAdapter#LoadDirectShareIconTask to update the icon.
2. NotSelectableTargetInfo#newPlaceHolderInfo() changed to receive a
context that would be used by the target it creates.
3. After the aforementioned changes no implementation of the
TargetInfo#getDisplayIcon actually uses its Context argument, thus it
is deleted.
4. A default implementation added for TargetInfo#hasDisplayIcon method
as all implementations, essentially, were the same.
5. TargetInfo#loadIcon removed as not used.
Fix: 257285229
Test: manual functinality test
Test: atest IntentResolverUnitTests
Change-Id: I448ebed9c5346092ebca6c4e356830c55288d55b
11 files changed