SelectableTargetInfo "immutability"/other cleanup
This CL makes many small "pure refactoring" changes as part of
my ongoing go/chooser-targetinfo-cleanup.
1. Most important: introduce APIs to manage "functional"/"mutable"
aspects of `SelectableTargetInfo`: `IconHolder` (to manage icon
getting/setting), `TargetActivityStarter` (for the various `start`
methods in `TargetInfo`), and `TargetHashProvider` (to compute
a hash we use for metrics logging). I pulled `IconHolder` up into
the base API and exposed it directly to clients (since they're
really the ones that manipulate the "set" icon, and eventually
they shold take over more of the icon-management responsibilities,
as I've noted in a new TODO comment). I've left the others in
`SelectableTargetInfo` for now since their responsibilities aren't
as concerning in an "immutable" `TargetInfo` -- they defer some
computation that's parameterized on the caller arguments, but
they don't directly mutate any state in the target object.
Eventually, the other interfaces can move to the upcoming new
`ImmutableTargetInfo` type (where it will be convenient having the
ability to copy these sub-components as whole objects).
2. Precompute any other fields in `SelectableTargetInfo` to show that
we're now basically ready to implement immutability.
3. Extract `ChooserTarget` fields in the `SelectableTargetInfo`
"factory method" -- that deprecated type is no longer part of the
API of this `TargetInfo` implementation. Also add a new factory
overload to skip the `ChooserTarget` representation for synthetic
targets where it was only used as an intermediary in shuttling
around these particular fields.
4. Implement `SelectableTargetInfo` "copy constructor" in terms of
its primary (internal) constructor to make sure we perform any
necessary initialization steps consistently.
Test: atest IntentResolverUnitTests
Bug: 202167050
Change-Id: If6f0cceebc4627fcd9a796948738c34195269e6d
11 files changed