CDMALTEPhone.java revision c38bb60d867c5d61d90b7179a9ed2b2d1848124f
1c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville/*
2c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville * Copyright (C) 2011 The Android Open Source Project
3c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville *
4c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville * Licensed under the Apache License, Version 2.0 (the "License");
5c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville * you may not use this file except in compliance with the License.
6c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville * You may obtain a copy of the License at
7c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville *
8c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville *      http://www.apache.org/licenses/LICENSE-2.0
9c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville *
10c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville * Unless required by applicable law or agreed to in writing, software
11c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville * distributed under the License is distributed on an "AS IS" BASIS,
12c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville * See the License for the specific language governing permissions and
14c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville * limitations under the License.
15c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville */
16c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
17c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savillepackage com.android.internal.telephony.cdma;
18c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
19c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport android.content.ContentValues;
20c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport android.content.Context;
21c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport android.content.SharedPreferences;
22c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport android.database.SQLException;
23c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport android.net.Uri;
24c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport android.os.AsyncResult;
25c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport android.os.Message;
26c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport android.preference.PreferenceManager;
27c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport android.provider.Telephony;
28c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport android.util.Log;
29c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
30c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.CommandsInterface;
31c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.IccCard;
32c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.OperatorInfo;
33c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.Phone;
34c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.PhoneConstants;
35c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.PhoneNotifier;
36c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.PhoneProxy;
37c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.SMSDispatcher;
38c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.gsm.GsmSMSDispatcher;
39c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.gsm.SmsMessage;
40c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.ims.IsimRecords;
41c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.uicc.UiccController;
42c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
43c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport java.io.FileDescriptor;
44c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport java.io.PrintWriter;
45c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
46c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savillepublic class CDMALTEPhone extends CDMAPhone {
47c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    static final String LOG_TAG = "CDMA";
48c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
49c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    private static final boolean DBG = true;
50c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
51c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    /** Secondary SMSDispatcher for 3GPP format messages. */
52c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    SMSDispatcher m3gppSMS;
53c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
54c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    /**
55c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville     * Small container class used to hold information relevant to
56c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville     * the carrier selection process. operatorNumeric can be ""
57c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville     * if we are looking for automatic selection. operatorAlphaLong is the
58c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville     * corresponding operator name.
59c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville     */
60c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    private static class NetworkSelectMessage {
61c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        public Message message;
62c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        public String operatorNumeric;
63c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        public String operatorAlphaLong;
64c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
65c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
66c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    // Constructors
67c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public CDMALTEPhone(Context context, CommandsInterface ci, PhoneNotifier notifier) {
68c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        super(context, ci, notifier, false);
69c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        m3gppSMS = new GsmSMSDispatcher(this, mSmsStorageMonitor, mSmsUsageMonitor);
70c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        mIccRecords.registerForNewSms(this, EVENT_NEW_ICC_SMS, null);
71c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
72c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
73c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
74c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public void handleMessage (Message msg) {
75c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        AsyncResult ar;
76c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        switch (msg.what) {
77c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            // handle the select network completion callbacks.
78c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case EVENT_SET_NETWORK_MANUAL_COMPLETE:
79c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                handleSetSelectNetwork((AsyncResult) msg.obj);
80c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                break;
81c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case EVENT_NEW_ICC_SMS:
82c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                ar = (AsyncResult)msg.obj;
83c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                m3gppSMS.dispatchMessage((SmsMessage)ar.result);
84c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                break;
85c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            default:
86c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                super.handleMessage(msg);
87c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        }
88c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
89c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
90c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
91c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    protected void initSstIcc() {
92c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        mIccCard.set(UiccController.getInstance(this).getIccCard());
93c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        mIccRecords = mIccCard.get().getIccRecords();
94c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        // CdmaLteServiceStateTracker registers with IccCard to know
95c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        // when the card is ready. So create mIccCard before the ServiceStateTracker
96c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        mSST = new CdmaLteServiceStateTracker(this);
97c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
98c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
99c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
100c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public void dispose() {
101c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        synchronized(PhoneProxy.lockForRadioTechnologyChange) {
102c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            super.dispose();
103c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            m3gppSMS.dispose();
104c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            mIccRecords.unregisterForNewSms(this);
105c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        }
106c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
107c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
108c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
109c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public void removeReferences() {
110c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        super.removeReferences();
111c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        m3gppSMS = null;
112c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
113c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
114c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
115c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public PhoneConstants.DataState getDataConnectionState(String apnType) {
116c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PhoneConstants.DataState ret = PhoneConstants.DataState.DISCONNECTED;
117c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
118c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        if (mSST == null) {
119c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            // Radio Technology Change is ongoing, dispose() and
120c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            // removeReferences() have already been called
121c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
122c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            ret = PhoneConstants.DataState.DISCONNECTED;
123c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        } else if (mDataConnectionTracker.isApnTypeEnabled(apnType) == false) {
124c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            ret = PhoneConstants.DataState.DISCONNECTED;
125c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        } else {
126c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            switch (mDataConnectionTracker.getState(apnType)) {
127c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                case FAILED:
128c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                case IDLE:
129c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                    ret = PhoneConstants.DataState.DISCONNECTED;
130c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                    break;
131c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
132c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                case CONNECTED:
133c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                case DISCONNECTING:
134c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                    if (mCT.state != PhoneConstants.State.IDLE &&
135c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                            !mSST.isConcurrentVoiceAndDataAllowed()) {
136c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                        ret = PhoneConstants.DataState.SUSPENDED;
137c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                    } else {
138c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                        ret = PhoneConstants.DataState.CONNECTED;
139c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                    }
140c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                    break;
141c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
142c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                case INITING:
143c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                case CONNECTING:
144c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                case SCANNING:
145c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                    ret = PhoneConstants.DataState.CONNECTING;
146c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                    break;
147c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            }
148c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        }
149c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
150c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        log("getDataConnectionState apnType=" + apnType + " ret=" + ret);
151c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        return ret;
152c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
153c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
154c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
155c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public void
156c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    selectNetworkManually(OperatorInfo network,
157c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            Message response) {
158c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        // wrap the response message in our own message along with
159c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        // the operator's id.
160c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        NetworkSelectMessage nsm = new NetworkSelectMessage();
161c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        nsm.message = response;
162c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        nsm.operatorNumeric = network.getOperatorNumeric();
163c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        nsm.operatorAlphaLong = network.getOperatorAlphaLong();
164c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
165c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        // get the message
166c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        Message msg = obtainMessage(EVENT_SET_NETWORK_MANUAL_COMPLETE, nsm);
167c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
168c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        mCM.setNetworkSelectionModeManual(network.getOperatorNumeric(), msg);
169c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
170c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
171c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    /**
172c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville     * Used to track the settings upon completion of the network change.
173c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville     */
174c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    private void handleSetSelectNetwork(AsyncResult ar) {
175c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        // look for our wrapper within the asyncresult, skip the rest if it
176c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        // is null.
177c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        if (!(ar.userObj instanceof NetworkSelectMessage)) {
178c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            Log.e(LOG_TAG, "unexpected result from user object.");
179c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            return;
180c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        }
181c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
182c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        NetworkSelectMessage nsm = (NetworkSelectMessage) ar.userObj;
183c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
184c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        // found the object, now we send off the message we had originally
185c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        // attached to the request.
186c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        if (nsm.message != null) {
187c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            if (DBG) log("sending original message to recipient");
188c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            AsyncResult.forMessage(nsm.message, ar.result, ar.exception);
189c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            nsm.message.sendToTarget();
190c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        }
191c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
192c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        // open the shared preferences editor, and write the value.
193c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        // nsm.operatorNumeric is "" if we're in automatic.selection.
194c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
195c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        SharedPreferences.Editor editor = sp.edit();
196c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        editor.putString(NETWORK_SELECTION_KEY, nsm.operatorNumeric);
197c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        editor.putString(NETWORK_SELECTION_NAME_KEY, nsm.operatorAlphaLong);
198c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
199c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        // commit and log the result.
200c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        if (! editor.commit()) {
201c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            Log.e(LOG_TAG, "failed to commit network selection preference");
202c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        }
203c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
204c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
205c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
206c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
207c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public boolean updateCurrentCarrierInProvider() {
208c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        if (mIccRecords != null) {
209c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            try {
210c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                Uri uri = Uri.withAppendedPath(Telephony.Carriers.CONTENT_URI, "current");
211c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                ContentValues map = new ContentValues();
212c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                String operatorNumeric = mIccRecords.getOperatorNumeric();
213c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                map.put(Telephony.Carriers.NUMERIC, operatorNumeric);
214c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                if (DBG) log("updateCurrentCarrierInProvider from UICC: numeric=" +
215c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                        operatorNumeric);
216c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                mContext.getContentResolver().insert(uri, map);
217c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                return true;
218c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            } catch (SQLException e) {
219c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                Log.e(LOG_TAG, "[CDMALTEPhone] Can't store current operator ret false", e);
220c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            }
221c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        } else {
222c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            if (DBG) log("updateCurrentCarrierInProvider mIccRecords == null ret false");
223c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        }
224c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        return false;
225c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
226c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
227c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    // return IMSI from USIM as subscriber ID.
228c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
229c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public String getSubscriberId() {
230c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        return mIccRecords.getIMSI();
231c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
232c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
233c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
234c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public String getImei() {
235c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        return mImei;
236c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
237c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
238c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
239c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public String getDeviceSvn() {
240c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        return mImeiSv;
241c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
242c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
243c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
244c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public IsimRecords getIsimRecords() {
245c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        return mIccRecords.getIsimRecords();
246c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
247c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
248c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
249c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public String getMsisdn() {
250c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        return mIccRecords.getMsisdnNumber();
251c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
252c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
253c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
254c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public void getAvailableNetworks(Message response) {
255c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        mCM.getAvailableNetworks(response);
256c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
257c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
258c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
259c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public void requestIsimAuthentication(String nonce, Message result) {
260c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        mCM.requestIsimAuthentication(nonce, result);
261c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
262c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
263c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
264c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    protected void log(String s) {
265c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            Log.d(LOG_TAG, "[CDMALTEPhone] " + s);
266c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
267c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
268c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
269c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
270c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        pw.println("CDMALTEPhone extends:");
271c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        super.dump(fd, pw, args);
272c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        pw.println(" m3gppSMS=" + m3gppSMS);
273c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
274c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville}
275