1/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.internal.telephony;
18
19import android.app.ActivityManager;
20import android.app.AlarmManager;
21import android.content.Context;
22import android.content.res.Configuration;
23import android.net.wifi.WifiManager;
24import android.os.Build;
25import android.os.RemoteException;
26import android.os.SystemProperties;
27import android.telephony.TelephonyManager;
28import android.text.TextUtils;
29import android.util.Slog;
30
31import com.android.internal.app.LocaleStore;
32import com.android.internal.app.LocaleStore.LocaleInfo;
33
34import libcore.icu.ICU;
35import libcore.icu.TimeZoneNames;
36
37import java.util.ArrayList;
38import java.util.Arrays;
39import java.util.Collections;
40import java.util.HashMap;
41import java.util.List;
42import java.util.Locale;
43import java.util.Map;
44
45/**
46 * Mobile Country Code
47 *
48 * {@hide}
49 */
50public final class MccTable {
51    static final String LOG_TAG = "MccTable";
52
53    static ArrayList<MccEntry> sTable;
54
55    static class MccEntry implements Comparable<MccEntry> {
56        final int mMcc;
57        final String mIso;
58        final int mSmallestDigitsMnc;
59
60        MccEntry(int mnc, String iso, int smallestDigitsMCC) {
61            if (iso == null) {
62                throw new NullPointerException();
63            }
64            mMcc = mnc;
65            mIso = iso;
66            mSmallestDigitsMnc = smallestDigitsMCC;
67        }
68
69        @Override
70        public int compareTo(MccEntry o) {
71            return mMcc - o.mMcc;
72        }
73    }
74
75    private static MccEntry entryForMcc(int mcc) {
76        MccEntry m = new MccEntry(mcc, "", 0);
77
78        int index = Collections.binarySearch(sTable, m);
79
80        if (index < 0) {
81            return null;
82        } else {
83            return sTable.get(index);
84        }
85    }
86
87    /**
88     * Returns a default time zone ID for the given MCC.
89     * @param mcc Mobile Country Code
90     * @return default TimeZone ID, or null if not specified
91     */
92    public static String defaultTimeZoneForMcc(int mcc) {
93        MccEntry entry = entryForMcc(mcc);
94        if (entry == null) {
95            return null;
96        }
97        Locale locale = new Locale("", entry.mIso);
98        String[] tz = TimeZoneNames.forLocale(locale);
99        if (tz.length == 0) return null;
100
101        String zoneName = tz[0];
102
103        /* Use Australia/Sydney instead of Australia/Lord_Howe for Australia.
104         * http://b/33228250
105         * Todo: remove the code, see b/62418027
106         */
107        if (mcc == 505  /* Australia / Norfolk Island */) {
108            for (String zone : tz) {
109                if (zone.contains("Sydney")) {
110                    zoneName = zone;
111                }
112            }
113        }
114        return zoneName;
115    }
116
117    /**
118     * Given a GSM Mobile Country Code, returns
119     * an ISO two-character country code if available.
120     * Returns "" if unavailable.
121     */
122    public static String countryCodeForMcc(int mcc) {
123        MccEntry entry = entryForMcc(mcc);
124
125        if (entry == null) {
126            return "";
127        } else {
128            return entry.mIso;
129        }
130    }
131
132    /**
133     * Given a GSM Mobile Country Code, returns
134     * an ISO 2-3 character language code if available.
135     * Returns null if unavailable.
136     */
137    public static String defaultLanguageForMcc(int mcc) {
138        MccEntry entry = entryForMcc(mcc);
139        if (entry == null) {
140            Slog.d(LOG_TAG, "defaultLanguageForMcc(" + mcc + "): no country for mcc");
141            return null;
142        }
143
144        final String country = entry.mIso;
145
146        // Choose English as the default language for India.
147        if ("in".equals(country)) {
148            return "en";
149        }
150
151        // Ask CLDR for the language this country uses...
152        Locale likelyLocale = ICU.addLikelySubtags(new Locale("und", country));
153        String likelyLanguage = likelyLocale.getLanguage();
154        Slog.d(LOG_TAG, "defaultLanguageForMcc(" + mcc + "): country " + country + " uses " +
155               likelyLanguage);
156        return likelyLanguage;
157    }
158
159    /**
160     * Given a GSM Mobile Country Code, returns
161     * the smallest number of digits that M if available.
162     * Returns 2 if unavailable.
163     */
164    public static int smallestDigitsMccForMnc(int mcc) {
165        MccEntry entry = entryForMcc(mcc);
166
167        if (entry == null) {
168            return 2;
169        } else {
170            return entry.mSmallestDigitsMnc;
171        }
172    }
173
174    /**
175     * Updates MCC and MNC device configuration information for application retrieving
176     * correct version of resources.  If MCC is 0, MCC and MNC will be ignored (not set).
177     * @param context Context to act on.
178     * @param mccmnc truncated imsi with just the MCC and MNC - MNC assumed to be from 4th to end
179     * @param fromServiceState true if coming from the radio service state, false if from SIM
180     */
181    public static void updateMccMncConfiguration(Context context, String mccmnc,
182            boolean fromServiceState) {
183        Slog.d(LOG_TAG, "updateMccMncConfiguration mccmnc='" + mccmnc + "' fromServiceState=" + fromServiceState);
184
185        if (Build.IS_DEBUGGABLE) {
186            String overrideMcc = SystemProperties.get("persist.sys.override_mcc");
187            if (!TextUtils.isEmpty(overrideMcc)) {
188                mccmnc = overrideMcc;
189                Slog.d(LOG_TAG, "updateMccMncConfiguration overriding mccmnc='" + mccmnc + "'");
190            }
191        }
192
193        if (!TextUtils.isEmpty(mccmnc)) {
194            int mcc, mnc;
195
196            String defaultMccMnc = TelephonyManager.getDefault().getSimOperatorNumeric();
197            Slog.d(LOG_TAG, "updateMccMncConfiguration defaultMccMnc=" + defaultMccMnc);
198            //Update mccmnc only for default subscription in case of MultiSim.
199//            if (!defaultMccMnc.equals(mccmnc)) {
200//                Slog.d(LOG_TAG, "Not a Default subscription, ignoring mccmnc config update.");
201//                return;
202//            }
203
204            try {
205                mcc = Integer.parseInt(mccmnc.substring(0,3));
206                mnc = Integer.parseInt(mccmnc.substring(3));
207            } catch (NumberFormatException e) {
208                Slog.e(LOG_TAG, "Error parsing IMSI: " + mccmnc);
209                return;
210            }
211
212            Slog.d(LOG_TAG, "updateMccMncConfiguration: mcc=" + mcc + ", mnc=" + mnc);
213            if (mcc != 0) {
214                setTimezoneFromMccIfNeeded(context, mcc);
215            }
216            if (fromServiceState) {
217                setWifiCountryCodeFromMcc(context, mcc);
218            } else {
219                // from SIM
220                try {
221                    Configuration config = new Configuration();
222                    boolean updateConfig = false;
223                    if (mcc != 0) {
224                        config.mcc = mcc;
225                        config.mnc = mnc == 0 ? Configuration.MNC_ZERO : mnc;
226                        updateConfig = true;
227                    }
228
229                    if (updateConfig) {
230                        Slog.d(LOG_TAG, "updateMccMncConfiguration updateConfig config=" + config);
231                        ActivityManager.getService().updateConfiguration(config);
232                    } else {
233                        Slog.d(LOG_TAG, "updateMccMncConfiguration nothing to update");
234                    }
235                } catch (RemoteException e) {
236                    Slog.e(LOG_TAG, "Can't update configuration", e);
237                }
238            }
239        } else {
240            if (fromServiceState) {
241                // an empty mccmnc means no signal - tell wifi we don't know
242                setWifiCountryCodeFromMcc(context, 0);
243            }
244        }
245    }
246
247    /**
248     * Maps a given locale to a fallback locale that approximates it. This is a hack.
249     */
250    private static final Map<Locale, Locale> FALLBACKS = new HashMap<Locale, Locale>();
251
252    static {
253        // If we have English (without a country) explicitly prioritize en_US. http://b/28998094
254        FALLBACKS.put(Locale.ENGLISH, Locale.US);
255    }
256
257    /**
258     * Finds a suitable locale among {@code candidates} to use as the fallback locale for
259     * {@code target}. This looks through the list of {@link #FALLBACKS}, and follows the chain
260     * until a locale in {@code candidates} is found.
261     * This function assumes that {@code target} is not in {@code candidates}.
262     *
263     * TODO: This should really follow the CLDR chain of parent locales! That might be a bit
264     * of a problem because we don't really have an en-001 locale on android.
265     *
266     * @return The fallback locale or {@code null} if there is no suitable fallback defined in the
267     *         lookup.
268     */
269    private static Locale lookupFallback(Locale target, List<Locale> candidates) {
270        Locale fallback = target;
271        while ((fallback = FALLBACKS.get(fallback)) != null) {
272            if (candidates.contains(fallback)) {
273                return fallback;
274            }
275        }
276
277        return null;
278    }
279
280    /**
281     * Return Locale for the language and country or null if no good match.
282     *
283     * @param context Context to act on.
284     * @param language Two character language code desired
285     * @param country Two character country code desired
286     *
287     * @return Locale or null if no appropriate value
288     */
289    private static Locale getLocaleForLanguageCountry(Context context, String language,
290            String country) {
291        if (language == null) {
292            Slog.d(LOG_TAG, "getLocaleForLanguageCountry: skipping no language");
293            return null; // no match possible
294        }
295        if (country == null) {
296            country = ""; // The Locale constructor throws if passed null.
297        }
298
299        final Locale target = new Locale(language, country);
300        try {
301            String[] localeArray = context.getAssets().getLocales();
302            List<String> locales = new ArrayList<>(Arrays.asList(localeArray));
303
304            // Even in developer mode, you don't want the pseudolocales.
305            locales.remove("ar-XB");
306            locales.remove("en-XA");
307
308            List<Locale> languageMatches = new ArrayList<>();
309            for (String locale : locales) {
310                final Locale l = Locale.forLanguageTag(locale.replace('_', '-'));
311
312                // Only consider locales with both language and country.
313                if (l == null || "und".equals(l.getLanguage()) ||
314                        l.getLanguage().isEmpty() || l.getCountry().isEmpty()) {
315                    continue;
316                }
317                if (l.getLanguage().equals(target.getLanguage())) {
318                    // If we got a perfect match, we're done.
319                    if (l.getCountry().equals(target.getCountry())) {
320                        Slog.d(LOG_TAG, "getLocaleForLanguageCountry: got perfect match: " +
321                               l.toLanguageTag());
322                        return l;
323                    }
324
325                    // We've only matched the language, not the country.
326                    languageMatches.add(l);
327                }
328            }
329
330            if (languageMatches.isEmpty()) {
331                Slog.d(LOG_TAG, "getLocaleForLanguageCountry: no locales for language " + language);
332                return null;
333            }
334
335            Locale bestMatch = lookupFallback(target, languageMatches);
336            if (bestMatch != null) {
337                Slog.d(LOG_TAG, "getLocaleForLanguageCountry: got a fallback match: "
338                        + bestMatch.toLanguageTag());
339                return bestMatch;
340            } else {
341                // Ask {@link LocaleStore} whether this locale is considered "translated".
342                // LocaleStore has a broader definition of translated than just the asset locales
343                // above: a locale is "translated" if it has translation assets, or another locale
344                // with the same language and script has translation assets.
345                // If a locale is "translated", it is selectable in setup wizard, and can therefore
346                // be considerd a valid result for this method.
347                if (!TextUtils.isEmpty(target.getCountry())) {
348                    LocaleStore.fillCache(context);
349                    LocaleInfo targetInfo = LocaleStore.getLocaleInfo(target);
350                    if (targetInfo.isTranslated()) {
351                        Slog.d(LOG_TAG, "getLocaleForLanguageCountry: "
352                                + "target locale is translated: " + target);
353                        return target;
354                    }
355                }
356
357                // Somewhat arbitrarily take the first locale for the language,
358                // unless we get a perfect match later. Note that these come back in no
359                // particular order, so there's no reason to think the first match is
360                // a particularly good match.
361                Slog.d(LOG_TAG, "getLocaleForLanguageCountry: got language-only match: "
362                        + language);
363                return languageMatches.get(0);
364            }
365        } catch (Exception e) {
366            Slog.d(LOG_TAG, "getLocaleForLanguageCountry: exception", e);
367        }
368
369        return null;
370    }
371
372    /**
373     * If the timezone is not already set, set it based on the MCC of the SIM.
374     * @param context Context to act on.
375     * @param mcc Mobile Country Code of the SIM or SIM-like entity (build prop on CDMA)
376     */
377    private static void setTimezoneFromMccIfNeeded(Context context, int mcc) {
378        String timezone = SystemProperties.get(ServiceStateTracker.TIMEZONE_PROPERTY);
379        if (timezone == null || timezone.length() == 0) {
380            String zoneId = defaultTimeZoneForMcc(mcc);
381            if (zoneId != null && zoneId.length() > 0) {
382                // Set time zone based on MCC
383                AlarmManager alarm =
384                        (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
385                alarm.setTimeZone(zoneId);
386                Slog.d(LOG_TAG, "timezone set to " + zoneId);
387            }
388        }
389    }
390
391    /**
392     * Get Locale based on the MCC of the SIM.
393     *
394     * @param context Context to act on.
395     * @param mcc Mobile Country Code of the SIM or SIM-like entity (build prop on CDMA)
396     * @param simLanguage (nullable) the language from the SIM records (if present).
397     *
398     * @return locale for the mcc or null if none
399     */
400    public static Locale getLocaleFromMcc(Context context, int mcc, String simLanguage) {
401        boolean hasSimLanguage = !TextUtils.isEmpty(simLanguage);
402        String language = hasSimLanguage ? simLanguage : MccTable.defaultLanguageForMcc(mcc);
403        String country = MccTable.countryCodeForMcc(mcc);
404
405        Slog.d(LOG_TAG, "getLocaleFromMcc(" + language + ", " + country + ", " + mcc);
406        final Locale locale = getLocaleForLanguageCountry(context, language, country);
407
408        // If we couldn't find a locale that matches the SIM language, give it a go again
409        // with the "likely" language for the given country.
410        if (locale == null && hasSimLanguage) {
411            language = MccTable.defaultLanguageForMcc(mcc);
412            Slog.d(LOG_TAG, "[retry ] getLocaleFromMcc(" + language + ", " + country + ", " + mcc);
413            return getLocaleForLanguageCountry(context, language, country);
414        }
415
416        return locale;
417    }
418
419    /**
420     * Set the country code for wifi.  This sets allowed wifi channels based on the
421     * country of the carrier we see.  If we can't see any, reset to 0 so we don't
422     * broadcast on forbidden channels.
423     * @param context Context to act on.
424     * @param mcc Mobile Country Code of the operator.  0 if not known
425     */
426    private static void setWifiCountryCodeFromMcc(Context context, int mcc) {
427        String country = MccTable.countryCodeForMcc(mcc);
428        Slog.d(LOG_TAG, "WIFI_COUNTRY_CODE set to " + country);
429        WifiManager wM = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
430        wM.setCountryCode(country, false);
431    }
432
433    static {
434        sTable = new ArrayList<MccEntry>(240);
435
436
437        /*
438         * The table below is built from two resources:
439         *
440         * 1) ITU "Mobile Network Code (MNC) for the international
441         *   identification plan for mobile terminals and mobile users"
442         *   which is available as an annex to the ITU operational bulletin
443         *   available here: http://www.itu.int/itu-t/bulletin/annex.html
444         *
445         * 2) The ISO 3166 country codes list, available here:
446         *    http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/index.html
447         *
448         * This table has not been verified.
449         */
450
451		sTable.add(new MccEntry(202,"gr",2));	//Greece
452		sTable.add(new MccEntry(204,"nl",2));	//Netherlands (Kingdom of the)
453		sTable.add(new MccEntry(206,"be",2));	//Belgium
454		sTable.add(new MccEntry(208,"fr",2));	//France
455		sTable.add(new MccEntry(212,"mc",2));	//Monaco (Principality of)
456		sTable.add(new MccEntry(213,"ad",2));	//Andorra (Principality of)
457		sTable.add(new MccEntry(214,"es",2));	//Spain
458		sTable.add(new MccEntry(216,"hu",2));	//Hungary (Republic of)
459		sTable.add(new MccEntry(218,"ba",2));	//Bosnia and Herzegovina
460		sTable.add(new MccEntry(219,"hr",2));	//Croatia (Republic of)
461		sTable.add(new MccEntry(220,"rs",2));	//Serbia and Montenegro
462		sTable.add(new MccEntry(222,"it",2));	//Italy
463		sTable.add(new MccEntry(225,"va",2));	//Vatican City State
464		sTable.add(new MccEntry(226,"ro",2));	//Romania
465		sTable.add(new MccEntry(228,"ch",2));	//Switzerland (Confederation of)
466		sTable.add(new MccEntry(230,"cz",2));	//Czechia
467		sTable.add(new MccEntry(231,"sk",2));	//Slovak Republic
468		sTable.add(new MccEntry(232,"at",2));	//Austria
469		sTable.add(new MccEntry(234,"gb",2));	//United Kingdom of Great Britain and Northern Ireland
470		sTable.add(new MccEntry(235,"gb",2));	//United Kingdom of Great Britain and Northern Ireland
471		sTable.add(new MccEntry(238,"dk",2));	//Denmark
472		sTable.add(new MccEntry(240,"se",2));	//Sweden
473		sTable.add(new MccEntry(242,"no",2));	//Norway
474		sTable.add(new MccEntry(244,"fi",2));	//Finland
475		sTable.add(new MccEntry(246,"lt",2));	//Lithuania (Republic of)
476		sTable.add(new MccEntry(247,"lv",2));	//Latvia (Republic of)
477		sTable.add(new MccEntry(248,"ee",2));	//Estonia (Republic of)
478		sTable.add(new MccEntry(250,"ru",2));	//Russian Federation
479		sTable.add(new MccEntry(255,"ua",2));	//Ukraine
480		sTable.add(new MccEntry(257,"by",2));	//Belarus (Republic of)
481		sTable.add(new MccEntry(259,"md",2));	//Moldova (Republic of)
482		sTable.add(new MccEntry(260,"pl",2));	//Poland (Republic of)
483		sTable.add(new MccEntry(262,"de",2));	//Germany (Federal Republic of)
484		sTable.add(new MccEntry(266,"gi",2));	//Gibraltar
485		sTable.add(new MccEntry(268,"pt",2));	//Portugal
486		sTable.add(new MccEntry(270,"lu",2));	//Luxembourg
487		sTable.add(new MccEntry(272,"ie",2));	//Ireland
488		sTable.add(new MccEntry(274,"is",2));	//Iceland
489		sTable.add(new MccEntry(276,"al",2));	//Albania (Republic of)
490		sTable.add(new MccEntry(278,"mt",2));	//Malta
491		sTable.add(new MccEntry(280,"cy",2));	//Cyprus (Republic of)
492		sTable.add(new MccEntry(282,"ge",2));	//Georgia
493		sTable.add(new MccEntry(283,"am",2));	//Armenia (Republic of)
494		sTable.add(new MccEntry(284,"bg",2));	//Bulgaria (Republic of)
495		sTable.add(new MccEntry(286,"tr",2));	//Turkey
496		sTable.add(new MccEntry(288,"fo",2));	//Faroe Islands
497                sTable.add(new MccEntry(289,"ge",2));    //Abkhazia (Georgia)
498		sTable.add(new MccEntry(290,"gl",2));	//Greenland (Denmark)
499		sTable.add(new MccEntry(292,"sm",2));	//San Marino (Republic of)
500		sTable.add(new MccEntry(293,"si",2));	//Slovenia (Republic of)
501                sTable.add(new MccEntry(294,"mk",2));   //The Former Yugoslav Republic of Macedonia
502		sTable.add(new MccEntry(295,"li",2));	//Liechtenstein (Principality of)
503                sTable.add(new MccEntry(297,"me",2));    //Montenegro (Republic of)
504		sTable.add(new MccEntry(302,"ca",3));	//Canada
505		sTable.add(new MccEntry(308,"pm",2));	//Saint Pierre and Miquelon (Collectivit territoriale de la Rpublique franaise)
506		sTable.add(new MccEntry(310,"us",3));	//United States of America
507		sTable.add(new MccEntry(311,"us",3));	//United States of America
508		sTable.add(new MccEntry(312,"us",3));	//United States of America
509		sTable.add(new MccEntry(313,"us",3));	//United States of America
510		sTable.add(new MccEntry(314,"us",3));	//United States of America
511		sTable.add(new MccEntry(315,"us",3));	//United States of America
512		sTable.add(new MccEntry(316,"us",3));	//United States of America
513		sTable.add(new MccEntry(330,"pr",2));	//Puerto Rico
514		sTable.add(new MccEntry(332,"vi",2));	//United States Virgin Islands
515		sTable.add(new MccEntry(334,"mx",3));	//Mexico
516		sTable.add(new MccEntry(338,"jm",3));	//Jamaica
517		sTable.add(new MccEntry(340,"gp",2));	//Guadeloupe (French Department of)
518		sTable.add(new MccEntry(342,"bb",3));	//Barbados
519		sTable.add(new MccEntry(344,"ag",3));	//Antigua and Barbuda
520		sTable.add(new MccEntry(346,"ky",3));	//Cayman Islands
521		sTable.add(new MccEntry(348,"vg",3));	//British Virgin Islands
522		sTable.add(new MccEntry(350,"bm",2));	//Bermuda
523		sTable.add(new MccEntry(352,"gd",2));	//Grenada
524		sTable.add(new MccEntry(354,"ms",2));	//Montserrat
525		sTable.add(new MccEntry(356,"kn",2));	//Saint Kitts and Nevis
526		sTable.add(new MccEntry(358,"lc",2));	//Saint Lucia
527		sTable.add(new MccEntry(360,"vc",2));	//Saint Vincent and the Grenadines
528		sTable.add(new MccEntry(362,"ai",2));	//Netherlands Antilles
529		sTable.add(new MccEntry(363,"aw",2));	//Aruba
530		sTable.add(new MccEntry(364,"bs",2));	//Bahamas (Commonwealth of the)
531		sTable.add(new MccEntry(365,"ai",3));	//Anguilla
532		sTable.add(new MccEntry(366,"dm",2));	//Dominica (Commonwealth of)
533		sTable.add(new MccEntry(368,"cu",2));	//Cuba
534		sTable.add(new MccEntry(370,"do",2));	//Dominican Republic
535		sTable.add(new MccEntry(372,"ht",2));	//Haiti (Republic of)
536		sTable.add(new MccEntry(374,"tt",2));	//Trinidad and Tobago
537		sTable.add(new MccEntry(376,"tc",2));	//Turks and Caicos Islands
538		sTable.add(new MccEntry(400,"az",2));	//Azerbaijani Republic
539		sTable.add(new MccEntry(401,"kz",2));	//Kazakhstan (Republic of)
540		sTable.add(new MccEntry(402,"bt",2));	//Bhutan (Kingdom of)
541		sTable.add(new MccEntry(404,"in",2));	//India (Republic of)
542		sTable.add(new MccEntry(405,"in",2));	//India (Republic of)
543		sTable.add(new MccEntry(406,"in",2));	//India (Republic of)
544		sTable.add(new MccEntry(410,"pk",2));	//Pakistan (Islamic Republic of)
545		sTable.add(new MccEntry(412,"af",2));	//Afghanistan
546		sTable.add(new MccEntry(413,"lk",2));	//Sri Lanka (Democratic Socialist Republic of)
547		sTable.add(new MccEntry(414,"mm",2));	//Myanmar (Union of)
548		sTable.add(new MccEntry(415,"lb",2));	//Lebanon
549		sTable.add(new MccEntry(416,"jo",2));	//Jordan (Hashemite Kingdom of)
550		sTable.add(new MccEntry(417,"sy",2));	//Syrian Arab Republic
551		sTable.add(new MccEntry(418,"iq",2));	//Iraq (Republic of)
552		sTable.add(new MccEntry(419,"kw",2));	//Kuwait (State of)
553		sTable.add(new MccEntry(420,"sa",2));	//Saudi Arabia (Kingdom of)
554		sTable.add(new MccEntry(421,"ye",2));	//Yemen (Republic of)
555		sTable.add(new MccEntry(422,"om",2));	//Oman (Sultanate of)
556                sTable.add(new MccEntry(423,"ps",2));    //Palestine
557		sTable.add(new MccEntry(424,"ae",2));	//United Arab Emirates
558		sTable.add(new MccEntry(425,"il",2));	//Israel (State of)
559		sTable.add(new MccEntry(426,"bh",2));	//Bahrain (Kingdom of)
560		sTable.add(new MccEntry(427,"qa",2));	//Qatar (State of)
561		sTable.add(new MccEntry(428,"mn",2));	//Mongolia
562		sTable.add(new MccEntry(429,"np",2));	//Nepal
563		sTable.add(new MccEntry(430,"ae",2));	//United Arab Emirates
564		sTable.add(new MccEntry(431,"ae",2));	//United Arab Emirates
565		sTable.add(new MccEntry(432,"ir",2));	//Iran (Islamic Republic of)
566		sTable.add(new MccEntry(434,"uz",2));	//Uzbekistan (Republic of)
567		sTable.add(new MccEntry(436,"tj",2));	//Tajikistan (Republic of)
568		sTable.add(new MccEntry(437,"kg",2));	//Kyrgyz Republic
569		sTable.add(new MccEntry(438,"tm",2));	//Turkmenistan
570		sTable.add(new MccEntry(440,"jp",2));	//Japan
571		sTable.add(new MccEntry(441,"jp",2));	//Japan
572		sTable.add(new MccEntry(450,"kr",2));	//Korea (Republic of)
573		sTable.add(new MccEntry(452,"vn",2));	//Viet Nam (Socialist Republic of)
574		sTable.add(new MccEntry(454,"hk",2));	//"Hong Kong, China"
575		sTable.add(new MccEntry(455,"mo",2));	//"Macao, China"
576		sTable.add(new MccEntry(456,"kh",2));	//Cambodia (Kingdom of)
577		sTable.add(new MccEntry(457,"la",2));	//Lao People's Democratic Republic
578		sTable.add(new MccEntry(460,"cn",2));	//China (People's Republic of)
579		sTable.add(new MccEntry(461,"cn",2));	//China (People's Republic of)
580		sTable.add(new MccEntry(466,"tw",2));	//Taiwan
581		sTable.add(new MccEntry(467,"kp",2));	//Democratic People's Republic of Korea
582		sTable.add(new MccEntry(470,"bd",2));	//Bangladesh (People's Republic of)
583		sTable.add(new MccEntry(472,"mv",2));	//Maldives (Republic of)
584		sTable.add(new MccEntry(502,"my",2));	//Malaysia
585		sTable.add(new MccEntry(505,"au",2));	//Australia
586		sTable.add(new MccEntry(510,"id",2));	//Indonesia (Republic of)
587		sTable.add(new MccEntry(514,"tl",2));	//Democratic Republic of Timor-Leste
588		sTable.add(new MccEntry(515,"ph",2));	//Philippines (Republic of the)
589		sTable.add(new MccEntry(520,"th",2));	//Thailand
590		sTable.add(new MccEntry(525,"sg",2));	//Singapore (Republic of)
591		sTable.add(new MccEntry(528,"bn",2));	//Brunei Darussalam
592		sTable.add(new MccEntry(530,"nz",2));	//New Zealand
593		sTable.add(new MccEntry(534,"mp",2));	//Northern Mariana Islands (Commonwealth of the)
594		sTable.add(new MccEntry(535,"gu",2));	//Guam
595		sTable.add(new MccEntry(536,"nr",2));	//Nauru (Republic of)
596		sTable.add(new MccEntry(537,"pg",2));	//Papua New Guinea
597		sTable.add(new MccEntry(539,"to",2));	//Tonga (Kingdom of)
598		sTable.add(new MccEntry(540,"sb",2));	//Solomon Islands
599		sTable.add(new MccEntry(541,"vu",2));	//Vanuatu (Republic of)
600		sTable.add(new MccEntry(542,"fj",2));	//Fiji (Republic of)
601		sTable.add(new MccEntry(543,"wf",2));	//Wallis and Futuna (Territoire franais d'outre-mer)
602		sTable.add(new MccEntry(544,"as",2));	//American Samoa
603		sTable.add(new MccEntry(545,"ki",2));	//Kiribati (Republic of)
604		sTable.add(new MccEntry(546,"nc",2));	//New Caledonia (Territoire franais d'outre-mer)
605		sTable.add(new MccEntry(547,"pf",2));	//French Polynesia (Territoire franais d'outre-mer)
606		sTable.add(new MccEntry(548,"ck",2));	//Cook Islands
607		sTable.add(new MccEntry(549,"ws",2));	//Samoa (Independent State of)
608		sTable.add(new MccEntry(550,"fm",2));	//Micronesia (Federated States of)
609		sTable.add(new MccEntry(551,"mh",2));	//Marshall Islands (Republic of the)
610		sTable.add(new MccEntry(552,"pw",2));	//Palau (Republic of)
611		sTable.add(new MccEntry(553,"tv",2));	//Tuvalu
612		sTable.add(new MccEntry(555,"nu",2));	//Niue
613		sTable.add(new MccEntry(602,"eg",2));	//Egypt (Arab Republic of)
614		sTable.add(new MccEntry(603,"dz",2));	//Algeria (People's Democratic Republic of)
615		sTable.add(new MccEntry(604,"ma",2));	//Morocco (Kingdom of)
616		sTable.add(new MccEntry(605,"tn",2));	//Tunisia
617		sTable.add(new MccEntry(606,"ly",2));	//Libya (Socialist People's Libyan Arab Jamahiriya)
618		sTable.add(new MccEntry(607,"gm",2));	//Gambia (Republic of the)
619		sTable.add(new MccEntry(608,"sn",2));	//Senegal (Republic of)
620		sTable.add(new MccEntry(609,"mr",2));	//Mauritania (Islamic Republic of)
621		sTable.add(new MccEntry(610,"ml",2));	//Mali (Republic of)
622		sTable.add(new MccEntry(611,"gn",2));	//Guinea (Republic of)
623		sTable.add(new MccEntry(612,"ci",2));	//Côte d'Ivoire (Republic of)
624		sTable.add(new MccEntry(613,"bf",2));	//Burkina Faso
625		sTable.add(new MccEntry(614,"ne",2));	//Niger (Republic of the)
626		sTable.add(new MccEntry(615,"tg",2));	//Togolese Republic
627		sTable.add(new MccEntry(616,"bj",2));	//Benin (Republic of)
628		sTable.add(new MccEntry(617,"mu",2));	//Mauritius (Republic of)
629		sTable.add(new MccEntry(618,"lr",2));	//Liberia (Republic of)
630		sTable.add(new MccEntry(619,"sl",2));	//Sierra Leone
631		sTable.add(new MccEntry(620,"gh",2));	//Ghana
632		sTable.add(new MccEntry(621,"ng",2));	//Nigeria (Federal Republic of)
633		sTable.add(new MccEntry(622,"td",2));	//Chad (Republic of)
634		sTable.add(new MccEntry(623,"cf",2));	//Central African Republic
635		sTable.add(new MccEntry(624,"cm",2));	//Cameroon (Republic of)
636		sTable.add(new MccEntry(625,"cv",2));	//Cape Verde (Republic of)
637		sTable.add(new MccEntry(626,"st",2));	//Sao Tome and Principe (Democratic Republic of)
638		sTable.add(new MccEntry(627,"gq",2));	//Equatorial Guinea (Republic of)
639		sTable.add(new MccEntry(628,"ga",2));	//Gabonese Republic
640		sTable.add(new MccEntry(629,"cg",2));	//Congo (Republic of the)
641		sTable.add(new MccEntry(630,"cd",2));	//Democratic Republic of the Congo
642		sTable.add(new MccEntry(631,"ao",2));	//Angola (Republic of)
643		sTable.add(new MccEntry(632,"gw",2));	//Guinea-Bissau (Republic of)
644		sTable.add(new MccEntry(633,"sc",2));	//Seychelles (Republic of)
645		sTable.add(new MccEntry(634,"sd",2));	//Sudan (Republic of the)
646		sTable.add(new MccEntry(635,"rw",2));	//Rwanda (Republic of)
647		sTable.add(new MccEntry(636,"et",2));	//Ethiopia (Federal Democratic Republic of)
648		sTable.add(new MccEntry(637,"so",2));	//Somali Democratic Republic
649		sTable.add(new MccEntry(638,"dj",2));	//Djibouti (Republic of)
650		sTable.add(new MccEntry(639,"ke",2));	//Kenya (Republic of)
651		sTable.add(new MccEntry(640,"tz",2));	//Tanzania (United Republic of)
652		sTable.add(new MccEntry(641,"ug",2));	//Uganda (Republic of)
653		sTable.add(new MccEntry(642,"bi",2));	//Burundi (Republic of)
654		sTable.add(new MccEntry(643,"mz",2));	//Mozambique (Republic of)
655		sTable.add(new MccEntry(645,"zm",2));	//Zambia (Republic of)
656		sTable.add(new MccEntry(646,"mg",2));	//Madagascar (Republic of)
657		sTable.add(new MccEntry(647,"re",2));	//Reunion (French Department of)
658		sTable.add(new MccEntry(648,"zw",2));	//Zimbabwe (Republic of)
659		sTable.add(new MccEntry(649,"na",2));	//Namibia (Republic of)
660		sTable.add(new MccEntry(650,"mw",2));	//Malawi
661		sTable.add(new MccEntry(651,"ls",2));	//Lesotho (Kingdom of)
662		sTable.add(new MccEntry(652,"bw",2));	//Botswana (Republic of)
663		sTable.add(new MccEntry(653,"sz",2));	//Swaziland (Kingdom of)
664		sTable.add(new MccEntry(654,"km",2));	//Comoros (Union of the)
665		sTable.add(new MccEntry(655,"za",2));	//South Africa (Republic of)
666		sTable.add(new MccEntry(657,"er",2));	//Eritrea
667		sTable.add(new MccEntry(658,"sh",2));	//Saint Helena, Ascension and Tristan da Cunha
668		sTable.add(new MccEntry(659,"ss",2));	//South Sudan (Republic of)
669		sTable.add(new MccEntry(702,"bz",2));	//Belize
670		sTable.add(new MccEntry(704,"gt",2));	//Guatemala (Republic of)
671		sTable.add(new MccEntry(706,"sv",2));	//El Salvador (Republic of)
672		sTable.add(new MccEntry(708,"hn",3));	//Honduras (Republic of)
673		sTable.add(new MccEntry(710,"ni",2));	//Nicaragua
674		sTable.add(new MccEntry(712,"cr",2));	//Costa Rica
675		sTable.add(new MccEntry(714,"pa",2));	//Panama (Republic of)
676		sTable.add(new MccEntry(716,"pe",2));	//Peru
677		sTable.add(new MccEntry(722,"ar",3));	//Argentine Republic
678		sTable.add(new MccEntry(724,"br",2));	//Brazil (Federative Republic of)
679		sTable.add(new MccEntry(730,"cl",2));	//Chile
680		sTable.add(new MccEntry(732,"co",3));	//Colombia (Republic of)
681		sTable.add(new MccEntry(734,"ve",2));	//Venezuela (Bolivarian Republic of)
682		sTable.add(new MccEntry(736,"bo",2));	//Bolivia (Republic of)
683		sTable.add(new MccEntry(738,"gy",2));	//Guyana
684		sTable.add(new MccEntry(740,"ec",2));	//Ecuador
685		sTable.add(new MccEntry(742,"gf",2));	//French Guiana (French Department of)
686		sTable.add(new MccEntry(744,"py",2));	//Paraguay (Republic of)
687		sTable.add(new MccEntry(746,"sr",2));	//Suriname (Republic of)
688		sTable.add(new MccEntry(748,"uy",2));	//Uruguay (Eastern Republic of)
689		sTable.add(new MccEntry(750,"fk",2));	//Falkland Islands (Malvinas)
690        //table.add(new MccEntry(901,"",2));	//"International Mobile, shared code"
691
692        Collections.sort(sTable);
693    }
694}
695