IMS-VT: Disable TTY mode settings when in a video call
- Currently TTY mode is turned off when we are in a call
and if volte is enabled and tty mode for volte is supported
"carrier_volte_tty_supported_bool" which is set to true in
config manager defaults
- Add a check to see if video call is in progress on any phone
object then disable TTY mode settings
Bug: 27106636
Change-Id: Ie15585362f59d71d242d87e41b3c495e6508a85c
diff --git a/src/com/android/phone/settings/AccessibilitySettingsFragment.java b/src/com/android/phone/settings/AccessibilitySettingsFragment.java
index d5a613b..ea19f75 100644
--- a/src/com/android/phone/settings/AccessibilitySettingsFragment.java
+++ b/src/com/android/phone/settings/AccessibilitySettingsFragment.java
@@ -31,10 +31,14 @@
import android.util.Log;
import com.android.ims.ImsManager;
+import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.PhoneFactory;
import com.android.phone.PhoneGlobals;
import com.android.phone.R;
import com.android.phone.settings.TtyModeListPreference;
+import java.util.List;
+
public class AccessibilitySettingsFragment extends PreferenceFragment {
private static final String LOG_TAG = AccessibilitySettingsFragment.class.getSimpleName();
private static final boolean DBG = (PhoneGlobals.DBG_LEVEL >= 2);
@@ -54,7 +58,10 @@
if (DBG) Log.d(LOG_TAG, "PhoneStateListener.onCallStateChanged: state=" + state);
Preference pref = getPreferenceScreen().findPreference(BUTTON_TTY_KEY);
if (pref != null) {
- pref.setEnabled(state == TelephonyManager.CALL_STATE_IDLE);
+ final boolean isVolteTtySupported = ImsManager.isVolteEnabledByPlatform(mContext)
+ && getVolteTtySupported();
+ pref.setEnabled((isVolteTtySupported && !isVideoCallInProgress()) ||
+ (state == TelephonyManager.CALL_STATE_IDLE));
}
}
};
@@ -98,23 +105,17 @@
@Override
public void onResume() {
super.onResume();
-
- if (ImsManager.isVolteEnabledByPlatform(mContext) && !getVolteTtySupported()) {
- TelephonyManager tm =
- (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
- tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
- }
+ TelephonyManager tm =
+ (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
+ tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
}
@Override
public void onPause() {
super.onPause();
-
- if (ImsManager.isVolteEnabledByPlatform(mContext) && !getVolteTtySupported()) {
- TelephonyManager tm =
- (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
- tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
- }
+ TelephonyManager tm =
+ (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
+ tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
}
@Override
@@ -142,4 +143,19 @@
return configManager.getConfig().getBoolean(
CarrierConfigManager.KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL);
}
+
+ private boolean isVideoCallInProgress() {
+ final Phone[] phones = PhoneFactory.getPhones();
+ if (phones == null) {
+ if (DBG) Log.d(LOG_TAG, "isVideoCallInProgress: No phones found. Return false");
+ return false;
+ }
+
+ for (Phone phone : phones) {
+ if (phone.isVideoCallPresent()) {
+ return true;
+ }
+ }
+ return false;
+ }
}