[automerger skipped] Merge "Remove IMS logs that may contain PII" am: 4ee1537408 am: 75bef0d2f6 -s ours am: 6f8a8a1b89 -s ours

am skip reason: Change-Id I1f547668f08b8988fdd986bd462fde28a5135908 with SHA-1 f06838ce3b is in history

Original change: https://android-review.googlesource.com/c/platform/packages/services/Telephony/+/1398655

Change-Id: I6d713e066775fa91781e4332e91de39ac55c5c7b
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index cf20002..7f97608 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -218,6 +218,7 @@
          from the background.  -->
     <uses-permission android:name="android.permission.START_ACTIVITIES_FROM_BACKGROUND" />
     <uses-permission android:name="android.permission.NETWORK_STATS_PROVIDER" />
+    <uses-permission android:name="android.permission.HANDLE_CAR_MODE_CHANGES"/>
 
     <application android:name="PhoneApp"
             android:persistent="true"
diff --git a/src/com/android/services/telephony/TelecomAccountRegistry.java b/src/com/android/services/telephony/TelecomAccountRegistry.java
index c59df33..7106788 100644
--- a/src/com/android/services/telephony/TelecomAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecomAccountRegistry.java
@@ -847,7 +847,8 @@
                 // Next check whether we're in or near a country that supports it
                 String country =
                         mPhone.getServiceStateTracker().getLocaleTracker()
-                                .getCurrentCountry().toLowerCase();
+                                .getLastKnownCountryIso().toLowerCase();
+
                 String[] supportedCountries = mContext.getResources().getStringArray(
                         R.array.config_simless_emergency_rtt_supported_countries);
                 if (supportedCountries == null || Arrays.stream(supportedCountries).noneMatch(
@@ -856,7 +857,7 @@
                             + " not supported in this country: " + country);
                     return false;
                 }
-                
+
                 return true;
             }