Reject e911 call during non-emergency satellite session.
Bug: 388926638
Test: 388938575
Flag: EXEMPT bugfix
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:7d097d53e863b86ca072361603348fdff17d9e9a)
Merged-In: If8e4b18fc0ef73765b1e5c999ec8503cb085d4f6
Change-Id: If8e4b18fc0ef73765b1e5c999ec8503cb085d4f6
diff --git a/res/values/config.xml b/res/values/config.xml
index 03da05b..4691f3d 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -400,4 +400,7 @@
starting the call. If the value is 0, it doesn't wait and starts the call right after
turning radio power on. -->
<integer name="config_in_service_wait_timer_when_dialing_emergency_routing_ecc_in_apm">3000</integer>
+
+ <!-- Whether to turn off non-emergency nb iot ntn satellite for emergency call -->
+ <bool name="config_turn_off_non_emergency_nb_iot_ntn_satellite_for_emergency_call">true</bool>
</resources>
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index c69880d..6f8e838 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -2152,6 +2152,11 @@
}
if (isEmergencyNumber) {
+ if (!shouldTurnOffNonEmergencyNbIotNtnSessionForEmergencyCall()) {
+ // Carrier
+ return false;
+ }
+
if (mSatelliteController.isDemoModeEnabled()) {
// If user makes emergency call in demo mode, end the satellite session
return true;
@@ -4869,6 +4874,18 @@
return turnOffSatellite;
}
+ private boolean shouldTurnOffNonEmergencyNbIotNtnSessionForEmergencyCall() {
+ boolean turnOffSatellite = false;
+ try {
+ turnOffSatellite = getApplicationContext().getResources().getBoolean(R.bool
+ .config_turn_off_non_emergency_nb_iot_ntn_satellite_for_emergency_call);
+ } catch (Resources.NotFoundException ex) {
+ Log.e(this, ex,
+ "shouldTurnOffNonEmergencyNbIotNtnSessionForEmergencyCall: ex=" + ex);
+ }
+ return turnOffSatellite;
+ }
+
/* Only for testing */
@VisibleForTesting
public void setFeatureFlags(FeatureFlags featureFlags) {
diff --git a/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java b/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
index 6a10d75..3497167 100644
--- a/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
+++ b/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
@@ -1482,7 +1482,8 @@
doReturn(true).when(mFeatureFlags).carrierRoamingNbIotNtn();
doReturn(true).when(mSatelliteController).isSatelliteEnabledOrBeingEnabled();
- // Set config_turn_off_oem_enabled_satellite_during_emergency_call as false
+ // Set config_turn_off_non_emergency_nb_iot_ntn_satellite_for_emergency_call as true
+ doReturn(true).when(mMockResources).getBoolean(anyInt());
doReturn(true).when(mTelephonyManagerProxy).isCurrentEmergencyNumber(anyString());
doReturn(false).when(mSatelliteController).isDemoModeEnabled();
@@ -1562,6 +1563,7 @@
mConnection.getDisconnectCause().getTelephonyDisconnectCause());
// Carrier: shouldTurnOffCarrierSatelliteForEmergencyCall = true
+ doReturn(true).when(mMockResources).getBoolean(anyInt());
doReturn(true).when(mSatelliteController).shouldTurnOffCarrierSatelliteForEmergencyCall();
setupConnectionServiceInApm();
@@ -1569,6 +1571,28 @@
assertNull(mConnection.getDisconnectCause());
}
+ @Test
+ @SmallTest
+ public void testCreateOutgoingEmergencyConnection_NonEmergencySatelliteSession() {
+ doReturn(true).when(mFeatureFlags).carrierRoamingNbIotNtn();
+ doReturn(true).when(mSatelliteController).isSatelliteEnabledOrBeingEnabled();
+
+ // Set config_turn_off_non_emergency_nb_iot_ntn_satellite_for_emergency_call as false
+ doReturn(false).when(mMockResources).getBoolean(anyInt());
+ doReturn(true).when(mTelephonyManagerProxy).isCurrentEmergencyNumber(anyString());
+ doReturn(false).when(mSatelliteController).isDemoModeEnabled();
+
+ // Satellite is for emergency
+ doReturn(false).when(mSatelliteController).getRequestIsEmergency();
+
+ setupConnectionServiceInApm();
+
+ // Verify DisconnectCause which not allows emergency call
+ assertNotNull(mConnection.getDisconnectCause());
+ assertEquals(android.telephony.DisconnectCause.SATELLITE_ENABLED,
+ mConnection.getDisconnectCause().getTelephonyDisconnectCause());
+ }
+
/**
* Test that the TelephonyConnectionService successfully turns radio on before placing the
* call when radio off because bluetooth on and wifi calling is not enabled