Fix crashloop in CarStatusBar.

System ui seems to be undergoing a refactor to bring in
dependency injection, in the process, mBatteryController
in CarStatusBar was not being set, causing a NPE.

Since it looks like the work is still ongoing, this is
just a spot fix for the crash, once the dependency injection
migration is complete, we can reexamine the CarStatusBar
implementation.

Bug: 34633087
Test: Verified that system booted correctly.
Change-Id: Idd3e0286fd87196ae572349904d5bef744d54353
This commit is contained in:
Rakesh Iyer
2017-01-23 18:10:21 -08:00
parent e1c8372fb6
commit 545e47d758
2 changed files with 2 additions and 6 deletions

View File

@@ -72,6 +72,7 @@ public class CarStatusBar extends PhoneStatusBar implements
SystemServicesProxy.getInstance(mContext).registerTaskStackListener(mTaskStackListener);
registerPackageChangeReceivers();
createBatteryController();
mCarBatteryController.startListening();
mConnectedDeviceSignalController.startListening();
}
@@ -113,8 +114,7 @@ public class CarStatusBar extends PhoneStatusBar implements
return statusBarView;
}
@Override
protected BatteryController createBatteryController() {
private BatteryController createBatteryController() {
mCarBatteryController = new CarBatteryController(mContext);
mCarBatteryController.addBatteryViewHandler(this);
return mCarBatteryController;

View File

@@ -989,10 +989,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
}
protected BatteryController createBatteryController() {
return new BatteryControllerImpl(mContext);
}
private void inflateShelf() {
mNotificationShelf =
(NotificationShelf) LayoutInflater.from(mContext).inflate(