Use PrefRefresh for Preference caching
Refactor a couple of fields to use PrefRefresh for caching instead instead of fields. This makes us construct PrefRefresh for display categories, which we hadn't been doing before, and was causing b/397466966. This also limits the tests' dependency on implementation. We had been using fields for caching Preference objects, which doesn't account for the same preference being needed for each display. PrefRefresh is a more flexible mechanism for recycling View objects and it largely makes the fields obsolete. The reuse* methods (previously get*Preference) can actually be inlined now that tests aren't calling into them, but to keep the diff easy to review I left them as separate methods. Because @NonNull doesn't actually do anything, and is considered the default, I neglected to add them to new arguments, and deleted them from lines I modified. Flag: com.android.settings.flags.display_topology_pane_in_display_list Test: ExternalDisplayPreferenceFragmentTest.java Test: with fragment visible, plug-in and activate a new physical display with the Mirror prompt Test: with topology disabled, verify footer is shown with and without a display attached Bug: b/397466966 Bug: b/397591022 Change-Id: I16b3ae925ca3d9d79471fd5df00b571ae3fc696f
Loading
Please register or sign in to comment