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