Work on sysui dependencies
One of the many problems with PhoneStatusBar is that it holds
dependencies for many other parts of SysUI. Fix this by creating
a static method of grabbing dependencies that are global to sysui
this cleans up a lot of chains of interdependence.
Also add easy way to inject mocks of these dependencies for the
purpose of testing.
Test: runtest systemui
Change-Id: Ia0e947faea62d15b665facada47ac9916c99f895
diff --git a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
index 030250a..b30b596 100644
--- a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
+++ b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
@@ -72,6 +72,10 @@
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
+ mBatteryController = Dependency.get(BatteryController.class);
+ mDrawable.setBatteryController(mBatteryController);
+ mBatteryController.addCallback(this);
+ mDrawable.startListening();
TunerService.get(getContext()).addTunable(this, StatusBarIconController.ICON_BLACKLIST);
}
@@ -95,13 +99,6 @@
}
- public void setBatteryController(BatteryController mBatteryController) {
- this.mBatteryController = mBatteryController;
- mDrawable.setBatteryController(mBatteryController);
- mBatteryController.addCallback(this);
- mDrawable.startListening();
- }
-
public void setDarkIntensity(float f) {
mDrawable.setDarkIntensity(f);
}