Root Cause: When configuration changes, it will recreate fragment then call no args constructor which lead to null pointer exception for error passing parameters in getInstance(). Solution: * Use setArguments() to pass parameters. * Move settings key update action into fragment. * Obsever settings key changes to update summary accordingly. Bug: 349049233 Test: atest ScreenFlashNotificationColorDialogFragmentTest ScreenFlashNotificationPreferenceControllerTest Flag: EXEMPT bugfix Change-Id: Ided0853cf9a989e2f288a85c1aa709f71f7e1cd6
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