AudioManager#getMode is a slow binder call which should not be called on UI thread. isFilterMatched will be frequently triggered on UI thread when updating the Connected devices page. Cache and update the audio mode when receive onModeChanged callback in this change. For long term, we should better separate the UI/background thread tasks in those classes. Also send request to Audio team to improve the API latency. Flag: EXEMPT small fix Bug: 380993178 Test: atest Change-Id: I054f3fa62f0fdf03b9a436a532ac1fb4738aaf58
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