Do not allow emergency call with bootstrap profile am: 2da5d2efee
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/services/Telephony/+/26990636
Change-Id: I1691845df5d8a346ce6b050ee080023efea0c38b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/res/values/config.xml b/res/values/config.xml
index 5dae649..a934398 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -328,6 +328,16 @@
<item>sg</item>
<!-- b/198393826 -->
<item>de</item>
+ <!-- b/334773484 -->
+ <item>gb</item>
+ <item>fr</item>
+ <item>be</item>
+ <item>ro</item>
+ <item>si</item>
+ <item>hr</item>
+ <item>gr</item>
+ <item>bg</item>
+ <item>my</item>
</string-array>
<!-- Array of countries that a normal service capable subscription is preferred
diff --git a/src/com/android/services/telephony/domainselection/EmergencyCallDomainSelector.java b/src/com/android/services/telephony/domainselection/EmergencyCallDomainSelector.java
index a073397..18c03ac 100644
--- a/src/com/android/services/telephony/domainselection/EmergencyCallDomainSelector.java
+++ b/src/com/android/services/telephony/domainselection/EmergencyCallDomainSelector.java
@@ -57,6 +57,7 @@
import static android.telephony.PreciseDisconnectCause.EMERGENCY_TEMP_FAILURE;
import static android.telephony.PreciseDisconnectCause.NO_VALID_SIM;
import static android.telephony.PreciseDisconnectCause.SERVICE_OPTION_NOT_AVAILABLE;
+import static android.telephony.SubscriptionManager.PROFILE_CLASS_PROVISIONING;
import static android.telephony.TelephonyManager.DATA_CONNECTED;
import static android.telephony.TelephonyManager.DATA_DISCONNECTED;
import static android.telephony.TelephonyManager.DATA_DISCONNECTING;
@@ -85,6 +86,7 @@
import android.telephony.DomainSelectionService.SelectionAttributes;
import android.telephony.EmergencyRegistrationResult;
import android.telephony.NetworkRegistrationInfo;
+import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.TransportSelectorCallback;
@@ -1541,7 +1543,6 @@
}
private boolean allowEmergencyCalls(EmergencyRegistrationResult regResult) {
- if (mModemCount < 2) return true;
if (regResult == null) {
loge("allowEmergencyCalls null regResult");
return true;
@@ -1549,14 +1550,18 @@
String iso = regResult.getCountryIso();
if (sSimReadyAllowList.contains(iso)) {
- TelephonyManager tm = mContext.getSystemService(TelephonyManager.class);
- int simState = tm.getSimState(getSlotId());
- if (simState != TelephonyManager.SIM_STATE_READY) {
- logi("allowEmergencyCalls not ready, simState=" + simState + ", iso=" + iso);
- if (mCrossSimRedialingController.isThereOtherSlot()) {
+ if (isSimReady()) {
+ SubscriptionManager sm = mContext.getSystemService(SubscriptionManager.class);
+ SubscriptionInfo subInfo = sm.getActiveSubscriptionInfo(getSubId());
+ if (subInfo != null
+ && subInfo.getProfileClass() == PROFILE_CLASS_PROVISIONING) {
+ // b/334773484, bootstrap profile
+ logi("allowEmergencyCalls bootstrap profile, iso=" + iso);
return false;
}
- logi("allowEmergencyCalls there is no other slot available");
+ } else {
+ logi("allowEmergencyCalls SIM state not ready, iso=" + iso);
+ return false;
}
}
@@ -1579,7 +1584,12 @@
private void terminateSelectionPermanentlyForSlot() {
logi("terminateSelectionPermanentlyForSlot");
- terminateSelection(DisconnectCause.EMERGENCY_PERM_FAILURE);
+ mCrossSimRedialingController.notifyCallFailure(EMERGENCY_PERM_FAILURE);
+ if (mCrossSimRedialingController.isThereOtherSlot()) {
+ terminateSelection(DisconnectCause.EMERGENCY_PERM_FAILURE);
+ } else {
+ terminateSelection(DisconnectCause.ICC_ERROR);
+ }
}
private void terminateSelectionForCrossSimRedialing(boolean permanent) {
diff --git a/tests/src/com/android/services/telephony/domainselection/EmergencyCallDomainSelectorTest.java b/tests/src/com/android/services/telephony/domainselection/EmergencyCallDomainSelectorTest.java
index a1d4162..fab7256 100644
--- a/tests/src/com/android/services/telephony/domainselection/EmergencyCallDomainSelectorTest.java
+++ b/tests/src/com/android/services/telephony/domainselection/EmergencyCallDomainSelectorTest.java
@@ -1840,9 +1840,8 @@
bindImsServiceUnregistered();
processAllMessages();
- verify(mTransportSelectorCallback, times(0))
- .onSelectionTerminated(eq(DisconnectCause.EMERGENCY_PERM_FAILURE));
- verifyScanPsPreferred();
+ verify(mTransportSelectorCallback, times(1))
+ .onSelectionTerminated(eq(DisconnectCause.ICC_ERROR));
}
@Test