From 0a4b3fd93b2de21de0684a8291663920d9099170 Mon Sep 17 00:00:00 2001 From: Irfan Sheriff Date: Wed, 2 Feb 2011 12:34:08 -0800 Subject: two digit number handling in croatia and serbia If users dial 92-96, dial them normally and not treat as USSD Change-Id: If3b6cb37b7ec0ff99d76cb10cba53368094a0b5d Signed-off-by: sj2202.park@samsung.com --- .../android/internal/telephony/gsm/GsmMmiCode.java | 27 +++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'telephony') diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmMmiCode.java b/telephony/java/com/android/internal/telephony/gsm/GsmMmiCode.java index aa16fa3..5c7ce2f 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmMmiCode.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmMmiCode.java @@ -148,7 +148,7 @@ public final class GsmMmiCode extends Handler implements MmiCode { static final int MATCH_GROUP_SIC = 9; static final int MATCH_GROUP_PWD_CONFIRM = 11; static final int MATCH_GROUP_DIALING_NUMBER = 12; - + static private String[] sTwoDigitNumberPattern; //***** Public Class methods @@ -191,6 +191,9 @@ public final class GsmMmiCode extends Handler implements MmiCode { ret = new GsmMmiCode(phone); ret.poundString = dialString; + } else if (isTwoDigitShortCode(phone.getContext(), dialString)) { + //Is a country-specific exception to short codes as defined in TS 22.030, 6.5.3.2 + ret = null; } else if (isShortCode(dialString, phone)) { // this may be a short code, as defined in TS 22.030, 6.5.3.2 ret = new GsmMmiCode(phone); @@ -445,6 +448,28 @@ public final class GsmMmiCode extends Handler implements MmiCode { } + static private boolean + isTwoDigitShortCode(Context context, String dialString) { + Log.d(LOG_TAG, "isTwoDigitShortCode"); + + if (dialString == null || dialString.length() != 2) return false; + + if (sTwoDigitNumberPattern == null) { + sTwoDigitNumberPattern = context.getResources().getStringArray( + com.android.internal.R.array.config_twoDigitNumberPattern); + } + + for (String dialnumber : sTwoDigitNumberPattern) { + Log.d(LOG_TAG, "Two Digit Number Pattern " + dialnumber); + if (dialString.equals(dialnumber)) { + Log.d(LOG_TAG, "Two Digit Number Pattern -true"); + return true; + } + } + Log.d(LOG_TAG, "Two Digit Number Pattern -false"); + return false; + } + /** * Helper function for newFromDialString. Returns true if dialString appears to be a short code * AND conditions are correct for it to be treated as such. -- cgit v1.1