Propagate "call with" account to Telephony layer.

When the user checks "always use this for calls", the setting should
also be saved through to SubInfoRecord.

Bug:18078232

Change-Id: I42874f16521155ed79ab72da57ca8a2d967d0179
diff --git a/src/com/android/server/telecom/PhoneAccountRegistrar.java b/src/com/android/server/telecom/PhoneAccountRegistrar.java
index 0cecf09..d2c67d4 100644
--- a/src/com/android/server/telecom/PhoneAccountRegistrar.java
+++ b/src/com/android/server/telecom/PhoneAccountRegistrar.java
@@ -29,6 +29,7 @@
 import android.telecom.PhoneAccountHandle;
 import android.telecom.TelecomManager;
 import android.telephony.PhoneNumberUtils;
+import android.telephony.SubscriptionManager;
 import android.content.ComponentName;
 import android.content.Context;
 import android.net.Uri;
@@ -217,6 +218,14 @@
                 return;
             }
 
+            if (getPhoneAccount(accountHandle).hasCapabilities(
+                    PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION)) {
+                // If the account selected is a SIM account, propagate down to the subscription
+                // record.
+                long subId = getSubscriptionIdForPhoneAccount(accountHandle);
+                SubscriptionManager.setDefaultVoiceSubId(subId);
+            }
+
             mState.defaultOutgoing = accountHandle;
         }