summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Monk <jmonk@google.com>2015-05-08 10:45:15 -0400
committerJason Monk <jmonk@google.com>2015-05-18 11:49:24 -0400
commit33f8ae7543fbf7d94266f0f1621ec873aa2542f1 (patch)
treecb89d30176c901bf976a45681107c13d0933d9ae
parent99f6977d3cbde054307cc1001cdc50f67399e4ca (diff)
downloadframeworks_base-33f8ae7543fbf7d94266f0f1621ec873aa2542f1.zip
frameworks_base-33f8ae7543fbf7d94266f0f1621ec873aa2542f1.tar.gz
frameworks_base-33f8ae7543fbf7d94266f0f1621ec873aa2542f1.tar.bz2
Show data icon when appropriate.
Show it in the status bar when its a default network, but always show it in QS when its connected, so that users can know its connected. Also fix the tests. Bug: 18776546 Change-Id: I553588fc6850b0c2ef6e6015b313222bf4c786e7
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/EthernetSignalController.java13
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java36
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java31
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java44
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java2
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java8
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java22
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerEthernetTest.java4
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java24
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerWifiTest.java18
11 files changed, 92 insertions, 119 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/EthernetSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/EthernetSignalController.java
index a2cd50a..bd36462 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/EthernetSignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/EthernetSignalController.java
@@ -20,6 +20,8 @@ import android.net.NetworkCapabilities;
import com.android.systemui.statusbar.policy.NetworkController.IconState;
+import java.util.BitSet;
+
public class EthernetSignalController extends
SignalController<SignalController.State, SignalController.IconGroup> {
@@ -38,6 +40,12 @@ public class EthernetSignalController extends
}
@Override
+ public void updateConnectivity(BitSet connectedTransports, BitSet validatedTransports) {
+ mCurrentState.connected = connectedTransports.get(mTransportType);
+ super.updateConnectivity(connectedTransports, validatedTransports);
+ }
+
+ @Override
public void notifyListeners() {
boolean ethernetVisible = mCurrentState.connected;
String contentDescription = getStringIfExists(getContentDescription());
@@ -51,9 +59,4 @@ public class EthernetSignalController extends
public SignalController.State cleanState() {
return new SignalController.State();
}
-
- public void setConnected(boolean connected) {
- mCurrentState.connected = connected;
- notifyListenersIfNecessary();
- }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
index 5515873..0d59953 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
@@ -36,6 +36,7 @@ import com.android.systemui.statusbar.policy.NetworkController.IconState;
import com.android.systemui.statusbar.policy.NetworkControllerImpl.Config;
import java.io.PrintWriter;
+import java.util.BitSet;
import java.util.Objects;
@@ -105,13 +106,13 @@ public class MobileSignalController extends SignalController<
notifyListenersIfNecessary();
}
- public void setInetCondition(int inetCondition, int inetConditionForNetwork) {
- // For mobile data, use general inet condition for phone signal indexing,
- // and network specific for data indexing (I think this might be a bug, but
- // keeping for now).
- // TODO: Update with explanation of why.
- mCurrentState.inetForNetwork = inetConditionForNetwork;
- setInetCondition(inetCondition);
+ @Override
+ public void updateConnectivity(BitSet connectedTransports, BitSet validatedTransports) {
+ boolean isValidated = validatedTransports.get(mTransportType);
+ mCurrentState.isDefault = connectedTransports.get(mTransportType);
+ // Only show this as not having connectivity if we are default.
+ mCurrentState.inetCondition = (isValidated || !mCurrentState.isDefault) ? 1 : 0;
+ notifyListenersIfNecessary();
}
public void setCarrierNetworkChangeMode(boolean carrierNetworkChangeMode) {
@@ -195,9 +196,9 @@ public class MobileSignalController extends SignalController<
String contentDescription = getStringIfExists(getContentDescription());
String dataContentDescription = getStringIfExists(icons.mDataContentDescription);
- boolean showDataIcon = mCurrentState.dataConnected && mCurrentState.inetForNetwork != 0
+ // Show icon in QS when we are connected or need to show roaming.
+ boolean showDataIcon = mCurrentState.dataConnected
|| mCurrentState.iconGroup == TelephonyIcons.ROAMING;
-
IconState statusIcon = new IconState(mCurrentState.enabled && !mCurrentState.airplaneMode,
getCurrentIconId(), contentDescription);
@@ -206,7 +207,7 @@ public class MobileSignalController extends SignalController<
String description = null;
// Only send data sim callbacks to QS.
if (mCurrentState.dataSim) {
- qsTypeIcon = showDataIcon ? icons.mQsDataType[mCurrentState.inetForNetwork] : 0;
+ qsTypeIcon = showDataIcon ? icons.mQsDataType : 0;
qsIcon = new IconState(mCurrentState.enabled
&& !mCurrentState.isEmergency, getQsCurrentIconId(), contentDescription);
description = mCurrentState.isEmergency ? null : mCurrentState.networkName;
@@ -217,6 +218,7 @@ public class MobileSignalController extends SignalController<
boolean activityOut = mCurrentState.dataConnected
&& !mCurrentState.carrierNetworkChangeMode
&& mCurrentState.activityOut;
+ showDataIcon &= mCurrentState.isDefault;
int typeIcon = showDataIcon ? icons.mDataType : 0;
mCallbackHandler.setMobileDataIndicators(statusIcon, qsIcon, getCurrentDarkIconId(),
typeIcon, qsTypeIcon, activityIn, activityOut, dataContentDescription, description,
@@ -470,12 +472,12 @@ public class MobileSignalController extends SignalController<
final int mDataContentDescription; // mContentDescriptionDataType
final int mDataType;
final boolean mIsWide;
- final int[] mQsDataType;
+ final int mQsDataType;
public MobileIconGroup(String name, int[][] sbIcons, int[][] qsIcons, int[] contentDesc,
int sbNullState, int qsNullState, int sbDiscState, int qsDiscState,
int discContentDesc, int dataContentDesc, int dataType, boolean isWide,
- int[] qsDataType) {
+ int qsDataType) {
this(name, sbIcons, sbIcons, qsIcons, contentDesc, sbNullState, qsNullState,
sbDiscState, sbDiscState, qsDiscState, discContentDesc, dataContentDesc,
dataType, isWide, qsDataType);
@@ -484,7 +486,7 @@ public class MobileSignalController extends SignalController<
public MobileIconGroup(String name, int[][] sbIcons, int[][] sbDarkIcons, int[][] qsIcons,
int[] contentDesc, int sbNullState, int qsNullState, int sbDiscState,
int sbDarkDiscState, int qsDiscState, int discContentDesc, int dataContentDesc,
- int dataType, boolean isWide, int[] qsDataType) {
+ int dataType, boolean isWide, int qsDataType) {
super(name, sbIcons, sbDarkIcons, qsIcons, contentDesc, sbNullState, qsNullState,
sbDiscState, sbDarkDiscState, qsDiscState, discContentDesc);
mDataContentDescription = dataContentDesc;
@@ -502,7 +504,7 @@ public class MobileSignalController extends SignalController<
boolean isEmergency;
boolean airplaneMode;
boolean carrierNetworkChangeMode;
- int inetForNetwork;
+ boolean isDefault;
@Override
public void copyFrom(State s) {
@@ -512,7 +514,7 @@ public class MobileSignalController extends SignalController<
networkName = state.networkName;
networkNameData = state.networkNameData;
dataConnected = state.dataConnected;
- inetForNetwork = state.inetForNetwork;
+ isDefault = state.isDefault;
isEmergency = state.isEmergency;
airplaneMode = state.airplaneMode;
carrierNetworkChangeMode = state.carrierNetworkChangeMode;
@@ -526,7 +528,7 @@ public class MobileSignalController extends SignalController<
builder.append("networkName=").append(networkName).append(',');
builder.append("networkNameData=").append(networkNameData).append(',');
builder.append("dataConnected=").append(dataConnected).append(',');
- builder.append("inetForNetwork=").append(inetForNetwork).append(',');
+ builder.append("isDefault=").append(isDefault).append(',');
builder.append("isEmergency=").append(isEmergency).append(',');
builder.append("airplaneMode=").append(airplaneMode).append(',');
builder.append("carrierNetworkChangeMode=").append(carrierNetworkChangeMode);
@@ -542,7 +544,7 @@ public class MobileSignalController extends SignalController<
&& ((MobileState) o).isEmergency == isEmergency
&& ((MobileState) o).airplaneMode == airplaneMode
&& ((MobileState) o).carrierNetworkChangeMode == carrierNetworkChangeMode
- && ((MobileState) o).inetForNetwork == inetForNetwork;
+ && ((MobileState) o).isDefault == isDefault;
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
index 484f66a..e8957f9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
@@ -538,17 +538,10 @@ public class NetworkControllerImpl extends BroadcastReceiver
private void pushConnectivityToSignals() {
// We want to update all the icons, all at once, for any condition change
for (MobileSignalController mobileSignalController : mMobileSignalControllers.values()) {
- mobileSignalController.setInetCondition(
- mInetCondition ? 1 : 0,
- mValidatedTransports.get(mobileSignalController.getTransportType()) ? 1 : 0);
+ mobileSignalController.updateConnectivity(mConnectedTransports, mValidatedTransports);
}
- mWifiSignalController.setInetCondition(
- mValidatedTransports.get(mWifiSignalController.getTransportType()) ? 1 : 0);
-
- mEthernetSignalController.setConnected(
- mConnectedTransports.get(mEthernetSignalController.getTransportType()));
- mEthernetSignalController.setInetCondition(
- mValidatedTransports.get(mEthernetSignalController.getTransportType()) ? 1 : 0);
+ mWifiSignalController.updateConnectivity(mConnectedTransports, mValidatedTransports);
+ mEthernetSignalController.updateConnectivity(mConnectedTransports, mValidatedTransports);
}
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
@@ -581,7 +574,7 @@ public class NetworkControllerImpl extends BroadcastReceiver
}
private boolean mDemoMode;
- private int mDemoInetCondition;
+ private boolean mDemoInetCondition;
private WifiSignalController.WifiState mDemoWifiState;
@Override
@@ -590,7 +583,7 @@ public class NetworkControllerImpl extends BroadcastReceiver
if (DEBUG) Log.d(TAG, "Entering demo mode");
unregisterListeners();
mDemoMode = true;
- mDemoInetCondition = mInetCondition ? 1 : 0;
+ mDemoInetCondition = mInetCondition;
mDemoWifiState = mWifiSignalController.getState();
} else if (mDemoMode && command.equals(COMMAND_EXIT)) {
if (DEBUG) Log.d(TAG, "Exiting demo mode");
@@ -614,10 +607,18 @@ public class NetworkControllerImpl extends BroadcastReceiver
}
String fully = args.getString("fully");
if (fully != null) {
- mDemoInetCondition = Boolean.parseBoolean(fully) ? 1 : 0;
- mWifiSignalController.setInetCondition(mDemoInetCondition);
+ mDemoInetCondition = Boolean.parseBoolean(fully);
+ BitSet connected = new BitSet();
+
+ if (mDemoInetCondition) {
+ connected.set(mWifiSignalController.mTransportType);
+ }
+ mWifiSignalController.updateConnectivity(connected, connected);
for (MobileSignalController controller : mMobileSignalControllers.values()) {
- controller.setInetCondition(mDemoInetCondition, mDemoInetCondition);
+ if (mDemoInetCondition) {
+ connected.set(controller.mTransportType);
+ }
+ controller.updateConnectivity(connected, connected);
}
}
String wifi = args.getString("wifi");
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java
index 97b530c..e6ca646 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java
@@ -22,6 +22,7 @@ import android.text.format.DateFormat;
import android.util.Log;
import java.io.PrintWriter;
+import java.util.BitSet;
/**
@@ -75,12 +76,8 @@ public abstract class SignalController<T extends SignalController.State,
return mCurrentState;
}
- public int getTransportType() {
- return mTransportType;
- }
-
- public void setInetCondition(int inetCondition) {
- mCurrentState.inetCondition = inetCondition;
+ public void updateConnectivity(BitSet connectedTransports, BitSet validatedTransports) {
+ mCurrentState.inetCondition = validatedTransports.get(mTransportType) ? 1 : 0;
notifyListenersIfNecessary();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java
index 053feb12..fa4d464 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java
@@ -104,10 +104,7 @@ class TelephonyIcons {
R.drawable.ic_qs_signal_carrier_network_change_animation }
};
- static final int[] QS_DATA_R = {
- R.drawable.ic_qs_signal_r,
- R.drawable.ic_qs_signal_r
- };
+ static final int QS_DATA_R = R.drawable.ic_qs_signal_r;
//***** Data connection icons
@@ -123,10 +120,7 @@ class TelephonyIcons {
R.drawable.stat_sys_data_fully_connected_g }
};
- static final int[] QS_DATA_G = {
- R.drawable.ic_qs_signal_g,
- R.drawable.ic_qs_signal_g
- };
+ static final int QS_DATA_G = R.drawable.ic_qs_signal_g;
static final int[][] DATA_3G = {
{ R.drawable.stat_sys_data_fully_connected_3g,
@@ -139,10 +133,7 @@ class TelephonyIcons {
R.drawable.stat_sys_data_fully_connected_3g }
};
- static final int[] QS_DATA_3G = {
- R.drawable.ic_qs_signal_3g,
- R.drawable.ic_qs_signal_3g
- };
+ static final int QS_DATA_3G = R.drawable.ic_qs_signal_3g;
static final int[][] DATA_E = {
{ R.drawable.stat_sys_data_fully_connected_e,
@@ -155,10 +146,7 @@ class TelephonyIcons {
R.drawable.stat_sys_data_fully_connected_e }
};
- static final int[] QS_DATA_E = {
- R.drawable.ic_qs_signal_e,
- R.drawable.ic_qs_signal_e
- };
+ static final int QS_DATA_E = R.drawable.ic_qs_signal_e;
//3.5G
static final int[][] DATA_H = {
@@ -172,10 +160,7 @@ class TelephonyIcons {
R.drawable.stat_sys_data_fully_connected_h }
};
- static final int[] QS_DATA_H = {
- R.drawable.ic_qs_signal_h,
- R.drawable.ic_qs_signal_h
- };
+ static final int QS_DATA_H = R.drawable.ic_qs_signal_h;
//CDMA
// Use 3G icons for EVDO data and 1x icons for 1XRTT data
@@ -190,10 +175,7 @@ class TelephonyIcons {
R.drawable.stat_sys_data_fully_connected_1x }
};
- static final int[] QS_DATA_1X = {
- R.drawable.ic_qs_signal_1x,
- R.drawable.ic_qs_signal_1x
- };
+ static final int QS_DATA_1X = R.drawable.ic_qs_signal_1x;
// LTE and eHRPD
static final int[][] DATA_4G = {
@@ -207,10 +189,7 @@ class TelephonyIcons {
R.drawable.stat_sys_data_fully_connected_4g }
};
- static final int[] QS_DATA_4G = {
- R.drawable.ic_qs_signal_4g,
- R.drawable.ic_qs_signal_4g
- };
+ static final int QS_DATA_4G = R.drawable.ic_qs_signal_4g;
// LTE branded "LTE"
static final int[][] DATA_LTE = {
@@ -224,10 +203,7 @@ class TelephonyIcons {
R.drawable.stat_sys_data_fully_connected_lte }
};
- static final int[] QS_DATA_LTE = {
- R.drawable.ic_qs_signal_lte,
- R.drawable.ic_qs_signal_lte
- };
+ static final int QS_DATA_LTE = R.drawable.ic_qs_signal_lte;
static final int FLIGHT_MODE_ICON = R.drawable.stat_sys_airplane_mode;
static final int ROAMING_ICON = R.drawable.stat_sys_data_fully_connected_roam;
@@ -264,7 +240,7 @@ class TelephonyIcons {
R.string.accessibility_carrier_network_change_mode,
0,
false,
- null
+ 0
);
static final MobileIconGroup THREE_G = new MobileIconGroup(
@@ -291,7 +267,7 @@ class TelephonyIcons {
TelephonyIcons.TELEPHONY_NO_NETWORK,
TelephonyIcons.QS_TELEPHONY_NO_NETWORK,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
- 0, 0, false, new int[2]
+ 0, 0, false, 0
);
static final MobileIconGroup E = new MobileIconGroup(
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java
index 1cc6fa8..c14d06f 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java
@@ -20,9 +20,9 @@ import android.telephony.SubscriptionInfo;
import android.test.AndroidTestCase;
import com.android.systemui.R;
+import com.android.systemui.statusbar.policy.NetworkController.IconState;
import com.android.systemui.statusbar.policy.NetworkController.SignalCallback;
import com.android.systemui.statusbar.policy.NetworkControllerImpl.EmergencyListener;
-import com.android.systemui.statusbar.policy.NetworkControllerImpl.IconState;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
index 3d5f045..2d6bb68 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
@@ -34,8 +34,8 @@ import android.util.Log;
import com.android.internal.telephony.cdma.EriInfo;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.statusbar.policy.NetworkController.IconState;
import com.android.systemui.statusbar.policy.NetworkControllerImpl.Config;
-import com.android.systemui.statusbar.policy.NetworkControllerImpl.IconState;
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
@@ -145,10 +145,10 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
setLevel(DEFAULT_LEVEL);
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
TelephonyManager.NETWORK_TYPE_UMTS);
- setConnectivity(100, ConnectivityManager.TYPE_MOBILE, true);
+ setConnectivity(NetworkCapabilities.TRANSPORT_CELLULAR, true, true);
}
- public void setConnectivity(int inetCondition, int networkType, boolean isConnected) {
+ public void setConnectivity(int networkType, boolean inetCondition, boolean isConnected) {
Intent i = new Intent(ConnectivityManager.INET_CONDITION_ACTION);
// TODO: Separate out into several NetworkCapabilities.
if (isConnected) {
@@ -156,7 +156,7 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
} else {
mNetCapabilities.removeTransportType(networkType);
}
- if (inetCondition != 0) {
+ if (inetCondition) {
mNetCapabilities.addCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED);
} else {
mNetCapabilities.removeCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java
index 015127d..15752e1 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java
@@ -1,17 +1,17 @@
package com.android.systemui.statusbar.policy;
-import org.mockito.Mockito;
-
import android.os.Looper;
import android.telephony.TelephonyManager;
+import org.mockito.Mockito;
+
public class NetworkControllerDataTest extends NetworkControllerBaseTest {
public void test3gDataIcon() {
setupDefaultSignal();
verifyDataIndicators(TelephonyIcons.DATA_3G[1][0 /* No direction */],
- TelephonyIcons.QS_DATA_3G[1]);
+ TelephonyIcons.QS_DATA_3G);
}
public void testRoamingDataIcon() {
@@ -23,7 +23,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
TelephonyIcons.ROAMING_ICON);
verifyLastQsMobileDataIndicators(true,
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH[1][DEFAULT_LEVEL],
- TelephonyIcons.QS_DATA_R[1], false, false);
+ TelephonyIcons.QS_DATA_R, false, false);
}
public void test2gDataIcon() {
@@ -32,7 +32,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
TelephonyManager.NETWORK_TYPE_GSM);
verifyDataIndicators(TelephonyIcons.DATA_G[1][0 /* No direction */],
- TelephonyIcons.QS_DATA_G[1]);
+ TelephonyIcons.QS_DATA_G);
}
public void testCdmaDataIcon() {
@@ -41,7 +41,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
TelephonyManager.NETWORK_TYPE_CDMA);
verifyDataIndicators(TelephonyIcons.DATA_1X[1][0 /* No direction */],
- TelephonyIcons.QS_DATA_1X[1]);
+ TelephonyIcons.QS_DATA_1X);
}
public void testEdgeDataIcon() {
@@ -50,7 +50,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
TelephonyManager.NETWORK_TYPE_EDGE);
verifyDataIndicators(TelephonyIcons.DATA_E[1][0 /* No direction */],
- TelephonyIcons.QS_DATA_E[1]);
+ TelephonyIcons.QS_DATA_E);
}
public void testLteDataIcon() {
@@ -59,7 +59,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
TelephonyManager.NETWORK_TYPE_LTE);
verifyDataIndicators(TelephonyIcons.DATA_LTE[1][0 /* No direction */],
- TelephonyIcons.QS_DATA_LTE[1]);
+ TelephonyIcons.QS_DATA_LTE);
}
public void testHspaDataIcon() {
@@ -68,7 +68,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
TelephonyManager.NETWORK_TYPE_HSPA);
verifyDataIndicators(TelephonyIcons.DATA_H[1][0 /* No direction */],
- TelephonyIcons.QS_DATA_H[1]);
+ TelephonyIcons.QS_DATA_H);
}
public void test4gDataIcon() {
@@ -85,7 +85,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
TelephonyManager.NETWORK_TYPE_LTE);
verifyDataIndicators(TelephonyIcons.DATA_4G[1][0 /* No direction */],
- TelephonyIcons.QS_DATA_4G[1]);
+ TelephonyIcons.QS_DATA_4G);
}
public void test4gDataIconConfigChange() {
@@ -101,7 +101,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
mNetworkController.handleConfigurationChanged();
verifyDataIndicators(TelephonyIcons.DATA_4G[1][0 /* No direction */],
- TelephonyIcons.QS_DATA_4G[1]);
+ TelephonyIcons.QS_DATA_4G);
}
public void testDataActivity() {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerEthernetTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerEthernetTest.java
index f1d2acb..5d63d8d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerEthernetTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerEthernetTest.java
@@ -2,7 +2,7 @@ package com.android.systemui.statusbar.policy;
import android.net.NetworkCapabilities;
-import com.android.systemui.statusbar.policy.NetworkControllerImpl.IconState;
+import com.android.systemui.statusbar.policy.NetworkController.IconState;
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
@@ -26,7 +26,7 @@ public class NetworkControllerEthernetTest extends NetworkControllerBaseTest {
}
protected void setEthernetState(boolean connected, boolean validated) {
- setConnectivity(validated ? 100 : 0, NetworkCapabilities.TRANSPORT_ETHERNET, connected);
+ setConnectivity(NetworkCapabilities.TRANSPORT_ETHERNET, validated, connected);
}
protected void verifyLastEthernetIcon(boolean visible, int icon) {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
index a85bca2..874fdf9 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
@@ -19,6 +19,7 @@ import static org.mockito.Mockito.mock;
import android.content.Intent;
import android.net.ConnectivityManager;
+import android.net.NetworkCapabilities;
import android.os.Looper;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
@@ -79,13 +80,12 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
setLevel(testStrength);
verifyLastMobileDataIndicators(true,
- TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH[1][testStrength],
- DEFAULT_ICON);
+ TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH[1][testStrength], DEFAULT_ICON);
// Verify low inet number indexing.
- setConnectivity(0, ConnectivityManager.TYPE_MOBILE, true);
+ setConnectivity(NetworkCapabilities.TRANSPORT_CELLULAR, false, true);
verifyLastMobileDataIndicators(true,
- TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH[0][testStrength], 0);
+ TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH[0][testStrength], DEFAULT_ICON);
}
}
@@ -154,18 +154,12 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
}
}
- public void testNoRoamingWithoutSignal() {
+ public void testNoBangWithWifi() {
setupDefaultSignal();
- setCdma();
- setCdmaRoaming(true);
- setVoiceRegState(ServiceState.STATE_OUT_OF_SERVICE);
- setDataRegState(ServiceState.STATE_OUT_OF_SERVICE);
-
- // This exposes the bug in b/18034542, and should be switched to the commented out
- // verification below (and pass), once the bug is fixed.
- verifyLastMobileDataIndicators(true, R.drawable.stat_sys_signal_null,
- TelephonyIcons.ROAMING_ICON);
- //verifyLastMobileDataIndicators(true, R.drawable.stat_sys_signal_null, 0 /* No Icon */);
+ setConnectivity(mMobileSignalController.mTransportType, false, false);
+ setConnectivity(NetworkCapabilities.TRANSPORT_WIFI, true, true);
+
+ verifyLastMobileDataIndicators(true, TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH[1][2], 0);
}
// Some tests of actual NetworkController code, just internals not display stuff
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerWifiTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerWifiTest.java
index d0c95b9..cecf2fd 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerWifiTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerWifiTest.java
@@ -1,12 +1,12 @@
package com.android.systemui.statusbar.policy;
import android.content.Intent;
-import android.net.ConnectivityManager;
+import android.net.NetworkCapabilities;
import android.net.NetworkInfo;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
-import com.android.systemui.statusbar.policy.NetworkControllerImpl.IconState;
+import com.android.systemui.statusbar.policy.NetworkController.IconState;
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
@@ -27,9 +27,9 @@ public class NetworkControllerWifiTest extends NetworkControllerBaseTest {
for (int testLevel = 0; testLevel < WifiIcons.WIFI_LEVEL_COUNT; testLevel++) {
setWifiLevel(testLevel);
- setConnectivity(100, ConnectivityManager.TYPE_WIFI, true);
+ setConnectivity(NetworkCapabilities.TRANSPORT_WIFI, true, true);
verifyLastWifiIcon(true, WifiIcons.WIFI_SIGNAL_STRENGTH[1][testLevel]);
- setConnectivity(0, ConnectivityManager.TYPE_WIFI, true);
+ setConnectivity(NetworkCapabilities.TRANSPORT_WIFI, false, true);
verifyLastWifiIcon(true, WifiIcons.WIFI_SIGNAL_STRENGTH[0][testLevel]);
}
}
@@ -47,10 +47,10 @@ public class NetworkControllerWifiTest extends NetworkControllerBaseTest {
for (int testLevel = 0; testLevel < WifiIcons.WIFI_LEVEL_COUNT; testLevel++) {
setWifiLevel(testLevel);
- setConnectivity(100, ConnectivityManager.TYPE_WIFI, true);
+ setConnectivity(NetworkCapabilities.TRANSPORT_WIFI, true, true);
verifyLastQsWifiIcon(true, true, WifiIcons.QS_WIFI_SIGNAL_STRENGTH[1][testLevel],
testSsid);
- setConnectivity(0, ConnectivityManager.TYPE_WIFI, true);
+ setConnectivity(NetworkCapabilities.TRANSPORT_WIFI, false, true);
verifyLastQsWifiIcon(true, true, WifiIcons.QS_WIFI_SIGNAL_STRENGTH[0][testLevel],
testSsid);
}
@@ -63,7 +63,7 @@ public class NetworkControllerWifiTest extends NetworkControllerBaseTest {
setWifiEnabled(true);
setWifiState(true, testSsid);
setWifiLevel(testLevel);
- setConnectivity(100, ConnectivityManager.TYPE_WIFI, true);
+ setConnectivity(NetworkCapabilities.TRANSPORT_WIFI, true, true);
verifyLastQsWifiIcon(true, true,
WifiIcons.QS_WIFI_SIGNAL_STRENGTH[1][testLevel], testSsid);
@@ -84,13 +84,13 @@ public class NetworkControllerWifiTest extends NetworkControllerBaseTest {
setWifiEnabled(true);
setWifiState(true, testSsid);
setWifiLevel(testLevel);
- setConnectivity(100, ConnectivityManager.TYPE_WIFI, true);
+ setConnectivity(NetworkCapabilities.TRANSPORT_WIFI, true, true);
verifyLastWifiIcon(true, WifiIcons.WIFI_SIGNAL_STRENGTH[1][testLevel]);
setupDefaultSignal();
setGsmRoaming(true);
// Still be on wifi though.
- setConnectivity(100, ConnectivityManager.TYPE_WIFI, true);
+ setConnectivity(NetworkCapabilities.TRANSPORT_WIFI, true, true);
verifyLastMobileDataIndicators(true,
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH_ROAMING[1][DEFAULT_LEVEL],
TelephonyIcons.ROAMING_ICON);