1ab57aa5d465ef3a6dc0895b2408276617a2f6fa0Tom Taylor/*
2ace9a749c5a2a5e07527f728b7331423d16c36cdSukanya Rajkhowa * 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
19a8467dd0c524787104b1ccdddc5e8af10ba729edWink Savilleimport android.app.ActivityManagerNative;
20c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport android.content.ContentValues;
21c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport android.content.Context;
22a8467dd0c524787104b1ccdddc5e8af10ba729edWink Savilleimport android.content.Intent;
23c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport android.content.SharedPreferences;
24c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport android.database.SQLException;
25c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport android.net.Uri;
26c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport android.os.AsyncResult;
27a8467dd0c524787104b1ccdddc5e8af10ba729edWink Savilleimport android.os.Handler;
28c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport android.os.Message;
29a8467dd0c524787104b1ccdddc5e8af10ba729edWink Savilleimport android.os.UserHandle;
30c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport android.preference.PreferenceManager;
31a8467dd0c524787104b1ccdddc5e8af10ba729edWink Savilleimport android.os.PowerManager;
32a8467dd0c524787104b1ccdddc5e8af10ba729edWink Savilleimport android.os.SystemProperties;
33c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport android.provider.Telephony;
34a8467dd0c524787104b1ccdddc5e8af10ba729edWink Savilleimport android.text.TextUtils;
35a8467dd0c524787104b1ccdddc5e8af10ba729edWink Savilleimport android.telephony.SubscriptionManager;
36ded9c0af7fa49504c047275ed34c2d3b22bf0c3aWink Savilleimport android.telephony.Rlog;
37c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
38c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.CommandsInterface;
39ab57aa5d465ef3a6dc0895b2408276617a2f6fa0Tom Taylor
40a8467dd0c524787104b1ccdddc5e8af10ba729edWink Savilleimport android.telephony.TelephonyManager;
411260f1c6c909f2940989b72afe1b91fd83845eaaSukanya Rajkhowa
42a8467dd0c524787104b1ccdddc5e8af10ba729edWink Savilleimport com.android.internal.telephony.dataconnection.DcTracker;
43a8467dd0c524787104b1ccdddc5e8af10ba729edWink Savilleimport com.android.internal.telephony.MccTable;
44c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.OperatorInfo;
45c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.PhoneConstants;
46c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.PhoneNotifier;
47c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.PhoneProxy;
48a8467dd0c524787104b1ccdddc5e8af10ba729edWink Savilleimport com.android.internal.telephony.PhoneFactory;
49a8467dd0c524787104b1ccdddc5e8af10ba729edWink Savilleimport com.android.internal.telephony.PhoneSubInfo;
50c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.SMSDispatcher;
510d4bcdf379842af4b6304809156971e926f374f0Jake Hambyimport com.android.internal.telephony.SmsBroadcastUndelivered;
52a8467dd0c524787104b1ccdddc5e8af10ba729edWink Savilleimport com.android.internal.telephony.Subscription;
53ab57aa5d465ef3a6dc0895b2408276617a2f6fa0Tom Taylorimport com.android.internal.telephony.SubscriptionController;
54c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.gsm.GsmSMSDispatcher;
55c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.gsm.SmsMessage;
5680bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhaoimport com.android.internal.telephony.uicc.IccRecords;
57d720945f2be5ea5fe0faf67e67d9ea0e184eba67Alex Yakavenkaimport com.android.internal.telephony.uicc.IsimRecords;
58d720945f2be5ea5fe0faf67e67d9ea0e184eba67Alex Yakavenkaimport com.android.internal.telephony.uicc.IsimUiccRecords;
5980bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhaoimport com.android.internal.telephony.uicc.RuimRecords;
60d720945f2be5ea5fe0faf67e67d9ea0e184eba67Alex Yakavenkaimport com.android.internal.telephony.uicc.SIMRecords;
61d720945f2be5ea5fe0faf67e67d9ea0e184eba67Alex Yakavenkaimport com.android.internal.telephony.uicc.UiccCardApplication;
62c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport com.android.internal.telephony.uicc.UiccController;
63a8467dd0c524787104b1ccdddc5e8af10ba729edWink Savilleimport com.android.internal.telephony.ServiceStateTracker;
64a8467dd0c524787104b1ccdddc5e8af10ba729edWink Savilleimport com.android.internal.telephony.TelephonyIntents;
65a8467dd0c524787104b1ccdddc5e8af10ba729edWink Savilleimport com.android.internal.telephony.TelephonyProperties;
66c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
67c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport java.io.FileDescriptor;
68c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savilleimport java.io.PrintWriter;
69c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
70a8467dd0c524787104b1ccdddc5e8af10ba729edWink Savilleimport static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_ALPHA;
71a8467dd0c524787104b1ccdddc5e8af10ba729edWink Savilleimport static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_ISO_COUNTRY;
72a8467dd0c524787104b1ccdddc5e8af10ba729edWink Savilleimport static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC;
73a8467dd0c524787104b1ccdddc5e8af10ba729edWink Savilleimport static com.android.internal.telephony.PhoneConstants.EVENT_SUBSCRIPTION_ACTIVATED;
74a8467dd0c524787104b1ccdddc5e8af10ba729edWink Savilleimport static com.android.internal.telephony.PhoneConstants.EVENT_SUBSCRIPTION_DEACTIVATED;
75a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
76c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Savillepublic class CDMALTEPhone extends CDMAPhone {
77cbaa45bbf2cab852b6c9c3a887e9f803d4e857eaWink Saville    static final String LOG_LTE_TAG = "CDMALTEPhone";
78c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    private static final boolean DBG = true;
79c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
80e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka    /** CdmaLtePhone in addition to RuimRecords available from
81e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka     * PhoneBase needs access to SIMRecords and IsimUiccRecords
82e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka     */
83e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka    private SIMRecords mSimRecords;
84e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka    private IsimUiccRecords mIsimUiccRecords;
85e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka
86c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    // Constructors
87a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    public CDMALTEPhone(Context context, CommandsInterface ci, PhoneNotifier notifier,
88a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville            int phoneId) {
89a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        this(context, ci, notifier, false, phoneId);
90a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    }
91a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
92a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    public CDMALTEPhone(Context context, CommandsInterface ci, PhoneNotifier notifier,
93a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville            boolean unitTestMode, int phoneId) {
94a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        super(context, ci, notifier, phoneId);
95a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
96a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        Rlog.d(LOG_TAG, "CDMALTEPhone: constructor: sub = " + mPhoneId);
97a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
98a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        mDcTracker = new DcTracker(this);
99a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
100a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    }
101a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
102a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    // Constructors
103c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public CDMALTEPhone(Context context, CommandsInterface ci, PhoneNotifier notifier) {
104c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        super(context, ci, notifier, false);
105c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
106c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
107c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
108a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    public void handleMessage (Message msg) {
109a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        switch (msg.what) {
110a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville            case EVENT_SUBSCRIPTION_ACTIVATED:
111a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville                log("EVENT_SUBSCRIPTION_ACTIVATED");
112a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville                onSubscriptionActivated();
113a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville                break;
114a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
115a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville            case EVENT_SUBSCRIPTION_DEACTIVATED:
116a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville                log("EVENT_SUBSCRIPTION_DEACTIVATED");
117a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville                onSubscriptionDeactivated();
118a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville                break;
119a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
120a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville            default:
121a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville                super.handleMessage(msg);
122a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        }
123a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    }
124a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
125a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    @Override
126c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    protected void initSstIcc() {
127c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        mSST = new CdmaLteServiceStateTracker(this);
128c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
129c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
130c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
131c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public void dispose() {
132c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        synchronized(PhoneProxy.lockForRadioTechnologyChange) {
133c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            super.dispose();
134c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        }
135c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
136c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
137c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
138c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public void removeReferences() {
139c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        super.removeReferences();
140c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
141c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
142c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
143c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public PhoneConstants.DataState getDataConnectionState(String apnType) {
144c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PhoneConstants.DataState ret = PhoneConstants.DataState.DISCONNECTED;
145c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
146c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        if (mSST == null) {
147c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            // Radio Technology Change is ongoing, dispose() and
148c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            // removeReferences() have already been called
149c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
150c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            ret = PhoneConstants.DataState.DISCONNECTED;
151454b1dfd508844b42eb775e4ab2359be74d3672bWink Saville        } else if (mDcTracker.isApnTypeEnabled(apnType) == false) {
152c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            ret = PhoneConstants.DataState.DISCONNECTED;
153c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        } else {
154454b1dfd508844b42eb775e4ab2359be74d3672bWink Saville            switch (mDcTracker.getState(apnType)) {
155c6bbea82bf74ebb492508199b6f3e172b7ce860aWink Saville                case RETRYING:
156c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                case FAILED:
157c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                case IDLE:
158c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                    ret = PhoneConstants.DataState.DISCONNECTED;
159c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                    break;
160c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
161c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                case CONNECTED:
162c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                case DISCONNECTING:
16322d85a8e3a575a6d01d2c788587971657dfe20c6Wink Saville                    if (mCT.mState != PhoneConstants.State.IDLE &&
164c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                            !mSST.isConcurrentVoiceAndDataAllowed()) {
165c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                        ret = PhoneConstants.DataState.SUSPENDED;
166c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                    } else {
167c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                        ret = PhoneConstants.DataState.CONNECTED;
168c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                    }
169c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                    break;
170c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
171c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                case CONNECTING:
172c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                case SCANNING:
173c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                    ret = PhoneConstants.DataState.CONNECTING;
174c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                    break;
175c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            }
176c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        }
177c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
178c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        log("getDataConnectionState apnType=" + apnType + " ret=" + ret);
179c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        return ret;
180c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
181c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
182ce06370fc58f59abda3cb072326e9425da3d755dWink Saville    /**
183ce06370fc58f59abda3cb072326e9425da3d755dWink Saville     * Sets the "current" field in the telephony provider according to the
184ce06370fc58f59abda3cb072326e9425da3d755dWink Saville     * build-time operator numeric property
185ce06370fc58f59abda3cb072326e9425da3d755dWink Saville     *
186ce06370fc58f59abda3cb072326e9425da3d755dWink Saville     * @return true for success; false otherwise.
187ce06370fc58f59abda3cb072326e9425da3d755dWink Saville     */
188ce06370fc58f59abda3cb072326e9425da3d755dWink Saville    @Override
189ce06370fc58f59abda3cb072326e9425da3d755dWink Saville    boolean updateCurrentCarrierInProvider(String operatorNumeric) {
190ce06370fc58f59abda3cb072326e9425da3d755dWink Saville        boolean retVal;
191a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        if (mUiccController.getUiccCardApplication(mPhoneId, UiccController.APP_FAM_3GPP) == null) {
192ce06370fc58f59abda3cb072326e9425da3d755dWink Saville            if (DBG) log("updateCurrentCarrierInProvider APP_FAM_3GPP == null");
193ce06370fc58f59abda3cb072326e9425da3d755dWink Saville            retVal = super.updateCurrentCarrierInProvider(operatorNumeric);
194ce06370fc58f59abda3cb072326e9425da3d755dWink Saville        } else {
195ce06370fc58f59abda3cb072326e9425da3d755dWink Saville            if (DBG) log("updateCurrentCarrierInProvider not updated");
196ce06370fc58f59abda3cb072326e9425da3d755dWink Saville            retVal = true;
197ce06370fc58f59abda3cb072326e9425da3d755dWink Saville        }
198ce06370fc58f59abda3cb072326e9425da3d755dWink Saville        if (DBG) log("updateCurrentCarrierInProvider X retVal=" + retVal);
199ce06370fc58f59abda3cb072326e9425da3d755dWink Saville        return retVal;
200ce06370fc58f59abda3cb072326e9425da3d755dWink Saville    }
201ce06370fc58f59abda3cb072326e9425da3d755dWink Saville
202c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
203c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public boolean updateCurrentCarrierInProvider() {
204a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        long currentDds = SubscriptionManager.getDefaultDataSubId();
205a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        String operatorNumeric = getOperatorNumeric();
206a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
207a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        Rlog.d(LOG_TAG, "updateCurrentCarrierInProvider: mSubscription = " + getSubId()
208a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville                + " currentDds = " + currentDds + " operatorNumeric = " + operatorNumeric);
209a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
210a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        if (!TextUtils.isEmpty(operatorNumeric) && (getSubId() == currentDds)) {
211c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            try {
212c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                Uri uri = Uri.withAppendedPath(Telephony.Carriers.CONTENT_URI, "current");
213c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                ContentValues map = new ContentValues();
214c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                map.put(Telephony.Carriers.NUMERIC, operatorNumeric);
215c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                mContext.getContentResolver().insert(uri, map);
216c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                return true;
217c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            } catch (SQLException e) {
218a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville                Rlog.e(LOG_TAG, "Can't store current operator", e);
219c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            }
220c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        }
221c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        return false;
222c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
223c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
224c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    // return IMSI from USIM as subscriber ID.
225c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
226c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public String getSubscriberId() {
227e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka        return (mSimRecords != null) ? mSimRecords.getIMSI() : "";
228c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
229c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
2300e4abef0d7e978d4c3dea5199f451a1c69158d03Sungmin Choi    // return GID1 from USIM
2310e4abef0d7e978d4c3dea5199f451a1c69158d03Sungmin Choi    @Override
2320e4abef0d7e978d4c3dea5199f451a1c69158d03Sungmin Choi    public String getGroupIdLevel1() {
2330e4abef0d7e978d4c3dea5199f451a1c69158d03Sungmin Choi        return (mSimRecords != null) ? mSimRecords.getGid1() : "";
2340e4abef0d7e978d4c3dea5199f451a1c69158d03Sungmin Choi    }
2350e4abef0d7e978d4c3dea5199f451a1c69158d03Sungmin Choi
236c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
237c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public String getImei() {
238c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        return mImei;
239c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
240c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
241c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
242c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public String getDeviceSvn() {
243c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        return mImeiSv;
244c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
245c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
246c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
247c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public IsimRecords getIsimRecords() {
248e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka        return mIsimUiccRecords;
249c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
250c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
251c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
252c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public String getMsisdn() {
253e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka        return (mSimRecords != null) ? mSimRecords.getMsisdnNumber() : null;
254c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
255c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
256c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
257c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public void getAvailableNetworks(Message response) {
25822d85a8e3a575a6d01d2c788587971657dfe20c6Wink Saville        mCi.getAvailableNetworks(response);
259c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
260c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
261c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
262e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka    protected void onUpdateIccAvailability() {
263e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka        if (mUiccController == null ) {
264bb36adde615d3d85fa0fc23935197c6bc6a799edAlex Yakavenka            return;
265bb36adde615d3d85fa0fc23935197c6bc6a799edAlex Yakavenka        }
266bb36adde615d3d85fa0fc23935197c6bc6a799edAlex Yakavenka
26780bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao        // Update IsimRecords
26880bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao        UiccCardApplication newUiccApplication =
2692e41209f95670cb26aba5897b9bc0dcd9679e908Shishir Agrawal                mUiccController.getUiccCardApplication(mPhoneId, UiccController.APP_FAM_IMS);
27080bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao        IsimUiccRecords newIsimUiccRecords = null;
271a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
27280bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao        if (newUiccApplication != null) {
27380bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao            newIsimUiccRecords = (IsimUiccRecords) newUiccApplication.getIccRecords();
274a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        }
27580bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao        mIsimUiccRecords = newIsimUiccRecords;
27680bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao
27780bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao        // Update UsimRecords
2782e41209f95670cb26aba5897b9bc0dcd9679e908Shishir Agrawal        newUiccApplication = mUiccController.getUiccCardApplication(mPhoneId,
2792e41209f95670cb26aba5897b9bc0dcd9679e908Shishir Agrawal                UiccController.APP_FAM_3GPP);
28080bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao        SIMRecords newSimRecords = null;
28180bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao        if (newUiccApplication != null) {
28280bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao            newSimRecords = (SIMRecords) newUiccApplication.getIccRecords();
28380bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao        }
28480bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao        mSimRecords = newSimRecords;
285a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
286a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        super.onUpdateIccAvailability();
287a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    }
288e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka
289a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    @Override
290a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    protected void init(Context context, PhoneNotifier notifier) {
291a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        mCi.setPhoneType(PhoneConstants.PHONE_TYPE_CDMA);
292a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        mCT = new CdmaCallTracker(this);
293a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        mCdmaSSM = CdmaSubscriptionSourceManager.getInstance(context, mCi, this,
294a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville                EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED, null);
295a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        mRuimPhoneBookInterfaceManager = new RuimPhoneBookInterfaceManager(this);
296a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        mSubInfo = new PhoneSubInfo(this);
297a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        mEriManager = new EriManager(this, context, EriManager.ERI_FROM_XML);
298a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
299a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        mCi.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null);
300a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        mCi.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
301a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        mCi.registerForOn(this, EVENT_RADIO_ON, null);
302a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        mCi.setOnSuppServiceNotification(this, EVENT_SSN, null);
303a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        mSST.registerForNetworkAttached(this, EVENT_REGISTERED_TO_NETWORK, null);
304a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        mCi.setEmergencyCallbackMode(this, EVENT_EMERGENCY_CALLBACK_MODE_ENTER, null);
305a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        mCi.registerForExitEmergencyCallbackMode(this, EVENT_EXIT_EMERGENCY_CALLBACK_RESPONSE,
306a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville                null);
307a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
308a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        PowerManager pm
309a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville            = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
310a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,LOG_TAG);
311a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
312a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        // This is needed to handle phone process crashes
313a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        String inEcm = SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE, "false");
314a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        mIsPhoneInEcmState = inEcm.equals("true");
315a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        if (mIsPhoneInEcmState) {
316a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville            // Send a message which will invoke handleExitEmergencyCallbackMode
317a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville            mCi.exitEmergencyCallbackMode(obtainMessage(EVENT_EXIT_EMERGENCY_CALLBACK_RESPONSE));
318bb36adde615d3d85fa0fc23935197c6bc6a799edAlex Yakavenka        }
319e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka
320a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        // get the string that specifies the carrier OTA Sp number
321a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        mCarrierOtaSpNumSchema = SystemProperties.get(
322a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville                TelephonyProperties.PROPERTY_OTASP_NUM_SCHEMA,"");
323a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
324a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        setProperties();
325a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    }
326a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
327a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    private void onSubscriptionActivated() {
328a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville//        mSubscriptionData = SubscriptionManager.getCurrentSubscription(mSubscription);
329a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
330a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        log("SUBSCRIPTION ACTIVATED : slotId : " + mSubscriptionData.slotId
331a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville                + " appid : " + mSubscriptionData.m3gpp2Index
332a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville                + " subId : " + mSubscriptionData.subId
333a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville                + " subStatus : " + mSubscriptionData.subStatus);
334a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
335a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        // Make sure properties are set for proper subscription.
336a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        setProperties();
337a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
338a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        onUpdateIccAvailability();
339a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        mSST.sendMessage(mSST.obtainMessage(ServiceStateTracker.EVENT_ICC_CHANGED));
340a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        ((CdmaLteServiceStateTracker)mSST).updateCdmaSubscription();
341a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        ((DcTracker)mDcTracker).updateRecords();
342a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    }
343a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
344a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    private void onSubscriptionDeactivated() {
345a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        log("SUBSCRIPTION DEACTIVATED");
346a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        // resetSubSpecifics
347a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        mSubscriptionData = null;
348a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    }
349a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
350a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    // Set the properties per subscription
351a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    private void setProperties() {
352a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        //Change the system property
353a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        setSystemProperty(TelephonyProperties.CURRENT_ACTIVE_PHONE,
354a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville                new Integer(PhoneConstants.PHONE_TYPE_CDMA).toString());
355a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        // Sets operator alpha property by retrieving from build-time system property
356a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        String operatorAlpha = SystemProperties.get("ro.cdma.home.operator.alpha");
357b93bb3538c55f173f94a4ee7510d9d1521d8f731Shishir Agrawal        if (!TextUtils.isEmpty(operatorAlpha)) {
358b93bb3538c55f173f94a4ee7510d9d1521d8f731Shishir Agrawal            setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, operatorAlpha);
359b93bb3538c55f173f94a4ee7510d9d1521d8f731Shishir Agrawal        }
360a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
361a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        // Sets operator numeric property by retrieving from build-time system property
362a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        String operatorNumeric = SystemProperties.get(PROPERTY_CDMA_HOME_OPERATOR_NUMERIC);
363a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        log("update icc_operator_numeric=" + operatorNumeric);
364b93bb3538c55f173f94a4ee7510d9d1521d8f731Shishir Agrawal        if (!TextUtils.isEmpty(operatorNumeric)) {
365b93bb3538c55f173f94a4ee7510d9d1521d8f731Shishir Agrawal            setSystemProperty(PROPERTY_ICC_OPERATOR_NUMERIC, operatorNumeric);
366ab57aa5d465ef3a6dc0895b2408276617a2f6fa0Tom Taylor
367ab57aa5d465ef3a6dc0895b2408276617a2f6fa0Tom Taylor            SubscriptionController.getInstance().setMccMnc(operatorNumeric, getSubId());
368b93bb3538c55f173f94a4ee7510d9d1521d8f731Shishir Agrawal            // Sets iso country property by retrieving from build-time system property
369b93bb3538c55f173f94a4ee7510d9d1521d8f731Shishir Agrawal            setIsoCountryProperty(operatorNumeric);
370b93bb3538c55f173f94a4ee7510d9d1521d8f731Shishir Agrawal            // Updates MCC MNC device configuration information
371b93bb3538c55f173f94a4ee7510d9d1521d8f731Shishir Agrawal            log("update mccmnc=" + operatorNumeric);
372b93bb3538c55f173f94a4ee7510d9d1521d8f731Shishir Agrawal            MccTable.updateMccMncConfiguration(mContext, operatorNumeric, false);
373b93bb3538c55f173f94a4ee7510d9d1521d8f731Shishir Agrawal        }
374a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        // Sets current entry in the telephony carrier table
375a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        updateCurrentCarrierInProvider();
376a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    }
377a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
378a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    @Override
379a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    public void setSystemProperty(String property, String value) {
380a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        if(getUnitTestMode()) {
381a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville            return;
382e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka        }
383a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        TelephonyManager.setTelephonyProperty(property, getSubId(), value);
384a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    }
385a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
386a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    public String getSystemProperty(String property, String defValue) {
387a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        if(getUnitTestMode()) {
388a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville            return null;
389a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        }
390a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        return TelephonyManager.getTelephonyProperty(property, getSubId(), defValue);
391a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    }
392a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
393a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    public void updateDataConnectionTracker() {
394a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        ((DcTracker)mDcTracker).update();
395a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    }
396a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
397a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    public void setInternalDataEnabled(boolean enable, Message onCompleteMsg) {
398a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        ((DcTracker)mDcTracker)
399a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville                .setInternalDataEnabled(enable, onCompleteMsg);
400a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    }
401a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
402a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    public boolean setInternalDataEnabledFlag(boolean enable) {
403a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville       return ((DcTracker)mDcTracker)
404a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville                .setInternalDataEnabledFlag(enable);
405a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    }
406a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
407a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    /**
408a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville     * @return operator numeric.
409a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville     */
410a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    public String getOperatorNumeric() {
411a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        String operatorNumeric = null;
41280bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao        IccRecords curIccRecords = null;
413a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        if (mCdmaSubscriptionSource == CDMA_SUBSCRIPTION_NV) {
414a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville            operatorNumeric = SystemProperties.get("ro.cdma.home.operator.numeric");
41580bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao        } else if (mCdmaSubscriptionSource == CDMA_SUBSCRIPTION_RUIM_SIM) {
41680bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao            curIccRecords = mSimRecords;
41780bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao            if (curIccRecords != null) {
41880bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao                operatorNumeric = curIccRecords.getOperatorNumeric();
41980bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao            } else {
42080bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao                curIccRecords = mIccRecords.get();
42180bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao                if (curIccRecords != null && (curIccRecords instanceof RuimRecords)) {
42280bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao                    RuimRecords csim = (RuimRecords) curIccRecords;
42380bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao                    operatorNumeric = csim.getRUIMOperatorNumeric();
42480bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao                }
42580bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao            }
42680bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao        }
42780bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao        if (operatorNumeric == null) {
428a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville            Rlog.e(LOG_TAG, "getOperatorNumeric: Cannot retrieve operatorNumeric:"
429a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville                    + " mCdmaSubscriptionSource = " + mCdmaSubscriptionSource + " mIccRecords = "
43080bc1e5a6f0bd91b886351997b797e01732c1c67Jing Zhao                    + ((curIccRecords != null) ? curIccRecords.getRecordsLoaded() : null));
431e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka        }
432e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenka
433a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        Rlog.d(LOG_TAG, "getOperatorNumeric: mCdmaSubscriptionSource = " + mCdmaSubscriptionSource
434a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville                + " operatorNumeric = " + operatorNumeric);
435a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
436a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        return operatorNumeric;
437a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    }
438a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    public void registerForAllDataDisconnected(Handler h, int what, Object obj) {
439a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        ((DcTracker)mDcTracker)
440a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville               .registerForAllDataDisconnected(h, what, obj);
441a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    }
442a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville
443a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    public void unregisterForAllDataDisconnected(Handler h) {
444a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville        ((DcTracker)mDcTracker)
445a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville                .unregisterForAllDataDisconnected(h);
446bb36adde615d3d85fa0fc23935197c6bc6a799edAlex Yakavenka    }
447bb36adde615d3d85fa0fc23935197c6bc6a799edAlex Yakavenka
448bb36adde615d3d85fa0fc23935197c6bc6a799edAlex Yakavenka    @Override
449c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    protected void log(String s) {
450cbaa45bbf2cab852b6c9c3a887e9f803d4e857eaWink Saville            Rlog.d(LOG_LTE_TAG, s);
451cbaa45bbf2cab852b6c9c3a887e9f803d4e857eaWink Saville    }
452cbaa45bbf2cab852b6c9c3a887e9f803d4e857eaWink Saville
453cbaa45bbf2cab852b6c9c3a887e9f803d4e857eaWink Saville    protected void loge(String s) {
454cbaa45bbf2cab852b6c9c3a887e9f803d4e857eaWink Saville            Rlog.e(LOG_LTE_TAG, s);
455c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
456c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
457cbaa45bbf2cab852b6c9c3a887e9f803d4e857eaWink Saville    protected void loge(String s, Throwable e) {
458cbaa45bbf2cab852b6c9c3a887e9f803d4e857eaWink Saville        Rlog.e(LOG_LTE_TAG, s, e);
459f61aaae6608243be4e0da97a56ff9fed488cb173Shishir Agrawal    }
460cbaa45bbf2cab852b6c9c3a887e9f803d4e857eaWink Saville
461c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
462c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
463c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        pw.println("CDMALTEPhone extends:");
464c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        super.dump(fd, pw, args);
465c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
466c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville}
467