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

Commit 10e574ac authored by Jeevaka Badrappan's avatar Jeevaka Badrappan
Browse files

telephony: Fix issue in short code ussd detection



According to the 3PGG TS 22.030 specification
Figure 3.5.3.2: A 1 or 2 digit "short code" is
treated as USSD if it is entered while on a call or
does not satisfy the condition (exactly 2 digits
&& starts with '1').

Following rule is already addressed in function
GsmMmiCode::newFromDialString.

If the user of the device enters one digit followed
by the #-key, phone shall initiate a USSD/SS command

Change-Id: I70795da1fb5144d1c91059f6200b74b5fd33de22
Author: Jeevaka Badrappan <jeevaka.badrappan@intel.com>
Signed-off-by: default avatarJack Ren <jack.ren@intel.com>
Signed-off-by: default avatarBruce Beare <bruce.j.beare@intel.com>
Author-tracking-BZ: 28800
parent 08159700
Loading
Loading
Loading
Loading
+5 −16
Original line number Diff line number Diff line
@@ -538,29 +538,18 @@ public final class GsmMmiCode extends Handler implements MmiCode {
     * equal or less then the MAX_LENGTH_SHORT_CODE [constant that is equal to 2]
     *
     * The phone shall initiate a USSD/SS commands.
     *
     * Exception (2) to Call initiation is: If the user of the device enters one
     * Digit followed by the #-key. This rule defines this String as the
     * #-String which is a USSD/SS command.
     *
     * The phone shall initiate a USSD/SS command.
     */
    static private boolean isShortCodeUSSD(String dialString, GSMPhone phone) {
        if (dialString != null) {
        if (dialString != null && dialString.length() <= MAX_LENGTH_SHORT_CODE) {
            if (phone.isInCall()) {
                // The maximum length of a Short Code (aka Short String) is 2
                if (dialString.length() <= MAX_LENGTH_SHORT_CODE) {
                return true;
            }
            }

            // The maximum length of a Short Code (aka Short String) is 2
            if (dialString.length() <= MAX_LENGTH_SHORT_CODE) {
                if (dialString.charAt(dialString.length() - 1) == END_OF_USSD_COMMAND) {
            if (dialString.length() != MAX_LENGTH_SHORT_CODE ||
                    dialString.charAt(0) != '1') {
                return true;
            }
        }
        }
        return false;
    }