summaryrefslogtreecommitdiff
path: root/java/src-debug
diff options
context:
space:
mode:
author Joshua Trask <joshtrask@google.com> 2023-02-08 22:25:29 +0000
committer Joshua Trask <joshtrask@google.com> 2023-02-09 21:15:21 +0000
commit691cfdb494fd6d4e194b1e9dc07470ab64564bfe (patch)
tree2af39c59fab771bd03a647c4fa160ed3f3e07bf3 /java/src-debug
parent8c9576af0ed784bf2ee09942c2495f2688336614 (diff)
Convert NotSelectableTargetInfo subtree to factories
Clients of the `NotSelectableTargetInfo` factory methods won't notice any API change, but those methods will now return instances of `ImmutableTargetInfo`, built to match the same behavior of the legacy subtype (note no clients have any remaining `instanceof` checks in this part of the inheritance graph). The class now just hosts the static factory methods and some private static helpers, and no longer inherits from `ChooserTargetInfo` (or any other base). The two concrete `NotSelectableTargetInfo` subclasses are removed altogether. This change is a near-pure refactoring; the only other theoretical difference is that these `NotSelectableTargetInfo` targets will now get a plausible implementation of `cloneFilledIn()` instead of returning null, but in practice that method will never actually be invoked on these particular `TargetInfo` types. We're also *slightly* more eager in building `IconHolder` instances, but in practice we would always do that at nearly the same time anyways (and there's no particular concern about the overhead). There are also two changes to tests: 1. The device config permission change seemed to be necessary in order to run `TargetInfoTest` in isolation, even though those same tests could run as part of `IntentResolverUnitTests` already. I'm not sure why the discrepancy, but the fix seems reasonable. 2. I needed to do a better job of setting up the placeholder targets' icon for tests since the new `ImmutableTargetInfo.Builder` API doesn't offer a mechanism to override `hasDisplayIcon()` directly. With the better support in place, I made some extra assertions. This is the first (low-hanging-fruit) conversion of this type, and in future CLs we should proceed through the rest of the hierarchy before eventually flattening all the APIs into a single class. Test: `atest TargetInfoTest` Bug: 202167050 Change-Id: Ibabfee6ef2349de0db0be97f1d2f894d0672cbfd
Diffstat (limited to 'java/src-debug')
0 files changed, 0 insertions, 0 deletions