Since the updateState() method is being called regardless of the availability of a work profile, we were trying to get settings for USER_NULL, which was leading to crashes. Flag: com.android.server.notification.polite_notifications Fixes: 402317471 Test: manual with existing work profile & without existing work profile Change-Id: Icddabd9a7575713f42a0f5bd955b65a7e46c7f45
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