Merge "Support RRO for emergency number conversion map" am: 980ba91dc2 am: 255b792b65
am: 8831900674

Change-Id: I9bca7f94409ccbbd9366f918fd2b5e8dd5e02ad9
diff --git a/src/com/android/phone/EmergencyDialer.java b/src/com/android/phone/EmergencyDialer.java
index 53f6f7e..e7b05ce 100644
--- a/src/com/android/phone/EmergencyDialer.java
+++ b/src/com/android/phone/EmergencyDialer.java
@@ -513,11 +513,12 @@
      */
     private void placeCall() {
         mLastNumber = mDigits.getText().toString();
-        // Convert into emergency number if necessary
-        // This is required in some regions (e.g. Taiwan).
-        if (PhoneNumberUtils.isConvertToEmergencyNumberEnabled()) {
-            mLastNumber = PhoneNumberUtils.convertToEmergencyNumber(mLastNumber);
-        }
+
+        // Convert into emergency number according to emergency conversion map.
+        // If conversion map is not defined (this is default), this method does
+        // nothing and just returns input number.
+        mLastNumber = PhoneNumberUtils.convertToEmergencyNumber(this, mLastNumber);
+
         if (PhoneNumberUtils.isLocalEmergencyNumber(this, mLastNumber)) {
             if (DBG) Log.d(LOG_TAG, "placing call to " + mLastNumber);
 
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index 6cf27cf..0c8c11c 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -328,8 +328,7 @@
 
         // Convert into emergency number if necessary
         // This is required in some regions (e.g. Taiwan).
-        if (!PhoneNumberUtils.isLocalEmergencyNumber(this, number) &&
-                PhoneNumberUtils.isConvertToEmergencyNumberEnabled()) {
+        if (!PhoneNumberUtils.isLocalEmergencyNumber(this, number)) {
             final Phone phone = getPhoneForAccount(request.getAccountHandle(), false);
             // We only do the conversion if the phone is not in service. The un-converted
             // emergency numbers will go to the correct destination when the phone is in-service,
@@ -337,7 +336,7 @@
             // service.
             if (phone == null || phone.getServiceState().getState()
                     != ServiceState.STATE_IN_SERVICE) {
-                String convertedNumber = PhoneNumberUtils.convertToEmergencyNumber(number);
+                String convertedNumber = PhoneNumberUtils.convertToEmergencyNumber(this, number);
                 if (!TextUtils.equals(convertedNumber, number)) {
                     Log.i(this, "onCreateOutgoingConnection, converted to emergency number");
                     number = convertedNumber;