1b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project/*
2b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project * Copyright (C) 2006 The Android Open Source Project
3b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project *
4b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project * Licensed under the Apache License, Version 2.0 (the "License");
5b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project * you may not use this file except in compliance with the License.
6b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project * You may obtain a copy of the License at
7b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project *
8b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project *      http://www.apache.org/licenses/LICENSE-2.0
9b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project *
10b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project * Unless required by applicable law or agreed to in writing, software
11b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project * distributed under the License is distributed on an "AS IS" BASIS,
12b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project * See the License for the specific language governing permissions and
14b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project * limitations under the License.
15b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project */
16b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project
17b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Projectpackage com.android.phone;
18b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project
19b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Projectimport android.app.Activity;
20b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Projectimport android.app.AlertDialog;
21b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Projectimport android.content.Context;
22b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Projectimport android.content.Intent;
23b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Projectimport android.net.Uri;
24b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Projectimport android.provider.Telephony.Intents;
25b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Projectimport com.android.internal.telephony.PhoneFactory;
266fc6603ae72f8a2430beddee2464310a0a97a958Tracy Puimport com.android.internal.telephony.Phone;
27b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Projectimport android.telephony.PhoneNumberUtils;
28b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Projectimport android.util.Log;
29b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Projectimport android.view.WindowManager;
30b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project
31b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project/**
32b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project * Helper class to listen for some magic character sequences
33b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project * that are handled specially by the Phone app.
348160733cdd1adc9a2381f94072f20e26d7a5a172David Brown *
358160733cdd1adc9a2381f94072f20e26d7a5a172David Brown * TODO: there's lots of duplicated code between this class and the
368160733cdd1adc9a2381f94072f20e26d7a5a172David Brown * corresponding class under apps/Contacts.  Let's figure out a way to
378160733cdd1adc9a2381f94072f20e26d7a5a172David Brown * unify these two classes (in the framework? in a common shared library?)
38b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project */
39b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Projectpublic class SpecialCharSequenceMgr {
40b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project    private static final String TAG = PhoneApp.LOG_TAG;
41b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project    private static final boolean DBG = false;
42b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project
43b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project    private static final String MMI_IMEI_DISPLAY = "*#06#";
44b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project
45b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project    /** This class is never instantiated. */
46b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project    private SpecialCharSequenceMgr() {
47b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project    }
48b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project
49fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania    /**
50fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania     * Check for special strings of digits from an input
51fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania     * string.
52fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania     * @param context input Context for the events we handle.
53fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania     * @param input the dial string to be examined.
54fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania     */
55b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project    static boolean handleChars(Context context, String input) {
56fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania        return handleChars(context, input, null);
57b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project    }
58fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania
59b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project    /**
60fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania     * Generally used for the Personal Unblocking Key (PUK) unlocking
61fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania     * case, where we want to be able to maintain a handle to the
62fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania     * calling activity so that we can close it or otherwise display
63b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project     * indication if the PUK code is recognized.
64fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania     *
65b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project     * NOTE: The counterpart to this file in Contacts does
66b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project     * NOT contain the special PUK handling code, since it
67b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project     * does NOT need it.  When the device gets into PUK-
68b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project     * locked state, the keyguard comes up and the only way
69b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project     * to unlock the device is through the Emergency dialer,
70b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project     * which is still in the Phone App.
71fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania     *
72fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania     * @param context input Context for the events we handle.
73fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania     * @param input the dial string to be examined.
74b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project     * @param pukInputActivity activity that originated this
75fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania     * PUK call, tracked so that we can close it or otherwise
76fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania     * indicate that special character sequence is
77fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania     * successfully processed. Can be null.
78fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania     * @return true if the input was a special string which has been
79fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania     * handled.
80b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project     */
81b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project    static boolean handleChars(Context context,
82fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania                               String input,
83b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project                               Activity pukInputActivity) {
84fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania
85fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania        //get rid of the separators so that the string gets parsed correctly
86b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        String dialString = PhoneNumberUtils.stripSeparators(input);
87fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania
88fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania        if (handleIMEIDisplay(context, dialString)
89b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project            || handlePinEntry(context, dialString, pukInputActivity)
90b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project            || handleAdnEntry(context, dialString)
91b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project            || handleSecretCode(context, dialString)) {
92b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project            return true;
93b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        }
94fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania
95b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        return false;
96b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project    }
97b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project
98b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project    /**
998160733cdd1adc9a2381f94072f20e26d7a5a172David Brown     * Variant of handleChars() that looks for the subset of "special
1008160733cdd1adc9a2381f94072f20e26d7a5a172David Brown     * sequences" that are available even if the device is locked.
1018160733cdd1adc9a2381f94072f20e26d7a5a172David Brown     *
1028160733cdd1adc9a2381f94072f20e26d7a5a172David Brown     * (Specifically, these are the sequences that you're allowed to type
1038160733cdd1adc9a2381f94072f20e26d7a5a172David Brown     * in the Emergency Dialer, which is accessible *without* unlocking
1048160733cdd1adc9a2381f94072f20e26d7a5a172David Brown     * the device.)
1058160733cdd1adc9a2381f94072f20e26d7a5a172David Brown     */
1068160733cdd1adc9a2381f94072f20e26d7a5a172David Brown    static boolean handleCharsForLockedDevice(Context context,
1078160733cdd1adc9a2381f94072f20e26d7a5a172David Brown                                              String input,
1088160733cdd1adc9a2381f94072f20e26d7a5a172David Brown                                              Activity pukInputActivity) {
1098160733cdd1adc9a2381f94072f20e26d7a5a172David Brown        // Get rid of the separators so that the string gets parsed correctly
1108160733cdd1adc9a2381f94072f20e26d7a5a172David Brown        String dialString = PhoneNumberUtils.stripSeparators(input);
1118160733cdd1adc9a2381f94072f20e26d7a5a172David Brown
1128160733cdd1adc9a2381f94072f20e26d7a5a172David Brown        // The only sequences available on a locked device are the "**04"
1138160733cdd1adc9a2381f94072f20e26d7a5a172David Brown        // or "**05" sequences that allow you to enter PIN or PUK-related
1148160733cdd1adc9a2381f94072f20e26d7a5a172David Brown        // codes.  (e.g. for the case where you're currently locked out of
1158160733cdd1adc9a2381f94072f20e26d7a5a172David Brown        // your phone, and need to change the PIN!  The only way to do
1168160733cdd1adc9a2381f94072f20e26d7a5a172David Brown        // that is via the Emergency Dialer.)
1178160733cdd1adc9a2381f94072f20e26d7a5a172David Brown
1188160733cdd1adc9a2381f94072f20e26d7a5a172David Brown        if (handlePinEntry(context, dialString, pukInputActivity)) {
1198160733cdd1adc9a2381f94072f20e26d7a5a172David Brown            return true;
1208160733cdd1adc9a2381f94072f20e26d7a5a172David Brown        }
1218160733cdd1adc9a2381f94072f20e26d7a5a172David Brown
1228160733cdd1adc9a2381f94072f20e26d7a5a172David Brown        return false;
1238160733cdd1adc9a2381f94072f20e26d7a5a172David Brown    }
1248160733cdd1adc9a2381f94072f20e26d7a5a172David Brown
1258160733cdd1adc9a2381f94072f20e26d7a5a172David Brown    /**
126b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project     * Handles secret codes to launch arbitrary activities in the form of *#*#<code>#*#*.
127b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project     * If a secret code is encountered an Intent is started with the android_secret_code://<code>
128b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project     * URI.
129fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania     *
130b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project     * @param context the context to use
131b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project     * @param input the text to check for a secret code in
132b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project     * @return true if a secret code was encountered
133b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project     */
134fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania    static private boolean handleSecretCode(Context context, String input) {
135b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        // Secret codes are in the form *#*#<code>#*#*
136b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        int len = input.length();
137b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        if (len > 8 && input.startsWith("*#*#") && input.endsWith("#*#*")) {
138b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project            Intent intent = new Intent(Intents.SECRET_CODE_ACTION,
139b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project                    Uri.parse("android_secret_code://" + input.substring(4, len - 4)));
140b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project            context.sendBroadcast(intent);
141b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project            return true;
142b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        }
143b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project
144b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        return false;
145b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project    }
146b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project
147fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania    static private boolean handleAdnEntry(Context context, String input) {
148b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        /* ADN entries are of the form "N(N)(N)#" */
149fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania
150b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        // if the phone is keyguard-restricted, then just ignore this
151b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        // input.  We want to make sure that sim card contacts are NOT
152b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        // exposed unless the phone is unlocked, and this code can be
153b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        // accessed from the emergency dialer.
154b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        if (PhoneApp.getInstance().getKeyguardManager().inKeyguardRestrictedInputMode()) {
155b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project            return false;
156b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        }
157fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania
158b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        int len = input.length();
159b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        if ((len > 1) && (len < 5) && (input.endsWith("#"))) {
160b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project            try {
161b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project                int index = Integer.parseInt(input.substring(0, len-1));
162b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project                Intent intent = new Intent(Intent.ACTION_PICK);
163b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project
164b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project                intent.setClassName("com.android.phone",
165b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project                                    "com.android.phone.SimContacts");
166b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
167b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project                intent.putExtra("index", index);
168b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project                PhoneApp.getInstance().startActivity(intent);
169b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project
170b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project                return true;
171b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project            } catch (NumberFormatException ex) {}
172b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        }
173b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        return false;
174b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project    }
175b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project
176fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania    static private boolean handlePinEntry(Context context, String input,
177fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania                                          Activity pukInputActivity) {
178fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania        // TODO: The string constants here should be removed in favor
179fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania        // of some call to a static the MmiCode class that determines
180fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania        // if a dialstring is an MMI code.
181fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania        if ((input.startsWith("**04") || input.startsWith("**05"))
182b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project                && input.endsWith("#")) {
183b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project            PhoneApp app = PhoneApp.getInstance();
184b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project            boolean isMMIHandled = app.phone.handlePinMmi(input);
185fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania
186b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project            // if the PUK code is recognized then indicate to the
187b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project            // phone app that an attempt to unPUK the device was
188b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project            // made with this activity.  The PUK code may still
189b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project            // fail though, but we won't know until the MMI code
190b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project            // returns a result.
191b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project            if (isMMIHandled && input.startsWith("**05")) {
192b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project                app.setPukEntryActivity(pukInputActivity);
193b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project            }
194b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project            return isMMIHandled;
195b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        }
196b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        return false;
197b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project    }
198b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project
199fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania    static private boolean handleIMEIDisplay(Context context,
200fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania                                             String input) {
201b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        if (input.equals(MMI_IMEI_DISPLAY)) {
20279b9f6e30e8402b103f1ec3ed9dda1fcad2b1cd5Tammo Spalink            int phoneType = PhoneApp.getInstance().phone.getPhoneType();
20379b9f6e30e8402b103f1ec3ed9dda1fcad2b1cd5Tammo Spalink            if (phoneType == Phone.PHONE_TYPE_CDMA) {
204fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania                showMEIDPanel(context);
2056fc6603ae72f8a2430beddee2464310a0a97a958Tracy Pu                return true;
20679b9f6e30e8402b103f1ec3ed9dda1fcad2b1cd5Tammo Spalink            } else if (phoneType == Phone.PHONE_TYPE_GSM) {
207fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania                showIMEIPanel(context);
2086fc6603ae72f8a2430beddee2464310a0a97a958Tracy Pu                return true;
2096fc6603ae72f8a2430beddee2464310a0a97a958Tracy Pu            }
210b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        }
211b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project
212b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        return false;
213b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project    }
214b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project
215fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania    // TODO: showIMEIPanel and showMEIDPanel are almost cut and paste
216fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania    // clones. Refactor.
217fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania    static private void showIMEIPanel(Context context) {
218b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        if (DBG) log("showIMEIPanel");
219b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project
220b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        String imeiStr = PhoneFactory.getDefaultPhone().getDeviceId();
221b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project
222b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        AlertDialog alert = new AlertDialog.Builder(context)
223b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project                .setTitle(R.string.imei)
224b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project                .setMessage(imeiStr)
225b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project                .setPositiveButton(R.string.ok, null)
226b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project                .setCancelable(false)
227b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project                .show();
228b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        alert.getWindow().setType(WindowManager.LayoutParams.TYPE_PRIORITY_PHONE);
229b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project    }
230b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project
231fdb931638b6bda659875dbd1ac2a5f87179d17cfNicolas Catania    static private void showMEIDPanel(Context context) {
2326fc6603ae72f8a2430beddee2464310a0a97a958Tracy Pu        if (DBG) log("showMEIDPanel");
2336fc6603ae72f8a2430beddee2464310a0a97a958Tracy Pu
2346fc6603ae72f8a2430beddee2464310a0a97a958Tracy Pu        String meidStr = PhoneFactory.getDefaultPhone().getDeviceId();
2356fc6603ae72f8a2430beddee2464310a0a97a958Tracy Pu
2366fc6603ae72f8a2430beddee2464310a0a97a958Tracy Pu        AlertDialog alert = new AlertDialog.Builder(context)
2376fc6603ae72f8a2430beddee2464310a0a97a958Tracy Pu                .setTitle(R.string.meid)
2386fc6603ae72f8a2430beddee2464310a0a97a958Tracy Pu                .setMessage(meidStr)
2396fc6603ae72f8a2430beddee2464310a0a97a958Tracy Pu                .setPositiveButton(R.string.ok, null)
2406fc6603ae72f8a2430beddee2464310a0a97a958Tracy Pu                .setCancelable(false)
2416fc6603ae72f8a2430beddee2464310a0a97a958Tracy Pu                .show();
2426fc6603ae72f8a2430beddee2464310a0a97a958Tracy Pu        alert.getWindow().setType(WindowManager.LayoutParams.TYPE_PRIORITY_PHONE);
2436fc6603ae72f8a2430beddee2464310a0a97a958Tracy Pu    }
2446fc6603ae72f8a2430beddee2464310a0a97a958Tracy Pu
245b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project    private static void log(String msg) {
246b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project        Log.d(TAG, "[SpecialCharSequenceMgr] " + msg);
247b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project    }
248b16363f5fc191b769e88c364243e34b92eb22688The Android Open Source Project}
249