Add sort order to PhoneAccounts extras

Add slot index to EXTRA_SORT_ORDER phoneaccount
extras, so that it will be used for sorting
phone accounts in Telecomm.

Test: Manual
Bug: 34872161
Merged-In: I268d2250cc9bcd1a5e9eb8be99dcb23e2bcceadc
Change-Id: I268d2250cc9bcd1a5e9eb8be99dcb23e2bcceadc
diff --git a/src/com/android/services/telephony/TelecomAccountRegistry.java b/src/com/android/services/telephony/TelecomAccountRegistry.java
index 02cd2c4..8abf381 100644
--- a/src/com/android/services/telephony/TelecomAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecomAccountRegistry.java
@@ -209,11 +209,12 @@
             }
 
             mIsVideoPauseSupported = isCarrierVideoPauseSupported();
-            Bundle instantLetteringExtras = null;
+            Bundle phoneAccountExtras = new Bundle();
             if (isCarrierInstantLetteringSupported()) {
                 capabilities |= PhoneAccount.CAPABILITY_CALL_SUBJECT;
-                instantLetteringExtras = getPhoneAccountExtras();
+                phoneAccountExtras = getPhoneAccountExtras(phoneAccountExtras);
             }
+            phoneAccountExtras.putString(PhoneAccount.EXTRA_SORT_ORDER, String.valueOf(slotId));
             mIsMergeCallSupported = isCarrierMergeCallSupported();
             mIsMergeImsCallSupported = isCarrierMergeImsCallSupported();
             mIsVideoConferencingSupported = isCarrierVideoConferencingSupported();
@@ -269,7 +270,7 @@
                     .setShortDescription(description)
                     .setSupportedUriSchemes(Arrays.asList(
                             PhoneAccount.SCHEME_TEL, PhoneAccount.SCHEME_VOICEMAIL))
-                    .setExtras(instantLetteringExtras)
+                    .setExtras(phoneAccountExtras)
                     .setGroupId(groupId)
                     .build();
 
@@ -385,7 +386,7 @@
         /**
          * @return The {@link PhoneAccount} extras associated with the current subscription.
          */
-        private Bundle getPhoneAccountExtras() {
+        private Bundle getPhoneAccountExtras(Bundle phoneAccountExtras) {
             PersistableBundle b =
                     PhoneGlobals.getInstance().getCarrierConfigForSubId(mPhone.getSubId());
 
@@ -394,7 +395,6 @@
             String instantLetteringEncoding = b.getString(
                     CarrierConfigManager.KEY_CARRIER_INSTANT_LETTERING_ENCODING_STRING);
 
-            Bundle phoneAccountExtras = new Bundle();
             phoneAccountExtras.putInt(PhoneAccount.EXTRA_CALL_SUBJECT_MAX_LENGTH,
                     instantLetteringMaxLength);
             phoneAccountExtras.putString(PhoneAccount.EXTRA_CALL_SUBJECT_CHARACTER_ENCODING,