2 * Copyright (C) 2006 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.android.internal.telephony.cdma;
19 import android.os.SystemProperties;
20 import android.content.Context;
21 import android.net.Uri;
22 import android.content.Context;
23 import android.provider.Telephony;
24 import android.content.ContentValues;
25 import android.database.SQLException;
26 import android.telephony.ServiceState;
27 import android.telephony.SignalStrength;
29 import com.android.internal.telephony.gsm.SIMRecords;
30 import com.android.internal.telephony.gsm.SimCard;
31 import com.android.internal.telephony.ServiceStateTracker;
32 import com.android.internal.telephony.DataConnectionTracker;
33 import com.android.internal.telephony.CommandsInterface;
34 import com.android.internal.telephony.Phone;
35 import com.android.internal.telephony.PhoneBase;
36 import com.android.internal.telephony.PhoneNotifier;
37 import com.android.internal.telephony.PhoneProxy;
38 import com.android.internal.telephony.IccCard;
39 import com.android.internal.telephony.gsm.GsmDataConnectionTracker;
41 import android.util.Log;
43 public class CDMALTEPhone extends CDMAPhone {
44 static final String LOG_TAG = "CDMA";
46 private static final boolean DBG = true;
49 public CDMALTEPhone(Context context, CommandsInterface ci, PhoneNotifier notifier) {
50 this(context, ci, notifier, false);
53 public CDMALTEPhone(Context context, CommandsInterface ci, PhoneNotifier notifier,
54 boolean unitTestMode) {
55 super(context, ci, notifier, false);
59 protected void initSstIcc() {
60 mSST = new CdmaLteServiceStateTracker(this);
61 mIccRecords = new CdmaLteUiccRecords(this);
62 mIccCard = new SimCard(this, LOG_TAG, DBG);
63 mIccFileHandler = new CdmaLteUiccFileHandler(this);
67 public DataState getDataConnectionState(String apnType) {
68 DataState ret = DataState.DISCONNECTED;
71 // Radio Technology Change is ongoning, dispose() and
72 // removeReferences() have already been called
74 ret = DataState.DISCONNECTED;
75 } else if (mDataConnectionTracker.isApnTypeEnabled(apnType) == false) {
76 ret = DataState.DISCONNECTED;
78 switch (mDataConnectionTracker.getState(apnType)) {
81 ret = DataState.DISCONNECTED;
86 if (mCT.state != Phone.State.IDLE && !mSST.isConcurrentVoiceAndDataAllowed()) {
87 ret = DataState.SUSPENDED;
89 ret = DataState.CONNECTED;
96 ret = DataState.CONNECTING;
101 log("getDataConnectionState apnType=" + apnType + " ret=" + ret);
105 public boolean updateCurrentCarrierInProvider() {
106 if (mIccRecords != null) {
108 Uri uri = Uri.withAppendedPath(Telephony.Carriers.CONTENT_URI, "current");
109 ContentValues map = new ContentValues();
110 map.put(Telephony.Carriers.NUMERIC, mIccRecords.getOperatorNumeric());
111 log("updateCurrentCarrierInProvider insert uri=" + uri);
112 mContext.getContentResolver().insert(uri, map);
114 } catch (SQLException e) {
115 Log.e(LOG_TAG, "[CDMALTEPhone] Can't store current operator ret false", e);
118 log("updateCurrentCarrierInProvider mIccRecords == null ret false");
124 public void setSystemLocale(String language, String country, boolean fromMcc) {
125 // Avoid system locale is set from MCC table if CDMALTEPhone is used.
126 // The locale will be picked up based on EFpl/EFli once CSIM records are loaded.
129 super.setSystemLocale(language, country, false);
132 // return IMSI from USIM as subscriber ID.
134 public String getSubscriberId() {
135 return mIccRecords.getIMSI();
139 protected void log(String s) {
141 Log.d(LOG_TAG, "[CDMALTEPhone] " + s);