Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java +8 −1 Original line number Diff line number Diff line Loading @@ -15,6 +15,9 @@ */ package com.android.systemui.statusbar.policy; import static android.telephony.AccessNetworkConstants.TRANSPORT_TYPE_WWAN; import static android.telephony.NetworkRegistrationInfo.DOMAIN_PS; import android.content.Context; import android.content.Intent; import android.database.ContentObserver; Loading Loading @@ -708,7 +711,11 @@ public class MobileSignalController extends SignalController< } mServiceState = state; if (mServiceState != null) { updateDataNetType(mServiceState.getDataNetworkType()); NetworkRegistrationInfo regInfo = mServiceState.getNetworkRegistrationInfo( DOMAIN_PS, TRANSPORT_TYPE_WWAN); if (regInfo != null) { updateDataNetType(regInfo.getAccessNetworkTechnology()); } } updateTelephony(); } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java +11 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.systemui.statusbar.policy; import static android.telephony.AccessNetworkConstants.TRANSPORT_TYPE_WWAN; import static android.telephony.NetworkRegistrationInfo.DOMAIN_PS; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotNull; Loading @@ -39,6 +42,7 @@ import android.net.wifi.WifiManager; import android.os.Handler; import android.provider.Settings; import android.provider.Settings.Global; import android.telephony.NetworkRegistrationInfo; import android.telephony.PhoneStateListener; import android.telephony.ServiceState; import android.telephony.SignalStrength; Loading Loading @@ -347,7 +351,13 @@ public class NetworkControllerBaseTest extends SysuiTestCase { } public void updateDataConnectionState(int dataState, int dataNetType) { when(mServiceState.getDataNetworkType()).thenReturn(dataNetType); NetworkRegistrationInfo fakeRegInfo = new NetworkRegistrationInfo.Builder() .setTransportType(TRANSPORT_TYPE_WWAN) .setDomain(DOMAIN_PS) .setAccessNetworkTechnology(dataNetType) .build(); when(mServiceState.getNetworkRegistrationInfo(DOMAIN_PS, TRANSPORT_TYPE_WWAN)) .thenReturn(fakeRegInfo); mPhoneStateListener.onDataConnectionStateChanged(dataState, dataNetType); } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java +17 −3 Original line number Diff line number Diff line package com.android.systemui.statusbar.policy; import static android.telephony.AccessNetworkConstants.TRANSPORT_TYPE_WWAN; import static android.telephony.NetworkRegistrationInfo.DOMAIN_PS; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.anyInt; Loading Loading @@ -418,7 +421,13 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest { // State from NR_5G to NONE NR_STATE_RESTRICTED, showing corresponding icon doReturn(NetworkRegistrationInfo.NR_STATE_RESTRICTED).when(mServiceState).getNrState(); doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mServiceState).getDataNetworkType(); NetworkRegistrationInfo fakeRegInfo = new NetworkRegistrationInfo.Builder() .setTransportType(TRANSPORT_TYPE_WWAN) .setDomain(DOMAIN_PS) .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_LTE) .build(); doReturn(fakeRegInfo).when(mServiceState) .getNetworkRegistrationInfo(DOMAIN_PS, TRANSPORT_TYPE_WWAN); mPhoneStateListener.onDataConnectionStateChanged(TelephonyManager.DATA_CONNECTED, TelephonyManager.NETWORK_TYPE_LTE); Loading Loading @@ -480,8 +489,13 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest { verifyDataIndicators(TelephonyIcons.ICON_LTE); when(mServiceState.getDataNetworkType()) .thenReturn(TelephonyManager.NETWORK_TYPE_HSPA); NetworkRegistrationInfo fakeRegInfo = new NetworkRegistrationInfo.Builder() .setTransportType(TRANSPORT_TYPE_WWAN) .setDomain(DOMAIN_PS) .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_HSPA) .build(); when(mServiceState.getNetworkRegistrationInfo(DOMAIN_PS, TRANSPORT_TYPE_WWAN)) .thenReturn(fakeRegInfo); updateServiceState(); verifyDataIndicators(TelephonyIcons.ICON_H); } Loading services/core/java/com/android/server/connectivity/DataConnectionStats.java +8 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.server.connectivity; import static android.telephony.AccessNetworkConstants.TRANSPORT_TYPE_WWAN; import static android.telephony.NetworkRegistrationInfo.DOMAIN_PS; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; Loading @@ -24,6 +27,7 @@ import android.net.ConnectivityManager; import android.os.Handler; import android.os.Looper; import android.os.RemoteException; import android.telephony.NetworkRegistrationInfo; import android.telephony.PhoneStateListener; import android.telephony.ServiceState; import android.telephony.SignalStrength; Loading Loading @@ -91,7 +95,10 @@ public class DataConnectionStats extends BroadcastReceiver { boolean visible = (simReadyOrUnknown || isCdma()) // we only check the sim state for GSM && hasService() && mDataState == TelephonyManager.DATA_CONNECTED; int networkType = mServiceState.getDataNetworkType(); NetworkRegistrationInfo regInfo = mServiceState.getNetworkRegistrationInfo(DOMAIN_PS, TRANSPORT_TYPE_WWAN); int networkType = regInfo == null ? TelephonyManager.NETWORK_TYPE_UNKNOWN : regInfo.getAccessNetworkTechnology(); if (DEBUG) Log.d(TAG, String.format("Noting data connection for network type %s: %svisible", networkType, visible ? "" : "not ")); try { Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java +8 −1 Original line number Diff line number Diff line Loading @@ -15,6 +15,9 @@ */ package com.android.systemui.statusbar.policy; import static android.telephony.AccessNetworkConstants.TRANSPORT_TYPE_WWAN; import static android.telephony.NetworkRegistrationInfo.DOMAIN_PS; import android.content.Context; import android.content.Intent; import android.database.ContentObserver; Loading Loading @@ -708,7 +711,11 @@ public class MobileSignalController extends SignalController< } mServiceState = state; if (mServiceState != null) { updateDataNetType(mServiceState.getDataNetworkType()); NetworkRegistrationInfo regInfo = mServiceState.getNetworkRegistrationInfo( DOMAIN_PS, TRANSPORT_TYPE_WWAN); if (regInfo != null) { updateDataNetType(regInfo.getAccessNetworkTechnology()); } } updateTelephony(); } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java +11 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.systemui.statusbar.policy; import static android.telephony.AccessNetworkConstants.TRANSPORT_TYPE_WWAN; import static android.telephony.NetworkRegistrationInfo.DOMAIN_PS; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotNull; Loading @@ -39,6 +42,7 @@ import android.net.wifi.WifiManager; import android.os.Handler; import android.provider.Settings; import android.provider.Settings.Global; import android.telephony.NetworkRegistrationInfo; import android.telephony.PhoneStateListener; import android.telephony.ServiceState; import android.telephony.SignalStrength; Loading Loading @@ -347,7 +351,13 @@ public class NetworkControllerBaseTest extends SysuiTestCase { } public void updateDataConnectionState(int dataState, int dataNetType) { when(mServiceState.getDataNetworkType()).thenReturn(dataNetType); NetworkRegistrationInfo fakeRegInfo = new NetworkRegistrationInfo.Builder() .setTransportType(TRANSPORT_TYPE_WWAN) .setDomain(DOMAIN_PS) .setAccessNetworkTechnology(dataNetType) .build(); when(mServiceState.getNetworkRegistrationInfo(DOMAIN_PS, TRANSPORT_TYPE_WWAN)) .thenReturn(fakeRegInfo); mPhoneStateListener.onDataConnectionStateChanged(dataState, dataNetType); } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java +17 −3 Original line number Diff line number Diff line package com.android.systemui.statusbar.policy; import static android.telephony.AccessNetworkConstants.TRANSPORT_TYPE_WWAN; import static android.telephony.NetworkRegistrationInfo.DOMAIN_PS; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.anyInt; Loading Loading @@ -418,7 +421,13 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest { // State from NR_5G to NONE NR_STATE_RESTRICTED, showing corresponding icon doReturn(NetworkRegistrationInfo.NR_STATE_RESTRICTED).when(mServiceState).getNrState(); doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mServiceState).getDataNetworkType(); NetworkRegistrationInfo fakeRegInfo = new NetworkRegistrationInfo.Builder() .setTransportType(TRANSPORT_TYPE_WWAN) .setDomain(DOMAIN_PS) .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_LTE) .build(); doReturn(fakeRegInfo).when(mServiceState) .getNetworkRegistrationInfo(DOMAIN_PS, TRANSPORT_TYPE_WWAN); mPhoneStateListener.onDataConnectionStateChanged(TelephonyManager.DATA_CONNECTED, TelephonyManager.NETWORK_TYPE_LTE); Loading Loading @@ -480,8 +489,13 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest { verifyDataIndicators(TelephonyIcons.ICON_LTE); when(mServiceState.getDataNetworkType()) .thenReturn(TelephonyManager.NETWORK_TYPE_HSPA); NetworkRegistrationInfo fakeRegInfo = new NetworkRegistrationInfo.Builder() .setTransportType(TRANSPORT_TYPE_WWAN) .setDomain(DOMAIN_PS) .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_HSPA) .build(); when(mServiceState.getNetworkRegistrationInfo(DOMAIN_PS, TRANSPORT_TYPE_WWAN)) .thenReturn(fakeRegInfo); updateServiceState(); verifyDataIndicators(TelephonyIcons.ICON_H); } Loading
services/core/java/com/android/server/connectivity/DataConnectionStats.java +8 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.server.connectivity; import static android.telephony.AccessNetworkConstants.TRANSPORT_TYPE_WWAN; import static android.telephony.NetworkRegistrationInfo.DOMAIN_PS; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; Loading @@ -24,6 +27,7 @@ import android.net.ConnectivityManager; import android.os.Handler; import android.os.Looper; import android.os.RemoteException; import android.telephony.NetworkRegistrationInfo; import android.telephony.PhoneStateListener; import android.telephony.ServiceState; import android.telephony.SignalStrength; Loading Loading @@ -91,7 +95,10 @@ public class DataConnectionStats extends BroadcastReceiver { boolean visible = (simReadyOrUnknown || isCdma()) // we only check the sim state for GSM && hasService() && mDataState == TelephonyManager.DATA_CONNECTED; int networkType = mServiceState.getDataNetworkType(); NetworkRegistrationInfo regInfo = mServiceState.getNetworkRegistrationInfo(DOMAIN_PS, TRANSPORT_TYPE_WWAN); int networkType = regInfo == null ? TelephonyManager.NETWORK_TYPE_UNKNOWN : regInfo.getAccessNetworkTechnology(); if (DEBUG) Log.d(TAG, String.format("Noting data connection for network type %s: %svisible", networkType, visible ? "" : "not ")); try { Loading