Fix to display accounts in order

Do not sort accounts based on hash code as it changes the order
accounts visible to the user.

Fix: 27106350
Change-Id: I52cd42b60c02d57ad8648e0b9f1876628f0d74a6
diff --git a/src/com/android/phone/settings/PhoneAccountSettingsFragment.java b/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
index 70e9fad..25c0f95 100644
--- a/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
+++ b/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
@@ -306,6 +306,14 @@
                     retval = isSim1 ? -1 : 1;
                 }
 
+                int subId1 = PhoneUtils.getSubIdForPhoneAccount(account1);
+                int subId2 = PhoneUtils.getSubIdForPhoneAccount(account2);
+                if (subId1 != SubscriptionManager.INVALID_SUBSCRIPTION_ID &&
+                        subId2 != SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+                    retval = (mSubscriptionManager.getSlotId(subId1) <
+                        mSubscriptionManager.getSlotId(subId2)) ? -1 : 1;
+                }
+
                 // Then order by package
                 if (retval == 0) {
                     String pkg1 = account1.getAccountHandle().getComponentName().getPackageName();