Expose ShortcutInfo & AppTarget from TargetInfo
This allows `TargetInfo` clients to look up the same auxiliary source
data that was already retained in `ChooserActivity`'s "cache"
structures, but it removes the extra complexity of holding that data
outside of the target itself only to need to look it back up again
when we try to use the target later. (For now this CL leaves the
auxiliary "cache" structures in place for one specific usage that's
out-of-scope to refactor here, but it removes any other indeterminate
subsequent uses). Incidentally, those "subsequent uses" that are
removed were some of the only remaining places where we made calls to
`TargetInfo.getChooserTarget()`, and we're attempting to burn down
all the remaining calls to *that* API since `ChooserTarget` is
deprecated.
`SelectableTargetInfo` objects aleady retain the (nullable)
`ShortcutInfo`, but for historical reasons it's been used as mutable
state related to icon loading and could sometimes be reset to null. In
order to expose the `ShortcutInfo` this CL makes it a `final` member
and introduces an explicit state bit to replace the null-reset used in
the past. This CL also makes some other minor cleanups in
`SelectableTargetInfo` to clarify the immutability (precomputability)
of some additional fields (to support unrelated upcoming CLs, while
I happen to be making similar changes in here anyways). This brought
attention to a likely bug where the target `mIsSuspended` bit was
neglected in the implementation of `SelectableTargetInfo`'s "copy
constructor" (fixed in this CL).
Test: atest IntentResolverUnitTests
Bug: 202167050
Change-Id: I1a18a1aea3acdded7c360311bf216f05fc75cb67
9 files changed