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/qs/tiles/DataSaverTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/DataSaverTile.java
index aadc8e7..412fe3d 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DataSaverTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DataSaverTile.java
@@ -21,11 +21,13 @@
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
+import com.android.systemui.Dependency;
import com.android.systemui.Prefs;
import com.android.systemui.R;
import com.android.systemui.qs.QSTile;
import com.android.systemui.statusbar.phone.SystemUIDialog;
import com.android.systemui.statusbar.policy.DataSaverController;
+import com.android.systemui.statusbar.policy.NetworkController;
public class DataSaverTile extends QSTile<QSTile.BooleanState> implements
DataSaverController.Listener{
@@ -34,7 +36,7 @@
public DataSaverTile(Host host) {
super(host);
- mDataSaverController = host.getNetworkController().getDataSaverController();
+ mDataSaverController = Dependency.get(NetworkController.class).getDataSaverController();
}
@Override