Merge "[MEP] Refactor PhoneInterfaceManager to integrate with latest MEP platform changes."
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index cf365e7..256212c 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -6706,8 +6706,13 @@
mApp.enforceCallingOrSelfPermission(android.Manifest.permission.ACCESS_NETWORK_STATE,
null);
} catch (Exception e) {
- mApp.enforceCallingOrSelfPermission(android.Manifest.permission.READ_PHONE_STATE,
- "isDataEnabledForReason");
+ try {
+ mApp.enforceCallingOrSelfPermission(android.Manifest.permission.READ_PHONE_STATE,
+ "isDataEnabledForReason");
+ } catch (Exception e2) {
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, subId, "isDataEnabledForReason");
+ }
}
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index 55456f6..a392876 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -2086,8 +2086,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"
@@ -2210,12 +2209,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) {
@@ -2234,6 +2227,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) {