IMS: Disable TTY settings during call

-- Disable TTY settings during call for multi sim
   configuration by listening call state on both
   the subscriptions.

Test: Manual
Bug: 74939081
Change-Id: I7681649ae5bbbe6a31909c13a0cfec72ecf53a86
diff --git a/src/com/android/phone/settings/AccessibilitySettingsFragment.java b/src/com/android/phone/settings/AccessibilitySettingsFragment.java
index 57b6d8e..0eb3845 100644
--- a/src/com/android/phone/settings/AccessibilitySettingsFragment.java
+++ b/src/com/android/phone/settings/AccessibilitySettingsFragment.java
@@ -57,10 +57,17 @@
             if (DBG) Log.d(LOG_TAG, "PhoneStateListener.onCallStateChanged: state=" + state);
             Preference pref = getPreferenceScreen().findPreference(BUTTON_TTY_KEY);
             if (pref != null) {
-                final boolean isVolteTtySupported = ImsManager.isVolteEnabledByPlatform(mContext)
-                        && getVolteTtySupported();
-                pref.setEnabled((isVolteTtySupported && !isVideoCallOrConferenceInProgress()) ||
-                        (state == TelephonyManager.CALL_STATE_IDLE));
+                // Use TelephonyManager#getCallState instead of 'state' parameter because
+                // needs to check the current state of all phone calls to
+                // support multi sim configuration.
+                TelephonyManager telephonyManager =
+                        (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
+                final boolean isVolteTtySupported = getVolteTtySupported();
+                final boolean isVolteCurrentlyEnabled =
+                        ImsManager.isVolteEnabledByPlatform(mContext);
+                pref.setEnabled((isVolteTtySupported && isVolteCurrentlyEnabled &&
+                        !isVideoCallOrConferenceInProgress()) ||
+                        (telephonyManager.getCallState() == TelephonyManager.CALL_STATE_IDLE));
             }
         }
     };