Loading src/java/com/android/internal/telephony/satellite/SatelliteController.java +10 −0 Original line number Diff line number Diff line Loading @@ -92,6 +92,7 @@ import android.os.SystemProperties; import android.os.UserHandle; import android.provider.Settings; import android.provider.Telephony; import android.telecom.TelecomManager; import android.telephony.AccessNetworkConstants; import android.telephony.CarrierConfigManager; import android.telephony.DropBoxManagerLoggerBackend; Loading Loading @@ -254,6 +255,7 @@ public class SatelliteController extends Handler { @NonNull private CarrierRoamingSatelliteControllerStats mCarrierRoamingSatelliteControllerStats; @NonNull private final SubscriptionManagerService mSubscriptionManagerService; @NonNull private final TelephonyCountryDetector mCountryDetector; @NonNull private final TelecomManager mTelecomManager; private final CommandsInterface mCi; private ContentResolver mContentResolver; private final DeviceStateMonitor mDSM; Loading Loading @@ -557,6 +559,7 @@ public class SatelliteController extends Handler { mCountryDetector = TelephonyCountryDetector.getInstance(context); mCountryDetector.registerForWifiConnectivityStateChanged(this, EVENT_WIFI_CONNECTIVITY_STATE_CHANGED, null); mTelecomManager = mContext.getSystemService(TelecomManager.class); // Create the PointingUIController singleton, // which is used to manage interactions with PointingUI app. Loading Loading @@ -1691,6 +1694,13 @@ public class SatelliteController extends Handler { return; } } if (mTelecomManager.isInEmergencyCall()) { plogd("requestSatelliteEnabled: reject as emergency call is ongoing."); sendErrorAndReportSessionMetrics( SatelliteManager.SATELLITE_RESULT_EMERGENCY_CALL_IN_PROGRESS, result); return; } } else { /* if disable satellite, always assume demo is also disabled */ enableDemoMode = false; Loading tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java +19 −3 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import static android.telephony.satellite.SatelliteManager.SATELLITE_COMMUNICATI import static android.telephony.satellite.SatelliteManager.SATELLITE_MODEM_STATE_CONNECTED; import static android.telephony.satellite.SatelliteManager.SATELLITE_MODEM_STATE_OFF; import static android.telephony.satellite.SatelliteManager.SATELLITE_MODEM_STATE_UNAVAILABLE; import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_EMERGENCY_CALL_IN_PROGRESS; import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_ERROR; import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_INVALID_ARGUMENTS; import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_INVALID_MODEM_STATE; Loading Loading @@ -807,6 +808,21 @@ public class SatelliteControllerTest extends TelephonyTest { processAllMessages(); verifySatelliteProvisioned(true, SATELLITE_RESULT_SUCCESS); // Fail to enable satellite when the emergency call is in progress mIIntegerConsumerResults.clear(); mSatelliteControllerUT.setSettingsKeyForSatelliteModeCalled = false; mSatelliteControllerUT.setSettingsKeyToAllowDeviceRotationCalled = false; setUpResponseForRequestSatelliteEnabled(true, false, false, SATELLITE_RESULT_SUCCESS); doReturn(true).when(mTelecomManager).isInEmergencyCall(); mSatelliteControllerUT.requestSatelliteEnabled(SUB_ID, true, false, false, mIIntegerConsumer); mSatelliteControllerUT.setSatelliteSessionController(mMockSatelliteSessionController); processAllMessages(); assertTrue(waitForIIntegerConsumerResult(1)); assertEquals(SATELLITE_RESULT_EMERGENCY_CALL_IN_PROGRESS, (long) mIIntegerConsumerResults.get(0)); doReturn(false).when(mTelecomManager).isInEmergencyCall(); // Successfully enable satellite mIIntegerConsumerResults.clear(); mSatelliteControllerUT.setSettingsKeyForSatelliteModeCalled = false; Loading Loading @@ -989,13 +1005,13 @@ public class SatelliteControllerTest extends TelephonyTest { assertTrue(waitForIIntegerConsumerResult(1)); assertEquals(SATELLITE_RESULT_INVALID_MODEM_STATE, (long) mIIntegerConsumerResults.get(0)); verify(mMockSessionMetricsStats, times(15)).setInitializationResult(anyInt()); verify(mMockSessionMetricsStats, times(15)).setSatelliteTechnology(anyInt()); verify(mMockSessionMetricsStats, times(16)).setInitializationResult(anyInt()); verify(mMockSessionMetricsStats, times(16)).setSatelliteTechnology(anyInt()); verify(mMockSessionMetricsStats, times(3)).setInitializationProcessingTime(anyLong()); verify(mMockSessionMetricsStats, times(2)).setTerminationResult(anyInt()); verify(mMockSessionMetricsStats, times(2)).setTerminationProcessingTime(anyLong()); verify(mMockSessionMetricsStats, times(2)).setSessionDurationSec(anyInt()); verify(mMockSessionMetricsStats, times(15)).reportSessionMetrics(); verify(mMockSessionMetricsStats, times(16)).reportSessionMetrics(); /** * Make areAllRadiosDisabled return false and move mWaitingForRadioDisabled to true, which Loading Loading
src/java/com/android/internal/telephony/satellite/SatelliteController.java +10 −0 Original line number Diff line number Diff line Loading @@ -92,6 +92,7 @@ import android.os.SystemProperties; import android.os.UserHandle; import android.provider.Settings; import android.provider.Telephony; import android.telecom.TelecomManager; import android.telephony.AccessNetworkConstants; import android.telephony.CarrierConfigManager; import android.telephony.DropBoxManagerLoggerBackend; Loading Loading @@ -254,6 +255,7 @@ public class SatelliteController extends Handler { @NonNull private CarrierRoamingSatelliteControllerStats mCarrierRoamingSatelliteControllerStats; @NonNull private final SubscriptionManagerService mSubscriptionManagerService; @NonNull private final TelephonyCountryDetector mCountryDetector; @NonNull private final TelecomManager mTelecomManager; private final CommandsInterface mCi; private ContentResolver mContentResolver; private final DeviceStateMonitor mDSM; Loading Loading @@ -557,6 +559,7 @@ public class SatelliteController extends Handler { mCountryDetector = TelephonyCountryDetector.getInstance(context); mCountryDetector.registerForWifiConnectivityStateChanged(this, EVENT_WIFI_CONNECTIVITY_STATE_CHANGED, null); mTelecomManager = mContext.getSystemService(TelecomManager.class); // Create the PointingUIController singleton, // which is used to manage interactions with PointingUI app. Loading Loading @@ -1691,6 +1694,13 @@ public class SatelliteController extends Handler { return; } } if (mTelecomManager.isInEmergencyCall()) { plogd("requestSatelliteEnabled: reject as emergency call is ongoing."); sendErrorAndReportSessionMetrics( SatelliteManager.SATELLITE_RESULT_EMERGENCY_CALL_IN_PROGRESS, result); return; } } else { /* if disable satellite, always assume demo is also disabled */ enableDemoMode = false; Loading
tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java +19 −3 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import static android.telephony.satellite.SatelliteManager.SATELLITE_COMMUNICATI import static android.telephony.satellite.SatelliteManager.SATELLITE_MODEM_STATE_CONNECTED; import static android.telephony.satellite.SatelliteManager.SATELLITE_MODEM_STATE_OFF; import static android.telephony.satellite.SatelliteManager.SATELLITE_MODEM_STATE_UNAVAILABLE; import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_EMERGENCY_CALL_IN_PROGRESS; import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_ERROR; import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_INVALID_ARGUMENTS; import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_INVALID_MODEM_STATE; Loading Loading @@ -807,6 +808,21 @@ public class SatelliteControllerTest extends TelephonyTest { processAllMessages(); verifySatelliteProvisioned(true, SATELLITE_RESULT_SUCCESS); // Fail to enable satellite when the emergency call is in progress mIIntegerConsumerResults.clear(); mSatelliteControllerUT.setSettingsKeyForSatelliteModeCalled = false; mSatelliteControllerUT.setSettingsKeyToAllowDeviceRotationCalled = false; setUpResponseForRequestSatelliteEnabled(true, false, false, SATELLITE_RESULT_SUCCESS); doReturn(true).when(mTelecomManager).isInEmergencyCall(); mSatelliteControllerUT.requestSatelliteEnabled(SUB_ID, true, false, false, mIIntegerConsumer); mSatelliteControllerUT.setSatelliteSessionController(mMockSatelliteSessionController); processAllMessages(); assertTrue(waitForIIntegerConsumerResult(1)); assertEquals(SATELLITE_RESULT_EMERGENCY_CALL_IN_PROGRESS, (long) mIIntegerConsumerResults.get(0)); doReturn(false).when(mTelecomManager).isInEmergencyCall(); // Successfully enable satellite mIIntegerConsumerResults.clear(); mSatelliteControllerUT.setSettingsKeyForSatelliteModeCalled = false; Loading Loading @@ -989,13 +1005,13 @@ public class SatelliteControllerTest extends TelephonyTest { assertTrue(waitForIIntegerConsumerResult(1)); assertEquals(SATELLITE_RESULT_INVALID_MODEM_STATE, (long) mIIntegerConsumerResults.get(0)); verify(mMockSessionMetricsStats, times(15)).setInitializationResult(anyInt()); verify(mMockSessionMetricsStats, times(15)).setSatelliteTechnology(anyInt()); verify(mMockSessionMetricsStats, times(16)).setInitializationResult(anyInt()); verify(mMockSessionMetricsStats, times(16)).setSatelliteTechnology(anyInt()); verify(mMockSessionMetricsStats, times(3)).setInitializationProcessingTime(anyLong()); verify(mMockSessionMetricsStats, times(2)).setTerminationResult(anyInt()); verify(mMockSessionMetricsStats, times(2)).setTerminationProcessingTime(anyLong()); verify(mMockSessionMetricsStats, times(2)).setSessionDurationSec(anyInt()); verify(mMockSessionMetricsStats, times(15)).reportSessionMetrics(); verify(mMockSessionMetricsStats, times(16)).reportSessionMetrics(); /** * Make areAllRadiosDisabled return false and move mWaitingForRadioDisabled to true, which Loading