Always set the subscription number

Always populate the subscription number, and rely on the in-call UI to
show it when appropriate (and in the appropriate way).

Bug: 13333595
Change-Id: I0d3b2cfcea08aeba760c392c116303f21beb70d3
diff --git a/src/com/android/services/telephony/TelecommAccountRegistry.java b/src/com/android/services/telephony/TelecommAccountRegistry.java
index 794201e..331f719 100644
--- a/src/com/android/services/telephony/TelecommAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecommAccountRegistry.java
@@ -65,6 +65,7 @@
             PhoneAccountMetadata metadata = new PhoneAccountMetadata(
                     phoneAccount,
                     Uri.fromParts(TEL_SCHEME, telephonyManager.getLine1Number(subId), null),
+                    mPhone.getPhoneSubInfo().getLine1Number(),
                     PhoneAccountMetadata.CAPABILITY_SIM_SUBSCRIPTION |
                             PhoneAccountMetadata.CAPABILITY_CALL_PROVIDER,
                     com.android.phone.R.mipmap.ic_launcher_phone,
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 4168366..36e06fd 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -323,30 +323,8 @@
         }
     }
 
-    void onAddedToCallService(ConnectionService connectionService) {
+    void onAddedToCallService() {
         updateState(false);
-
-        StatusHints hints = getStatusHints();
-        if (hints == null) {
-            hints = new StatusHints(
-                    new ComponentName(connectionService, TelephonyConnectionService.class),
-                    "", R.mipmap.ic_launcher_phone, new Bundle());
-        }
-
-        Bundle extras = hints.getExtras();
-        String number = getHandle().getSchemeSpecificPart();
-        if (PhoneNumberUtils.isEmergencyNumber(number)) {
-            Phone phone = getOriginalConnection().getCall().getPhone();
-            long subId = phone.getSubId();
-
-            String simNumber = phone.getPhoneSubInfo().getLine1Number();
-            String visibleNumber = TelephonyManager.from(connectionService).getLine1Number(subId);
-            if (!PhoneNumberUtils.compare(simNumber, visibleNumber)) {
-                Log.d(this, "SIM number is different; populate the SIM number");
-                extras.putString(TelecommConstants.EXTRA_EMERGENCY_CALL_BACK_NUMBER, simNumber);
-            }
-        }
-        setStatusHints(hints);
     }
 
     void onRemovedFromCallService() {
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index 0572d49..835e74e 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -207,7 +207,7 @@
     protected void onConnectionAdded(Connection connection) {
         Log.v(this, "onConnectionAdded, connection: " + connection);
         if (connection instanceof TelephonyConnection) {
-            ((TelephonyConnection) connection).onAddedToCallService(this);
+            ((TelephonyConnection) connection).onAddedToCallService();
         }
     }