summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/tests
diff options
context:
space:
mode:
authorJason Monk <jmonk@google.com>2014-11-12 16:50:31 -0500
committerJason Monk <jmonk@google.com>2014-12-02 10:35:09 -0500
commitb574627ebc383d35cf8212ee241b191b26518a0d (patch)
tree13b5a036ab3660bd48f28899aae904dbda66b572 /packages/SystemUI/tests
parentfbeeac8266c190afba084cfc1164385ff5020fce (diff)
downloadframeworks_base-b574627ebc383d35cf8212ee241b191b26518a0d.zip
frameworks_base-b574627ebc383d35cf8212ee241b191b26518a0d.tar.gz
frameworks_base-b574627ebc383d35cf8212ee241b191b26518a0d.tar.bz2
SysUI: Actual MSIM status bar support
Expand SignalClusterView and NetworkController to handle multiple SIMs. It does this by creating multiple MobileSignalControllers for each of the active subscriptions on the device. Also some minor changes for followup on the NetworkController refactor that went in before this. Bug: 18222975 Change-Id: Ic7a857cfc5cadb46d51bb9ded0df8187eea799f7
Diffstat (limited to 'packages/SystemUI/tests')
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java26
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java6
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java6
3 files changed, 25 insertions, 13 deletions
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 49fe1e3..eaf2f78 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
@@ -11,6 +11,8 @@ import android.net.wifi.WifiManager;
import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
+import android.telephony.SubscriptionInfo;
+import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.test.AndroidTestCase;
import android.util.Log;
@@ -25,6 +27,8 @@ import org.mockito.Mockito;
import java.io.PrintWriter;
import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
public class NetworkControllerBaseTest extends AndroidTestCase {
private static final String TAG = "NetworkControllerBaseTest";
@@ -44,6 +48,7 @@ public class NetworkControllerBaseTest extends AndroidTestCase {
private ServiceState mServiceState;
protected ConnectivityManager mMockCm;
protected WifiManager mMockWm;
+ protected SubscriptionManager mMockSm;
protected TelephonyManager mMockTm;
protected Config mConfig;
@@ -56,6 +61,7 @@ public class NetworkControllerBaseTest extends AndroidTestCase {
mMockWm = mock(WifiManager.class);
mMockTm = mock(TelephonyManager.class);
+ mMockSm = mock(SubscriptionManager.class);
mMockCm = mock(ConnectivityManager.class);
when(mMockCm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)).thenReturn(true);
@@ -64,14 +70,22 @@ public class NetworkControllerBaseTest extends AndroidTestCase {
mConfig = new Config();
mConfig.hspaDataDistinguishable = true;
- mNetworkController = new NetworkControllerImpl(mContext, mMockCm, mMockTm, mMockWm,
+ mNetworkController = new NetworkControllerImpl(mContext, mMockCm, mMockTm, mMockWm, mMockSm,
mConfig, mock(AccessPointControllerImpl.class),
mock(MobileDataControllerImpl.class));
setupNetworkController();
}
protected void setupNetworkController() {
- mPhoneStateListener = mNetworkController.mMobileSignalController.mPhoneStateListener;
+ // For now just pretend to be the data sim, so we can test that too.
+ final int subId = SubscriptionManager.getDefaultDataSubId();
+ SubscriptionInfo subscription = mock(SubscriptionInfo.class);
+ List<SubscriptionInfo> subs = new ArrayList<SubscriptionInfo>();
+ when(subscription.getSubscriptionId()).thenReturn(subId);
+ subs.add(subscription);
+ mNetworkController.setCurrentSubscriptions(subs);
+ mPhoneStateListener =
+ mNetworkController.mMobileSignalControllers.get(subId).mPhoneStateListener;
mSignalCluster = mock(SignalCluster.class);
mNetworkSignalChangedCallback = mock(NetworkSignalChangedCallback.class);
mNetworkController.addSignalCluster(mSignalCluster);
@@ -182,13 +196,12 @@ public class NetworkControllerBaseTest extends AndroidTestCase {
}
protected void verifyLastQsMobileDataIndicators(boolean visible, int icon, int typeIcon,
- boolean dataIn, boolean dataOut, boolean noSim) {
+ boolean dataIn, boolean dataOut) {
ArgumentCaptor<Integer> iconArg = ArgumentCaptor.forClass(Integer.class);
ArgumentCaptor<Integer> typeIconArg = ArgumentCaptor.forClass(Integer.class);
ArgumentCaptor<Boolean> visibleArg = ArgumentCaptor.forClass(Boolean.class);
ArgumentCaptor<Boolean> dataInArg = ArgumentCaptor.forClass(Boolean.class);
ArgumentCaptor<Boolean> dataOutArg = ArgumentCaptor.forClass(Boolean.class);
- ArgumentCaptor<Boolean> noSimArg = ArgumentCaptor.forClass(Boolean.class);
Mockito.verify(mNetworkSignalChangedCallback, Mockito.atLeastOnce())
.onMobileDataSignalChanged(visibleArg.capture(), iconArg.capture(),
@@ -198,7 +211,6 @@ public class NetworkControllerBaseTest extends AndroidTestCase {
dataOutArg.capture(),
ArgumentCaptor.forClass(String.class).capture(),
ArgumentCaptor.forClass(String.class).capture(),
- noSimArg.capture(),
ArgumentCaptor.forClass(Boolean.class).capture());
assertEquals("Visibility in, quick settings", visible, (boolean) visibleArg.getValue());
assertEquals("Signal icon in, quick settings", icon, (int) iconArg.getValue());
@@ -207,7 +219,6 @@ public class NetworkControllerBaseTest extends AndroidTestCase {
(boolean) dataInArg.getValue());
assertEquals("Data direction out, in quick settings", dataOut,
(boolean) dataOutArg.getValue());
- assertEquals("Sim state in quick settings", noSim, (boolean) noSimArg.getValue());
}
protected void verifyLastMobileDataIndicators(boolean visible, int icon, int typeIcon) {
@@ -220,7 +231,8 @@ public class NetworkControllerBaseTest extends AndroidTestCase {
visibleArg.capture(), iconArg.capture(), typeIconArg.capture(),
ArgumentCaptor.forClass(String.class).capture(),
ArgumentCaptor.forClass(String.class).capture(),
- ArgumentCaptor.forClass(Boolean.class).capture());
+ ArgumentCaptor.forClass(Boolean.class).capture(),
+ ArgumentCaptor.forClass(Integer.class).capture());
assertEquals("Signal icon in status bar", icon, (int) iconArg.getValue());
assertEquals("Data icon in status bar", typeIcon, (int) typeIconArg.getValue());
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 146e76d..e327233 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
@@ -22,7 +22,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, false);
+ TelephonyIcons.QS_DATA_R[1], false, false);
}
public void test2gDataIcon() {
@@ -86,14 +86,14 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
verifyLastMobileDataIndicators(true, DEFAULT_SIGNAL_STRENGTH, DEFAULT_ICON);
verifyLastQsMobileDataIndicators(true, DEFAULT_QS_SIGNAL_STRENGTH,
- DEFAULT_QS_ICON, in, out, false);
+ DEFAULT_QS_ICON, in, out);
}
private void verifyDataIndicators(int dataIcon, int qsDataIcon) {
verifyLastMobileDataIndicators(true, DEFAULT_SIGNAL_STRENGTH, dataIcon);
verifyLastQsMobileDataIndicators(true, DEFAULT_QS_SIGNAL_STRENGTH, qsDataIcon, false,
- false, false);
+ false);
}
}
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 bb2ff7c..b5d97d9 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
@@ -17,7 +17,7 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
// Turn off mobile network support.
Mockito.when(mMockCm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)).thenReturn(false);
// Create a new NetworkController as this is currently handled in constructor.
- mNetworkController = new NetworkControllerImpl(mContext, mMockCm, mMockTm, mMockWm,
+ mNetworkController = new NetworkControllerImpl(mContext, mMockCm, mMockTm, mMockWm, mMockSm,
mConfig, mock(AccessPointControllerImpl.class),
mock(MobileDataControllerImpl.class));
setupNetworkController();
@@ -90,7 +90,7 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
verifyLastQsMobileDataIndicators(true,
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH[1][testStrength],
- DEFAULT_QS_ICON, false, false, false);
+ DEFAULT_QS_ICON, false, false);
}
}
@@ -103,7 +103,7 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
verifyLastQsMobileDataIndicators(true,
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH[1][testStrength],
- TelephonyIcons.QS_ICON_1X, false, false, false);
+ TelephonyIcons.QS_ICON_1X, false, false);
}
}