Loading src/java/com/android/internal/telephony/satellite/SatelliteController.java +12 −0 Original line number Diff line number Diff line Loading @@ -1178,7 +1178,11 @@ public class SatelliteController extends Handler { case EVENT_RADIO_STATE_CHANGED: { if (mCi.getRadioState() == TelephonyManager.RADIO_POWER_ON) { mIsRadioOn = true; } else if (mCi.getRadioState() == TelephonyManager.RADIO_POWER_OFF) { mIsRadioOn = false; resetCarrierRoamingSatelliteModeParams(); } if (mCi.getRadioState() != TelephonyManager.RADIO_POWER_UNAVAILABLE) { if (mSatelliteModemInterface.isSatelliteServiceConnected()) { synchronized (mIsSatelliteSupportedLock) { Loading Loading @@ -4516,6 +4520,14 @@ public class SatelliteController extends Handler { notificationBuilder.build(), UserHandle.ALL); } private void resetCarrierRoamingSatelliteModeParams() { if (!mFeatureFlags.carrierEnabledSatelliteFlag()) return; for (Phone phone : PhoneFactory.getPhones()) { resetCarrierRoamingSatelliteModeParams(phone.getSubId()); } } private void resetCarrierRoamingSatelliteModeParams(int subId) { if (!mFeatureFlags.carrierEnabledSatelliteFlag()) return; Loading tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java +35 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.internal.telephony.satellite; import static android.telephony.CarrierConfigManager.KEY_EMERGENCY_CALL_TO_SATELLITE_T911_HANDOVER_TIMEOUT_MILLIS_INT; import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL; import static android.telephony.CarrierConfigManager.KEY_SATELLITE_CONNECTION_HYSTERESIS_SEC_INT; import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_DATA; import static android.telephony.SubscriptionManager.SATELLITE_ENTITLEMENT_STATUS; import static android.telephony.satellite.NtnSignalStrength.NTN_SIGNAL_STRENGTH_GOOD; import static android.telephony.satellite.NtnSignalStrength.NTN_SIGNAL_STRENGTH_GREAT; Loading Loading @@ -102,6 +103,7 @@ import android.os.PersistableBundle; import android.os.RemoteException; import android.os.ResultReceiver; import android.telephony.CarrierConfigManager; import android.telephony.NetworkRegistrationInfo; import android.telephony.Rlog; import android.telephony.ServiceState; import android.telephony.satellite.INtnSignalStrengthCallback; Loading Loading @@ -174,6 +176,8 @@ public class SatelliteControllerTest extends TelephonyTest { private static final int[] ACTIVE_SUB_IDS = {SUB_ID}; private static final int TEST_WAIT_FOR_SATELLITE_ENABLING_RESPONSE_TIMEOUT_MILLIS = (int) TimeUnit.SECONDS.toMillis(60); private static final String SATELLITE_PLMN = "00103"; private List<Pair<Executor, CarrierConfigManager.CarrierConfigChangeListener>> mCarrierConfigChangedListenerList = new ArrayList<>(); Loading Loading @@ -700,6 +704,37 @@ public class SatelliteControllerTest extends TelephonyTest { .requestIsSatelliteSupported(any(Message.class)); } @Test public void testRadioPowerOff() { when(mFeatureFlags.carrierEnabledSatelliteFlag()).thenReturn(true); NetworkRegistrationInfo satelliteNri = new NetworkRegistrationInfo.Builder() .setIsNonTerrestrialNetwork(true) .setAvailableServices(List.of(NetworkRegistrationInfo.SERVICE_TYPE_DATA)) .build(); mCarrierConfigBundle.putInt(KEY_SATELLITE_CONNECTION_HYSTERESIS_SEC_INT, 1 * 60); mCarrierConfigBundle.putBoolean(KEY_SATELLITE_ATTACH_SUPPORTED_BOOL, true); for (Pair<Executor, CarrierConfigManager.CarrierConfigChangeListener> pair : mCarrierConfigChangedListenerList) { pair.first.execute(() -> pair.second.onCarrierConfigChanged( /*slotIndex*/ 0, /*subId*/ SUB_ID, /*carrierId*/ 0, /*specificCarrierId*/ 0) ); } when(mServiceState.getNetworkRegistrationInfoList()).thenReturn(List.of(satelliteNri)); when(mServiceState.isUsingNonTerrestrialNetwork()).thenReturn(true); sendServiceStateChangedEvent(); processAllMessages(); assertTrue(mSatelliteControllerUT.isInSatelliteModeForCarrierRoaming(mPhone)); assertEquals(List.of(SERVICE_TYPE_DATA), mSatelliteControllerUT.getCapabilitiesForCarrierRoamingSatelliteMode(mPhone)); when(mServiceState.isUsingNonTerrestrialNetwork()).thenReturn(false); setRadioPower(false); processAllMessages(); assertFalse(mSatelliteControllerUT.isInSatelliteModeForCarrierRoaming(mPhone)); assertEquals(new ArrayList<>(), mSatelliteControllerUT.getCapabilitiesForCarrierRoamingSatelliteMode(mPhone)); } @Test public void testRequestSatelliteEnabled() { mIsSatelliteEnabledSemaphore.drainPermits(); Loading Loading
src/java/com/android/internal/telephony/satellite/SatelliteController.java +12 −0 Original line number Diff line number Diff line Loading @@ -1178,7 +1178,11 @@ public class SatelliteController extends Handler { case EVENT_RADIO_STATE_CHANGED: { if (mCi.getRadioState() == TelephonyManager.RADIO_POWER_ON) { mIsRadioOn = true; } else if (mCi.getRadioState() == TelephonyManager.RADIO_POWER_OFF) { mIsRadioOn = false; resetCarrierRoamingSatelliteModeParams(); } if (mCi.getRadioState() != TelephonyManager.RADIO_POWER_UNAVAILABLE) { if (mSatelliteModemInterface.isSatelliteServiceConnected()) { synchronized (mIsSatelliteSupportedLock) { Loading Loading @@ -4516,6 +4520,14 @@ public class SatelliteController extends Handler { notificationBuilder.build(), UserHandle.ALL); } private void resetCarrierRoamingSatelliteModeParams() { if (!mFeatureFlags.carrierEnabledSatelliteFlag()) return; for (Phone phone : PhoneFactory.getPhones()) { resetCarrierRoamingSatelliteModeParams(phone.getSubId()); } } private void resetCarrierRoamingSatelliteModeParams(int subId) { if (!mFeatureFlags.carrierEnabledSatelliteFlag()) return; Loading
tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java +35 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.internal.telephony.satellite; import static android.telephony.CarrierConfigManager.KEY_EMERGENCY_CALL_TO_SATELLITE_T911_HANDOVER_TIMEOUT_MILLIS_INT; import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL; import static android.telephony.CarrierConfigManager.KEY_SATELLITE_CONNECTION_HYSTERESIS_SEC_INT; import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_DATA; import static android.telephony.SubscriptionManager.SATELLITE_ENTITLEMENT_STATUS; import static android.telephony.satellite.NtnSignalStrength.NTN_SIGNAL_STRENGTH_GOOD; import static android.telephony.satellite.NtnSignalStrength.NTN_SIGNAL_STRENGTH_GREAT; Loading Loading @@ -102,6 +103,7 @@ import android.os.PersistableBundle; import android.os.RemoteException; import android.os.ResultReceiver; import android.telephony.CarrierConfigManager; import android.telephony.NetworkRegistrationInfo; import android.telephony.Rlog; import android.telephony.ServiceState; import android.telephony.satellite.INtnSignalStrengthCallback; Loading Loading @@ -174,6 +176,8 @@ public class SatelliteControllerTest extends TelephonyTest { private static final int[] ACTIVE_SUB_IDS = {SUB_ID}; private static final int TEST_WAIT_FOR_SATELLITE_ENABLING_RESPONSE_TIMEOUT_MILLIS = (int) TimeUnit.SECONDS.toMillis(60); private static final String SATELLITE_PLMN = "00103"; private List<Pair<Executor, CarrierConfigManager.CarrierConfigChangeListener>> mCarrierConfigChangedListenerList = new ArrayList<>(); Loading Loading @@ -700,6 +704,37 @@ public class SatelliteControllerTest extends TelephonyTest { .requestIsSatelliteSupported(any(Message.class)); } @Test public void testRadioPowerOff() { when(mFeatureFlags.carrierEnabledSatelliteFlag()).thenReturn(true); NetworkRegistrationInfo satelliteNri = new NetworkRegistrationInfo.Builder() .setIsNonTerrestrialNetwork(true) .setAvailableServices(List.of(NetworkRegistrationInfo.SERVICE_TYPE_DATA)) .build(); mCarrierConfigBundle.putInt(KEY_SATELLITE_CONNECTION_HYSTERESIS_SEC_INT, 1 * 60); mCarrierConfigBundle.putBoolean(KEY_SATELLITE_ATTACH_SUPPORTED_BOOL, true); for (Pair<Executor, CarrierConfigManager.CarrierConfigChangeListener> pair : mCarrierConfigChangedListenerList) { pair.first.execute(() -> pair.second.onCarrierConfigChanged( /*slotIndex*/ 0, /*subId*/ SUB_ID, /*carrierId*/ 0, /*specificCarrierId*/ 0) ); } when(mServiceState.getNetworkRegistrationInfoList()).thenReturn(List.of(satelliteNri)); when(mServiceState.isUsingNonTerrestrialNetwork()).thenReturn(true); sendServiceStateChangedEvent(); processAllMessages(); assertTrue(mSatelliteControllerUT.isInSatelliteModeForCarrierRoaming(mPhone)); assertEquals(List.of(SERVICE_TYPE_DATA), mSatelliteControllerUT.getCapabilitiesForCarrierRoamingSatelliteMode(mPhone)); when(mServiceState.isUsingNonTerrestrialNetwork()).thenReturn(false); setRadioPower(false); processAllMessages(); assertFalse(mSatelliteControllerUT.isInSatelliteModeForCarrierRoaming(mPhone)); assertEquals(new ArrayList<>(), mSatelliteControllerUT.getCapabilitiesForCarrierRoamingSatelliteMode(mPhone)); } @Test public void testRequestSatelliteEnabled() { mIsSatelliteEnabledSemaphore.drainPermits(); Loading