Loading src/java/com/android/internal/telephony/satellite/SatelliteServiceUtils.java +10 −1 Original line number Diff line number Diff line Loading @@ -533,8 +533,17 @@ public class SatelliteServiceUtils { ServiceState serviceState = phone.getServiceState(); if (serviceState != null) { int state = serviceState.getState(); NetworkRegistrationInfo dataNri = serviceState.getNetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN); boolean isCellularDataInService = dataNri != null && dataNri.isInService(); logd("isCellularAvailable: phoneId=" + phone.getPhoneId() + " state=" + state + " isEmergencyOnly=" + serviceState.isEmergencyOnly() + " isCellularDataInService=" + isCellularDataInService); if ((state == STATE_IN_SERVICE || state == STATE_EMERGENCY_ONLY || serviceState.isEmergencyOnly()) || serviceState.isEmergencyOnly() || isCellularDataInService) && !isSatellitePlmn(phone.getSubId(), serviceState)) { logd("isCellularAvailable true"); return true; Loading tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java +6 −0 Original line number Diff line number Diff line Loading @@ -3965,6 +3965,8 @@ public class SatelliteControllerTest extends TelephonyTest { when(mFeatureFlags.carrierRoamingNbIotNtn()).thenReturn(true); when(mServiceState.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE); when(mServiceState2.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE); when(mServiceState.getNetworkRegistrationInfo(anyInt(), anyInt())).thenReturn(null); when(mServiceState2.getNetworkRegistrationInfo(anyInt(), anyInt())).thenReturn(null); mSatelliteControllerUT.mIsApplicationSupportsP2P = true; mCarrierConfigBundle.putBoolean(KEY_SATELLITE_ATTACH_SUPPORTED_BOOL, true); mCarrierConfigBundle.putInt(KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT, 1); Loading Loading @@ -4028,6 +4030,8 @@ public class SatelliteControllerTest extends TelephonyTest { when(mFeatureFlags.carrierRoamingNbIotNtn()).thenReturn(true); when(mServiceState2.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE); when(mServiceState.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE); when(mServiceState.getNetworkRegistrationInfo(anyInt(), anyInt())).thenReturn(null); when(mServiceState2.getNetworkRegistrationInfo(anyInt(), anyInt())).thenReturn(null); mSatelliteControllerUT.mIsApplicationSupportsP2P = true; mSatelliteControllerUT.setIsSatelliteSupported(true); mCarrierConfigBundle.putBoolean(KEY_SATELLITE_ATTACH_SUPPORTED_BOOL, true); Loading Loading @@ -6890,6 +6894,8 @@ public class SatelliteControllerTest extends TelephonyTest { when(mFeatureFlags.carrierRoamingNbIotNtn()).thenReturn(true); when(mServiceState.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE); when(mServiceState2.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE); when(mServiceState.getNetworkRegistrationInfo(anyInt(), anyInt())).thenReturn(null); when(mServiceState2.getNetworkRegistrationInfo(anyInt(), anyInt())).thenReturn(null); mSatelliteControllerUT.mIsApplicationSupportsP2P = true; mCarrierConfigBundle.putBoolean(KEY_SATELLITE_ATTACH_SUPPORTED_BOOL, true); mCarrierConfigBundle.putInt(KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT, 1); Loading tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommenderTest.java +2 −0 Original line number Diff line number Diff line Loading @@ -175,6 +175,8 @@ public class SatelliteSOSMessageRecommenderTest extends TelephonyTest { mTestSatelliteController, mTestImsManager); when(mServiceState.getState()).thenReturn(STATE_OUT_OF_SERVICE); when(mServiceState2.getState()).thenReturn(STATE_OUT_OF_SERVICE); when(mServiceState.getNetworkRegistrationInfo(anyInt(), anyInt())).thenReturn(null); when(mServiceState2.getNetworkRegistrationInfo(anyInt(), anyInt())).thenReturn(null); when(mPhone.isImsRegistered()).thenReturn(false); when(mPhone2.isImsRegistered()).thenReturn(false); replaceInstance(SatelliteStats.class, "sInstance", null, Loading tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteServiceUtilsTest.java +19 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.internal.telephony.satellite; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; Loading Loading @@ -144,6 +145,8 @@ public class SatelliteServiceUtilsTest extends TelephonyTest { public void testIsCellularAvailable() { when(mServiceState.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE); when(mServiceState2.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE); when(mServiceState.getNetworkRegistrationInfo(anyInt(), anyInt())).thenReturn(null); when(mServiceState2.getNetworkRegistrationInfo(anyInt(), anyInt())).thenReturn(null); assertFalse(SatelliteServiceUtils.isCellularAvailable()); when(mServiceState.getState()).thenReturn(ServiceState.STATE_EMERGENCY_ONLY); Loading @@ -157,6 +160,22 @@ public class SatelliteServiceUtilsTest extends TelephonyTest { when(mServiceState2.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE); when(mServiceState2.isEmergencyOnly()).thenReturn(true); assertTrue(SatelliteServiceUtils.isCellularAvailable()); NetworkRegistrationInfo dataNri = new NetworkRegistrationInfo.Builder() .setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_HOME) .build(); when(mServiceState.getNetworkRegistrationInfo(anyInt(), anyInt())).thenReturn(dataNri); when(mServiceState.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE); when(mServiceState2.isEmergencyOnly()).thenReturn(false); assertTrue(SatelliteServiceUtils.isCellularAvailable()); dataNri = new NetworkRegistrationInfo.Builder() .setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_EMERGENCY) .build(); when(mServiceState.getNetworkRegistrationInfo(anyInt(), anyInt())).thenReturn(dataNri); when(mServiceState.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE); when(mServiceState2.isEmergencyOnly()).thenReturn(false); assertFalse(SatelliteServiceUtils.isCellularAvailable()); } @Test Loading Loading
src/java/com/android/internal/telephony/satellite/SatelliteServiceUtils.java +10 −1 Original line number Diff line number Diff line Loading @@ -533,8 +533,17 @@ public class SatelliteServiceUtils { ServiceState serviceState = phone.getServiceState(); if (serviceState != null) { int state = serviceState.getState(); NetworkRegistrationInfo dataNri = serviceState.getNetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN); boolean isCellularDataInService = dataNri != null && dataNri.isInService(); logd("isCellularAvailable: phoneId=" + phone.getPhoneId() + " state=" + state + " isEmergencyOnly=" + serviceState.isEmergencyOnly() + " isCellularDataInService=" + isCellularDataInService); if ((state == STATE_IN_SERVICE || state == STATE_EMERGENCY_ONLY || serviceState.isEmergencyOnly()) || serviceState.isEmergencyOnly() || isCellularDataInService) && !isSatellitePlmn(phone.getSubId(), serviceState)) { logd("isCellularAvailable true"); return true; Loading
tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java +6 −0 Original line number Diff line number Diff line Loading @@ -3965,6 +3965,8 @@ public class SatelliteControllerTest extends TelephonyTest { when(mFeatureFlags.carrierRoamingNbIotNtn()).thenReturn(true); when(mServiceState.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE); when(mServiceState2.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE); when(mServiceState.getNetworkRegistrationInfo(anyInt(), anyInt())).thenReturn(null); when(mServiceState2.getNetworkRegistrationInfo(anyInt(), anyInt())).thenReturn(null); mSatelliteControllerUT.mIsApplicationSupportsP2P = true; mCarrierConfigBundle.putBoolean(KEY_SATELLITE_ATTACH_SUPPORTED_BOOL, true); mCarrierConfigBundle.putInt(KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT, 1); Loading Loading @@ -4028,6 +4030,8 @@ public class SatelliteControllerTest extends TelephonyTest { when(mFeatureFlags.carrierRoamingNbIotNtn()).thenReturn(true); when(mServiceState2.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE); when(mServiceState.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE); when(mServiceState.getNetworkRegistrationInfo(anyInt(), anyInt())).thenReturn(null); when(mServiceState2.getNetworkRegistrationInfo(anyInt(), anyInt())).thenReturn(null); mSatelliteControllerUT.mIsApplicationSupportsP2P = true; mSatelliteControllerUT.setIsSatelliteSupported(true); mCarrierConfigBundle.putBoolean(KEY_SATELLITE_ATTACH_SUPPORTED_BOOL, true); Loading Loading @@ -6890,6 +6894,8 @@ public class SatelliteControllerTest extends TelephonyTest { when(mFeatureFlags.carrierRoamingNbIotNtn()).thenReturn(true); when(mServiceState.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE); when(mServiceState2.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE); when(mServiceState.getNetworkRegistrationInfo(anyInt(), anyInt())).thenReturn(null); when(mServiceState2.getNetworkRegistrationInfo(anyInt(), anyInt())).thenReturn(null); mSatelliteControllerUT.mIsApplicationSupportsP2P = true; mCarrierConfigBundle.putBoolean(KEY_SATELLITE_ATTACH_SUPPORTED_BOOL, true); mCarrierConfigBundle.putInt(KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT, 1); Loading
tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommenderTest.java +2 −0 Original line number Diff line number Diff line Loading @@ -175,6 +175,8 @@ public class SatelliteSOSMessageRecommenderTest extends TelephonyTest { mTestSatelliteController, mTestImsManager); when(mServiceState.getState()).thenReturn(STATE_OUT_OF_SERVICE); when(mServiceState2.getState()).thenReturn(STATE_OUT_OF_SERVICE); when(mServiceState.getNetworkRegistrationInfo(anyInt(), anyInt())).thenReturn(null); when(mServiceState2.getNetworkRegistrationInfo(anyInt(), anyInt())).thenReturn(null); when(mPhone.isImsRegistered()).thenReturn(false); when(mPhone2.isImsRegistered()).thenReturn(false); replaceInstance(SatelliteStats.class, "sInstance", null, Loading
tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteServiceUtilsTest.java +19 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.internal.telephony.satellite; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; Loading Loading @@ -144,6 +145,8 @@ public class SatelliteServiceUtilsTest extends TelephonyTest { public void testIsCellularAvailable() { when(mServiceState.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE); when(mServiceState2.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE); when(mServiceState.getNetworkRegistrationInfo(anyInt(), anyInt())).thenReturn(null); when(mServiceState2.getNetworkRegistrationInfo(anyInt(), anyInt())).thenReturn(null); assertFalse(SatelliteServiceUtils.isCellularAvailable()); when(mServiceState.getState()).thenReturn(ServiceState.STATE_EMERGENCY_ONLY); Loading @@ -157,6 +160,22 @@ public class SatelliteServiceUtilsTest extends TelephonyTest { when(mServiceState2.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE); when(mServiceState2.isEmergencyOnly()).thenReturn(true); assertTrue(SatelliteServiceUtils.isCellularAvailable()); NetworkRegistrationInfo dataNri = new NetworkRegistrationInfo.Builder() .setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_HOME) .build(); when(mServiceState.getNetworkRegistrationInfo(anyInt(), anyInt())).thenReturn(dataNri); when(mServiceState.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE); when(mServiceState2.isEmergencyOnly()).thenReturn(false); assertTrue(SatelliteServiceUtils.isCellularAvailable()); dataNri = new NetworkRegistrationInfo.Builder() .setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_EMERGENCY) .build(); when(mServiceState.getNetworkRegistrationInfo(anyInt(), anyInt())).thenReturn(dataNri); when(mServiceState.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE); when(mServiceState2.isEmergencyOnly()).thenReturn(false); assertFalse(SatelliteServiceUtils.isCellularAvailable()); } @Test Loading