IMS-VT: Disable upgrade/downgrade if TTY is on.
Upgrade/downgrade is not allowed when TTY is enabled.
A toast message is displayed when user attempts to
upgrade/downgrade the call while TTY is on.
CRs-Fixed: 570918
Change-Id: Ifba57f9b6d80d1fd0e6a60d6cc7b226effa15771
diff --git a/InCallUI/res/values/qtistrings.xml b/InCallUI/res/values/qtistrings.xml
index 533f5fb..3c28164 100644
--- a/InCallUI/res/values/qtistrings.xml
+++ b/InCallUI/res/values/qtistrings.xml
@@ -88,13 +88,15 @@
<!-- Text for the onscreen "consultative transfer" button -->
<string name="qti_ims_onscreenConsultativeTransfer">Consultative Transfer</string>
+ <!-- Message indicating video calls not allowed if user enabled TTY Mode -->
+ <string name="video_call_not_allowed_if_tty_enabled">Please disable TTY Mode to upgrade to video calls.</string>
+
<!-- Description of the deflect target in the Slide unlock screen. [CHAR LIMIT=NONE] -->
<string name="qti_description_target_deflect">Deflect</string>
<string name="qti_description_deflect_error">Number not set. Provide the number via IMS settings and retry.</string>
<string name="qti_description_deflect_service_error">Call Deflection service is not supported.</string>
<!-- Message indicating call failed due to handover not feasible -->
<string name="call_failed_ho_not_feasible">Call was ended as LTE to 3G/2G handover was not feasible.</string>
-
<!-- Text for the onscreen "Add Participant" button -->
<string name="onscreenAddParticipant">Add Participant</string>
diff --git a/InCallUI/src/com/android/incallui/QtiCallUtils.java b/InCallUI/src/com/android/incallui/QtiCallUtils.java
index 528b67b..e741e67 100644
--- a/InCallUI/src/com/android/incallui/QtiCallUtils.java
+++ b/InCallUI/src/com/android/incallui/QtiCallUtils.java
@@ -139,6 +139,12 @@
return;
}
+ if (isTtyEnabled(context)) {
+ Log.w(LOG_TAG, "Call session modification is allowed only when TTY is off.");
+ displayToast(context, R.string.video_call_not_allowed_if_tty_enabled);
+ return;
+ }
+
final ArrayList<CharSequence> items = new ArrayList<CharSequence>();
final ArrayList<Integer> itemToCallType = new ArrayList<Integer>();
final Resources res = context.getResources();
@@ -321,6 +327,21 @@
return isEmergencyNumber;
}
+ /**
+ * Returns true if TTY mode is enabled, false otherwise
+ */
+ private static boolean isTtyEnabled(final Context context) {
+ if (context == null) {
+ Log.w(context, "Context is null...");
+ return false;
+ }
+
+ final int TTY_MODE_OFF = 0;
+ final String PREFERRED_TTY_MODE = "preferred_tty_mode";
+ return (android.provider.Settings.Secure.getInt(context.getContentResolver(),
+ PREFERRED_TTY_MODE, TTY_MODE_OFF) != TTY_MODE_OFF);
+ }
+
static int getPhoneId(int subId) {
try {
Class c = Class.forName("android.telephony.SubscriptionManager");