Get data type from service state as well

Bug: 26276354
Bug: 26413831
Change-Id: Ic080300db7d5e5200caf611cc2ee1ef3af93736e
This commit is contained in:
Jason Monk
2016-01-12 10:24:09 -05:00
parent a73abeaf4b
commit 67b2c16a9a
3 changed files with 20 additions and 3 deletions

View File

@@ -440,6 +440,7 @@ public class MobileSignalController extends SignalController<
+ " dataState=" + state.getDataRegState());
}
mServiceState = state;
mDataNetType = state.getDataNetworkType();
updateTelephony();
}

View File

@@ -59,8 +59,8 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
protected NetworkControllerImpl mNetworkController;
protected MobileSignalController mMobileSignalController;
protected PhoneStateListener mPhoneStateListener;
private SignalStrength mSignalStrength;
private ServiceState mServiceState;
protected SignalStrength mSignalStrength;
protected ServiceState mServiceState;
protected ConnectivityManager mMockCm;
protected WifiManager mMockWm;
protected SubscriptionManager mMockSm;
@@ -234,7 +234,7 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
mPhoneStateListener.onSignalStrengthsChanged(mSignalStrength);
}
private void updateServiceState() {
protected void updateServiceState() {
Log.d(TAG, "Sending Service State: " + mServiceState);
mPhoneStateListener.onServiceStateChanged(mServiceState);
}
@@ -245,6 +245,7 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
}
public void updateDataConnectionState(int dataState, int dataNetType) {
when(mServiceState.getDataNetworkType()).thenReturn(dataNetType);
mPhoneStateListener.onDataConnectionStateChanged(dataState, dataNetType);
}

View File

@@ -114,6 +114,21 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
TelephonyIcons.QS_DATA_4G);
}
public void testDataChangeWithoutConnectionState() {
setupDefaultSignal();
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
TelephonyManager.NETWORK_TYPE_LTE);
verifyDataIndicators(TelephonyIcons.DATA_LTE[1][0 /* No direction */],
TelephonyIcons.QS_DATA_LTE);
Mockito.when(mServiceState.getDataNetworkType())
.thenReturn(TelephonyManager.NETWORK_TYPE_HSPA);
updateServiceState();
verifyDataIndicators(TelephonyIcons.DATA_H[1][0 /* No direction */],
TelephonyIcons.QS_DATA_H);
}
public void testDataActivity() {
setupDefaultSignal();