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.OperatorInfo; 32c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.Phone; 33c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.PhoneConstants; 34c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.PhoneNotifier; 35c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.PhoneProxy; 36c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.SMSDispatcher; 37e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenkaimport com.android.internal.telephony.UiccCardApplication; 38c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.gsm.GsmSMSDispatcher; 39e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenkaimport com.android.internal.telephony.gsm.SIMRecords; 40c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.gsm.SmsMessage; 41c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.ims.IsimRecords; 42e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenkaimport com.android.internal.telephony.ims.IsimUiccRecords; 43c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.uicc.UiccController; 44c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 45c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport java.io.FileDescriptor; 46c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport java.io.PrintWriter; 47c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 48c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savillepublic class CDMALTEPhone extends CDMAPhone { 49c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville static final String LOG_TAG = "CDMA"; 50c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 51c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville private static final boolean DBG = true; 52c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 53c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville /** Secondary SMSDispatcher for 3GPP format messages. */ 54c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville SMSDispatcher m3gppSMS; 55c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 56e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka /** CdmaLtePhone in addition to RuimRecords available from 57e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka * PhoneBase needs access to SIMRecords and IsimUiccRecords 58e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka */ 59e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka private SIMRecords mSimRecords; 60e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka private IsimUiccRecords mIsimUiccRecords; 61e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka 62c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville /** 63c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville * Small container class used to hold information relevant to 64c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville * the carrier selection process. operatorNumeric can be "" 65c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville * if we are looking for automatic selection. operatorAlphaLong is the 66c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville * corresponding operator name. 67c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville */ 68c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville private static class NetworkSelectMessage { 69c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville public Message message; 70c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville public String operatorNumeric; 71c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville public String operatorAlphaLong; 72c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 73c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 74c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville // Constructors 75c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville public CDMALTEPhone(Context context, CommandsInterface ci, PhoneNotifier notifier) { 76c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville super(context, ci, notifier, false); 77c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville m3gppSMS = new GsmSMSDispatcher(this, mSmsStorageMonitor, mSmsUsageMonitor); 78c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 79c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 80c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville @Override 81c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville public void handleMessage (Message msg) { 82c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville AsyncResult ar; 83c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville switch (msg.what) { 84c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville // handle the select network completion callbacks. 85c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville case EVENT_SET_NETWORK_MANUAL_COMPLETE: 86c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville handleSetSelectNetwork((AsyncResult) msg.obj); 87c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville break; 88c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville case EVENT_NEW_ICC_SMS: 89c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville ar = (AsyncResult)msg.obj; 90c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville m3gppSMS.dispatchMessage((SmsMessage)ar.result); 91c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville break; 92c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville default: 93c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville super.handleMessage(msg); 94c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 95c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 96c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 97c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville @Override 98c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville protected void initSstIcc() { 99c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville mSST = new CdmaLteServiceStateTracker(this); 100c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 101c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 102c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville @Override 103c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville public void dispose() { 104c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville synchronized(PhoneProxy.lockForRadioTechnologyChange) { 105c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville super.dispose(); 106c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville m3gppSMS.dispose(); 107c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 108c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 109c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 110c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville @Override 111c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville public void removeReferences() { 112c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville super.removeReferences(); 113c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville m3gppSMS = null; 114c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 115c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 116c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville @Override 117c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville public PhoneConstants.DataState getDataConnectionState(String apnType) { 118c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville PhoneConstants.DataState ret = PhoneConstants.DataState.DISCONNECTED; 119c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 120c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville if (mSST == null) { 121c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville // Radio Technology Change is ongoing, dispose() and 122c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville // removeReferences() have already been called 123c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 124c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville ret = PhoneConstants.DataState.DISCONNECTED; 125c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } else if (mDataConnectionTracker.isApnTypeEnabled(apnType) == false) { 126c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville ret = PhoneConstants.DataState.DISCONNECTED; 127c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } else { 128c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville switch (mDataConnectionTracker.getState(apnType)) { 129c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville case FAILED: 130c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville case IDLE: 131c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville ret = PhoneConstants.DataState.DISCONNECTED; 132c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville break; 133c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 134c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville case CONNECTED: 135c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville case DISCONNECTING: 136c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville if (mCT.state != PhoneConstants.State.IDLE && 137c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville !mSST.isConcurrentVoiceAndDataAllowed()) { 138c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville ret = PhoneConstants.DataState.SUSPENDED; 139c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } else { 140c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville ret = PhoneConstants.DataState.CONNECTED; 141c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 142c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville break; 143c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 144c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville case INITING: 145c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville case CONNECTING: 146c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville case SCANNING: 147c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville ret = PhoneConstants.DataState.CONNECTING; 148c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville break; 149c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 150c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 151c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 152c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville log("getDataConnectionState apnType=" + apnType + " ret=" + ret); 153c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville return ret; 154c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 155c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 156c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville @Override 157c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville public void 158c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville selectNetworkManually(OperatorInfo network, 159c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville Message response) { 160c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville // wrap the response message in our own message along with 161c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville // the operator's id. 162c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville NetworkSelectMessage nsm = new NetworkSelectMessage(); 163c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville nsm.message = response; 164c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville nsm.operatorNumeric = network.getOperatorNumeric(); 165c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville nsm.operatorAlphaLong = network.getOperatorAlphaLong(); 166c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 167c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville // get the message 168c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville Message msg = obtainMessage(EVENT_SET_NETWORK_MANUAL_COMPLETE, nsm); 169c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 170c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville mCM.setNetworkSelectionModeManual(network.getOperatorNumeric(), msg); 171c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 172c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 173c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville /** 174c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville * Used to track the settings upon completion of the network change. 175c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville */ 176c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville private void handleSetSelectNetwork(AsyncResult ar) { 177c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville // look for our wrapper within the asyncresult, skip the rest if it 178c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville // is null. 179c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville if (!(ar.userObj instanceof NetworkSelectMessage)) { 180c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville Log.e(LOG_TAG, "unexpected result from user object."); 181c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville return; 182c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 183c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 184c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville NetworkSelectMessage nsm = (NetworkSelectMessage) ar.userObj; 185c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 186c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville // found the object, now we send off the message we had originally 187c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville // attached to the request. 188c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville if (nsm.message != null) { 189c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville if (DBG) log("sending original message to recipient"); 190c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville AsyncResult.forMessage(nsm.message, ar.result, ar.exception); 191c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville nsm.message.sendToTarget(); 192c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 193c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 194c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville // open the shared preferences editor, and write the value. 195c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville // nsm.operatorNumeric is "" if we're in automatic.selection. 196c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext()); 197c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville SharedPreferences.Editor editor = sp.edit(); 198c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville editor.putString(NETWORK_SELECTION_KEY, nsm.operatorNumeric); 199c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville editor.putString(NETWORK_SELECTION_NAME_KEY, nsm.operatorAlphaLong); 200c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 201c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville // commit and log the result. 202c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville if (! editor.commit()) { 203c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville Log.e(LOG_TAG, "failed to commit network selection preference"); 204c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 205c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 206c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 207c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 208c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville @Override 209c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville public boolean updateCurrentCarrierInProvider() { 210e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka if (mSimRecords != null) { 211c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville try { 212c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville Uri uri = Uri.withAppendedPath(Telephony.Carriers.CONTENT_URI, "current"); 213c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville ContentValues map = new ContentValues(); 214e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka String operatorNumeric = mSimRecords.getOperatorNumeric(); 215c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville map.put(Telephony.Carriers.NUMERIC, operatorNumeric); 216c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville if (DBG) log("updateCurrentCarrierInProvider from UICC: numeric=" + 217c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville operatorNumeric); 218c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville mContext.getContentResolver().insert(uri, map); 219c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville return true; 220c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } catch (SQLException e) { 221c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville Log.e(LOG_TAG, "[CDMALTEPhone] Can't store current operator ret false", e); 222c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 223c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } else { 224c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville if (DBG) log("updateCurrentCarrierInProvider mIccRecords == null ret false"); 225c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 226c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville return false; 227c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 228c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 229c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville // return IMSI from USIM as subscriber ID. 230c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville @Override 231c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville public String getSubscriberId() { 232e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka return (mSimRecords != null) ? mSimRecords.getIMSI() : ""; 233c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 234c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 235c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville @Override 236c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville public String getImei() { 237c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville return mImei; 238c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 239c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 240c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville @Override 241c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville public String getDeviceSvn() { 242c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville return mImeiSv; 243c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 244c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 245c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville @Override 246c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville public IsimRecords getIsimRecords() { 247e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka return mIsimUiccRecords; 248c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 249c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 250c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville @Override 251c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville public String getMsisdn() { 252e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka return (mSimRecords != null) ? mSimRecords.getMsisdnNumber() : null; 253c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 254c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 255c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville @Override 256c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville public void getAvailableNetworks(Message response) { 257c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville mCM.getAvailableNetworks(response); 258c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 259c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 260c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville @Override 261c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville public void requestIsimAuthentication(String nonce, Message result) { 262c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville mCM.requestIsimAuthentication(nonce, result); 263c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 264c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 265c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville @Override 266e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka protected void onUpdateIccAvailability() { 267e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka if (mUiccController == null ) { 268bb36adde615d3d85fa0fc23935197c6bc6a799edAlex Yakavenka return; 269bb36adde615d3d85fa0fc23935197c6bc6a799edAlex Yakavenka } 270bb36adde615d3d85fa0fc23935197c6bc6a799edAlex Yakavenka 271e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka // Update IsimRecords 272e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka UiccCardApplication newUiccApplication = 273e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka mUiccController.getUiccCardApplication(UiccController.APP_FAM_IMS); 274e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka IsimUiccRecords newIsimUiccRecords = null; 275e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka 276e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka if (newUiccApplication != null) { 277e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka newIsimUiccRecords = (IsimUiccRecords)newUiccApplication.getIccRecords(); 278bb36adde615d3d85fa0fc23935197c6bc6a799edAlex Yakavenka } 279e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka mIsimUiccRecords = newIsimUiccRecords; 280e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka 281e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka // Update UsimRecords 282e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka newUiccApplication = mUiccController.getUiccCardApplication(UiccController.APP_FAM_3GPP); 283e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka SIMRecords newSimRecords = null; 284e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka if (newUiccApplication != null) { 285e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka newSimRecords = (SIMRecords)newUiccApplication.getIccRecords(); 286e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka } 287e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka if (mSimRecords != newSimRecords) { 288e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka if (mSimRecords != null) { 289e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka log("Removing stale SIMRecords object."); 290e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka mSimRecords.unregisterForNewSms(this); 291e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka mSimRecords = null; 292e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka } 293e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka if (newSimRecords != null) { 294e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka log("New SIMRecords found"); 295e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka mSimRecords = newSimRecords; 296e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka mSimRecords.registerForNewSms(this, EVENT_NEW_ICC_SMS, null); 297e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka } 298e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka } 299e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka 300e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka super.onUpdateIccAvailability(); 301bb36adde615d3d85fa0fc23935197c6bc6a799edAlex Yakavenka } 302bb36adde615d3d85fa0fc23935197c6bc6a799edAlex Yakavenka 303bb36adde615d3d85fa0fc23935197c6bc6a799edAlex Yakavenka @Override 304c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville protected void log(String s) { 305c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville Log.d(LOG_TAG, "[CDMALTEPhone] " + s); 306c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 307c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville 308c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville @Override 309c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { 310c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville pw.println("CDMALTEPhone extends:"); 311c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville super.dump(fd, pw, args); 312c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville pw.println(" m3gppSMS=" + m3gppSMS); 313c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville } 314c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville} 315