The root cause is that androidx.preference.Preference does not implement equals and hashCode methods, but it is used as Map key (see bug comment2 for more details). Given that Preference.getParent() can find the category, we can simplify the data structure from Map to List. Bug: 388696327 Flag: EXEMPT bugfix Test: Resume/Pause Accessibility screen 100 times Change-Id: Ib70acbf2147048730f8a4e8fd66731f9efdadecf
Running Settings Robolectric tests
The full suite
$ croot
$ atest SettingsRoboTests
Running a single test class
With a filter
$ croot
$ atest SettingsRoboTests:com.android.settings.display.AdaptiveSleepPreferenceControllerTest
You can also run any single test class with atest (it will try to find the correct path)
$ atest AdaptiveSleepPreferenceControllerTest