Merge "Ensure PIN/PUK status is taken into account on HAL 1.4+" into sc-qpr1-dev am: 76a18880bb
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/services/Telephony/+/16382902
Change-Id: Ia8838d2ec671d3f525fbc2415fbf3f79702db43e
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index e637791..93b3670 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -2085,8 +2085,7 @@
if (phone.getEmergencyNumberTracker() != null) {
if (phone.getEmergencyNumberTracker().isEmergencyNumber(
emergencyNumberAddress, true)) {
- if (phone.getHalVersion().greaterOrEqual(RIL.RADIO_HAL_VERSION_1_4)
- || isAvailableForEmergencyCalls(phone)) {
+ if (isAvailableForEmergencyCalls(phone)) {
// a)
if (phone.getPhoneId() == defaultVoicePhoneId) {
Log.i(this, "getPhoneForEmergencyCall, Phone Id that supports"
@@ -2209,12 +2208,6 @@
// Only sort if there are enough elements to do so.
if (phoneSlotStatus.size() > 1) {
Collections.sort(phoneSlotStatus, (o1, o2) -> {
- if (!o1.hasDialedEmergencyNumber && o2.hasDialedEmergencyNumber) {
- return -1;
- }
- if (o1.hasDialedEmergencyNumber && !o2.hasDialedEmergencyNumber) {
- return 1;
- }
// Sort by non-absent SIM.
if (o1.simState == TelephonyManager.SIM_STATE_ABSENT
&& o2.simState != TelephonyManager.SIM_STATE_ABSENT) {
@@ -2233,6 +2226,13 @@
if (o2.isLocked && !o1.isLocked) {
return 1;
}
+ // Prefer slots where the number is considered emergency.
+ if (!o1.hasDialedEmergencyNumber && o2.hasDialedEmergencyNumber) {
+ return -1;
+ }
+ if (o1.hasDialedEmergencyNumber && !o2.hasDialedEmergencyNumber) {
+ return 1;
+ }
// sort by number of RadioAccessFamily Capabilities.
int compare = RadioAccessFamily.compare(o1.capabilities, o2.capabilities);
if (compare == 0) {