Loading src/java/com/android/internal/telephony/data/DataNetworkController.java +3 −3 Original line number Diff line number Diff line Loading @@ -296,7 +296,7 @@ public class DataNetworkController extends Handler { private final @NonNull Set<DataNetworkControllerCallback> mDataNetworkControllerCallbacks = new ArraySet<>(); /** Indicates if packet switch data is restricted by the network. */ /** Indicates if packet switch data is restricted by the cellular network. */ private boolean mPsRestricted = false; /** Indicates if NR advanced is allowed by PCO. */ Loading Loading @@ -1466,8 +1466,8 @@ public class DataNetworkController extends Handler { evaluation.addDataDisallowedReason(DataDisallowedReason.ROAMING_DISABLED); } // Check if data is restricted by the network. if (mPsRestricted) { // Check if data is restricted by the cellular network. if (mPsRestricted && transport == AccessNetworkConstants.TRANSPORT_TYPE_WWAN) { evaluation.addDataDisallowedReason(DataDisallowedReason.DATA_RESTRICTED_BY_NETWORK); } Loading tests/telephonytests/src/com/android/internal/telephony/data/DataNetworkControllerTest.java +35 −0 Original line number Diff line number Diff line Loading @@ -1193,6 +1193,41 @@ public class DataNetworkControllerTest extends TelephonyTest { verifyConnectedNetworkHasCapabilities(NetworkCapabilities.NET_CAPABILITY_INTERNET); } @Test public void testPsRestrictedAllowIwlan() throws Exception { // IMS preferred on IWLAN. doReturn(AccessNetworkConstants.TRANSPORT_TYPE_WLAN).when(mAccessNetworksManager) .getPreferredTransportByNetworkCapability( eq(NetworkCapabilities.NET_CAPABILITY_IMS)); // PS restricted mDataNetworkControllerUT.obtainMessage(6/*EVENT_PS_RESTRICT_ENABLED*/).sendToTarget(); processAllMessages(); // PS restricted, new setup NOT allowed mDataNetworkControllerUT.addNetworkRequest( createNetworkRequest(NetworkCapabilities.NET_CAPABILITY_INTERNET)); setSuccessfulSetupDataResponse(mMockedDataServiceManagers .get(AccessNetworkConstants.TRANSPORT_TYPE_WWAN), 2); processAllMessages(); verifyAllDataDisconnected(); // Request IMS mDataNetworkControllerUT.addNetworkRequest( createNetworkRequest(NetworkCapabilities.NET_CAPABILITY_IMS, NetworkCapabilities.NET_CAPABILITY_MMTEL)); setSuccessfulSetupDataResponse(mMockedDataServiceManagers .get(AccessNetworkConstants.TRANSPORT_TYPE_WLAN), 3); processAllMessages(); // Make sure IMS on IWLAN. verifyConnectedNetworkHasCapabilities(NetworkCapabilities.NET_CAPABILITY_IMS); assertThat(getDataNetworks()).hasSize(1); DataNetwork dataNetwork = getDataNetworks().get(0); assertThat(dataNetwork.getTransport()).isEqualTo( AccessNetworkConstants.TRANSPORT_TYPE_WLAN); } @Test public void testRatChanges() throws Exception { serviceStateChanged(TelephonyManager.NETWORK_TYPE_LTE, Loading Loading
src/java/com/android/internal/telephony/data/DataNetworkController.java +3 −3 Original line number Diff line number Diff line Loading @@ -296,7 +296,7 @@ public class DataNetworkController extends Handler { private final @NonNull Set<DataNetworkControllerCallback> mDataNetworkControllerCallbacks = new ArraySet<>(); /** Indicates if packet switch data is restricted by the network. */ /** Indicates if packet switch data is restricted by the cellular network. */ private boolean mPsRestricted = false; /** Indicates if NR advanced is allowed by PCO. */ Loading Loading @@ -1466,8 +1466,8 @@ public class DataNetworkController extends Handler { evaluation.addDataDisallowedReason(DataDisallowedReason.ROAMING_DISABLED); } // Check if data is restricted by the network. if (mPsRestricted) { // Check if data is restricted by the cellular network. if (mPsRestricted && transport == AccessNetworkConstants.TRANSPORT_TYPE_WWAN) { evaluation.addDataDisallowedReason(DataDisallowedReason.DATA_RESTRICTED_BY_NETWORK); } Loading
tests/telephonytests/src/com/android/internal/telephony/data/DataNetworkControllerTest.java +35 −0 Original line number Diff line number Diff line Loading @@ -1193,6 +1193,41 @@ public class DataNetworkControllerTest extends TelephonyTest { verifyConnectedNetworkHasCapabilities(NetworkCapabilities.NET_CAPABILITY_INTERNET); } @Test public void testPsRestrictedAllowIwlan() throws Exception { // IMS preferred on IWLAN. doReturn(AccessNetworkConstants.TRANSPORT_TYPE_WLAN).when(mAccessNetworksManager) .getPreferredTransportByNetworkCapability( eq(NetworkCapabilities.NET_CAPABILITY_IMS)); // PS restricted mDataNetworkControllerUT.obtainMessage(6/*EVENT_PS_RESTRICT_ENABLED*/).sendToTarget(); processAllMessages(); // PS restricted, new setup NOT allowed mDataNetworkControllerUT.addNetworkRequest( createNetworkRequest(NetworkCapabilities.NET_CAPABILITY_INTERNET)); setSuccessfulSetupDataResponse(mMockedDataServiceManagers .get(AccessNetworkConstants.TRANSPORT_TYPE_WWAN), 2); processAllMessages(); verifyAllDataDisconnected(); // Request IMS mDataNetworkControllerUT.addNetworkRequest( createNetworkRequest(NetworkCapabilities.NET_CAPABILITY_IMS, NetworkCapabilities.NET_CAPABILITY_MMTEL)); setSuccessfulSetupDataResponse(mMockedDataServiceManagers .get(AccessNetworkConstants.TRANSPORT_TYPE_WLAN), 3); processAllMessages(); // Make sure IMS on IWLAN. verifyConnectedNetworkHasCapabilities(NetworkCapabilities.NET_CAPABILITY_IMS); assertThat(getDataNetworks()).hasSize(1); DataNetwork dataNetwork = getDataNetworks().get(0); assertThat(dataNetwork.getTransport()).isEqualTo( AccessNetworkConstants.TRANSPORT_TYPE_WLAN); } @Test public void testRatChanges() throws Exception { serviceStateChanged(TelephonyManager.NETWORK_TYPE_LTE, Loading