This bug is because we always use mHourlyChartIndex to construct every view model in mHoulyViewModels. However, mHourlyChartIndex could be got from saved instance. So mHourlyChartIndex may be out of bound in some hourly view model which has not many hours data. This fix removes the selectedIndex in BatteryChartViewModel constructor. Suppose the selectedIndex should be set everytime the view model is used. Test: manual Bug: 236101166 Bug: 241872474 Change-Id: I0bb5568ac33fcc23c406fe3af308b8d2706c5542
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.