Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 06ab3b14 authored by Garik Badalyan's avatar Garik Badalyan Committed by Linux Build Service Account
Browse files

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
parent 96d3afba
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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>

+21 −0
Original line number Diff line number Diff line
@@ -139,6 +139,12 @@ public class QtiCallUtils {
            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 @@ public class QtiCallUtils {
        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");