summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui/qs
diff options
context:
space:
mode:
authorJason Monk <jmonk@google.com>2014-11-10 14:22:56 -0500
committerJason Monk <jmonk@google.com>2014-11-18 12:48:42 -0500
commitd2263cd9db36d5f74a124c5ffaf8594ef702408f (patch)
treecc1b0c2c1b6eb134a163fe2f06195cabd3bedd59 /packages/SystemUI/src/com/android/systemui/qs
parentb30d902ed404e5646bced27bdd2ca4006af802bf (diff)
downloadframeworks_base-d2263cd9db36d5f74a124c5ffaf8594ef702408f.zip
frameworks_base-d2263cd9db36d5f74a124c5ffaf8594ef702408f.tar.gz
frameworks_base-d2263cd9db36d5f74a124c5ffaf8594ef702408f.tar.bz2
SysUI: Refactor the NetworkControllerImpl
Minimal changes to interface/callbacks, all of the changes are internal and prepare for MSIM. Separate out AccessPoint and MobileData from the NetworkController interface to give some space. A SignalController class has been created as a base for both WifiSignalController and MobileSignalController, both of which internally handle the state of their respective connectivity and only reach up into the NetworkControllerImpl when completely necessary (such as for combined carrier label). Bug: 18222975 Change-Id: I75b954bbece187371cdb8571dd8420e7d2cad978
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/qs')
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java14
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/DataUsageDetailView.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java17
3 files changed, 20 insertions, 14 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
index 178590b..80ddd4a 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
@@ -29,7 +29,8 @@ import com.android.systemui.qs.QSTile;
import com.android.systemui.qs.QSTileView;
import com.android.systemui.qs.SignalTileView;
import com.android.systemui.statusbar.policy.NetworkController;
-import com.android.systemui.statusbar.policy.NetworkController.DataUsageInfo;
+import com.android.systemui.statusbar.policy.NetworkController.MobileDataController;
+import com.android.systemui.statusbar.policy.NetworkController.MobileDataController.DataUsageInfo;
import com.android.systemui.statusbar.policy.NetworkController.NetworkSignalChangedCallback;
/** Quick settings tile: Cellular **/
@@ -38,11 +39,13 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
"com.android.settings", "com.android.settings.Settings$DataUsageSummaryActivity"));
private final NetworkController mController;
+ private final MobileDataController mDataController;
private final CellularDetailAdapter mDetailAdapter;
public CellularTile(Host host) {
super(host);
mController = host.getNetworkController();
+ mDataController = mController.getMobileDataController();
mDetailAdapter = new CellularDetailAdapter();
}
@@ -72,7 +75,7 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
@Override
protected void handleClick() {
- if (mController.isMobileDataSupported()) {
+ if (mDataController.isMobileDataSupported()) {
showDetail(true);
} else {
mHost.startSettingsActivity(CELLULAR_SETTINGS);
@@ -199,7 +202,8 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
@Override
public Boolean getToggleState() {
- return mController.isMobileDataSupported() ? mController.isMobileDataEnabled() : null;
+ return mDataController.isMobileDataSupported()
+ ? mDataController.isMobileDataEnabled() : null;
}
@Override
@@ -209,7 +213,7 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
@Override
public void setToggleState(boolean state) {
- mController.setMobileDataEnabled(state);
+ mDataController.setMobileDataEnabled(state);
}
@Override
@@ -217,7 +221,7 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
final DataUsageDetailView v = (DataUsageDetailView) (convertView != null
? convertView
: LayoutInflater.from(mContext).inflate(R.layout.data_usage, parent, false));
- final DataUsageInfo info = mController.getDataUsageInfo();
+ final DataUsageInfo info = mDataController.getDataUsageInfo();
if (info == null) return v;
v.bind(info);
return v;
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/DataUsageDetailView.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/DataUsageDetailView.java
index 7bdb58f..eb816b7 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DataUsageDetailView.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DataUsageDetailView.java
@@ -20,7 +20,6 @@ import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.util.AttributeSet;
-import android.util.TypedValue;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -61,7 +60,7 @@ public class DataUsageDetailView extends LinearLayout {
R.dimen.qs_data_usage_text_size);
}
- public void bind(NetworkController.DataUsageInfo info) {
+ public void bind(NetworkController.MobileDataController.DataUsageInfo info) {
final Resources res = mContext.getResources();
final int titleId;
final long bytes;
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java
index 7aa884e..4fb1189 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java
@@ -31,7 +31,8 @@ import com.android.systemui.qs.QSTile;
import com.android.systemui.qs.QSTileView;
import com.android.systemui.qs.SignalTileView;
import com.android.systemui.statusbar.policy.NetworkController;
-import com.android.systemui.statusbar.policy.NetworkController.AccessPoint;
+import com.android.systemui.statusbar.policy.NetworkController.AccessPointController;
+import com.android.systemui.statusbar.policy.NetworkController.AccessPointController.AccessPoint;
import com.android.systemui.statusbar.policy.NetworkController.NetworkSignalChangedCallback;
/** Quick settings tile: Wifi **/
@@ -39,12 +40,14 @@ public class WifiTile extends QSTile<QSTile.SignalState> {
private static final Intent WIFI_SETTINGS = new Intent(Settings.ACTION_WIFI_SETTINGS);
private final NetworkController mController;
+ private final AccessPointController mWifiController;
private final WifiDetailAdapter mDetailAdapter;
private final QSTile.SignalState mStateBeforeClick = newTileState();
public WifiTile(Host host) {
super(host);
mController = host.getNetworkController();
+ mWifiController = mController.getAccessPointController();
mDetailAdapter = new WifiDetailAdapter();
}
@@ -62,10 +65,10 @@ public class WifiTile extends QSTile<QSTile.SignalState> {
public void setListening(boolean listening) {
if (listening) {
mController.addNetworkSignalChangedCallback(mCallback);
- mController.addAccessPointCallback(mDetailAdapter);
+ mWifiController.addAccessPointCallback(mDetailAdapter);
} else {
mController.removeNetworkSignalChangedCallback(mCallback);
- mController.removeAccessPointCallback(mDetailAdapter);
+ mWifiController.removeAccessPointCallback(mDetailAdapter);
}
}
@@ -87,7 +90,7 @@ public class WifiTile extends QSTile<QSTile.SignalState> {
@Override
protected void handleSecondaryClick() {
- if (!mController.canConfigWifi()) {
+ if (!mWifiController.canConfigWifi()) {
mHost.startSettingsActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
return;
}
@@ -231,7 +234,7 @@ public class WifiTile extends QSTile<QSTile.SignalState> {
};
private final class WifiDetailAdapter implements DetailAdapter,
- NetworkController.AccessPointCallback, QSDetailItems.Callback {
+ NetworkController.AccessPointController.AccessPointCallback, QSDetailItems.Callback {
private QSDetailItems mItems;
private AccessPoint[] mAccessPoints;
@@ -261,7 +264,7 @@ public class WifiTile extends QSTile<QSTile.SignalState> {
public View createDetailView(Context context, View convertView, ViewGroup parent) {
if (DEBUG) Log.d(TAG, "createDetailView convertView=" + (convertView != null));
mAccessPoints = null;
- mController.scanForAccessPoints();
+ mWifiController.scanForAccessPoints();
fireScanStateChanged(true);
mItems = QSDetailItems.convertOrInflate(context, convertView, parent);
mItems.setTagSuffix("Wifi");
@@ -287,7 +290,7 @@ public class WifiTile extends QSTile<QSTile.SignalState> {
if (item == null || item.tag == null) return;
final AccessPoint ap = (AccessPoint) item.tag;
if (!ap.isConnected) {
- if (mController.connect(ap)) {
+ if (mWifiController.connect(ap)) {
mHost.collapsePanels();
}
}