Skip to content

Commit 0a4b3fd

Browse files
committed
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
1 parent 155b0ee commit 0a4b3fd

File tree

4 files changed

+94
-1
lines changed

4 files changed

+94
-1
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/*
4+
** Copyright 2009, The Android Open Source Project
5+
**
6+
** Licensed under the Apache License, Version 2.0 (the "License");
7+
** you may not use this file except in compliance with the License.
8+
** You may obtain a copy of the License at
9+
**
10+
** http://www.apache.org/licenses/LICENSE-2.0
11+
**
12+
** Unless required by applicable law or agreed to in writing, software
13+
** distributed under the License is distributed on an "AS IS" BASIS,
14+
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
** See the License for the specific language governing permissions and
16+
** limitations under the License.
17+
*/
18+
-->
19+
20+
<!-- These resources are around just to allow their values to be customized
21+
for different hardware and product builds. -->
22+
<resources>
23+
<!-- Do not translate. Defines the slots is Two Digit Number for dialing normally not USSD -->
24+
<string-array name="config_twoDigitNumberPattern">
25+
<item>"92"</item>
26+
<item>"93"</item>
27+
<item>"94"</item>
28+
<item>"95"</item>
29+
<item>"96"</item>
30+
</string-array>
31+
32+
</resources>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/*
4+
** Copyright 2009, The Android Open Source Project
5+
**
6+
** Licensed under the Apache License, Version 2.0 (the "License");
7+
** you may not use this file except in compliance with the License.
8+
** You may obtain a copy of the License at
9+
**
10+
** http://www.apache.org/licenses/LICENSE-2.0
11+
**
12+
** Unless required by applicable law or agreed to in writing, software
13+
** distributed under the License is distributed on an "AS IS" BASIS,
14+
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
** See the License for the specific language governing permissions and
16+
** limitations under the License.
17+
*/
18+
-->
19+
20+
<!-- These resources are around just to allow their values to be customized
21+
for different hardware and product builds. -->
22+
<resources>
23+
<!-- Do not translate. Defines the slots is Two Digit Number for dialing normally not USSD -->
24+
<string-array name="config_twoDigitNumberPattern">
25+
<item>"92"</item>
26+
<item>"93"</item>
27+
<item>"94"</item>
28+
<item>"95"</item>
29+
<item>"96"</item>
30+
</string-array>
31+
32+
</resources>

core/res/res/values/config.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,4 +373,8 @@
373373
<!-- Boolean indicating if restoring network selection should be skipped -->
374374
<!-- The restoring is handled by modem if it is true-->
375375
<bool translatable="false" name="skip_restoring_network_selection">false</bool>
376+
377+
<!-- Do not translate. Defines the slots is Two Digit Number for dialing normally not USSD -->
378+
<string-array name="config_twoDigitNumberPattern">
379+
</string-array>
376380
</resources>

telephony/java/com/android/internal/telephony/gsm/GsmMmiCode.java

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public final class GsmMmiCode extends Handler implements MmiCode {
148148
static final int MATCH_GROUP_SIC = 9;
149149
static final int MATCH_GROUP_PWD_CONFIRM = 11;
150150
static final int MATCH_GROUP_DIALING_NUMBER = 12;
151-
151+
static private String[] sTwoDigitNumberPattern;
152152

153153
//***** Public Class methods
154154

@@ -191,6 +191,9 @@ public final class GsmMmiCode extends Handler implements MmiCode {
191191

192192
ret = new GsmMmiCode(phone);
193193
ret.poundString = dialString;
194+
} else if (isTwoDigitShortCode(phone.getContext(), dialString)) {
195+
//Is a country-specific exception to short codes as defined in TS 22.030, 6.5.3.2
196+
ret = null;
194197
} else if (isShortCode(dialString, phone)) {
195198
// this may be a short code, as defined in TS 22.030, 6.5.3.2
196199
ret = new GsmMmiCode(phone);
@@ -445,6 +448,28 @@ public boolean isCancelable() {
445448

446449
}
447450

451+
static private boolean
452+
isTwoDigitShortCode(Context context, String dialString) {
453+
Log.d(LOG_TAG, "isTwoDigitShortCode");
454+
455+
if (dialString == null || dialString.length() != 2) return false;
456+
457+
if (sTwoDigitNumberPattern == null) {
458+
sTwoDigitNumberPattern = context.getResources().getStringArray(
459+
com.android.internal.R.array.config_twoDigitNumberPattern);
460+
}
461+
462+
for (String dialnumber : sTwoDigitNumberPattern) {
463+
Log.d(LOG_TAG, "Two Digit Number Pattern " + dialnumber);
464+
if (dialString.equals(dialnumber)) {
465+
Log.d(LOG_TAG, "Two Digit Number Pattern -true");
466+
return true;
467+
}
468+
}
469+
Log.d(LOG_TAG, "Two Digit Number Pattern -false");
470+
return false;
471+
}
472+
448473
/**
449474
* Helper function for newFromDialString. Returns true if dialString appears to be a short code
450475
* AND conditions are correct for it to be treated as such.

0 commit comments

Comments
 (0)