summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/res/res/values/public.xml1
-rwxr-xr-xcore/res/res/values/strings.xml16
-rw-r--r--core/res/res/xml/sms_short_codes.xml189
-rw-r--r--telephony/java/com/android/internal/telephony/SMSDispatcher.java61
-rw-r--r--telephony/java/com/android/internal/telephony/SmsUsageMonitor.java321
-rw-r--r--telephony/tests/telephonytests/src/com/android/internal/telephony/SmsUsageMonitorShortCodeTest.java466
6 files changed, 9 insertions, 1045 deletions
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 801fdf6..7c2ce47 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1141,7 +1141,6 @@
<java-symbol type="xml" name="password_kbd_symbols_shift" />
<java-symbol type="xml" name="power_profile" />
<java-symbol type="xml" name="time_zones_by_country" />
- <java-symbol type="xml" name="sms_short_codes" />
<java-symbol type="raw" name="accessibility_gestures" />
<java-symbol type="raw" name="incognito_mode_start_page" />
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index ec8634a9..9861bae 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -2925,22 +2925,6 @@
<!-- See SMS_DIALOG. This is a button choice to disallow sending the SMSes. [CHAR LIMIT=30] -->
<string name="sms_control_no">Deny</string>
- <!-- SMS short code verification dialog. --> <skip />
- <!-- The dialog title for the SMS short code confirmation dialog. [CHAR LIMIT=30] -->
- <string name="sms_short_code_confirm_title">Send SMS to short code?</string>
- <!-- The dialog title for the SMS premium short code confirmation dialog. [CHAR LIMIT=30] -->
- <string name="sms_premium_short_code_confirm_title">Send premium SMS?</string>
- <!-- The message text for the SMS short code confirmation dialog. [CHAR LIMIT=NONE] -->
- <string name="sms_short_code_confirm_message">&lt;b><xliff:g id="app_name">%1$s</xliff:g>&lt;/b> would like to send a text message to &lt;b><xliff:g id="dest_address">%2$s</xliff:g>&lt;/b>, which appears to be an SMS short code.&lt;p>Sending text messages to some short codes may cause your mobile account to be billed for premium services.&lt;p>Do you want to allow this app to send the message?</string>
- <!-- The message text for the SMS short code confirmation dialog. [CHAR LIMIT=NONE] -->
- <string name="sms_premium_short_code_confirm_message">&lt;b><xliff:g id="app_name">%1$s</xliff:g>&lt;/b> would like to send a text message to &lt;b><xliff:g id="dest_address">%2$s</xliff:g>&lt;/b>, which is a premium SMS short code.&lt;p>&lt;b>Sending a message to this destination will cause your mobile account to be billed for premium services.&lt;/b>&lt;p>Do you want to allow this app to send the message?</string>
- <!-- Text of the approval button for the SMS short code confirmation dialog. [CHAR LIMIT=50] -->
- <string name="sms_short_code_confirm_allow">Send message</string>
- <!-- Text of the cancel button for the SMS short code confirmation dialog. [CHAR LIMIT=30] -->
- <string name="sms_short_code_confirm_deny">Don\'t send</string>
- <!-- Text of the button for the SMS short code confirmation dialog to report a malicious app. [CHAR LIMIT=30] -->
- <string name="sms_short_code_confirm_report">Report malicious app</string>
-
<!-- SIM swap and device reboot Dialog --> <skip />
<!-- See SIM_REMOVED_DIALOG. This is the title of that dialog. -->
<string name="sim_removed_title">SIM card removed</string>
diff --git a/core/res/res/xml/sms_short_codes.xml b/core/res/res/xml/sms_short_codes.xml
deleted file mode 100644
index 8b395af..0000000
--- a/core/res/res/xml/sms_short_codes.xml
+++ /dev/null
@@ -1,189 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<!-- Regex patterns for SMS short codes by country. -->
-<shortcodes>
-
- <!-- The country attribute is the ISO country code of the user's account (from SIM card or NV).
- The pattern attribute is a regex that matches all SMS short codes for the country.
- The premium attribute is a regex that matches premium rate SMS short codes.
- The free attribute matches short codes that we know will not cost the user, such as
- emergency numbers. The standard attribute matches short codes that are billed at the
- standard SMS rate. The user is warned when the destination phone number matches the
- "pattern" or "premium" regexes, and does not match the "free" or "standard" regexes. -->
-
- <!-- Harmonised European Short Codes are 6 digit numbers starting with 116 (free helplines).
- Premium patterns include short codes from: http://aonebill.com/coverage&tariffs
- and http://mobilcent.com/info-worldwide.asp and extracted from:
- http://smscoin.net/software/engine/WordPress/Paid+SMS-registration/ -->
-
- <!-- Albania: 5 digits, known short codes listed -->
- <shortcode country="al" pattern="\\d{5}" premium="15191|55[56]00" />
-
- <!-- Armenia: 3-4 digits, emergency numbers 10[123] -->
- <shortcode country="am" pattern="\\d{3,4}" premium="11[2456]1|3024" free="10[123]" />
-
- <!-- Austria: 10 digits, premium prefix 09xx, plus EU -->
- <shortcode country="at" pattern="11\\d{4}" premium="09.*" free="116\\d{3}" />
-
- <!-- Australia: 6 or 8 digits starting with "19" -->
- <shortcode country="au" pattern="19(?:\\d{4}|\\d{6})" premium="19998882" />
-
- <!-- Azerbaijan: 4-5 digits, known premium codes listed -->
- <shortcode country="az" pattern="\\d{4,5}" premium="330[12]|87744|901[234]|93(?:94|101)|9426|9525" />
-
- <!-- Belgium: 4 digits, plus EU: http://www.mobileweb.be/en/mobileweb/sms-numberplan.asp -->
- <shortcode country="be" premium="\\d{4}" free="8\\d{3}|116\\d{3}" />
-
- <!-- Bulgaria: 4-5 digits, plus EU -->
- <shortcode country="bg" pattern="\\d{4,5}" premium="18(?:16|423)|19(?:1[56]|35)" free="116\\d{3}" />
-
- <!-- Belarus: 4 digits -->
- <shortcode country="by" pattern="\\d{4}" premium="3336|4161|444[4689]|501[34]|7781" />
-
- <!-- Canada: 5-6 digits -->
- <shortcode country="ca" pattern="\\d{5,6}" premium="60999|88188" />
-
- <!-- Switzerland: 3-5 digits: http://www.swisscom.ch/fxres/kmu/thirdpartybusiness_code_of_conduct_en.pdf -->
- <shortcode country="ch" pattern="[2-9]\\d{2,4}" premium="543|83111" />
-
- <!-- China: premium shortcodes start with "1066", free shortcodes start with "1065":
- http://clients.txtnation.com/entries/197192-china-premium-sms-short-code-requirements -->
- <shortcode country="cn" premium="1066.*" free="1065.*" />
-
- <!-- Cyprus: 4-6 digits (not confirmed), known premium codes listed, plus EU -->
- <shortcode country="cy" pattern="\\d{4,6}" premium="7510" free="116\\d{3}" />
-
- <!-- Czech Republic: 7-8 digits, starting with 9, plus EU:
- http://www.o2.cz/osobni/en/services-by-alphabet/91670-premium_sms.html -->
- <shortcode country="cz" premium="9\\d{6,7}" free="116\\d{3}" />
-
- <!-- Germany: 4-5 digits plus 1232xxx (premium codes from http://www.vodafone.de/infofaxe/537.pdf and http://premiumdienste.eplus.de/pdf/kodex.pdf), plus EU. To keep the premium regex from being too large, it only includes payment processors that have been used by SMS malware, with the regular pattern matching the other premium short codes. -->
- <shortcode country="de" pattern="\\d{4,5}|1232\\d{3}" premium="11(?:111|833)|1232(?:013|021|060|075|286|358)|118(?:44|80|86)|20[25]00|220(?:21|22|88|99)|221(?:14|21)|223(?:44|53|77)|224[13]0|225(?:20|59|90)|226(?:06|10|20|26|30|40|56|70)|227(?:07|33|39|66|76|78|79|88|99)|228(?:08|11|66|77)|23300|30030|3[12347]000|330(?:33|55|66)|33(?:233|331|366|533)|34(?:34|567)|37000|40(?:040|123|444|[3568]00)|41(?:010|414)|44(?:000|044|344|44[24]|544)|50005|50100|50123|50555|51000|52(?:255|783)|54(?:100|2542)|55(?:077|[24]00|222|333|55|[12369]55)|56(?:789|886)|60800|6[13]000|66(?:[12348]66|566|766|777|88|999)|68888|70(?:07|123|777)|76766|77(?:007|070|222|444|[567]77)|80(?:008|123|888)|82(?:002|[378]00|323|444|472|474|488|727)|83(?:005|[169]00|333|830)|84(?:141|300|32[34]|343|488|499|777|888)|85888|86(?:188|566|640|644|650|677|868|888)|870[24]9|871(?:23|[49]9)|872(?:1[0-8]|49|99)|87499|875(?:49|55|99)|876(?:0[1367]|1[1245678]|54|99)|877(?:00|99)|878(?:15|25|3[567]|8[12])|87999|880(?:08|44|55|77|99)|88688|888(?:03|10|8|89)|8899|90(?:009|999)|99999" free="116\\d{3}" />
-
- <!-- Denmark: see http://iprs.webspacecommerce.com/Denmark-Premium-Rate-Numbers -->
- <shortcode country="dk" pattern="\\d{4,5}" premium="1\\d{3}" free="116\\d{3}" />
-
- <!-- Estonia: short codes 3-5 digits starting with 1, plus premium 7 digit numbers starting with 90, plus EU.
- http://www.tja.ee/public/documents/Elektrooniline_side/Oigusaktid/ENG/Estonian_Numbering_Plan_annex_06_09_2010.mht -->
- <shortcode country="ee" pattern="1\\d{2,4}" premium="90\\d{5}|15330|1701[0-3]" free="116\\d{3}" />
-
- <!-- Spain: 5-6 digits: 25xxx, 27xxx, 280xx, 35xxx, 37xxx, 795xxx, 797xxx, 995xxx, 997xxx, plus EU.
- http://www.legallink.es/?q=en/content/which-current-regulatory-status-premium-rate-services-spain -->
- <shortcode country="es" premium="[23][57]\\d{3}|280\\d{2}|[79]9[57]\\d{3}" free="116\\d{3}" />
-
- <!-- Finland: 5-6 digits, premium 0600, 0700: http://en.wikipedia.org/wiki/Telephone_numbers_in_Finland -->
- <shortcode country="fi" pattern="\\d{5,6}" premium="0600.*|0700.*|171(?:59|63)" free="116\\d{3}" />
-
- <!-- France: 5 digits, free: 3xxxx, premium [4-8]xxxx, plus EU:
- http://clients.txtnation.com/entries/161972-france-premium-sms-short-code-requirements -->
- <shortcode country="fr" premium="[4-8]\\d{4}" free="3\\d{4}|116\\d{3}" />
-
- <!-- United Kingdom (Great Britain): 4-6 digits, common codes [5-8]xxxx, plus EU:
- http://www.short-codes.com/media/Co-regulatoryCodeofPracticeforcommonshortcodes170206.pdf -->
- <shortcode country="gb" pattern="\\d{4,6}" premium="[5-8]\\d{4}" free="116\\d{3}" />
-
- <!-- Georgia: 4 digits, known premium codes listed -->
- <shortcode country="ge" pattern="\\d{4}" premium="801[234]|888[239]" />
-
- <!-- Greece: 5 digits (54xxx, 19yxx, x=0-9, y=0-5): http://www.cmtelecom.com/premium-sms/greece -->
- <shortcode country="gr" pattern="\\d{5}" premium="54\\d{3}|19[0-5]\\d{2}" free="116\\d{3}" />
-
- <!-- Hungary: 4 or 10 digits starting with 1 or 0, plus EU:
- http://clients.txtnation.com/entries/209633-hungary-premium-sms-short-code-regulations -->
- <shortcode country="hu" pattern="[01](?:\\d{3}|\\d{9})" premium="0691227910|1784" free="116\\d{3}" />
-
- <!-- Ireland: 5 digits, 5xxxx (50xxx=free, 5[12]xxx=standard), plus EU:
- http://www.comreg.ie/_fileupload/publications/ComReg1117.pdf -->
- <shortcode country="ie" pattern="\\d{5}" premium="5[3-9]\\d{3}" free="50\\d{3}|116\\d{3}" standard="5[12]\\d{3}" />
-
- <!-- Israel: 4 digits, known premium codes listed -->
- <shortcode country="il" pattern="\\d{4}" premium="4422|4545" />
-
- <!-- Italy: 5 digits (premium=4xxxx), plus EU:
- http://clients.txtnation.com/attachments/token/di5kfblvubttvlw/?name=Italy_CASP_EN.pdf -->
- <shortcode country="it" pattern="\\d{5}" premium="4\\d{4}" free="116\\d{3}" />
-
- <!-- Kyrgyzstan: 4 digits, known premium codes listed -->
- <shortcode country="kg" pattern="\\d{4}" premium="415[2367]|444[69]" />
-
- <!-- Kazakhstan: 4 digits, known premium codes listed: http://smscoin.net/info/pricing-kazakhstan/ -->
- <shortcode country="kz" pattern="\\d{4}" premium="335[02]|4161|444[469]|77[2359]0|8444|919[3-5]|968[2-5]" />
-
- <!-- Lithuania: 3-5 digits, known premium codes listed, plus EU -->
- <shortcode country="lt" pattern="\\d{3,5}" premium="13[89]1|1394|16[34]5" free="116\\d{3}" />
-
- <!-- Luxembourg: 5 digits, 6xxxx, plus EU:
- http://www.luxgsm.lu/assets/files/filepage/file_1253803400.pdf -->
- <shortcode country="lu" premium="6\\d{4}" free="116\\d{3}" />
-
- <!-- Latvia: 4 digits, known premium codes listed, plus EU -->
- <shortcode country="lv" pattern="\\d{4}" premium="18(?:19|63|7[1-4])" free="116\\d{3}" />
-
- <!-- Mexico: 4-5 digits (not confirmed), known premium codes listed -->
- <shortcode country="mx" pattern="\\d{4,5}" premium="53035|7766" />
-
- <!-- Malaysia: 5 digits: http://www.skmm.gov.my/attachment/Consumer_Regulation/Mobile_Content_Services_FAQs.pdf -->
- <shortcode country="my" pattern="\\d{5}" premium="32298|33776" />
-
- <!-- The Netherlands, 4 digits, known premium codes listed, plus EU -->
- <shortcode country="nl" pattern="\\d{4}" premium="4466|5040" free="116\\d{3}" />
-
- <!-- Norway: 4-5 digits (not confirmed), known premium codes listed -->
- <shortcode country="no" pattern="\\d{4,5}" premium="2201|222[67]" />
-
- <!-- New Zealand: 3-4 digits, known premium codes listed -->
- <shortcode country="nz" pattern="\\d{3,4}" premium="3903|8995" />
-
- <!-- Poland: 4-5 digits (not confirmed), known premium codes listed, plus EU -->
- <shortcode country="pl" pattern="\\d{4,5}" premium="74240|79(?:10|866)|92525" free="116\\d{3}" />
-
- <!-- Portugal: 5 digits, plus EU:
- http://clients.txtnation.com/entries/158326-portugal-premium-sms-short-code-regulations -->
- <shortcode country="pt" premium="6[1289]\\d{3}" free="116\\d{3}" />
-
- <!-- Romania: 4 digits, plus EU: http://www.simplus.ro/en/resources/glossary-of-terms/ -->
- <shortcode country="ro" pattern="\\d{4}" premium="12(?:63|66|88)|13(?:14|80)" free="116\\d{3}" />
-
- <!-- Russia: 4 digits, known premium codes listed: http://smscoin.net/info/pricing-russia/ -->
- <shortcode country="ru" pattern="\\d{4}" premium="1(?:1[56]1|899)|2(?:09[57]|322|47[46]|880|990)|3[589]33|4161|44(?:4[3-9]|81)|77(?:33|81)" />
-
- <!-- Sweden: 5 digits (72xxx), plus EU: http://www.viatel.se/en/premium-sms/ -->
- <shortcode country="se" premium="72\\d{3}" free="116\\d{3}" />
-
- <!-- Singapore: 5 digits: http://clients.txtnation.com/entries/306442-singapore-premium-sms-short-code-requirements
- Free government directory info at 74688: http://app.sgdi.gov.sg/sms_help.asp -->
- <shortcode country="sg" pattern="7\\d{4}" premium="73800" standard="74688" />
-
- <!-- Slovenia: 4 digits (premium=3xxx, 6xxx, 8xxx), plus EU: http://www.cmtelecom.com/premium-sms/slovenia -->
- <shortcode country="si" pattern="\\d{4}" premium="[368]\\d{3}" free="116\\d{3}" />
-
- <!-- Slovakia: 4 digits (premium), plus EU: http://www.cmtelecom.com/premium-sms/slovakia -->
- <shortcode country="sk" premium="\\d{4}" free="116\\d{3}" />
-
- <!-- Tajikistan: 4 digits, known premium codes listed -->
- <shortcode country="tj" pattern="\\d{4}" premium="11[3-7]1|4161|4333|444[689]" />
-
- <!-- Ukraine: 4 digits, known premium codes listed -->
- <shortcode country="ua" pattern="\\d{4}" premium="444[3-9]|70[579]4|7540" />
-
- <!-- USA: 5-6 digits (premium codes from https://www.premiumsmsrefunds.com/ShortCodes.htm) -->
- <shortcode country="us" pattern="\\d{5,6}" premium="20433|21(?:344|472)|22715|23(?:333|847)|24(?:15|28)0|25209|27(?:449|606|663)|28498|305(?:00|83)|32(?:340|941)|33(?:166|786|849)|34746|35(?:182|564)|37975|38(?:135|146|254)|41(?:366|463)|42335|43(?:355|500)|44(?:578|711|811)|45814|46(?:157|173|327)|46666|47553|48(?:221|277|669)|50(?:844|920)|51(?:062|368)|52944|54(?:723|892)|55928|56483|57370|59(?:182|187|252|342)|60339|61(?:266|982)|62478|64(?:219|898)|65(?:108|500)|69(?:208|388)|70877|71851|72(?:078|087|465)|73(?:288|588|882|909|997)|74(?:034|332|815)|76426|79213|81946|83177|84(?:103|685)|85797|86(?:234|236|666)|89616|90(?:715|842|938)|91(?:362|958)|94719|95297|96(?:040|666|835|969)|97(?:142|294|688)|99(?:689|796|807)" />
-
-</shortcodes>
diff --git a/telephony/java/com/android/internal/telephony/SMSDispatcher.java b/telephony/java/com/android/internal/telephony/SMSDispatcher.java
index 41125dd..6ba8b9e 100644
--- a/telephony/java/com/android/internal/telephony/SMSDispatcher.java
+++ b/telephony/java/com/android/internal/telephony/SMSDispatcher.java
@@ -920,61 +920,18 @@ public abstract class SMSDispatcher extends Handler {
SmsTracker tracker = new SmsTracker(map, sentIntent, deliveryIntent, appPackage,
PhoneNumberUtils.extractNetworkPortion(destAddr));
- // checkDestination() returns true if the destination is not a premium short code or the
- // sending app is approved to send to short codes. Otherwise, a message is sent to our
- // handler with the SmsTracker to request user confirmation before sending.
- if (checkDestination(tracker)) {
- // check for excessive outgoing SMS usage by this app
- if (!mUsageMonitor.check(appPackage, SINGLE_PART_SMS)) {
- sendMessage(obtainMessage(EVENT_SEND_LIMIT_REACHED_CONFIRMATION, tracker));
- return;
- }
-
- int ss = mPhone.getServiceState().getState();
-
- if (ss != ServiceState.STATE_IN_SERVICE) {
- handleNotInService(ss, tracker.mSentIntent);
- } else {
- sendSms(tracker);
- }
+ // check for excessive outgoing SMS usage by this app
+ if (!mUsageMonitor.check(appPackage, SINGLE_PART_SMS)) {
+ sendMessage(obtainMessage(EVENT_SEND_LIMIT_REACHED_CONFIRMATION, tracker));
+ return;
}
- }
- /**
- * Check if destination is a potential premium short code and sender is not pre-approved to
- * send to short codes.
- *
- * @param tracker the tracker for the SMS to send
- * @return true if the destination is approved; false if user confirmation event was sent
- */
- boolean checkDestination(SmsTracker tracker) {
- if (mContext.checkCallingOrSelfPermission(SEND_SMS_NO_CONFIRMATION_PERMISSION)
- == PackageManager.PERMISSION_GRANTED) {
- return true; // app is pre-approved to send to short codes
- } else {
- String countryIso = mTelephonyManager.getSimCountryIso();
- if (countryIso == null || countryIso.length() != 2) {
- Log.e(TAG, "Can't get SIM country code: trying network country code");
- countryIso = mTelephonyManager.getNetworkCountryIso();
- }
+ int ss = mPhone.getServiceState().getState();
- switch (mUsageMonitor.checkDestination(tracker.mDestAddress, countryIso)) {
- case SmsUsageMonitor.CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE:
- sendMessage(obtainMessage(EVENT_CONFIRM_SEND_TO_POSSIBLE_PREMIUM_SHORT_CODE,
- tracker));
- return false; // wait for user confirmation before sending
-
- case SmsUsageMonitor.CATEGORY_PREMIUM_SHORT_CODE:
- sendMessage(obtainMessage(EVENT_CONFIRM_SEND_TO_PREMIUM_SHORT_CODE,
- tracker));
- return false; // wait for user confirmation before sending
-
- case SmsUsageMonitor.CATEGORY_NOT_SHORT_CODE:
- case SmsUsageMonitor.CATEGORY_FREE_SHORT_CODE:
- case SmsUsageMonitor.CATEGORY_STANDARD_SHORT_CODE:
- default:
- return true; // destination is not a premium short code
- }
+ if (ss != ServiceState.STATE_IN_SERVICE) {
+ handleNotInService(ss, tracker.mSentIntent);
+ } else {
+ sendSms(tracker);
}
}
diff --git a/telephony/java/com/android/internal/telephony/SmsUsageMonitor.java b/telephony/java/com/android/internal/telephony/SmsUsageMonitor.java
index 1804d97..4a4485d 100644
--- a/telephony/java/com/android/internal/telephony/SmsUsageMonitor.java
+++ b/telephony/java/com/android/internal/telephony/SmsUsageMonitor.java
@@ -60,177 +60,17 @@ public class SmsUsageMonitor {
/** Default number of SMS sent in checking period without user permission. */
private static final int DEFAULT_SMS_MAX_COUNT = 30;
- /** Return value from {@link #checkDestination} for regular phone numbers. */
- static final int CATEGORY_NOT_SHORT_CODE = 0;
-
- /** Return value from {@link #checkDestination} for free (no cost) short codes. */
- static final int CATEGORY_FREE_SHORT_CODE = 1;
-
- /** Return value from {@link #checkDestination} for standard rate (non-premium) short codes. */
- static final int CATEGORY_STANDARD_SHORT_CODE = 2;
-
- /** Return value from {@link #checkDestination} for possible premium short codes. */
- static final int CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE = 3;
-
- /** Return value from {@link #checkDestination} for premium short codes. */
- static final int CATEGORY_PREMIUM_SHORT_CODE = 4;
-
private final int mCheckPeriod;
private final int mMaxAllowed;
private final HashMap<String, ArrayList<Long>> mSmsStamp =
new HashMap<String, ArrayList<Long>>();
- /** Context for retrieving regexes from XML resource. */
- private final Context mContext;
-
- /** Country code for the cached short code pattern matcher. */
- private String mCurrentCountry;
-
- /** Cached short code pattern matcher for {@link #mCurrentCountry}. */
- private ShortCodePatternMatcher mCurrentPatternMatcher;
-
- /** Cached short code regex patterns from secure settings for {@link #mCurrentCountry}. */
- private String mSettingsShortCodePatterns;
-
- /** Handler for responding to content observer updates. */
- private final SettingsObserverHandler mSettingsObserverHandler;
-
- /** XML tag for root element. */
- private static final String TAG_SHORTCODES = "shortcodes";
-
- /** XML tag for short code patterns for a specific country. */
- private static final String TAG_SHORTCODE = "shortcode";
-
- /** XML attribute for the country code. */
- private static final String ATTR_COUNTRY = "country";
-
- /** XML attribute for the short code regex pattern. */
- private static final String ATTR_PATTERN = "pattern";
-
- /** XML attribute for the premium short code regex pattern. */
- private static final String ATTR_PREMIUM = "premium";
-
- /** XML attribute for the free short code regex pattern. */
- private static final String ATTR_FREE = "free";
-
- /** XML attribute for the standard rate short code regex pattern. */
- private static final String ATTR_STANDARD = "standard";
-
- /**
- * SMS short code regex pattern matcher for a specific country.
- */
- private static final class ShortCodePatternMatcher {
- private final Pattern mShortCodePattern;
- private final Pattern mPremiumShortCodePattern;
- private final Pattern mFreeShortCodePattern;
- private final Pattern mStandardShortCodePattern;
-
- ShortCodePatternMatcher(String shortCodeRegex, String premiumShortCodeRegex,
- String freeShortCodeRegex, String standardShortCodeRegex) {
- mShortCodePattern = (shortCodeRegex != null ? Pattern.compile(shortCodeRegex) : null);
- mPremiumShortCodePattern = (premiumShortCodeRegex != null ?
- Pattern.compile(premiumShortCodeRegex) : null);
- mFreeShortCodePattern = (freeShortCodeRegex != null ?
- Pattern.compile(freeShortCodeRegex) : null);
- mStandardShortCodePattern = (standardShortCodeRegex != null ?
- Pattern.compile(standardShortCodeRegex) : null);
- }
-
- int getNumberCategory(String phoneNumber) {
- if (mFreeShortCodePattern != null && mFreeShortCodePattern.matcher(phoneNumber)
- .matches()) {
- return CATEGORY_FREE_SHORT_CODE;
- }
- if (mStandardShortCodePattern != null && mStandardShortCodePattern.matcher(phoneNumber)
- .matches()) {
- return CATEGORY_STANDARD_SHORT_CODE;
- }
- if (mPremiumShortCodePattern != null && mPremiumShortCodePattern.matcher(phoneNumber)
- .matches()) {
- return CATEGORY_PREMIUM_SHORT_CODE;
- }
- if (mShortCodePattern != null && mShortCodePattern.matcher(phoneNumber).matches()) {
- return CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE;
- }
- return CATEGORY_NOT_SHORT_CODE;
- }
- }
-
- /**
- * Observe the secure setting for updated regex patterns.
- */
- private static class SettingsObserver extends ContentObserver {
- private final int mWhat;
- private final Handler mHandler;
-
- SettingsObserver(Handler handler, int what) {
- super(handler);
- mHandler = handler;
- mWhat = what;
- }
-
- @Override
- public void onChange(boolean selfChange) {
- mHandler.obtainMessage(mWhat).sendToTarget();
- }
- }
-
- /**
- * Handler to update regex patterns when secure setting for the current country is updated.
- */
- private class SettingsObserverHandler extends Handler {
- /** Current content observer, or null. */
- SettingsObserver mSettingsObserver;
-
- /** Current country code to watch for settings updates. */
- private String mCountryIso;
-
- /** Request to start observing a secure setting. */
- static final int OBSERVE_SETTING = 1;
-
- /** Handler event for updated secure settings. */
- static final int SECURE_SETTINGS_CHANGED = 2;
-
- /** Send a message to this handler requesting to observe the setting for a new country. */
- void observeSettingForCountry(String countryIso) {
- obtainMessage(OBSERVE_SETTING, countryIso).sendToTarget();
- }
-
- @Override
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case OBSERVE_SETTING:
- if (msg.obj != null && msg.obj instanceof String) {
- mCountryIso = (String) msg.obj;
- String settingName = getSettingNameForCountry(mCountryIso);
- ContentResolver resolver = mContext.getContentResolver();
-
- if (mSettingsObserver != null) {
- if (VDBG) log("Unregistering old content observer");
- resolver.unregisterContentObserver(mSettingsObserver);
- }
-
- mSettingsObserver = new SettingsObserver(this, SECURE_SETTINGS_CHANGED);
- resolver.registerContentObserver(
- Settings.Secure.getUriFor(settingName), false, mSettingsObserver);
- if (VDBG) log("Registered content observer for " + settingName);
- }
- break;
-
- case SECURE_SETTINGS_CHANGED:
- loadPatternsFromSettings(mCountryIso);
- break;
- }
- }
- }
-
/**
* Create SMS usage monitor.
* @param context the context to use to load resources and get TelephonyManager service
*/
public SmsUsageMonitor(Context context) {
- mContext = context;
ContentResolver resolver = context.getContentResolver();
mMaxAllowed = Settings.Secure.getInt(resolver,
@@ -240,83 +80,6 @@ public class SmsUsageMonitor {
mCheckPeriod = Settings.Secure.getInt(resolver,
Settings.Secure.SMS_OUTGOING_CHECK_INTERVAL_MS,
DEFAULT_SMS_CHECK_PERIOD);
-
- mSettingsObserverHandler = new SettingsObserverHandler();
- }
-
- /**
- * Return a pattern matcher object for the specified country.
- * @param country the country to search for
- * @return a {@link ShortCodePatternMatcher} for the specified country, or null if not found
- */
- private ShortCodePatternMatcher getPatternMatcher(String country) {
- int id = com.android.internal.R.xml.sms_short_codes;
- XmlResourceParser parser = mContext.getResources().getXml(id);
-
- try {
- return getPatternMatcher(country, parser);
- } catch (XmlPullParserException e) {
- Log.e(TAG, "XML parser exception reading short code pattern resource", e);
- } catch (IOException e) {
- Log.e(TAG, "I/O exception reading short code pattern resource", e);
- } finally {
- parser.close();
- }
- return null; // country not found
- }
-
- /**
- * Return a pattern matcher object for the specified country from a secure settings string.
- * @return a {@link ShortCodePatternMatcher} for the specified country, or null if not found
- */
- private static ShortCodePatternMatcher getPatternMatcher(String country, String settingsPattern) {
- // embed pattern tag into an XML document.
- String document = "<shortcodes>" + settingsPattern + "</shortcodes>";
- if (VDBG) log("loading updated patterns from: " + document);
-
- try {
- XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
- XmlPullParser parser = factory.newPullParser();
- parser.setInput(new StringReader(document));
- return getPatternMatcher(country, parser);
- } catch (XmlPullParserException e) {
- Log.e(TAG, "XML parser exception reading short code pattern from settings", e);
- } catch (IOException e) {
- Log.e(TAG, "I/O exception reading short code pattern from settings", e);
- }
- return null; // country not found
- }
-
- /**
- * Return a pattern matcher object for the specified country and pattern XML parser.
- * @param country the country to search for
- * @return a {@link ShortCodePatternMatcher} for the specified country, or null if not found
- */
- private static ShortCodePatternMatcher getPatternMatcher(String country, XmlPullParser parser)
- throws XmlPullParserException, IOException
- {
- XmlUtils.beginDocument(parser, TAG_SHORTCODES);
-
- while (true) {
- XmlUtils.nextElement(parser);
-
- String element = parser.getName();
- if (element == null) break;
-
- if (element.equals(TAG_SHORTCODE)) {
- String currentCountry = parser.getAttributeValue(null, ATTR_COUNTRY);
- if (country.equals(currentCountry)) {
- String pattern = parser.getAttributeValue(null, ATTR_PATTERN);
- String premium = parser.getAttributeValue(null, ATTR_PREMIUM);
- String free = parser.getAttributeValue(null, ATTR_FREE);
- String standard = parser.getAttributeValue(null, ATTR_STANDARD);
- return new ShortCodePatternMatcher(pattern, premium, free, standard);
- }
- } else {
- Log.e(TAG, "Error: skipping unknown XML tag " + element);
- }
- }
- return null; // country not found
}
/** Clear the SMS application list for disposal. */
@@ -349,90 +112,6 @@ public class SmsUsageMonitor {
}
/**
- * Check if the destination is a possible premium short code.
- * NOTE: the caller is expected to strip non-digits from the destination number with
- * {@link PhoneNumberUtils#extractNetworkPortion} before calling this method.
- * This happens in {@link SMSDispatcher#sendRawPdu} so that we use the same phone number
- * for testing and in the user confirmation dialog if the user needs to confirm the number.
- * This makes it difficult for malware to fool the user or the short code pattern matcher
- * by using non-ASCII characters to make the number appear to be different from the real
- * destination phone number.
- *
- * @param destAddress the destination address to test for possible short code
- * @return {@link #CATEGORY_NOT_SHORT_CODE}, {@link #CATEGORY_FREE_SHORT_CODE},
- * {@link #CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE}, or {@link #CATEGORY_PREMIUM_SHORT_CODE}.
- */
- public int checkDestination(String destAddress, String countryIso) {
- synchronized (mSettingsObserverHandler) {
- // always allow emergency numbers
- if (PhoneNumberUtils.isEmergencyNumber(destAddress, countryIso)) {
- return CATEGORY_NOT_SHORT_CODE;
- }
-
- ShortCodePatternMatcher patternMatcher = null;
-
- if (countryIso != null) {
- // query secure settings and initialize content observer for updated regex patterns
- if (mCurrentCountry == null || !countryIso.equals(mCurrentCountry)) {
- loadPatternsFromSettings(countryIso);
- mSettingsObserverHandler.observeSettingForCountry(countryIso);
- }
-
- if (countryIso.equals(mCurrentCountry)) {
- patternMatcher = mCurrentPatternMatcher;
- } else {
- patternMatcher = getPatternMatcher(countryIso);
- mCurrentCountry = countryIso;
- mCurrentPatternMatcher = patternMatcher; // may be null if not found
- }
- }
-
- if (patternMatcher != null) {
- return patternMatcher.getNumberCategory(destAddress);
- } else {
- // Generic rule: numbers of 5 digits or less are considered potential short codes
- Log.e(TAG, "No patterns for \"" + countryIso + "\": using generic short code rule");
- if (destAddress.length() <= 5) {
- return CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE;
- } else {
- return CATEGORY_NOT_SHORT_CODE;
- }
- }
- }
- }
-
- private static String getSettingNameForCountry(String countryIso) {
- return Settings.Secure.SMS_SHORT_CODES_PREFIX + countryIso;
- }
-
- /**
- * Load regex patterns from secure settings if present.
- * @param countryIso the country to search for
- */
- void loadPatternsFromSettings(String countryIso) {
- synchronized (mSettingsObserverHandler) {
- if (VDBG) log("loadPatternsFromSettings(" + countryIso + ") called");
- String settingsPatterns = Settings.Secure.getString(
- mContext.getContentResolver(), getSettingNameForCountry(countryIso));
- if (settingsPatterns != null && !settingsPatterns.equals(
- mSettingsShortCodePatterns)) {
- // settings pattern string has changed: update the pattern matcher
- mSettingsShortCodePatterns = settingsPatterns;
- ShortCodePatternMatcher matcher = getPatternMatcher(countryIso, settingsPatterns);
- if (matcher != null) {
- mCurrentCountry = countryIso;
- mCurrentPatternMatcher = matcher;
- }
- } else if (settingsPatterns == null && mSettingsShortCodePatterns != null) {
- // pattern string was removed: caller will load default patterns from XML resource
- mCurrentCountry = null;
- mCurrentPatternMatcher = null;
- mSettingsShortCodePatterns = null;
- }
- }
- }
-
- /**
* Remove keys containing only old timestamps. This can happen if an SMS app is used
* to send messages and then uninstalled.
*/
diff --git a/telephony/tests/telephonytests/src/com/android/internal/telephony/SmsUsageMonitorShortCodeTest.java b/telephony/tests/telephonytests/src/com/android/internal/telephony/SmsUsageMonitorShortCodeTest.java
deleted file mode 100644
index 3bb7c06..0000000
--- a/telephony/tests/telephonytests/src/com/android/internal/telephony/SmsUsageMonitorShortCodeTest.java
+++ /dev/null
@@ -1,466 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.telephony;
-
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
-
-import static com.android.internal.telephony.SmsUsageMonitor.CATEGORY_FREE_SHORT_CODE;
-import static com.android.internal.telephony.SmsUsageMonitor.CATEGORY_NOT_SHORT_CODE;
-import static com.android.internal.telephony.SmsUsageMonitor.CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE;
-import static com.android.internal.telephony.SmsUsageMonitor.CATEGORY_PREMIUM_SHORT_CODE;
-import static com.android.internal.telephony.SmsUsageMonitor.CATEGORY_STANDARD_SHORT_CODE;
-
-/**
- * Test cases for SMS short code pattern matching in SmsUsageMonitor.
- */
-public class SmsUsageMonitorShortCodeTest extends AndroidTestCase {
-
- private static final class ShortCodeTest {
- final String countryIso;
- final String address;
- final int category;
-
- ShortCodeTest(String countryIso, String destAddress, int category) {
- this.countryIso = countryIso;
- this.address = destAddress;
- this.category = category;
- }
- }
-
- /**
- * List of short code test cases.
- */
- private static final ShortCodeTest[] sShortCodeTests = new ShortCodeTest[] {
- new ShortCodeTest("al", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("al", "4321", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("al", "54321", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("al", "15191", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("al", "55500", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("al", "55600", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("al", "654321", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("am", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("am", "101", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("am", "102", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("am", "103", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("am", "222", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("am", "1111", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("am", "9999", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("am", "1121", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("am", "1141", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("am", "1161", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("am", "3024", CATEGORY_PREMIUM_SHORT_CODE),
-
- new ShortCodeTest("at", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("at", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("at", "0901234", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("at", "0900666266", CATEGORY_PREMIUM_SHORT_CODE),
-
- new ShortCodeTest("au", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("au", "180000", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("au", "190000", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("au", "1900000", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("au", "19000000", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("au", "19998882", CATEGORY_PREMIUM_SHORT_CODE),
-
- new ShortCodeTest("az", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("az", "1234", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("az", "12345", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("az", "87744", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("az", "3301", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("az", "3302", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("az", "9012", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("az", "9014", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("az", "9394", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("az", "87744", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("az", "93101", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("az", "123456", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("be", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("be", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("be", "567890", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("be", "8000", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("be", "6566", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("be", "7777", CATEGORY_PREMIUM_SHORT_CODE),
-
- new ShortCodeTest("bg", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("bg", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("bg", "1234", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("bg", "12345", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("bg", "1816", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("bg", "1915", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("bg", "1916", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("bg", "1935", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("bg", "18423", CATEGORY_PREMIUM_SHORT_CODE),
-
- new ShortCodeTest("by", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("by", "1234", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("by", "3336", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("by", "5013", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("by", "5014", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("by", "7781", CATEGORY_PREMIUM_SHORT_CODE),
-
- new ShortCodeTest("ca", "911", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ca", "+18005551234", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ca", "8005551234", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ca", "20000", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ca", "200000", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ca", "2000000", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ca", "60999", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ca", "88188", CATEGORY_PREMIUM_SHORT_CODE),
-
- new ShortCodeTest("ch", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ch", "123", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ch", "234", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ch", "3456", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ch", "98765", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ch", "543", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ch", "83111", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ch", "234567", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ch", "87654321", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("cn", "120", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("cn", "1062503000", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("cn", "1065123456", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("cn", "1066335588", CATEGORY_PREMIUM_SHORT_CODE),
-
- new ShortCodeTest("cy", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("cy", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("cy", "4321", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("cy", "54321", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("cy", "654321", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("cy", "7510", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("cy", "987654321", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("cz", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("cz", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("cz", "9090150", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("cz", "90901599", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("cz", "987654321", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("de", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("de", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("de", "1234", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "12345", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "8888", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "11111", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "11886", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "22022", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "23300", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "3434", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "34567", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "41414", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "55655", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "66766", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "66777", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "77677", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "80888", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "1232286", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "987654321", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("dk", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("dk", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("dk", "1259", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("dk", "16123", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("dk", "987654321", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("ee", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ee", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("ee", "123", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ee", "1259", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ee", "15330", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ee", "17999", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ee", "17010", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ee", "17013", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ee", "9034567", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ee", "34567890", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("es", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("es", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("es", "25165", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("es", "27333", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("es", "995399", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("es", "87654321", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("fi", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("fi", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("fi", "12345", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("fi", "123456", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("fi", "17159", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("fi", "17163", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("fi", "0600123", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("fi", "070012345", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("fi", "987654321", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("fr", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("fr", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("fr", "34567", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("fr", "45678", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("fr", "81185", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("fr", "87654321", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("gb", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("gb", "999", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("gb", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("gb", "4567", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("gb", "45678", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("gb", "56789", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("gb", "79067", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("gb", "80079", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("gb", "654321", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("gb", "7654321", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("ge", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ge", "8765", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ge", "2345", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ge", "8012", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ge", "8013", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ge", "8014", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ge", "8889", CATEGORY_PREMIUM_SHORT_CODE),
-
- new ShortCodeTest("gr", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("gr", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("gr", "54321", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("gr", "19567", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("gr", "19678", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("gr", "87654321", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("hu", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("hu", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("hu", "012", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("hu", "0123", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("hu", "1234", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("hu", "1784", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("hu", "2345", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("hu", "01234", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("hu", "012345678", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("hu", "0123456789", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("hu", "1234567890", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("hu", "0691227910", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("hu", "2345678901", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("hu", "01234567890", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("ie", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ie", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("ie", "50123", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("ie", "51234", CATEGORY_STANDARD_SHORT_CODE),
- new ShortCodeTest("ie", "52345", CATEGORY_STANDARD_SHORT_CODE),
- new ShortCodeTest("ie", "57890", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ie", "67890", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ie", "87654321", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("il", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("il", "5432", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("il", "4422", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("il", "4545", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("il", "98765", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("it", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("it", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("it", "4567", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("it", "48000", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("it", "45678", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("it", "56789", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("it", "456789", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("kg", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("kg", "5432", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("kg", "4152", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("kg", "4157", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("kg", "4449", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("kg", "98765", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("kz", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("kz", "5432", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("kz", "9194", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("kz", "7790", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("kz", "98765", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("lt", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("lt", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("lt", "123", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("lt", "1234", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("lt", "1381", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("lt", "1394", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("lt", "1645", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("lt", "12345", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("lt", "123456", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("lu", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("lu", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("lu", "1234", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("lu", "12345", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("lu", "64747", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("lu", "678901", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("lv", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("lv", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("lv", "5432", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("lv", "1819", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("lv", "1863", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("lv", "1874", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("lv", "98765", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("mx", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("mx", "2345", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("mx", "7766", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("mx", "23456", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("mx", "53035", CATEGORY_PREMIUM_SHORT_CODE),
-
- new ShortCodeTest("my", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("my", "1234", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("my", "23456", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("my", "32298", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("my", "33776", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("my", "345678", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("nl", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("nl", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("nl", "1234", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("nl", "4466", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("nl", "5040", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("nl", "23456", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("no", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("no", "1234", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("no", "2201", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("no", "2226", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("no", "2227", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("no", "23456", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("no", "234567", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("nz", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("nz", "123", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("nz", "2345", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("nz", "3903", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("nz", "8995", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("nz", "23456", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("pl", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("pl", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("pl", "7890", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("pl", "34567", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("pl", "7910", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("pl", "74240", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("pl", "79866", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("pl", "92525", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("pl", "87654321", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("pt", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("pt", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("pt", "61000", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("pt", "62345", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("pt", "68304", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("pt", "69876", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("pt", "87654321", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("ro", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ro", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("ro", "1234", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ro", "1263", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ro", "1288", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ro", "1314", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ro", "1380", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ro", "7890", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ro", "12345", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("ru", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ru", "5432", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ru", "1161", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ru", "2097", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ru", "3933", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ru", "7781", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ru", "98765", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("se", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("se", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("se", "1234", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("se", "72345", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("se", "72999", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("se", "123456", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("se", "87654321", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("sg", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("sg", "1234", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("sg", "70000", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("sg", "79999", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("sg", "73800", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("sg", "74688", CATEGORY_STANDARD_SHORT_CODE),
- new ShortCodeTest("sg", "987654", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("si", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("si", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("si", "1234", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("si", "3838", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("si", "72999", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("sk", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("sk", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("sk", "1234", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("sk", "6674", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("sk", "7604", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("sk", "72999", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("tj", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("tj", "5432", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("tj", "1161", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("tj", "1171", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("tj", "4161", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("tj", "4449", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("tj", "98765", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("ua", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ua", "5432", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ua", "4448", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ua", "7094", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ua", "7540", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ua", "98765", CATEGORY_NOT_SHORT_CODE),
-
- new ShortCodeTest("us", "911", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("us", "+18005551234", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("us", "8005551234", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("us", "20000", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("us", "200000", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("us", "2000000", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("us", "20433", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("us", "21472", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("us", "23333", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("us", "99807", CATEGORY_PREMIUM_SHORT_CODE),
-
- // generic rules for other countries: 5 digits or less considered potential short code
- new ShortCodeTest("zz", "2000000", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("zz", "54321", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("zz", "4321", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("zz", "321", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("zz", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest(null, "2000000", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest(null, "54321", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest(null, "4321", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest(null, "321", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest(null, "112", CATEGORY_NOT_SHORT_CODE),
- };
-
- @SmallTest
- public void testSmsUsageMonitor() {
- SmsUsageMonitor monitor = new SmsUsageMonitor(getContext());
- for (ShortCodeTest test : sShortCodeTests) {
- assertEquals("country: " + test.countryIso + " number: " + test.address,
- test.category, monitor.checkDestination(test.address, test.countryIso));
- }
- }
-}