Fix infinite loop of launching Call accounts on multi-sim device

"Calling accounts" preference is displayed repeatedly, and user can
transit infinitely on multi-sim devices.

To resolve this issue, hide "Call accounts" preference in
"Call settings" on multi-sim devices.

Bug: 110908265
Test: manual - Checked that "Calling accounts" preference is not
displayed in "Call settings" screen on the multi-sim device.
Change-Id: Idd002c7f52d9b22c6c2fc633968a3e5cd018bf43
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index e2f4fee..4aaa05f 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -236,6 +236,17 @@
         TelephonyManager telephonyManager = getSystemService(TelephonyManager.class)
                 .createForSubscriptionId(mPhone.getSubId());
 
+        // Note: The PhoneAccountSettingsActivity accessible via the
+        // android.telecom.action.CHANGE_PHONE_ACCOUNTS intent is accessible directly from
+        // the AOSP Dialer settings page on multi-sim devices.
+        // Where a device does NOT make the PhoneAccountSettingsActivity directly accessible from
+        // its Dialer app, this check must be modified in the device's AOSP branch to ensure that
+        // the PhoneAccountSettingsActivity is always accessible.
+        if (telephonyManager.isMultiSimEnabled()) {
+            Preference phoneAccountSettingsPreference = findPreference(PHONE_ACCOUNT_SETTINGS_KEY);
+            getPreferenceScreen().removePreference(phoneAccountSettingsPreference);
+        }
+
         PreferenceScreen prefSet = getPreferenceScreen();
         mVoicemailSettingsScreen =
                 (PreferenceScreen) findPreference(VOICEMAIL_SETTING_SCREEN_PREF_KEY);