Controller generates the injection location settings in updateState() which happens in onResume. That's the primary reason why we observed the shifting issue. In a good practice, we generate preference in displayPreference(), and then update the setting state in updateState(). In this cl, we create a base controller class to encapsulate most implementation, and developer need to inject location services in child class. Test: Add work profile, and see correct services list. Bug: 183169265 Change-Id: I5735ba974da87ad83b56791abd8a8637c2317571
Running Settings Robolectric tests
The full suite
$ croot
$ make RunSettingsRoboTests
Running a single test class
$ croot
$ make RunSettingsRoboTests ROBOTEST_FILTER=<ClassName>
For example:
make RunSettingsRoboTests ROBOTEST_FILTER=CodeInspectionTest
You can also use partial class name in ROBOTEST_FILTER. If the partial class name matches multiple file names, all of them will be executed.