diff options
author | Jason Monk <jmonk@google.com> | 2015-05-08 10:45:15 -0400 |
---|---|---|
committer | Jason Monk <jmonk@google.com> | 2015-05-18 11:49:24 -0400 |
commit | 33f8ae7543fbf7d94266f0f1621ec873aa2542f1 (patch) | |
tree | cb89d30176c901bf976a45681107c13d0933d9ae /packages/SystemUI/tests | |
parent | 99f6977d3cbde054307cc1001cdc50f67399e4ca (diff) | |
download | frameworks_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
Diffstat (limited to 'packages/SystemUI/tests')
6 files changed, 36 insertions, 42 deletions
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); |