PhoneBase.java revision 5e2000b856a7959609e8f15148a3584ec372f865
1/*
2 * Copyright (C) 2007 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.content.Context;
20import android.content.SharedPreferences;
21import android.net.LinkCapabilities;
22import android.net.LinkProperties;
23import android.net.wifi.WifiManager;
24import android.os.AsyncResult;
25import android.os.Build;
26import android.os.Handler;
27import android.os.Looper;
28import android.os.Message;
29import android.os.RegistrantList;
30import android.os.SystemProperties;
31import android.preference.PreferenceManager;
32import android.provider.Settings;
33import android.telephony.CellInfo;
34import android.telephony.ServiceState;
35import android.telephony.SignalStrength;
36import android.text.TextUtils;
37import android.telephony.Rlog;
38
39import com.android.internal.R;
40import com.android.internal.telephony.dataconnection.DcTrackerBase;
41import com.android.internal.telephony.test.SimulatedRadioControl;
42import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType;
43import com.android.internal.telephony.uicc.IccFileHandler;
44import com.android.internal.telephony.uicc.IccRecords;
45import com.android.internal.telephony.uicc.IsimRecords;
46import com.android.internal.telephony.uicc.UiccCardApplication;
47import com.android.internal.telephony.uicc.UiccController;
48import com.android.internal.telephony.uicc.UsimServiceTable;
49import java.io.FileDescriptor;
50import java.io.PrintWriter;
51import java.util.List;
52import java.util.concurrent.atomic.AtomicReference;
53
54
55/**
56 * (<em>Not for SDK use</em>)
57 * A base implementation for the com.android.internal.telephony.Phone interface.
58 *
59 * Note that implementations of Phone.java are expected to be used
60 * from a single application thread. This should be the same thread that
61 * originally called PhoneFactory to obtain the interface.
62 *
63 *  {@hide}
64 *
65 */
66
67public abstract class PhoneBase extends Handler implements Phone {
68    private static final String LOG_TAG = "PhoneBase";
69
70    // Key used to read and write the saved network selection numeric value
71    public static final String NETWORK_SELECTION_KEY = "network_selection_key";
72    // Key used to read and write the saved network selection operator name
73    public static final String NETWORK_SELECTION_NAME_KEY = "network_selection_name_key";
74
75
76    // Key used to read/write "disable data connection on boot" pref (used for testing)
77    public static final String DATA_DISABLED_ON_BOOT_KEY = "disabled_on_boot_key";
78
79    /* Event Constants */
80    protected static final int EVENT_RADIO_AVAILABLE             = 1;
81    /** Supplementary Service Notification received. */
82    protected static final int EVENT_SSN                         = 2;
83    protected static final int EVENT_SIM_RECORDS_LOADED          = 3;
84    protected static final int EVENT_MMI_DONE                    = 4;
85    protected static final int EVENT_RADIO_ON                    = 5;
86    protected static final int EVENT_GET_BASEBAND_VERSION_DONE   = 6;
87    protected static final int EVENT_USSD                        = 7;
88    protected static final int EVENT_RADIO_OFF_OR_NOT_AVAILABLE  = 8;
89    protected static final int EVENT_GET_IMEI_DONE               = 9;
90    protected static final int EVENT_GET_IMEISV_DONE             = 10;
91    protected static final int EVENT_GET_SIM_STATUS_DONE         = 11;
92    protected static final int EVENT_SET_CALL_FORWARD_DONE       = 12;
93    protected static final int EVENT_GET_CALL_FORWARD_DONE       = 13;
94    protected static final int EVENT_CALL_RING                   = 14;
95    protected static final int EVENT_CALL_RING_CONTINUE          = 15;
96
97    // Used to intercept the carrier selection calls so that
98    // we can save the values.
99    protected static final int EVENT_SET_NETWORK_MANUAL_COMPLETE    = 16;
100    protected static final int EVENT_SET_NETWORK_AUTOMATIC_COMPLETE = 17;
101    protected static final int EVENT_SET_CLIR_COMPLETE              = 18;
102    protected static final int EVENT_REGISTERED_TO_NETWORK          = 19;
103    protected static final int EVENT_SET_VM_NUMBER_DONE             = 20;
104    // Events for CDMA support
105    protected static final int EVENT_GET_DEVICE_IDENTITY_DONE       = 21;
106    protected static final int EVENT_RUIM_RECORDS_LOADED            = 22;
107    protected static final int EVENT_NV_READY                       = 23;
108    protected static final int EVENT_SET_ENHANCED_VP                = 24;
109    protected static final int EVENT_EMERGENCY_CALLBACK_MODE_ENTER  = 25;
110    protected static final int EVENT_EXIT_EMERGENCY_CALLBACK_RESPONSE = 26;
111    protected static final int EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED = 27;
112    // other
113    protected static final int EVENT_SET_NETWORK_AUTOMATIC          = 28;
114    protected static final int EVENT_NEW_ICC_SMS                    = 29;
115    protected static final int EVENT_ICC_RECORD_EVENTS              = 30;
116    protected static final int EVENT_ICC_CHANGED                    = 31;
117
118    // Key used to read/write current CLIR setting
119    public static final String CLIR_KEY = "clir_key";
120
121    // Key used to read/write "disable DNS server check" pref (used for testing)
122    public static final String DNS_SERVER_CHECK_DISABLED_KEY = "dns_server_check_disabled_key";
123
124    /* Instance Variables */
125    public CommandsInterface mCi;
126    boolean mDnsCheckDisabled;
127    public DcTrackerBase mDcTracker;
128    boolean mDoesRilSendMultipleCallRing;
129    int mCallRingContinueToken;
130    int mCallRingDelay;
131    public boolean mIsTheCurrentActivePhone = true;
132    boolean mIsVoiceCapable = true;
133    protected UiccController mUiccController = null;
134    public AtomicReference<IccRecords> mIccRecords = new AtomicReference<IccRecords>();
135    public SmsStorageMonitor mSmsStorageMonitor;
136    public SmsUsageMonitor mSmsUsageMonitor;
137    protected AtomicReference<UiccCardApplication> mUiccApplication =
138            new AtomicReference<UiccCardApplication>();
139    public SMSDispatcher mSMS;
140
141    private TelephonyTester mTelephonyTester;
142    private final String mName;
143    private final String mActionDetached;
144    private final String mActionAttached;
145
146    @Override
147    public String getPhoneName() {
148        return mName;
149    }
150
151    /**
152     * Return the ActionDetached string. When this action is received by components
153     * they are to simulate detaching from the network.
154     *
155     * @return com.android.internal.telephony.{mName}.action_detached
156     *          {mName} is GSM, CDMA ...
157     */
158    public String getActionDetached() {
159        return mActionDetached;
160    }
161
162    /**
163     * Return the ActionAttached string. When this action is received by components
164     * they are to simulate attaching to the network.
165     *
166     * @return com.android.internal.telephony.{mName}.action_detached
167     *          {mName} is GSM, CDMA ...
168     */
169    public String getActionAttached() {
170        return mActionAttached;
171    }
172
173    /**
174     * Set a system property, unless we're in unit test mode
175     */
176    public void setSystemProperty(String property, String value) {
177        if(getUnitTestMode()) {
178            return;
179        }
180        SystemProperties.set(property, value);
181    }
182
183
184    protected final RegistrantList mPreciseCallStateRegistrants
185            = new RegistrantList();
186
187    protected final RegistrantList mNewRingingConnectionRegistrants
188            = new RegistrantList();
189
190    protected final RegistrantList mIncomingRingRegistrants
191            = new RegistrantList();
192
193    protected final RegistrantList mDisconnectRegistrants
194            = new RegistrantList();
195
196    protected final RegistrantList mServiceStateRegistrants
197            = new RegistrantList();
198
199    protected final RegistrantList mMmiCompleteRegistrants
200            = new RegistrantList();
201
202    protected final RegistrantList mMmiRegistrants
203            = new RegistrantList();
204
205    protected final RegistrantList mUnknownConnectionRegistrants
206            = new RegistrantList();
207
208    protected final RegistrantList mSuppServiceFailedRegistrants
209            = new RegistrantList();
210
211    protected Looper mLooper; /* to insure registrants are in correct thread*/
212
213    protected final Context mContext;
214
215    /**
216     * PhoneNotifier is an abstraction for all system-wide
217     * state change notification. DefaultPhoneNotifier is
218     * used here unless running we're inside a unit test.
219     */
220    protected PhoneNotifier mNotifier;
221
222    protected SimulatedRadioControl mSimulatedRadioControl;
223
224    boolean mUnitTestMode;
225
226    /**
227     * Constructs a PhoneBase in normal (non-unit test) mode.
228     *
229     * @param notifier An instance of DefaultPhoneNotifier,
230     * @param context Context object from hosting application
231     * unless unit testing.
232     * @param ci the CommandsInterface
233     */
234    protected PhoneBase(String name, PhoneNotifier notifier, Context context, CommandsInterface ci) {
235        this(name, notifier, context, ci, false);
236    }
237
238    /**
239     * Constructs a PhoneBase in normal (non-unit test) mode.
240     *
241     * @param notifier An instance of DefaultPhoneNotifier,
242     * @param context Context object from hosting application
243     * unless unit testing.
244     * @param ci is CommandsInterface
245     * @param unitTestMode when true, prevents notifications
246     * of state change events
247     */
248    protected PhoneBase(String name, PhoneNotifier notifier, Context context, CommandsInterface ci,
249            boolean unitTestMode) {
250        mName = name;
251        mNotifier = notifier;
252        mContext = context;
253        mLooper = Looper.myLooper();
254        mCi = ci;
255        mActionDetached = this.getClass().getPackage().getName() + ".action_detached";
256        mActionAttached = this.getClass().getPackage().getName() + ".action_attached";
257
258        if (Build.IS_DEBUGGABLE) {
259            mTelephonyTester = new TelephonyTester(this);
260        }
261
262        setPropertiesByCarrier();
263
264        setUnitTestMode(unitTestMode);
265
266        SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
267        mDnsCheckDisabled = sp.getBoolean(DNS_SERVER_CHECK_DISABLED_KEY, false);
268        mCi.setOnCallRing(this, EVENT_CALL_RING, null);
269
270        /* "Voice capable" means that this device supports circuit-switched
271        * (i.e. voice) phone calls over the telephony network, and is allowed
272        * to display the in-call UI while a cellular voice call is active.
273        * This will be false on "data only" devices which can't make voice
274        * calls and don't support any in-call UI.
275        */
276        mIsVoiceCapable = mContext.getResources().getBoolean(
277                com.android.internal.R.bool.config_voice_capable);
278
279        /**
280         *  Some RIL's don't always send RIL_UNSOL_CALL_RING so it needs
281         *  to be generated locally. Ideally all ring tones should be loops
282         * and this wouldn't be necessary. But to minimize changes to upper
283         * layers it is requested that it be generated by lower layers.
284         *
285         * By default old phones won't have the property set but do generate
286         * the RIL_UNSOL_CALL_RING so the default if there is no property is
287         * true.
288         */
289        mDoesRilSendMultipleCallRing = SystemProperties.getBoolean(
290                TelephonyProperties.PROPERTY_RIL_SENDS_MULTIPLE_CALL_RING, true);
291        Rlog.d(LOG_TAG, "mDoesRilSendMultipleCallRing=" + mDoesRilSendMultipleCallRing);
292
293        mCallRingDelay = SystemProperties.getInt(
294                TelephonyProperties.PROPERTY_CALL_RING_DELAY, 3000);
295        Rlog.d(LOG_TAG, "mCallRingDelay=" + mCallRingDelay);
296
297        // Initialize device storage and outgoing SMS usage monitors for SMSDispatchers.
298        mSmsStorageMonitor = new SmsStorageMonitor(this);
299        mSmsUsageMonitor = new SmsUsageMonitor(context);
300        mUiccController = UiccController.getInstance();
301        mUiccController.registerForIccChanged(this, EVENT_ICC_CHANGED, null);
302    }
303
304    @Override
305    public void dispose() {
306        synchronized(PhoneProxy.lockForRadioTechnologyChange) {
307            mCi.unSetOnCallRing(this);
308            // Must cleanup all connectionS and needs to use sendMessage!
309            mDcTracker.cleanUpAllConnections(null);
310            mIsTheCurrentActivePhone = false;
311            // Dispose the SMS usage and storage monitors
312            mSmsStorageMonitor.dispose();
313            mSmsUsageMonitor.dispose();
314            mUiccController.unregisterForIccChanged(this);
315
316            if (mTelephonyTester != null) {
317                mTelephonyTester.dispose();
318            }
319        }
320    }
321
322    @Override
323    public void removeReferences() {
324        mSmsStorageMonitor = null;
325        mSmsUsageMonitor = null;
326        mSMS = null;
327        mIccRecords.set(null);
328        mUiccApplication.set(null);
329        mDcTracker = null;
330        mUiccController = null;
331    }
332
333    /**
334     * When overridden the derived class needs to call
335     * super.handleMessage(msg) so this method has a
336     * a chance to process the message.
337     *
338     * @param msg
339     */
340    @Override
341    public void handleMessage(Message msg) {
342        AsyncResult ar;
343
344        if (!mIsTheCurrentActivePhone) {
345            Rlog.e(LOG_TAG, "Received message " + msg +
346                    "[" + msg.what + "] while being destroyed. Ignoring.");
347            return;
348        }
349        switch(msg.what) {
350            case EVENT_CALL_RING:
351                Rlog.d(LOG_TAG, "Event EVENT_CALL_RING Received state=" + getState());
352                ar = (AsyncResult)msg.obj;
353                if (ar.exception == null) {
354                    PhoneConstants.State state = getState();
355                    if ((!mDoesRilSendMultipleCallRing)
356                            && ((state == PhoneConstants.State.RINGING) ||
357                                    (state == PhoneConstants.State.IDLE))) {
358                        mCallRingContinueToken += 1;
359                        sendIncomingCallRingNotification(mCallRingContinueToken);
360                    } else {
361                        notifyIncomingRing();
362                    }
363                }
364                break;
365
366            case EVENT_CALL_RING_CONTINUE:
367                Rlog.d(LOG_TAG, "Event EVENT_CALL_RING_CONTINUE Received stat=" + getState());
368                if (getState() == PhoneConstants.State.RINGING) {
369                    sendIncomingCallRingNotification(msg.arg1);
370                }
371                break;
372
373            case EVENT_ICC_CHANGED:
374                onUpdateIccAvailability();
375                break;
376
377            default:
378                throw new RuntimeException("unexpected event not handled");
379        }
380    }
381
382    // Inherited documentation suffices.
383    @Override
384    public Context getContext() {
385        return mContext;
386    }
387
388    // Will be called when icc changed
389    protected abstract void onUpdateIccAvailability();
390
391    /**
392     * Disables the DNS check (i.e., allows "0.0.0.0").
393     * Useful for lab testing environment.
394     * @param b true disables the check, false enables.
395     */
396    @Override
397    public void disableDnsCheck(boolean b) {
398        mDnsCheckDisabled = b;
399        SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
400        SharedPreferences.Editor editor = sp.edit();
401        editor.putBoolean(DNS_SERVER_CHECK_DISABLED_KEY, b);
402        editor.apply();
403    }
404
405    /**
406     * Returns true if the DNS check is currently disabled.
407     */
408    @Override
409    public boolean isDnsCheckDisabled() {
410        return mDnsCheckDisabled;
411    }
412
413    // Inherited documentation suffices.
414    @Override
415    public void registerForPreciseCallStateChanged(Handler h, int what, Object obj) {
416        checkCorrectThread(h);
417
418        mPreciseCallStateRegistrants.addUnique(h, what, obj);
419    }
420
421    // Inherited documentation suffices.
422    @Override
423    public void unregisterForPreciseCallStateChanged(Handler h) {
424        mPreciseCallStateRegistrants.remove(h);
425    }
426
427    /**
428     * Subclasses of Phone probably want to replace this with a
429     * version scoped to their packages
430     */
431    protected void notifyPreciseCallStateChangedP() {
432        AsyncResult ar = new AsyncResult(null, this, null);
433        mPreciseCallStateRegistrants.notifyRegistrants(ar);
434    }
435
436    // Inherited documentation suffices.
437    @Override
438    public void registerForUnknownConnection(Handler h, int what, Object obj) {
439        checkCorrectThread(h);
440
441        mUnknownConnectionRegistrants.addUnique(h, what, obj);
442    }
443
444    // Inherited documentation suffices.
445    @Override
446    public void unregisterForUnknownConnection(Handler h) {
447        mUnknownConnectionRegistrants.remove(h);
448    }
449
450    // Inherited documentation suffices.
451    @Override
452    public void registerForNewRingingConnection(
453            Handler h, int what, Object obj) {
454        checkCorrectThread(h);
455
456        mNewRingingConnectionRegistrants.addUnique(h, what, obj);
457    }
458
459    // Inherited documentation suffices.
460    @Override
461    public void unregisterForNewRingingConnection(Handler h) {
462        mNewRingingConnectionRegistrants.remove(h);
463    }
464
465    // Inherited documentation suffices.
466    @Override
467    public void registerForInCallVoicePrivacyOn(Handler h, int what, Object obj){
468        mCi.registerForInCallVoicePrivacyOn(h,what,obj);
469    }
470
471    // Inherited documentation suffices.
472    @Override
473    public void unregisterForInCallVoicePrivacyOn(Handler h){
474        mCi.unregisterForInCallVoicePrivacyOn(h);
475    }
476
477    // Inherited documentation suffices.
478    @Override
479    public void registerForInCallVoicePrivacyOff(Handler h, int what, Object obj){
480        mCi.registerForInCallVoicePrivacyOff(h,what,obj);
481    }
482
483    // Inherited documentation suffices.
484    @Override
485    public void unregisterForInCallVoicePrivacyOff(Handler h){
486        mCi.unregisterForInCallVoicePrivacyOff(h);
487    }
488
489    // Inherited documentation suffices.
490    @Override
491    public void registerForIncomingRing(
492            Handler h, int what, Object obj) {
493        checkCorrectThread(h);
494
495        mIncomingRingRegistrants.addUnique(h, what, obj);
496    }
497
498    // Inherited documentation suffices.
499    @Override
500    public void unregisterForIncomingRing(Handler h) {
501        mIncomingRingRegistrants.remove(h);
502    }
503
504    // Inherited documentation suffices.
505    @Override
506    public void registerForDisconnect(Handler h, int what, Object obj) {
507        checkCorrectThread(h);
508
509        mDisconnectRegistrants.addUnique(h, what, obj);
510    }
511
512    // Inherited documentation suffices.
513    @Override
514    public void unregisterForDisconnect(Handler h) {
515        mDisconnectRegistrants.remove(h);
516    }
517
518    // Inherited documentation suffices.
519    @Override
520    public void registerForSuppServiceFailed(Handler h, int what, Object obj) {
521        checkCorrectThread(h);
522
523        mSuppServiceFailedRegistrants.addUnique(h, what, obj);
524    }
525
526    // Inherited documentation suffices.
527    @Override
528    public void unregisterForSuppServiceFailed(Handler h) {
529        mSuppServiceFailedRegistrants.remove(h);
530    }
531
532    // Inherited documentation suffices.
533    @Override
534    public void registerForMmiInitiate(Handler h, int what, Object obj) {
535        checkCorrectThread(h);
536
537        mMmiRegistrants.addUnique(h, what, obj);
538    }
539
540    // Inherited documentation suffices.
541    @Override
542    public void unregisterForMmiInitiate(Handler h) {
543        mMmiRegistrants.remove(h);
544    }
545
546    // Inherited documentation suffices.
547    @Override
548    public void registerForMmiComplete(Handler h, int what, Object obj) {
549        checkCorrectThread(h);
550
551        mMmiCompleteRegistrants.addUnique(h, what, obj);
552    }
553
554    // Inherited documentation suffices.
555    @Override
556    public void unregisterForMmiComplete(Handler h) {
557        checkCorrectThread(h);
558
559        mMmiCompleteRegistrants.remove(h);
560    }
561
562    /**
563     * Method to retrieve the saved operator id from the Shared Preferences
564     */
565    private String getSavedNetworkSelection() {
566        // open the shared preferences and search with our key.
567        SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
568        return sp.getString(NETWORK_SELECTION_KEY, "");
569    }
570
571    /**
572     * Method to restore the previously saved operator id, or reset to
573     * automatic selection, all depending upon the value in the shared
574     * preferences.
575     */
576    public void restoreSavedNetworkSelection(Message response) {
577        // retrieve the operator id
578        String networkSelection = getSavedNetworkSelection();
579
580        // set to auto if the id is empty, otherwise select the network.
581        if (TextUtils.isEmpty(networkSelection)) {
582            mCi.setNetworkSelectionModeAutomatic(response);
583        } else {
584            mCi.setNetworkSelectionModeManual(networkSelection, response);
585        }
586    }
587
588    // Inherited documentation suffices.
589    @Override
590    public void setUnitTestMode(boolean f) {
591        mUnitTestMode = f;
592    }
593
594    // Inherited documentation suffices.
595    @Override
596    public boolean getUnitTestMode() {
597        return mUnitTestMode;
598    }
599
600    /**
601     * To be invoked when a voice call Connection disconnects.
602     *
603     * Subclasses of Phone probably want to replace this with a
604     * version scoped to their packages
605     */
606    protected void notifyDisconnectP(Connection cn) {
607        AsyncResult ar = new AsyncResult(null, cn, null);
608        mDisconnectRegistrants.notifyRegistrants(ar);
609    }
610
611    // Inherited documentation suffices.
612    @Override
613    public void registerForServiceStateChanged(
614            Handler h, int what, Object obj) {
615        checkCorrectThread(h);
616
617        mServiceStateRegistrants.add(h, what, obj);
618    }
619
620    // Inherited documentation suffices.
621    @Override
622    public void unregisterForServiceStateChanged(Handler h) {
623        mServiceStateRegistrants.remove(h);
624    }
625
626    // Inherited documentation suffices.
627    @Override
628    public void registerForRingbackTone(Handler h, int what, Object obj) {
629        mCi.registerForRingbackTone(h,what,obj);
630    }
631
632    // Inherited documentation suffices.
633    @Override
634    public void unregisterForRingbackTone(Handler h) {
635        mCi.unregisterForRingbackTone(h);
636    }
637
638    // Inherited documentation suffices.
639    @Override
640    public void registerForResendIncallMute(Handler h, int what, Object obj) {
641        mCi.registerForResendIncallMute(h,what,obj);
642    }
643
644    // Inherited documentation suffices.
645    @Override
646    public void unregisterForResendIncallMute(Handler h) {
647        mCi.unregisterForResendIncallMute(h);
648    }
649
650    @Override
651    public void setEchoSuppressionEnabled(boolean enabled) {
652        // no need for regular phone
653    }
654
655    /**
656     * Subclasses of Phone probably want to replace this with a
657     * version scoped to their packages
658     */
659    protected void notifyServiceStateChangedP(ServiceState ss) {
660        AsyncResult ar = new AsyncResult(null, ss, null);
661        mServiceStateRegistrants.notifyRegistrants(ar);
662
663        mNotifier.notifyServiceState(this);
664    }
665
666    // Inherited documentation suffices.
667    @Override
668    public SimulatedRadioControl getSimulatedRadioControl() {
669        return mSimulatedRadioControl;
670    }
671
672    /**
673     * Verifies the current thread is the same as the thread originally
674     * used in the initialization of this instance. Throws RuntimeException
675     * if not.
676     *
677     * @exception RuntimeException if the current thread is not
678     * the thread that originally obtained this PhoneBase instance.
679     */
680    private void checkCorrectThread(Handler h) {
681        if (h.getLooper() != mLooper) {
682            throw new RuntimeException(
683                    "com.android.internal.telephony.Phone must be used from within one thread");
684        }
685    }
686
687    /**
688     * Set the properties by matching the carrier string in
689     * a string-array resource
690     */
691    private void setPropertiesByCarrier() {
692        String carrier = SystemProperties.get("ro.carrier");
693
694        if (null == carrier || 0 == carrier.length() || "unknown".equals(carrier)) {
695            return;
696        }
697
698        CharSequence[] carrierLocales = mContext.
699                getResources().getTextArray(R.array.carrier_properties);
700
701        for (int i = 0; i < carrierLocales.length; i+=3) {
702            String c = carrierLocales[i].toString();
703            if (carrier.equals(c)) {
704                String l = carrierLocales[i+1].toString();
705
706                String language = l.substring(0, 2);
707                String country = "";
708                if (l.length() >=5) {
709                    country = l.substring(3, 5);
710                }
711                MccTable.setSystemLocale(mContext, language, country);
712
713                if (!country.isEmpty()) {
714                    try {
715                        Settings.Global.getInt(mContext.getContentResolver(),
716                                Settings.Global.WIFI_COUNTRY_CODE);
717                    } catch (Settings.SettingNotFoundException e) {
718                        // note this is not persisting
719                        WifiManager wM = (WifiManager)
720                                mContext.getSystemService(Context.WIFI_SERVICE);
721                        wM.setCountryCode(country, false);
722                    }
723                }
724                return;
725            }
726        }
727    }
728
729    /**
730     * Get state
731     */
732    @Override
733    public abstract PhoneConstants.State getState();
734
735    /**
736     * Retrieves the IccFileHandler of the Phone instance
737     */
738    public IccFileHandler getIccFileHandler(){
739        UiccCardApplication uiccApplication = mUiccApplication.get();
740        if (uiccApplication == null) return null;
741        return uiccApplication.getIccFileHandler();
742    }
743
744    /*
745     * Retrieves the Handler of the Phone instance
746     */
747    public Handler getHandler() {
748        return this;
749    }
750
751    /**
752    * Retrieves the ServiceStateTracker of the phone instance.
753    */
754    public ServiceStateTracker getServiceStateTracker() {
755        return null;
756    }
757
758    /**
759    * Get call tracker
760    */
761    public CallTracker getCallTracker() {
762        return null;
763    }
764
765    public AppType getCurrentUiccAppType() {
766        UiccCardApplication currentApp = mUiccApplication.get();
767        if (currentApp != null) {
768            return currentApp.getType();
769        }
770        return AppType.APPTYPE_UNKNOWN;
771    }
772
773    @Override
774    public IccCard getIccCard() {
775        return null;
776        //throw new Exception("getIccCard Shouldn't be called from PhoneBase");
777    }
778
779    @Override
780    public String getIccSerialNumber() {
781        IccRecords r = mIccRecords.get();
782        return (r != null) ? r.getIccId() : null;
783    }
784
785    @Override
786    public boolean getIccRecordsLoaded() {
787        IccRecords r = mIccRecords.get();
788        return (r != null) ? r.getRecordsLoaded() : false;
789    }
790
791    /**
792     * @return all available cell information or null if none.
793     */
794    @Override
795    public List<CellInfo> getAllCellInfo() {
796        return getServiceStateTracker().getAllCellInfo();
797    }
798
799    /**
800     * {@inheritDoc}
801     */
802    @Override
803    public void setCellInfoListRate(int rateInMillis) {
804        mCi.setCellInfoListRate(rateInMillis, null);
805    }
806
807    @Override
808    public boolean getMessageWaitingIndicator() {
809        IccRecords r = mIccRecords.get();
810        return (r != null) ? r.getVoiceMessageWaiting() : false;
811    }
812
813    @Override
814    public boolean getCallForwardingIndicator() {
815        IccRecords r = mIccRecords.get();
816        return (r != null) ? r.getVoiceCallForwardingFlag() : false;
817    }
818
819    /**
820     *  Query the status of the CDMA roaming preference
821     */
822    @Override
823    public void queryCdmaRoamingPreference(Message response) {
824        mCi.queryCdmaRoamingPreference(response);
825    }
826
827    /**
828     * Get the signal strength
829     */
830    @Override
831    public SignalStrength getSignalStrength() {
832        ServiceStateTracker sst = getServiceStateTracker();
833        if (sst == null) {
834            return new SignalStrength();
835        } else {
836            return sst.getSignalStrength();
837        }
838    }
839
840    /**
841     *  Set the status of the CDMA roaming preference
842     */
843    @Override
844    public void setCdmaRoamingPreference(int cdmaRoamingType, Message response) {
845        mCi.setCdmaRoamingPreference(cdmaRoamingType, response);
846    }
847
848    /**
849     *  Set the status of the CDMA subscription mode
850     */
851    @Override
852    public void setCdmaSubscription(int cdmaSubscriptionType, Message response) {
853        mCi.setCdmaSubscriptionSource(cdmaSubscriptionType, response);
854    }
855
856    /**
857     *  Set the preferred Network Type: Global, CDMA only or GSM/UMTS only
858     */
859    @Override
860    public void setPreferredNetworkType(int networkType, Message response) {
861        mCi.setPreferredNetworkType(networkType, response);
862    }
863
864    @Override
865    public void getPreferredNetworkType(Message response) {
866        mCi.getPreferredNetworkType(response);
867    }
868
869    @Override
870    public void getSmscAddress(Message result) {
871        mCi.getSmscAddress(result);
872    }
873
874    @Override
875    public void setSmscAddress(String address, Message result) {
876        mCi.setSmscAddress(address, result);
877    }
878
879    @Override
880    public void setTTYMode(int ttyMode, Message onComplete) {
881        mCi.setTTYMode(ttyMode, onComplete);
882    }
883
884    @Override
885    public void queryTTYMode(Message onComplete) {
886        mCi.queryTTYMode(onComplete);
887    }
888
889    @Override
890    public void enableEnhancedVoicePrivacy(boolean enable, Message onComplete) {
891        // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
892        logUnexpectedCdmaMethodCall("enableEnhancedVoicePrivacy");
893    }
894
895    @Override
896    public void getEnhancedVoicePrivacy(Message onComplete) {
897        // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
898        logUnexpectedCdmaMethodCall("getEnhancedVoicePrivacy");
899    }
900
901    @Override
902    public void setBandMode(int bandMode, Message response) {
903        mCi.setBandMode(bandMode, response);
904    }
905
906    @Override
907    public void queryAvailableBandMode(Message response) {
908        mCi.queryAvailableBandMode(response);
909    }
910
911    @Override
912    public void invokeOemRilRequestRaw(byte[] data, Message response) {
913        mCi.invokeOemRilRequestRaw(data, response);
914    }
915
916    @Override
917    public void invokeOemRilRequestStrings(String[] strings, Message response) {
918        mCi.invokeOemRilRequestStrings(strings, response);
919    }
920
921    @Override
922    public void notifyDataActivity() {
923        mNotifier.notifyDataActivity(this);
924    }
925
926    public void notifyMessageWaitingIndicator() {
927        // Do not notify voice mail waiting if device doesn't support voice
928        if (!mIsVoiceCapable)
929            return;
930
931        // This function is added to send the notification to DefaultPhoneNotifier.
932        mNotifier.notifyMessageWaitingChanged(this);
933    }
934
935    public void notifyDataConnection(String reason, String apnType,
936            PhoneConstants.DataState state) {
937        mNotifier.notifyDataConnection(this, reason, apnType, state);
938    }
939
940    public void notifyDataConnection(String reason, String apnType) {
941        mNotifier.notifyDataConnection(this, reason, apnType, getDataConnectionState(apnType));
942    }
943
944    public void notifyDataConnection(String reason) {
945        String types[] = getActiveApnTypes();
946        for (String apnType : types) {
947            mNotifier.notifyDataConnection(this, reason, apnType, getDataConnectionState(apnType));
948        }
949    }
950
951    public void notifyOtaspChanged(int otaspMode) {
952        mNotifier.notifyOtaspChanged(this, otaspMode);
953    }
954
955    public void notifySignalStrength() {
956        mNotifier.notifySignalStrength(this);
957    }
958
959    public void notifyCellInfo(List<CellInfo> cellInfo) {
960        mNotifier.notifyCellInfo(this, cellInfo);
961    }
962
963    /**
964     * @return true if a mobile originating emergency call is active
965     */
966    public boolean isInEmergencyCall() {
967        return false;
968    }
969
970    /**
971     * @return true if we are in the emergency call back mode. This is a period where
972     * the phone should be using as little power as possible and be ready to receive an
973     * incoming call from the emergency operator.
974     */
975    public boolean isInEcm() {
976        return false;
977    }
978
979    @Override
980    public abstract int getPhoneType();
981
982    /** @hide */
983    @Override
984    public int getVoiceMessageCount(){
985        return 0;
986    }
987
988    /**
989     * Returns the CDMA ERI icon index to display
990     */
991    @Override
992    public int getCdmaEriIconIndex() {
993        logUnexpectedCdmaMethodCall("getCdmaEriIconIndex");
994        return -1;
995    }
996
997    /**
998     * Returns the CDMA ERI icon mode,
999     * 0 - ON
1000     * 1 - FLASHING
1001     */
1002    @Override
1003    public int getCdmaEriIconMode() {
1004        logUnexpectedCdmaMethodCall("getCdmaEriIconMode");
1005        return -1;
1006    }
1007
1008    /**
1009     * Returns the CDMA ERI text,
1010     */
1011    @Override
1012    public String getCdmaEriText() {
1013        logUnexpectedCdmaMethodCall("getCdmaEriText");
1014        return "GSM nw, no ERI";
1015    }
1016
1017    @Override
1018    public String getCdmaMin() {
1019        // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
1020        logUnexpectedCdmaMethodCall("getCdmaMin");
1021        return null;
1022    }
1023
1024    @Override
1025    public boolean isMinInfoReady() {
1026        // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
1027        logUnexpectedCdmaMethodCall("isMinInfoReady");
1028        return false;
1029    }
1030
1031    @Override
1032    public String getCdmaPrlVersion(){
1033        //  This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
1034        logUnexpectedCdmaMethodCall("getCdmaPrlVersion");
1035        return null;
1036    }
1037
1038    @Override
1039    public void sendBurstDtmf(String dtmfString, int on, int off, Message onComplete) {
1040        // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
1041        logUnexpectedCdmaMethodCall("sendBurstDtmf");
1042    }
1043
1044    @Override
1045    public void exitEmergencyCallbackMode() {
1046        // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
1047        logUnexpectedCdmaMethodCall("exitEmergencyCallbackMode");
1048    }
1049
1050    @Override
1051    public void registerForCdmaOtaStatusChange(Handler h, int what, Object obj) {
1052        // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
1053        logUnexpectedCdmaMethodCall("registerForCdmaOtaStatusChange");
1054    }
1055
1056    @Override
1057    public void unregisterForCdmaOtaStatusChange(Handler h) {
1058        // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
1059        logUnexpectedCdmaMethodCall("unregisterForCdmaOtaStatusChange");
1060    }
1061
1062    @Override
1063    public void registerForSubscriptionInfoReady(Handler h, int what, Object obj) {
1064        // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
1065        logUnexpectedCdmaMethodCall("registerForSubscriptionInfoReady");
1066    }
1067
1068    @Override
1069    public void unregisterForSubscriptionInfoReady(Handler h) {
1070        // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
1071        logUnexpectedCdmaMethodCall("unregisterForSubscriptionInfoReady");
1072    }
1073
1074    /**
1075     * Returns true if OTA Service Provisioning needs to be performed.
1076     * If not overridden return false.
1077     */
1078    @Override
1079    public boolean needsOtaServiceProvisioning() {
1080        return false;
1081    }
1082
1083    /**
1084     * Return true if number is an OTASP number.
1085     * If not overridden return false.
1086     */
1087    @Override
1088    public  boolean isOtaSpNumber(String dialStr) {
1089        return false;
1090    }
1091
1092    @Override
1093    public void registerForCallWaiting(Handler h, int what, Object obj){
1094        // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
1095        logUnexpectedCdmaMethodCall("registerForCallWaiting");
1096    }
1097
1098    @Override
1099    public void unregisterForCallWaiting(Handler h){
1100        // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
1101        logUnexpectedCdmaMethodCall("unregisterForCallWaiting");
1102    }
1103
1104    @Override
1105    public void registerForEcmTimerReset(Handler h, int what, Object obj) {
1106        // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
1107        logUnexpectedCdmaMethodCall("registerForEcmTimerReset");
1108    }
1109
1110    @Override
1111    public void unregisterForEcmTimerReset(Handler h) {
1112        // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
1113        logUnexpectedCdmaMethodCall("unregisterForEcmTimerReset");
1114    }
1115
1116    @Override
1117    public void registerForSignalInfo(Handler h, int what, Object obj) {
1118        mCi.registerForSignalInfo(h, what, obj);
1119    }
1120
1121    @Override
1122    public void unregisterForSignalInfo(Handler h) {
1123        mCi.unregisterForSignalInfo(h);
1124    }
1125
1126    @Override
1127    public void registerForDisplayInfo(Handler h, int what, Object obj) {
1128        mCi.registerForDisplayInfo(h, what, obj);
1129    }
1130
1131     @Override
1132    public void unregisterForDisplayInfo(Handler h) {
1133         mCi.unregisterForDisplayInfo(h);
1134     }
1135
1136    @Override
1137    public void registerForNumberInfo(Handler h, int what, Object obj) {
1138        mCi.registerForNumberInfo(h, what, obj);
1139    }
1140
1141    @Override
1142    public void unregisterForNumberInfo(Handler h) {
1143        mCi.unregisterForNumberInfo(h);
1144    }
1145
1146    @Override
1147    public void registerForRedirectedNumberInfo(Handler h, int what, Object obj) {
1148        mCi.registerForRedirectedNumberInfo(h, what, obj);
1149    }
1150
1151    @Override
1152    public void unregisterForRedirectedNumberInfo(Handler h) {
1153        mCi.unregisterForRedirectedNumberInfo(h);
1154    }
1155
1156    @Override
1157    public void registerForLineControlInfo(Handler h, int what, Object obj) {
1158        mCi.registerForLineControlInfo( h, what, obj);
1159    }
1160
1161    @Override
1162    public void unregisterForLineControlInfo(Handler h) {
1163        mCi.unregisterForLineControlInfo(h);
1164    }
1165
1166    @Override
1167    public void registerFoT53ClirlInfo(Handler h, int what, Object obj) {
1168        mCi.registerFoT53ClirlInfo(h, what, obj);
1169    }
1170
1171    @Override
1172    public void unregisterForT53ClirInfo(Handler h) {
1173        mCi.unregisterForT53ClirInfo(h);
1174    }
1175
1176    @Override
1177    public void registerForT53AudioControlInfo(Handler h, int what, Object obj) {
1178        mCi.registerForT53AudioControlInfo( h, what, obj);
1179    }
1180
1181    @Override
1182    public void unregisterForT53AudioControlInfo(Handler h) {
1183        mCi.unregisterForT53AudioControlInfo(h);
1184    }
1185
1186     @Override
1187    public void setOnEcbModeExitResponse(Handler h, int what, Object obj){
1188         // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
1189         logUnexpectedCdmaMethodCall("setOnEcbModeExitResponse");
1190     }
1191
1192     @Override
1193    public void unsetOnEcbModeExitResponse(Handler h){
1194        // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
1195         logUnexpectedCdmaMethodCall("unsetOnEcbModeExitResponse");
1196     }
1197
1198    @Override
1199    public String[] getActiveApnTypes() {
1200        return mDcTracker.getActiveApnTypes();
1201    }
1202
1203    @Override
1204    public String getActiveApnHost(String apnType) {
1205        return mDcTracker.getActiveApnString(apnType);
1206    }
1207
1208    @Override
1209    public LinkProperties getLinkProperties(String apnType) {
1210        return mDcTracker.getLinkProperties(apnType);
1211    }
1212
1213    @Override
1214    public LinkCapabilities getLinkCapabilities(String apnType) {
1215        return mDcTracker.getLinkCapabilities(apnType);
1216    }
1217
1218    @Override
1219    public int enableApnType(String type) {
1220        return mDcTracker.enableApnType(type);
1221    }
1222
1223    @Override
1224    public int disableApnType(String type) {
1225        return mDcTracker.disableApnType(type);
1226    }
1227
1228    @Override
1229    public boolean isDataConnectivityPossible() {
1230        return isDataConnectivityPossible(PhoneConstants.APN_TYPE_DEFAULT);
1231    }
1232
1233    @Override
1234    public boolean isDataConnectivityPossible(String apnType) {
1235        return ((mDcTracker != null) &&
1236                (mDcTracker.isDataPossible(apnType)));
1237    }
1238
1239    /**
1240     * Notify registrants of a new ringing Connection.
1241     * Subclasses of Phone probably want to replace this with a
1242     * version scoped to their packages
1243     */
1244    protected void notifyNewRingingConnectionP(Connection cn) {
1245        if (!mIsVoiceCapable)
1246            return;
1247        AsyncResult ar = new AsyncResult(null, cn, null);
1248        mNewRingingConnectionRegistrants.notifyRegistrants(ar);
1249    }
1250
1251    /**
1252     * Notify registrants of a RING event.
1253     */
1254    private void notifyIncomingRing() {
1255        if (!mIsVoiceCapable)
1256            return;
1257        AsyncResult ar = new AsyncResult(null, this, null);
1258        mIncomingRingRegistrants.notifyRegistrants(ar);
1259    }
1260
1261    /**
1262     * Send the incoming call Ring notification if conditions are right.
1263     */
1264    private void sendIncomingCallRingNotification(int token) {
1265        if (mIsVoiceCapable && !mDoesRilSendMultipleCallRing &&
1266                (token == mCallRingContinueToken)) {
1267            Rlog.d(LOG_TAG, "Sending notifyIncomingRing");
1268            notifyIncomingRing();
1269            sendMessageDelayed(
1270                    obtainMessage(EVENT_CALL_RING_CONTINUE, token, 0), mCallRingDelay);
1271        } else {
1272            Rlog.d(LOG_TAG, "Ignoring ring notification request,"
1273                    + " mDoesRilSendMultipleCallRing=" + mDoesRilSendMultipleCallRing
1274                    + " token=" + token
1275                    + " mCallRingContinueToken=" + mCallRingContinueToken
1276                    + " mIsVoiceCapable=" + mIsVoiceCapable);
1277        }
1278    }
1279
1280    @Override
1281    public boolean isCspPlmnEnabled() {
1282        // This function should be overridden by the class GSMPhone.
1283        // Not implemented in CDMAPhone.
1284        logUnexpectedGsmMethodCall("isCspPlmnEnabled");
1285        return false;
1286    }
1287
1288    @Override
1289    public IsimRecords getIsimRecords() {
1290        Rlog.e(LOG_TAG, "getIsimRecords() is only supported on LTE devices");
1291        return null;
1292    }
1293
1294    @Override
1295    public void requestIsimAuthentication(String nonce, Message result) {
1296        Rlog.e(LOG_TAG, "requestIsimAuthentication() is only supported on LTE devices");
1297    }
1298
1299    @Override
1300    public String getMsisdn() {
1301        logUnexpectedGsmMethodCall("getMsisdn");
1302        return null;
1303    }
1304
1305    /**
1306     * Common error logger method for unexpected calls to CDMA-only methods.
1307     */
1308    private static void logUnexpectedCdmaMethodCall(String name)
1309    {
1310        Rlog.e(LOG_TAG, "Error! " + name + "() in PhoneBase should not be " +
1311                "called, CDMAPhone inactive.");
1312    }
1313
1314    @Override
1315    public PhoneConstants.DataState getDataConnectionState() {
1316        return getDataConnectionState(PhoneConstants.APN_TYPE_DEFAULT);
1317    }
1318
1319    /**
1320     * Common error logger method for unexpected calls to GSM/WCDMA-only methods.
1321     */
1322    private static void logUnexpectedGsmMethodCall(String name) {
1323        Rlog.e(LOG_TAG, "Error! " + name + "() in PhoneBase should not be " +
1324                "called, GSMPhone inactive.");
1325    }
1326
1327    // Called by SimRecords which is constructed with a PhoneBase instead of a GSMPhone.
1328    public void notifyCallForwardingIndicator() {
1329        // This function should be overridden by the class GSMPhone. Not implemented in CDMAPhone.
1330        Rlog.e(LOG_TAG, "Error! This function should never be executed, inactive CDMAPhone.");
1331    }
1332
1333    public void notifyDataConnectionFailed(String reason, String apnType) {
1334        mNotifier.notifyDataConnectionFailed(this, reason, apnType);
1335    }
1336
1337    /**
1338     * {@inheritDoc}
1339     */
1340    @Override
1341    public int getLteOnCdmaMode() {
1342        return mCi.getLteOnCdmaMode();
1343    }
1344
1345    /**
1346     * Sets the SIM voice message waiting indicator records.
1347     * @param line GSM Subscriber Profile Number, one-based. Only '1' is supported
1348     * @param countWaiting The number of messages waiting, if known. Use
1349     *                     -1 to indicate that an unknown number of
1350     *                      messages are waiting
1351     */
1352    @Override
1353    public void setVoiceMessageWaiting(int line, int countWaiting) {
1354        IccRecords r = mIccRecords.get();
1355        if (r != null) {
1356            r.setVoiceMessageWaiting(line, countWaiting);
1357        }
1358    }
1359
1360    /**
1361     * Gets the USIM service table from the UICC, if present and available.
1362     * @return an interface to the UsimServiceTable record, or null if not available
1363     */
1364    @Override
1365    public UsimServiceTable getUsimServiceTable() {
1366        IccRecords r = mIccRecords.get();
1367        return (r != null) ? r.getUsimServiceTable() : null;
1368    }
1369
1370    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
1371        pw.println("PhoneBase:");
1372        pw.println(" mCi=" + mCi);
1373        pw.println(" mDnsCheckDisabled=" + mDnsCheckDisabled);
1374        pw.println(" mDcTracker=" + mDcTracker);
1375        pw.println(" mDoesRilSendMultipleCallRing=" + mDoesRilSendMultipleCallRing);
1376        pw.println(" mCallRingContinueToken=" + mCallRingContinueToken);
1377        pw.println(" mCallRingDelay=" + mCallRingDelay);
1378        pw.println(" mIsTheCurrentActivePhone=" + mIsTheCurrentActivePhone);
1379        pw.println(" mIsVoiceCapable=" + mIsVoiceCapable);
1380        pw.println(" mIccRecords=" + mIccRecords.get());
1381        pw.println(" mUiccApplication=" + mUiccApplication.get());
1382        pw.println(" mSmsStorageMonitor=" + mSmsStorageMonitor);
1383        pw.println(" mSmsUsageMonitor=" + mSmsUsageMonitor);
1384        pw.println(" mSMS=" + mSMS);
1385        pw.flush();
1386        pw.println(" mLooper=" + mLooper);
1387        pw.println(" mContext=" + mContext);
1388        pw.println(" mNotifier=" + mNotifier);
1389        pw.println(" mSimulatedRadioControl=" + mSimulatedRadioControl);
1390        pw.println(" mUnitTestMode=" + mUnitTestMode);
1391        pw.println(" isDnsCheckDisabled()=" + isDnsCheckDisabled());
1392        pw.println(" getUnitTestMode()=" + getUnitTestMode());
1393        pw.println(" getState()=" + getState());
1394        pw.println(" getIccSerialNumber()=" + getIccSerialNumber());
1395        pw.println(" getIccRecordsLoaded()=" + getIccRecordsLoaded());
1396        pw.println(" getMessageWaitingIndicator()=" + getMessageWaitingIndicator());
1397        pw.println(" getCallForwardingIndicator()=" + getCallForwardingIndicator());
1398        pw.println(" isInEmergencyCall()=" + isInEmergencyCall());
1399        pw.flush();
1400        pw.println(" isInEcm()=" + isInEcm());
1401        pw.println(" getPhoneName()=" + getPhoneName());
1402        pw.println(" getPhoneType()=" + getPhoneType());
1403        pw.println(" getVoiceMessageCount()=" + getVoiceMessageCount());
1404        pw.println(" getActiveApnTypes()=" + getActiveApnTypes());
1405        pw.println(" isDataConnectivityPossible()=" + isDataConnectivityPossible());
1406        pw.println(" needsOtaServiceProvisioning=" + needsOtaServiceProvisioning());
1407    }
1408}
1409