The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2006 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package com.android.settings; |
| 18 | |
| 19 | import android.app.Activity; |
Pavel Zhamaitsiak | cb267a6 | 2015-01-21 18:25:14 -0800 | [diff] [blame] | 20 | import android.app.QueuedWork; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 21 | import android.content.Intent; |
Tammo Spalink | a5f4c8f | 2009-10-15 20:08:58 +0800 | [diff] [blame] | 22 | import android.content.pm.PackageManager; |
| 23 | import android.content.pm.ResolveInfo; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 24 | import android.content.res.Resources; |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 25 | import android.graphics.Typeface; |
Jeff Sharkey | 9302986 | 2011-05-27 18:26:15 -0700 | [diff] [blame] | 26 | import android.net.TrafficStats; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 27 | import android.net.Uri; |
| 28 | import android.os.AsyncResult; |
| 29 | import android.os.Bundle; |
| 30 | import android.os.Handler; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 31 | import android.os.Message; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 32 | import android.os.SystemProperties; |
Wink Saville | 79bff2a | 2012-06-01 14:37:21 -0700 | [diff] [blame] | 33 | import android.telephony.CellInfo; |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 34 | import android.telephony.CellInfoCdma; |
| 35 | import android.telephony.CellInfoGsm; |
| 36 | import android.telephony.CellInfoLte; |
| 37 | import android.telephony.CellInfoWcdma; |
| 38 | import android.telephony.CellIdentityCdma; |
| 39 | import android.telephony.CellIdentityGsm; |
| 40 | import android.telephony.CellIdentityLte; |
| 41 | import android.telephony.CellIdentityWcdma; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 42 | import android.telephony.CellLocation; |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 43 | import android.telephony.CellSignalStrengthCdma; |
| 44 | import android.telephony.CellSignalStrengthGsm; |
| 45 | import android.telephony.CellSignalStrengthLte; |
| 46 | import android.telephony.CellSignalStrengthWcdma; |
Wink Saville | 4f0d881 | 2014-04-15 22:05:24 -0700 | [diff] [blame] | 47 | import android.telephony.DataConnectionRealTimeInfo; |
Jason Monk | 39b4674 | 2015-09-10 15:52:51 -0400 | [diff] [blame] | 48 | import android.telephony.NeighboringCellInfo; |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 49 | import android.telephony.PreciseCallState; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 50 | import android.telephony.PhoneStateListener; |
| 51 | import android.telephony.ServiceState; |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 52 | import android.telephony.SignalStrength; |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 53 | import android.telephony.SubscriptionManager; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 54 | import android.telephony.TelephonyManager; |
jsh | 534f5ae | 2009-09-24 09:19:22 -0700 | [diff] [blame] | 55 | import android.telephony.cdma.CdmaCellLocation; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 56 | import android.telephony.gsm.GsmCellLocation; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 57 | import android.util.Log; |
| 58 | import android.view.Menu; |
| 59 | import android.view.MenuItem; |
| 60 | import android.view.View; |
| 61 | import android.view.View.OnClickListener; |
| 62 | import android.widget.AdapterView; |
| 63 | import android.widget.ArrayAdapter; |
| 64 | import android.widget.Button; |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 65 | import android.widget.CompoundButton; |
| 66 | import android.widget.CompoundButton.OnCheckedChangeListener; |
Jason Monk | 39b4674 | 2015-09-10 15:52:51 -0400 | [diff] [blame] | 67 | import android.widget.EditText; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 68 | import android.widget.Spinner; |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 69 | import android.widget.Switch; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 70 | import android.widget.TextView; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 71 | |
Jason Monk | 39b4674 | 2015-09-10 15:52:51 -0400 | [diff] [blame] | 72 | import com.android.ims.ImsConfig; |
| 73 | import com.android.ims.ImsException; |
| 74 | import com.android.ims.ImsManager; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 75 | import com.android.internal.telephony.Phone; |
Wink Saville | 5543404 | 2012-06-14 12:33:43 -0700 | [diff] [blame] | 76 | import com.android.internal.telephony.PhoneConstants; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 77 | import com.android.internal.telephony.PhoneFactory; |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 78 | import com.android.internal.telephony.RILConstants; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 79 | import com.android.internal.telephony.TelephonyProperties; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 80 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 81 | import java.io.IOException; |
Jason Monk | 39b4674 | 2015-09-10 15:52:51 -0400 | [diff] [blame] | 82 | import java.net.HttpURLConnection; |
| 83 | import java.net.URL; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 84 | import java.net.UnknownHostException; |
| 85 | import java.util.ArrayList; |
| 86 | import java.util.List; |
| 87 | |
| 88 | public class RadioInfo extends Activity { |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 89 | private static final String TAG = "RadioInfo"; |
johnwang | 342101a | 2009-09-23 16:22:34 -0700 | [diff] [blame] | 90 | |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 91 | private static final String[] mPreferredNetworkLabels = { |
| 92 | "WCDMA preferred", |
| 93 | "GSM only", |
| 94 | "WCDMA only", |
| 95 | "GSM auto (PRL)", |
| 96 | "CDMA auto (PRL)", |
| 97 | "CDMA only", |
| 98 | "EvDo only", |
| 99 | "Global auto (PRL)", |
| 100 | "LTE/CDMA auto (PRL)", |
| 101 | "LTE/UMTS auto (PRL)", |
| 102 | "LTE/CDMA/UMTS auto (PRL)", |
| 103 | "LTE only", |
| 104 | "LTE/WCDMA", |
| 105 | "TD-SCDMA only", |
| 106 | "TD-SCDMA/WCDMA", |
| 107 | "LTE/TD-SCDMA", |
| 108 | "TD-SCDMA/GSM", |
| 109 | "TD-SCDMA/UMTS", |
| 110 | "LTE/TD-SCDMA/WCDMA", |
| 111 | "LTE/TD-SCDMA/UMTS", |
| 112 | "TD-SCDMA/CDMA/UMTS", |
| 113 | "Global/TD-SCDMA", |
| 114 | "Unknown" |
| 115 | }; |
| 116 | |
| 117 | |
| 118 | private static final int CELL_INFO_LIST_RATE_DISABLED = Integer.MAX_VALUE; |
| 119 | private static final int CELL_INFO_LIST_RATE_MAX = 0; |
| 120 | |
| 121 | //Values in must match mCellInfoRefreshRates |
| 122 | private static final String[] mCellInfoRefreshRateLabels = { |
| 123 | "Disabled", |
| 124 | "Immediate", |
| 125 | "Min 5s", |
| 126 | "Min 10s", |
| 127 | "Min 60s" |
| 128 | }; |
| 129 | |
| 130 | //Values in seconds, must match mCellInfoRefreshRateLabels |
| 131 | private static final int mCellInfoRefreshRates[] = { |
| 132 | CELL_INFO_LIST_RATE_DISABLED, |
| 133 | CELL_INFO_LIST_RATE_MAX, |
| 134 | 5000, |
| 135 | 10000, |
| 136 | 60000 |
| 137 | }; |
| 138 | |
| 139 | private void log(String s) { |
| 140 | Log.d(TAG, s); |
| 141 | } |
| 142 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 143 | private static final int EVENT_CFI_CHANGED = 302; |
| 144 | |
| 145 | private static final int EVENT_QUERY_PREFERRED_TYPE_DONE = 1000; |
| 146 | private static final int EVENT_SET_PREFERRED_TYPE_DONE = 1001; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 147 | private static final int EVENT_QUERY_SMSC_DONE = 1005; |
| 148 | private static final int EVENT_UPDATE_SMSC_DONE = 1006; |
| 149 | |
| 150 | private static final int MENU_ITEM_SELECT_BAND = 0; |
| 151 | private static final int MENU_ITEM_VIEW_ADN = 1; |
| 152 | private static final int MENU_ITEM_VIEW_FDN = 2; |
| 153 | private static final int MENU_ITEM_VIEW_SDN = 3; |
| 154 | private static final int MENU_ITEM_GET_PDP_LIST = 4; |
| 155 | private static final int MENU_ITEM_TOGGLE_DATA = 5; |
Tammo Spalink | a5f4c8f | 2009-10-15 20:08:58 +0800 | [diff] [blame] | 156 | |
Wink Saville | c388668 | 2009-04-02 11:00:56 -0700 | [diff] [blame] | 157 | private TextView mDeviceId; //DeviceId is the IMEI in GSM and the MEID in CDMA |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 158 | private TextView number; |
| 159 | private TextView callState; |
| 160 | private TextView operatorName; |
| 161 | private TextView roamingState; |
| 162 | private TextView gsmState; |
| 163 | private TextView gprsState; |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 164 | private TextView voiceNetwork; |
| 165 | private TextView dataNetwork; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 166 | private TextView dBm; |
| 167 | private TextView mMwi; |
| 168 | private TextView mCfi; |
| 169 | private TextView mLocation; |
| 170 | private TextView mNeighboringCids; |
Wink Saville | 79bff2a | 2012-06-01 14:37:21 -0700 | [diff] [blame] | 171 | private TextView mCellInfo; |
Wink Saville | 4f0d881 | 2014-04-15 22:05:24 -0700 | [diff] [blame] | 172 | private TextView mDcRtInfoTv; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 173 | private TextView sent; |
| 174 | private TextView received; |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 175 | private TextView mPingHostnameV4; |
| 176 | private TextView mPingHostnameV6; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 177 | private TextView mHttpClientTest; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 178 | private TextView dnsCheckState; |
| 179 | private EditText smsc; |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 180 | private Switch radioPowerOnSwitch; |
| 181 | private Button cellInfoRefreshRateButton; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 182 | private Button dnsCheckToggleButton; |
| 183 | private Button pingTestButton; |
| 184 | private Button updateSmscButton; |
| 185 | private Button refreshSmscButton; |
Tammo Spalink | a5f4c8f | 2009-10-15 20:08:58 +0800 | [diff] [blame] | 186 | private Button oemInfoButton; |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 187 | private Switch imsVoLteProvisionedSwitch; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 188 | private Spinner preferredNetworkType; |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 189 | private Spinner cellInfoRefreshRateSpinner; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 190 | |
| 191 | private TelephonyManager mTelephonyManager; |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 192 | private ImsManager mImsManager = null; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 193 | private Phone phone = null; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 194 | |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 195 | private String mPingHostnameResultV4; |
| 196 | private String mPingHostnameResultV6; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 197 | private String mHttpClientTestResult; |
| 198 | private boolean mMwiValue = false; |
| 199 | private boolean mCfiValue = false; |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 200 | |
| 201 | private List<CellInfo> mCellInfoResult = null; |
| 202 | private CellLocation mCellLocationResult = null; |
| 203 | private List<NeighboringCellInfo> mNeighboringCellResult = null; |
| 204 | |
| 205 | private int mPreferredNetworkTypeResult; |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 206 | private int mCellInfoRefreshRateIndex; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 207 | |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 208 | private final PhoneStateListener mPhoneStateListener = new PhoneStateListener() { |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 209 | @Override |
| 210 | public void onDataConnectionStateChanged(int state) { |
| 211 | updateDataState(); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 212 | updateNetworkType(); |
| 213 | } |
| 214 | |
| 215 | @Override |
| 216 | public void onDataActivity(int direction) { |
| 217 | updateDataStats2(); |
| 218 | } |
| 219 | |
| 220 | @Override |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 221 | public void onCallStateChanged(int state, String incomingNumber) { |
| 222 | updateNetworkType(); |
| 223 | updatePhoneState(state); |
| 224 | } |
| 225 | |
| 226 | @Override |
| 227 | public void onPreciseCallStateChanged(PreciseCallState preciseState) { |
| 228 | updateNetworkType(); |
| 229 | } |
| 230 | |
| 231 | @Override |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 232 | public void onCellLocationChanged(CellLocation location) { |
| 233 | updateLocation(location); |
| 234 | } |
| 235 | |
| 236 | @Override |
| 237 | public void onMessageWaitingIndicatorChanged(boolean mwi) { |
| 238 | mMwiValue = mwi; |
| 239 | updateMessageWaiting(); |
| 240 | } |
| 241 | |
| 242 | @Override |
| 243 | public void onCallForwardingIndicatorChanged(boolean cfi) { |
| 244 | mCfiValue = cfi; |
| 245 | updateCallRedirect(); |
| 246 | } |
Wink Saville | 79bff2a | 2012-06-01 14:37:21 -0700 | [diff] [blame] | 247 | |
| 248 | @Override |
| 249 | public void onCellInfoChanged(List<CellInfo> arrayCi) { |
Wink Saville | bf47128 | 2013-04-05 15:04:05 -0700 | [diff] [blame] | 250 | log("onCellInfoChanged: arrayCi=" + arrayCi); |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 251 | mCellInfoResult = arrayCi; |
| 252 | updateCellInfo(mCellInfoResult); |
Wink Saville | 79bff2a | 2012-06-01 14:37:21 -0700 | [diff] [blame] | 253 | } |
Wink Saville | 4f0d881 | 2014-04-15 22:05:24 -0700 | [diff] [blame] | 254 | |
| 255 | @Override |
| 256 | public void onDataConnectionRealTimeInfoChanged(DataConnectionRealTimeInfo dcRtInfo) { |
| 257 | log("onDataConnectionRealTimeInfoChanged: dcRtInfo=" + dcRtInfo); |
| 258 | updateDcRtInfoTv(dcRtInfo); |
| 259 | } |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 260 | |
| 261 | @Override |
| 262 | public void onSignalStrengthsChanged(SignalStrength signalStrength) { |
| 263 | log("onSignalStrengthChanged: SignalStrength=" +signalStrength); |
| 264 | updateSignalStrength(signalStrength); |
| 265 | } |
| 266 | |
| 267 | @Override |
| 268 | public void onServiceStateChanged(ServiceState serviceState) { |
| 269 | log("onServiceStateChanged: ServiceState=" + serviceState); |
| 270 | updateServiceState(serviceState); |
| 271 | updateRadioPowerState(); |
| 272 | updateNetworkType(); |
| 273 | updateImsVoLteProvisionedState(); |
| 274 | } |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 275 | }; |
| 276 | |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 277 | private void updatePreferredNetworkType(int type) { |
| 278 | if (type >= mPreferredNetworkLabels.length || type < 0) { |
| 279 | log("EVENT_QUERY_PREFERRED_TYPE_DONE: unknown " + |
| 280 | "type=" + type); |
| 281 | type = mPreferredNetworkLabels.length - 1; //set to Unknown |
| 282 | } |
| 283 | mPreferredNetworkTypeResult = type; |
| 284 | |
| 285 | preferredNetworkType.setSelection(mPreferredNetworkTypeResult, true); |
| 286 | } |
| 287 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 288 | private Handler mHandler = new Handler() { |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 289 | @Override |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 290 | public void handleMessage(Message msg) { |
| 291 | AsyncResult ar; |
| 292 | switch (msg.what) { |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 293 | case EVENT_QUERY_PREFERRED_TYPE_DONE: |
| 294 | ar= (AsyncResult) msg.obj; |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 295 | if (ar.exception == null && ar.result != null) { |
| 296 | updatePreferredNetworkType(((int[])ar.result)[0]); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 297 | } else { |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 298 | //In case of an exception, we will set this to unknown |
| 299 | updatePreferredNetworkType(mPreferredNetworkLabels.length-1); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 300 | } |
| 301 | break; |
| 302 | case EVENT_SET_PREFERRED_TYPE_DONE: |
| 303 | ar= (AsyncResult) msg.obj; |
| 304 | if (ar.exception != null) { |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 305 | log("Set preferred network type success."); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 306 | } |
| 307 | break; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 308 | case EVENT_QUERY_SMSC_DONE: |
| 309 | ar= (AsyncResult) msg.obj; |
| 310 | if (ar.exception != null) { |
| 311 | smsc.setText("refresh error"); |
| 312 | } else { |
jsh | 21dd407 | 2009-05-12 11:26:55 -0700 | [diff] [blame] | 313 | smsc.setText((String)ar.result); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 314 | } |
| 315 | break; |
| 316 | case EVENT_UPDATE_SMSC_DONE: |
| 317 | updateSmscButton.setEnabled(true); |
| 318 | ar= (AsyncResult) msg.obj; |
| 319 | if (ar.exception != null) { |
| 320 | smsc.setText("update error"); |
| 321 | } |
| 322 | break; |
| 323 | default: |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 324 | super.handleMessage(msg); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 325 | break; |
| 326 | |
| 327 | } |
| 328 | } |
| 329 | }; |
| 330 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 331 | @Override |
| 332 | public void onCreate(Bundle icicle) { |
| 333 | super.onCreate(icicle); |
| 334 | |
| 335 | setContentView(R.layout.radio_info); |
| 336 | |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 337 | log("Started onCreate"); |
| 338 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 339 | mTelephonyManager = (TelephonyManager)getSystemService(TELEPHONY_SERVICE); |
| 340 | phone = PhoneFactory.getDefaultPhone(); |
| 341 | |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 342 | //TODO: Need to update this if the default phoneId changes? |
| 343 | // Better to have an instance per phone? |
| 344 | mImsManager = ImsManager.getInstance(getApplicationContext(), |
| 345 | SubscriptionManager.getDefaultVoicePhoneId()); |
| 346 | |
Wink Saville | c388668 | 2009-04-02 11:00:56 -0700 | [diff] [blame] | 347 | mDeviceId= (TextView) findViewById(R.id.imei); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 348 | number = (TextView) findViewById(R.id.number); |
| 349 | callState = (TextView) findViewById(R.id.call); |
| 350 | operatorName = (TextView) findViewById(R.id.operator); |
| 351 | roamingState = (TextView) findViewById(R.id.roaming); |
| 352 | gsmState = (TextView) findViewById(R.id.gsm); |
| 353 | gprsState = (TextView) findViewById(R.id.gprs); |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 354 | voiceNetwork = (TextView) findViewById(R.id.voice_network); |
| 355 | dataNetwork = (TextView) findViewById(R.id.data_network); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 356 | dBm = (TextView) findViewById(R.id.dbm); |
| 357 | mMwi = (TextView) findViewById(R.id.mwi); |
| 358 | mCfi = (TextView) findViewById(R.id.cfi); |
| 359 | mLocation = (TextView) findViewById(R.id.location); |
| 360 | mNeighboringCids = (TextView) findViewById(R.id.neighboring); |
Wink Saville | 79bff2a | 2012-06-01 14:37:21 -0700 | [diff] [blame] | 361 | mCellInfo = (TextView) findViewById(R.id.cellinfo); |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 362 | mCellInfo.setTypeface(Typeface.MONOSPACE); |
Wink Saville | 4f0d881 | 2014-04-15 22:05:24 -0700 | [diff] [blame] | 363 | mDcRtInfoTv = (TextView) findViewById(R.id.dcrtinfo); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 364 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 365 | sent = (TextView) findViewById(R.id.sent); |
| 366 | received = (TextView) findViewById(R.id.received); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 367 | smsc = (EditText) findViewById(R.id.smsc); |
| 368 | dnsCheckState = (TextView) findViewById(R.id.dnsCheckState); |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 369 | mPingHostnameV4 = (TextView) findViewById(R.id.pingHostnameV4); |
| 370 | mPingHostnameV6 = (TextView) findViewById(R.id.pingHostnameV6); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 371 | mHttpClientTest = (TextView) findViewById(R.id.httpClientTest); |
| 372 | |
| 373 | preferredNetworkType = (Spinner) findViewById(R.id.preferredNetworkType); |
| 374 | ArrayAdapter<String> adapter = new ArrayAdapter<String> (this, |
| 375 | android.R.layout.simple_spinner_item, mPreferredNetworkLabels); |
johnwang | 342101a | 2009-09-23 16:22:34 -0700 | [diff] [blame] | 376 | adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 377 | preferredNetworkType.setAdapter(adapter); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 378 | |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 379 | cellInfoRefreshRateSpinner = (Spinner) findViewById(R.id.cell_info_rate_select); |
| 380 | ArrayAdapter<String> cellInfoAdapter = new ArrayAdapter<String>(this, |
| 381 | android.R.layout.simple_spinner_item, mCellInfoRefreshRateLabels); |
| 382 | cellInfoAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); |
| 383 | cellInfoRefreshRateSpinner.setAdapter(cellInfoAdapter); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 384 | |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 385 | imsVoLteProvisionedSwitch = (Switch) findViewById(R.id.volte_provisioned_switch); |
Wink Saville | bf47128 | 2013-04-05 15:04:05 -0700 | [diff] [blame] | 386 | |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 387 | radioPowerOnSwitch = (Switch) findViewById(R.id.radio_power); |
Wink Saville | 426fc66 | 2011-09-25 14:39:02 -0700 | [diff] [blame] | 388 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 389 | pingTestButton = (Button) findViewById(R.id.ping_test); |
| 390 | pingTestButton.setOnClickListener(mPingButtonHandler); |
| 391 | updateSmscButton = (Button) findViewById(R.id.update_smsc); |
| 392 | updateSmscButton.setOnClickListener(mUpdateSmscButtonHandler); |
| 393 | refreshSmscButton = (Button) findViewById(R.id.refresh_smsc); |
| 394 | refreshSmscButton.setOnClickListener(mRefreshSmscButtonHandler); |
| 395 | dnsCheckToggleButton = (Button) findViewById(R.id.dns_check_toggle); |
| 396 | dnsCheckToggleButton.setOnClickListener(mDnsCheckButtonHandler); |
johnwang | 342101a | 2009-09-23 16:22:34 -0700 | [diff] [blame] | 397 | |
Tammo Spalink | a5f4c8f | 2009-10-15 20:08:58 +0800 | [diff] [blame] | 398 | oemInfoButton = (Button) findViewById(R.id.oem_info); |
| 399 | oemInfoButton.setOnClickListener(mOemInfoButtonHandler); |
| 400 | PackageManager pm = getPackageManager(); |
| 401 | Intent oemInfoIntent = new Intent("com.android.settings.OEM_RADIO_INFO"); |
| 402 | List<ResolveInfo> oemInfoIntentList = pm.queryIntentActivities(oemInfoIntent, 0); |
| 403 | if (oemInfoIntentList.size() == 0) { |
| 404 | oemInfoButton.setEnabled(false); |
| 405 | } |
| 406 | |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 407 | mCellInfoRefreshRateIndex = CELL_INFO_LIST_RATE_DISABLED; |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 408 | mPreferredNetworkTypeResult = mPreferredNetworkLabels.length - 1; //Unknown |
| 409 | |
| 410 | //FIXME: Replace with TelephonyManager call |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 411 | phone.getPreferredNetworkType( |
| 412 | mHandler.obtainMessage(EVENT_QUERY_PREFERRED_TYPE_DONE)); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 413 | |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 414 | restoreFromBundle(icicle); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 415 | } |
| 416 | |
| 417 | @Override |
| 418 | protected void onResume() { |
| 419 | super.onResume(); |
| 420 | |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 421 | log("Started onResume"); |
| 422 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 423 | updateMessageWaiting(); |
| 424 | updateCallRedirect(); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 425 | updateDataState(); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 426 | updateDataStats2(); |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 427 | updateRadioPowerState(); |
Pavel Zhamaitsiak | cb267a6 | 2015-01-21 18:25:14 -0800 | [diff] [blame] | 428 | updateImsVoLteProvisionedState(); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 429 | updateProperties(); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 430 | updateDnsCheckState(); |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 431 | updateNetworkType(); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 432 | |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 433 | updateNeighboringCids(mNeighboringCellResult); |
| 434 | updateLocation(mCellLocationResult); |
| 435 | updateCellInfo(mCellInfoResult); |
| 436 | |
| 437 | mPingHostnameV4.setText(mPingHostnameResultV4); |
| 438 | mPingHostnameV6.setText(mPingHostnameResultV6); |
| 439 | mHttpClientTest.setText(mHttpClientTestResult); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 440 | |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 441 | //move these here so that the initial updates in create don't cause values to reset |
| 442 | cellInfoRefreshRateSpinner.setOnItemSelectedListener(mCellInfoRefreshRateHandler); |
| 443 | preferredNetworkType.setOnItemSelectedListener(mPreferredNetworkHandler); |
| 444 | radioPowerOnSwitch.setOnCheckedChangeListener(mRadioPowerOnChangeListener); |
| 445 | imsVoLteProvisionedSwitch.setOnCheckedChangeListener(mImsVoLteCheckedChangeListener); |
| 446 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 447 | mTelephonyManager.listen(mPhoneStateListener, |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 448 | PhoneStateListener.LISTEN_CALL_STATE |
| 449 | //b/27803938 - RadioInfo currently cannot read PRECISE_CALL_STATE |
| 450 | // | PhoneStateListener.LISTEN_PRECISE_CALL_STATE |
| 451 | | PhoneStateListener.LISTEN_DATA_CONNECTION_STATE |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 452 | | PhoneStateListener.LISTEN_DATA_ACTIVITY |
| 453 | | PhoneStateListener.LISTEN_CELL_LOCATION |
| 454 | | PhoneStateListener.LISTEN_MESSAGE_WAITING_INDICATOR |
Wink Saville | 79bff2a | 2012-06-01 14:37:21 -0700 | [diff] [blame] | 455 | | PhoneStateListener.LISTEN_CALL_FORWARDING_INDICATOR |
Wink Saville | 4f0d881 | 2014-04-15 22:05:24 -0700 | [diff] [blame] | 456 | | PhoneStateListener.LISTEN_CELL_INFO |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 457 | | PhoneStateListener.LISTEN_SERVICE_STATE |
| 458 | | PhoneStateListener.LISTEN_SIGNAL_STRENGTHS |
Wink Saville | 4f0d881 | 2014-04-15 22:05:24 -0700 | [diff] [blame] | 459 | | PhoneStateListener.LISTEN_DATA_CONNECTION_REAL_TIME_INFO); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 460 | } |
| 461 | |
| 462 | @Override |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 463 | protected void onPause() { |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 464 | super.onPause(); |
| 465 | |
Wink Saville | bf47128 | 2013-04-05 15:04:05 -0700 | [diff] [blame] | 466 | log("onPause: unregister phone & data intents"); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 467 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 468 | mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE); |
| 469 | } |
| 470 | |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 471 | private void restoreFromBundle(Bundle b) { |
| 472 | if( b == null) { |
| 473 | return; |
| 474 | } |
| 475 | |
| 476 | mPingHostnameResultV4 = b.getString("mPingHostnameResultV4",""); |
| 477 | mPingHostnameResultV6 = b.getString("mPingHostnameResultV6",""); |
| 478 | mHttpClientTestResult = b.getString("mHttpClientTestResult",""); |
| 479 | |
| 480 | mPingHostnameV4.setText(mPingHostnameResultV4); |
| 481 | mPingHostnameV6.setText(mPingHostnameResultV6); |
| 482 | mHttpClientTest.setText(mHttpClientTestResult); |
| 483 | |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 484 | mPreferredNetworkTypeResult = b.getInt("mPreferredNetworkTypeResult", |
| 485 | mPreferredNetworkLabels.length - 1); |
| 486 | |
| 487 | mCellInfoRefreshRateIndex = b.getInt("mCellInfoRefreshRateIndex", 0); |
| 488 | |
| 489 | cellInfoRefreshRateSpinner.setSelection(mCellInfoRefreshRateIndex); |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 490 | } |
| 491 | |
| 492 | @Override |
| 493 | protected void onSaveInstanceState(Bundle outState) { |
| 494 | outState.putString("mPingHostnameResultV4", mPingHostnameResultV4); |
| 495 | outState.putString("mPingHostnameResultV6", mPingHostnameResultV6); |
| 496 | outState.putString("mHttpClientTestResult", mHttpClientTestResult); |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 497 | |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 498 | outState.putInt("mPreferredNetworkTypeResult", mPreferredNetworkTypeResult); |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 499 | |
| 500 | outState.putInt("mCellInfoRefreshRateIndex", mCellInfoRefreshRateIndex); |
| 501 | |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 502 | } |
| 503 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 504 | @Override |
| 505 | public boolean onCreateOptionsMenu(Menu menu) { |
Wink Saville | c388668 | 2009-04-02 11:00:56 -0700 | [diff] [blame] | 506 | menu.add(0, MENU_ITEM_SELECT_BAND, 0, R.string.radio_info_band_mode_label) |
| 507 | .setOnMenuItemClickListener(mSelectBandCallback) |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 508 | .setAlphabeticShortcut('b'); |
| 509 | menu.add(1, MENU_ITEM_VIEW_ADN, 0, |
| 510 | R.string.radioInfo_menu_viewADN).setOnMenuItemClickListener(mViewADNCallback); |
| 511 | menu.add(1, MENU_ITEM_VIEW_FDN, 0, |
| 512 | R.string.radioInfo_menu_viewFDN).setOnMenuItemClickListener(mViewFDNCallback); |
| 513 | menu.add(1, MENU_ITEM_VIEW_SDN, 0, |
| 514 | R.string.radioInfo_menu_viewSDN).setOnMenuItemClickListener(mViewSDNCallback); |
| 515 | menu.add(1, MENU_ITEM_GET_PDP_LIST, |
| 516 | 0, R.string.radioInfo_menu_getPDP).setOnMenuItemClickListener(mGetPdpList); |
| 517 | menu.add(1, MENU_ITEM_TOGGLE_DATA, |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 518 | 0, R.string.radio_info_data_connection_disable).setOnMenuItemClickListener(mToggleData); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 519 | return true; |
| 520 | } |
| 521 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 522 | @Override |
Wink Saville | c388668 | 2009-04-02 11:00:56 -0700 | [diff] [blame] | 523 | public boolean onPrepareOptionsMenu(Menu menu) { |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 524 | // Get the TOGGLE DATA menu item in the right state. |
| 525 | MenuItem item = menu.findItem(MENU_ITEM_TOGGLE_DATA); |
| 526 | int state = mTelephonyManager.getDataState(); |
| 527 | boolean visible = true; |
| 528 | |
| 529 | switch (state) { |
| 530 | case TelephonyManager.DATA_CONNECTED: |
| 531 | case TelephonyManager.DATA_SUSPENDED: |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 532 | item.setTitle(R.string.radio_info_data_connection_disable); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 533 | break; |
| 534 | case TelephonyManager.DATA_DISCONNECTED: |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 535 | item.setTitle(R.string.radio_info_data_connection_enable); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 536 | break; |
| 537 | default: |
| 538 | visible = false; |
| 539 | break; |
| 540 | } |
| 541 | item.setVisible(visible); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 542 | return true; |
| 543 | } |
| 544 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 545 | private void updateDnsCheckState() { |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 546 | //FIXME: Replace with a TelephonyManager call |
Mike Lockwood | 5304c7e | 2009-04-05 11:37:45 -0700 | [diff] [blame] | 547 | dnsCheckState.setText(phone.isDnsCheckDisabled() ? |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 548 | "0.0.0.0 allowed" :"0.0.0.0 not allowed"); |
| 549 | } |
Wink Saville | e2a14e3 | 2009-05-29 14:06:30 -0700 | [diff] [blame] | 550 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 551 | private final void |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 552 | updateSignalStrength(SignalStrength signalStrength) { |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 553 | Resources r = getResources(); |
| 554 | |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 555 | int signalDbm = signalStrength.getDbm(); |
Wink Saville | e2a14e3 | 2009-05-29 14:06:30 -0700 | [diff] [blame] | 556 | |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 557 | int signalAsu = signalStrength.getAsuLevel(); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 558 | |
| 559 | if (-1 == signalAsu) signalAsu = 0; |
| 560 | |
| 561 | dBm.setText(String.valueOf(signalDbm) + " " |
| 562 | + r.getString(R.string.radioInfo_display_dbm) + " " |
| 563 | + String.valueOf(signalAsu) + " " |
| 564 | + r.getString(R.string.radioInfo_display_asu)); |
| 565 | } |
| 566 | |
| 567 | private final void updateLocation(CellLocation location) { |
jsh | 534f5ae | 2009-09-24 09:19:22 -0700 | [diff] [blame] | 568 | Resources r = getResources(); |
Wink Saville | c388668 | 2009-04-02 11:00:56 -0700 | [diff] [blame] | 569 | if (location instanceof GsmCellLocation) { |
| 570 | GsmCellLocation loc = (GsmCellLocation)location; |
jsh | 534f5ae | 2009-09-24 09:19:22 -0700 | [diff] [blame] | 571 | int lac = loc.getLac(); |
| 572 | int cid = loc.getCid(); |
| 573 | mLocation.setText(r.getString(R.string.radioInfo_lac) + " = " |
| 574 | + ((lac == -1) ? "unknown" : Integer.toHexString(lac)) |
| 575 | + " " |
| 576 | + r.getString(R.string.radioInfo_cid) + " = " |
| 577 | + ((cid == -1) ? "unknown" : Integer.toHexString(cid))); |
| 578 | } else if (location instanceof CdmaCellLocation) { |
| 579 | CdmaCellLocation loc = (CdmaCellLocation)location; |
| 580 | int bid = loc.getBaseStationId(); |
| 581 | int sid = loc.getSystemId(); |
| 582 | int nid = loc.getNetworkId(); |
| 583 | int lat = loc.getBaseStationLatitude(); |
| 584 | int lon = loc.getBaseStationLongitude(); |
| 585 | mLocation.setText("BID = " |
| 586 | + ((bid == -1) ? "unknown" : Integer.toHexString(bid)) |
| 587 | + " " |
| 588 | + "SID = " |
| 589 | + ((sid == -1) ? "unknown" : Integer.toHexString(sid)) |
| 590 | + " " |
| 591 | + "NID = " |
| 592 | + ((nid == -1) ? "unknown" : Integer.toHexString(nid)) |
| 593 | + "\n" |
| 594 | + "LAT = " |
| 595 | + ((lat == -1) ? "unknown" : Integer.toHexString(lat)) |
| 596 | + " " |
| 597 | + "LONG = " |
| 598 | + ((lon == -1) ? "unknown" : Integer.toHexString(lon))); |
| 599 | } else { |
| 600 | mLocation.setText("unknown"); |
Wink Saville | c388668 | 2009-04-02 11:00:56 -0700 | [diff] [blame] | 601 | } |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 602 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 603 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 604 | } |
| 605 | |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 606 | private final void updateNeighboringCids(List<NeighboringCellInfo> cids) { |
johnwang | f02c65f | 2009-09-25 17:26:54 -0700 | [diff] [blame] | 607 | StringBuilder sb = new StringBuilder(); |
| 608 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 609 | if (cids != null) { |
| 610 | if ( cids.isEmpty() ) { |
johnwang | f02c65f | 2009-09-25 17:26:54 -0700 | [diff] [blame] | 611 | sb.append("no neighboring cells"); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 612 | } else { |
| 613 | for (NeighboringCellInfo cell : cids) { |
johnwang | f02c65f | 2009-09-25 17:26:54 -0700 | [diff] [blame] | 614 | sb.append(cell.toString()).append(" "); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 615 | } |
| 616 | } |
| 617 | } else { |
johnwang | f02c65f | 2009-09-25 17:26:54 -0700 | [diff] [blame] | 618 | sb.append("unknown"); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 619 | } |
johnwang | f02c65f | 2009-09-25 17:26:54 -0700 | [diff] [blame] | 620 | mNeighboringCids.setText(sb.toString()); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 621 | } |
| 622 | |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 623 | private final String getCellInfoDisplayString(int i) { |
| 624 | return (i != Integer.MAX_VALUE) ? Integer.toString(i) : ""; |
| 625 | } |
| 626 | |
| 627 | private final String getCellInfoDisplayString(long i) { |
| 628 | return (i != Long.MAX_VALUE) ? Long.toString(i) : ""; |
| 629 | } |
| 630 | |
| 631 | private final String buildCdmaInfoString(CellInfoCdma ci) { |
| 632 | CellIdentityCdma cidCdma = ci.getCellIdentity(); |
| 633 | CellSignalStrengthCdma ssCdma = ci.getCellSignalStrength(); |
| 634 | |
| 635 | return String.format("%-3.3s %-5.5s %-5.5s %-5.5s %-6.6s %-6.6s %-6.6s %-6.6s %-5.5s", |
| 636 | ci.isRegistered() ? "S " : " ", |
| 637 | getCellInfoDisplayString(cidCdma.getSystemId()), |
| 638 | getCellInfoDisplayString(cidCdma.getNetworkId()), |
| 639 | getCellInfoDisplayString(cidCdma.getBasestationId()), |
| 640 | getCellInfoDisplayString(ssCdma.getCdmaDbm()), |
| 641 | getCellInfoDisplayString(ssCdma.getCdmaEcio()), |
| 642 | getCellInfoDisplayString(ssCdma.getEvdoDbm()), |
| 643 | getCellInfoDisplayString(ssCdma.getEvdoEcio()), |
| 644 | getCellInfoDisplayString(ssCdma.getEvdoSnr())); |
| 645 | } |
| 646 | |
| 647 | private final String buildGsmInfoString(CellInfoGsm ci) { |
| 648 | CellIdentityGsm cidGsm = ci.getCellIdentity(); |
| 649 | CellSignalStrengthGsm ssGsm = ci.getCellSignalStrength(); |
| 650 | |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 651 | return String.format("%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-6.6s %-4.4s %-4.4s\n", |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 652 | ci.isRegistered() ? "S " : " ", |
| 653 | getCellInfoDisplayString(cidGsm.getMcc()), |
| 654 | getCellInfoDisplayString(cidGsm.getMnc()), |
| 655 | getCellInfoDisplayString(cidGsm.getLac()), |
| 656 | getCellInfoDisplayString(cidGsm.getCid()), |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 657 | getCellInfoDisplayString(cidGsm.getArfcn()), |
| 658 | getCellInfoDisplayString(cidGsm.getBsic()), |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 659 | getCellInfoDisplayString(ssGsm.getDbm())); |
| 660 | } |
| 661 | |
| 662 | private final String buildLteInfoString(CellInfoLte ci) { |
| 663 | CellIdentityLte cidLte = ci.getCellIdentity(); |
| 664 | CellSignalStrengthLte ssLte = ci.getCellSignalStrength(); |
| 665 | |
| 666 | return String.format( |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 667 | "%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-3.3s %-6.6s %-4.4s %-4.4s %-2.2s\n", |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 668 | ci.isRegistered() ? "S " : " ", |
| 669 | getCellInfoDisplayString(cidLte.getMcc()), |
| 670 | getCellInfoDisplayString(cidLte.getMnc()), |
| 671 | getCellInfoDisplayString(cidLte.getTac()), |
| 672 | getCellInfoDisplayString(cidLte.getCi()), |
| 673 | getCellInfoDisplayString(cidLte.getPci()), |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 674 | getCellInfoDisplayString(cidLte.getEarfcn()), |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 675 | getCellInfoDisplayString(ssLte.getDbm()), |
| 676 | getCellInfoDisplayString(ssLte.getRsrq()), |
| 677 | getCellInfoDisplayString(ssLte.getTimingAdvance())); |
| 678 | } |
| 679 | |
| 680 | private final String buildWcdmaInfoString(CellInfoWcdma ci) { |
| 681 | CellIdentityWcdma cidWcdma = ci.getCellIdentity(); |
| 682 | CellSignalStrengthWcdma ssWcdma = ci.getCellSignalStrength(); |
| 683 | |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 684 | return String.format("%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-6.6s %-3.3s %-4.4s\n", |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 685 | ci.isRegistered() ? "S " : " ", |
| 686 | getCellInfoDisplayString(cidWcdma.getMcc()), |
| 687 | getCellInfoDisplayString(cidWcdma.getMnc()), |
| 688 | getCellInfoDisplayString(cidWcdma.getLac()), |
| 689 | getCellInfoDisplayString(cidWcdma.getCid()), |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 690 | getCellInfoDisplayString(cidWcdma.getUarfcn()), |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 691 | getCellInfoDisplayString(cidWcdma.getPsc()), |
| 692 | getCellInfoDisplayString(ssWcdma.getDbm())); |
| 693 | } |
| 694 | |
| 695 | private final String buildCellInfoString(List<CellInfo> arrayCi) { |
| 696 | String value = new String(); |
| 697 | StringBuilder cdmaCells = new StringBuilder(), |
| 698 | gsmCells = new StringBuilder(), |
| 699 | lteCells = new StringBuilder(), |
| 700 | wcdmaCells = new StringBuilder(); |
| 701 | |
| 702 | if (arrayCi != null) { |
| 703 | for (CellInfo ci : arrayCi) { |
| 704 | |
| 705 | if (ci instanceof CellInfoLte) { |
| 706 | lteCells.append(buildLteInfoString((CellInfoLte) ci)); |
| 707 | } else if (ci instanceof CellInfoWcdma) { |
| 708 | wcdmaCells.append(buildWcdmaInfoString((CellInfoWcdma) ci)); |
| 709 | } else if (ci instanceof CellInfoGsm) { |
| 710 | gsmCells.append(buildGsmInfoString((CellInfoGsm) ci)); |
| 711 | } else if (ci instanceof CellInfoCdma) { |
| 712 | cdmaCells.append(buildCdmaInfoString((CellInfoCdma) ci)); |
Wink Saville | 79bff2a | 2012-06-01 14:37:21 -0700 | [diff] [blame] | 713 | } |
| 714 | } |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 715 | if (lteCells.length() != 0) { |
| 716 | value += String.format( |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 717 | "LTE\n%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-3.3s %-6.6s %-4.4s %-4.4s %-2.2s\n", |
| 718 | "SRV", "MCC", "MNC", "TAC", "CID", "PCI", "EARFCN", "RSRP", "RSRQ", "TA"); |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 719 | value += lteCells.toString(); |
| 720 | } |
| 721 | if (wcdmaCells.length() != 0) { |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 722 | value += String.format("WCDMA\n%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-6.6s %-3.3s %-4.4s\n", |
| 723 | "SRV", "MCC", "MNC", "LAC", "CID", "UARFCN", "PSC", "RSCP"); |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 724 | value += wcdmaCells.toString(); |
| 725 | } |
| 726 | if (gsmCells.length() != 0) { |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 727 | value += String.format("GSM\n%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-6.6s %-4.4s %-4.4s\n", |
| 728 | "SRV", "MCC", "MNC", "LAC", "CID", "ARFCN", "BSIC", "RSSI"); |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 729 | value += gsmCells.toString(); |
| 730 | } |
| 731 | if (cdmaCells.length() != 0) { |
| 732 | value += String.format( |
| 733 | "CDMA/EVDO\n%-3.3s %-5.5s %-5.5s %-5.5s %-6.6s %-6.6s %-6.6s %-6.6s %-5.5s\n", |
| 734 | "SRV", "SID", "NID", "BSID", "C-RSSI", "C-ECIO", "E-RSSI", "E-ECIO", "E-SNR"); |
| 735 | value += cdmaCells.toString(); |
| 736 | } |
| 737 | } else { |
| 738 | value ="unknown"; |
Wink Saville | 79bff2a | 2012-06-01 14:37:21 -0700 | [diff] [blame] | 739 | } |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 740 | |
| 741 | return value.toString(); |
| 742 | } |
| 743 | |
| 744 | private final void updateCellInfo(List<CellInfo> arrayCi) { |
| 745 | mCellInfo.setText(buildCellInfoString(arrayCi)); |
Wink Saville | 79bff2a | 2012-06-01 14:37:21 -0700 | [diff] [blame] | 746 | } |
| 747 | |
Wink Saville | 4f0d881 | 2014-04-15 22:05:24 -0700 | [diff] [blame] | 748 | private final void updateDcRtInfoTv(DataConnectionRealTimeInfo dcRtInfo) { |
| 749 | mDcRtInfoTv.setText(dcRtInfo.toString()); |
| 750 | } |
| 751 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 752 | private final void |
| 753 | updateMessageWaiting() { |
| 754 | mMwi.setText(String.valueOf(mMwiValue)); |
| 755 | } |
| 756 | |
| 757 | private final void |
| 758 | updateCallRedirect() { |
| 759 | mCfi.setText(String.valueOf(mCfiValue)); |
| 760 | } |
| 761 | |
| 762 | |
| 763 | private final void |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 764 | updateServiceState(ServiceState serviceState) { |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 765 | int state = serviceState.getState(); |
| 766 | Resources r = getResources(); |
| 767 | String display = r.getString(R.string.radioInfo_unknown); |
johnwang | 342101a | 2009-09-23 16:22:34 -0700 | [diff] [blame] | 768 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 769 | switch (state) { |
| 770 | case ServiceState.STATE_IN_SERVICE: |
| 771 | display = r.getString(R.string.radioInfo_service_in); |
| 772 | break; |
| 773 | case ServiceState.STATE_OUT_OF_SERVICE: |
| 774 | case ServiceState.STATE_EMERGENCY_ONLY: |
| 775 | display = r.getString(R.string.radioInfo_service_emergency); |
| 776 | break; |
| 777 | case ServiceState.STATE_POWER_OFF: |
| 778 | display = r.getString(R.string.radioInfo_service_off); |
| 779 | break; |
| 780 | } |
johnwang | 342101a | 2009-09-23 16:22:34 -0700 | [diff] [blame] | 781 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 782 | gsmState.setText(display); |
johnwang | 342101a | 2009-09-23 16:22:34 -0700 | [diff] [blame] | 783 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 784 | if (serviceState.getRoaming()) { |
| 785 | roamingState.setText(R.string.radioInfo_roaming_in); |
| 786 | } else { |
| 787 | roamingState.setText(R.string.radioInfo_roaming_not); |
| 788 | } |
| 789 | |
| 790 | operatorName.setText(serviceState.getOperatorAlphaLong()); |
| 791 | } |
| 792 | |
| 793 | private final void |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 794 | updatePhoneState(int state) { |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 795 | Resources r = getResources(); |
| 796 | String display = r.getString(R.string.radioInfo_unknown); |
| 797 | |
| 798 | switch (state) { |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 799 | case TelephonyManager.CALL_STATE_IDLE: |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 800 | display = r.getString(R.string.radioInfo_phone_idle); |
| 801 | break; |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 802 | case TelephonyManager.CALL_STATE_RINGING: |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 803 | display = r.getString(R.string.radioInfo_phone_ringing); |
| 804 | break; |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 805 | case TelephonyManager.CALL_STATE_OFFHOOK: |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 806 | display = r.getString(R.string.radioInfo_phone_offhook); |
| 807 | break; |
| 808 | } |
| 809 | |
| 810 | callState.setText(display); |
| 811 | } |
| 812 | |
| 813 | private final void |
| 814 | updateDataState() { |
| 815 | int state = mTelephonyManager.getDataState(); |
| 816 | Resources r = getResources(); |
| 817 | String display = r.getString(R.string.radioInfo_unknown); |
| 818 | |
| 819 | switch (state) { |
| 820 | case TelephonyManager.DATA_CONNECTED: |
| 821 | display = r.getString(R.string.radioInfo_data_connected); |
| 822 | break; |
| 823 | case TelephonyManager.DATA_CONNECTING: |
| 824 | display = r.getString(R.string.radioInfo_data_connecting); |
| 825 | break; |
| 826 | case TelephonyManager.DATA_DISCONNECTED: |
| 827 | display = r.getString(R.string.radioInfo_data_disconnected); |
| 828 | break; |
| 829 | case TelephonyManager.DATA_SUSPENDED: |
| 830 | display = r.getString(R.string.radioInfo_data_suspended); |
| 831 | break; |
| 832 | } |
johnwang | 342101a | 2009-09-23 16:22:34 -0700 | [diff] [blame] | 833 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 834 | gprsState.setText(display); |
| 835 | } |
| 836 | |
| 837 | private final void updateNetworkType() { |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 838 | if( phone != null ) { |
| 839 | ServiceState ss = phone.getServiceState(); |
| 840 | dataNetwork.setText(ServiceState.rilRadioTechnologyToString( |
| 841 | phone.getServiceState().getRilDataRadioTechnology())); |
| 842 | voiceNetwork.setText(ServiceState.rilRadioTechnologyToString( |
| 843 | phone.getServiceState().getRilVoiceRadioTechnology())); |
| 844 | } |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 845 | } |
| 846 | |
| 847 | private final void |
| 848 | updateProperties() { |
| 849 | String s; |
| 850 | Resources r = getResources(); |
| 851 | |
| 852 | s = phone.getDeviceId(); |
johnwang | 342101a | 2009-09-23 16:22:34 -0700 | [diff] [blame] | 853 | if (s == null) s = r.getString(R.string.radioInfo_unknown); |
Wink Saville | c388668 | 2009-04-02 11:00:56 -0700 | [diff] [blame] | 854 | mDeviceId.setText(s); |
johnwang | 342101a | 2009-09-23 16:22:34 -0700 | [diff] [blame] | 855 | |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 856 | //FIXME: Replace with a TelephonyManager call |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 857 | s = phone.getLine1Number(); |
johnwang | 342101a | 2009-09-23 16:22:34 -0700 | [diff] [blame] | 858 | if (s == null) s = r.getString(R.string.radioInfo_unknown); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 859 | number.setText(s); |
| 860 | } |
| 861 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 862 | private final void updateDataStats2() { |
| 863 | Resources r = getResources(); |
| 864 | |
Jeff Sharkey | 9302986 | 2011-05-27 18:26:15 -0700 | [diff] [blame] | 865 | long txPackets = TrafficStats.getMobileTxPackets(); |
| 866 | long rxPackets = TrafficStats.getMobileRxPackets(); |
| 867 | long txBytes = TrafficStats.getMobileTxBytes(); |
| 868 | long rxBytes = TrafficStats.getMobileRxBytes(); |
johnwang | 342101a | 2009-09-23 16:22:34 -0700 | [diff] [blame] | 869 | |
Jeff Sharkey | 9302986 | 2011-05-27 18:26:15 -0700 | [diff] [blame] | 870 | String packets = r.getString(R.string.radioInfo_display_packets); |
| 871 | String bytes = r.getString(R.string.radioInfo_display_bytes); |
johnwang | 342101a | 2009-09-23 16:22:34 -0700 | [diff] [blame] | 872 | |
Jeff Sharkey | 9302986 | 2011-05-27 18:26:15 -0700 | [diff] [blame] | 873 | sent.setText(txPackets + " " + packets + ", " + txBytes + " " + bytes); |
| 874 | received.setText(rxPackets + " " + packets + ", " + rxBytes + " " + bytes); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 875 | } |
| 876 | |
| 877 | /** |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 878 | * Ping a host name |
| 879 | */ |
| 880 | private final void pingHostname() { |
| 881 | try { |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 882 | try { |
| 883 | Process p4 = Runtime.getRuntime().exec("ping -c 1 www.google.com"); |
| 884 | int status4 = p4.waitFor(); |
| 885 | if (status4 == 0) { |
| 886 | mPingHostnameResultV4 = "Pass"; |
| 887 | } else { |
| 888 | mPingHostnameResultV4 = String.format("Fail(%d)", status4); |
| 889 | } |
| 890 | } catch (IOException e) { |
| 891 | mPingHostnameResultV4 = "Fail: IOException"; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 892 | } |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 893 | try { |
| 894 | Process p6 = Runtime.getRuntime().exec("ping6 -c 1 www.google.com"); |
| 895 | int status6 = p6.waitFor(); |
| 896 | if (status6 == 0) { |
| 897 | mPingHostnameResultV6 = "Pass"; |
| 898 | } else { |
| 899 | mPingHostnameResultV6 = String.format("Fail(%d)", status6); |
| 900 | } |
| 901 | } catch (IOException e) { |
| 902 | mPingHostnameResultV6 = "Fail: IOException"; |
| 903 | } |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 904 | } catch (InterruptedException e) { |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 905 | mPingHostnameResultV4 = mPingHostnameResultV6 = "Fail: InterruptedException"; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 906 | } |
| 907 | } |
| 908 | |
| 909 | /** |
| 910 | * This function checks for basic functionality of HTTP Client. |
| 911 | */ |
| 912 | private void httpClientTest() { |
Narayan Kamath | f25627c | 2014-12-12 13:53:28 +0000 | [diff] [blame] | 913 | HttpURLConnection urlConnection = null; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 914 | try { |
Narayan Kamath | f25627c | 2014-12-12 13:53:28 +0000 | [diff] [blame] | 915 | // TODO: Hardcoded for now, make it UI configurable |
Alex Klyubin | b009023 | 2015-04-02 11:08:51 -0700 | [diff] [blame] | 916 | URL url = new URL("https://www.google.com"); |
Narayan Kamath | f25627c | 2014-12-12 13:53:28 +0000 | [diff] [blame] | 917 | urlConnection = (HttpURLConnection) url.openConnection(); |
| 918 | if (urlConnection.getResponseCode() == 200) { |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 919 | mHttpClientTestResult = "Pass"; |
| 920 | } else { |
Narayan Kamath | f25627c | 2014-12-12 13:53:28 +0000 | [diff] [blame] | 921 | mHttpClientTestResult = "Fail: Code: " + urlConnection.getResponseMessage(); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 922 | } |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 923 | } catch (IOException e) { |
| 924 | mHttpClientTestResult = "Fail: IOException"; |
Narayan Kamath | f25627c | 2014-12-12 13:53:28 +0000 | [diff] [blame] | 925 | } finally { |
| 926 | if (urlConnection != null) { |
| 927 | urlConnection.disconnect(); |
| 928 | } |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 929 | } |
| 930 | } |
| 931 | |
| 932 | private void refreshSmsc() { |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 933 | //FIXME: Replace with a TelephonyManager call |
jsh | 21dd407 | 2009-05-12 11:26:55 -0700 | [diff] [blame] | 934 | phone.getSmscAddress(mHandler.obtainMessage(EVENT_QUERY_SMSC_DONE)); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 935 | } |
| 936 | |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 937 | private final void updateAllCellInfo() { |
| 938 | |
| 939 | mCellInfo.setText(""); |
| 940 | mNeighboringCids.setText(""); |
| 941 | mLocation.setText(""); |
| 942 | |
| 943 | final Runnable updateAllCellInfoResults = new Runnable() { |
| 944 | public void run() { |
| 945 | updateNeighboringCids(mNeighboringCellResult); |
| 946 | updateLocation(mCellLocationResult); |
| 947 | updateCellInfo(mCellInfoResult); |
| 948 | } |
| 949 | }; |
| 950 | |
| 951 | Thread locThread = new Thread() { |
| 952 | @Override |
| 953 | public void run() { |
| 954 | mCellInfoResult = mTelephonyManager.getAllCellInfo(); |
| 955 | mCellLocationResult = mTelephonyManager.getCellLocation(); |
| 956 | mNeighboringCellResult = mTelephonyManager.getNeighboringCellInfo(); |
| 957 | |
| 958 | mHandler.post(updateAllCellInfoResults); |
| 959 | } |
| 960 | }; |
| 961 | locThread.start(); |
| 962 | } |
| 963 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 964 | private final void updatePingState() { |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 965 | // Set all to unknown since the threads will take a few secs to update. |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 966 | mPingHostnameResultV4 = getResources().getString(R.string.radioInfo_unknown); |
| 967 | mPingHostnameResultV6 = getResources().getString(R.string.radioInfo_unknown); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 968 | mHttpClientTestResult = getResources().getString(R.string.radioInfo_unknown); |
| 969 | |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 970 | mPingHostnameV4.setText(mPingHostnameResultV4); |
| 971 | mPingHostnameV6.setText(mPingHostnameResultV6); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 972 | mHttpClientTest.setText(mHttpClientTestResult); |
| 973 | |
| 974 | final Runnable updatePingResults = new Runnable() { |
| 975 | public void run() { |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 976 | mPingHostnameV4.setText(mPingHostnameResultV4); |
| 977 | mPingHostnameV6.setText(mPingHostnameResultV6); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 978 | mHttpClientTest.setText(mHttpClientTestResult); |
| 979 | } |
| 980 | }; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 981 | |
| 982 | Thread hostname = new Thread() { |
| 983 | @Override |
| 984 | public void run() { |
| 985 | pingHostname(); |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 986 | mHandler.post(updatePingResults); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 987 | } |
| 988 | }; |
| 989 | hostname.start(); |
| 990 | |
| 991 | Thread httpClient = new Thread() { |
| 992 | @Override |
| 993 | public void run() { |
| 994 | httpClientTest(); |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 995 | mHandler.post(updatePingResults); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 996 | } |
| 997 | }; |
| 998 | httpClient.start(); |
| 999 | } |
| 1000 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 1001 | private MenuItem.OnMenuItemClickListener mViewADNCallback = new MenuItem.OnMenuItemClickListener() { |
| 1002 | public boolean onMenuItemClick(MenuItem item) { |
| 1003 | Intent intent = new Intent(Intent.ACTION_VIEW); |
| 1004 | // XXX We need to specify the component here because if we don't |
| 1005 | // the activity manager will try to resolve the type by calling |
| 1006 | // the content provider, which causes it to be loaded in a process |
| 1007 | // other than the Dialer process, which causes a lot of stuff to |
| 1008 | // break. |
| 1009 | intent.setClassName("com.android.phone", |
| 1010 | "com.android.phone.SimContacts"); |
| 1011 | startActivity(intent); |
| 1012 | return true; |
| 1013 | } |
| 1014 | }; |
| 1015 | |
| 1016 | private MenuItem.OnMenuItemClickListener mViewFDNCallback = new MenuItem.OnMenuItemClickListener() { |
| 1017 | public boolean onMenuItemClick(MenuItem item) { |
| 1018 | Intent intent = new Intent(Intent.ACTION_VIEW); |
| 1019 | // XXX We need to specify the component here because if we don't |
| 1020 | // the activity manager will try to resolve the type by calling |
| 1021 | // the content provider, which causes it to be loaded in a process |
| 1022 | // other than the Dialer process, which causes a lot of stuff to |
| 1023 | // break. |
| 1024 | intent.setClassName("com.android.phone", |
Andrew Lee | da90d68 | 2014-10-31 13:12:20 -0700 | [diff] [blame] | 1025 | "com.android.phone.settings.fdn.FdnList"); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 1026 | startActivity(intent); |
| 1027 | return true; |
| 1028 | } |
| 1029 | }; |
| 1030 | |
| 1031 | private MenuItem.OnMenuItemClickListener mViewSDNCallback = new MenuItem.OnMenuItemClickListener() { |
| 1032 | public boolean onMenuItemClick(MenuItem item) { |
| 1033 | Intent intent = new Intent( |
Wink Saville | c388668 | 2009-04-02 11:00:56 -0700 | [diff] [blame] | 1034 | Intent.ACTION_VIEW, Uri.parse("content://icc/sdn")); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 1035 | // XXX We need to specify the component here because if we don't |
| 1036 | // the activity manager will try to resolve the type by calling |
| 1037 | // the content provider, which causes it to be loaded in a process |
| 1038 | // other than the Dialer process, which causes a lot of stuff to |
| 1039 | // break. |
| 1040 | intent.setClassName("com.android.phone", |
| 1041 | "com.android.phone.ADNList"); |
| 1042 | startActivity(intent); |
| 1043 | return true; |
| 1044 | } |
| 1045 | }; |
| 1046 | |
Tammo Spalink | a5f4c8f | 2009-10-15 20:08:58 +0800 | [diff] [blame] | 1047 | private MenuItem.OnMenuItemClickListener mGetPdpList = new MenuItem.OnMenuItemClickListener() { |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 1048 | public boolean onMenuItemClick(MenuItem item) { |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 1049 | //FIXME: Replace with a TelephonyManager call |
Tammo Spalink | a5f4c8f | 2009-10-15 20:08:58 +0800 | [diff] [blame] | 1050 | phone.getDataCallList(null); |
| 1051 | return true; |
| 1052 | } |
| 1053 | }; |
| 1054 | |
| 1055 | private MenuItem.OnMenuItemClickListener mSelectBandCallback = new MenuItem.OnMenuItemClickListener() { |
| 1056 | public boolean onMenuItemClick(MenuItem item) { |
| 1057 | Intent intent = new Intent(); |
| 1058 | intent.setClass(RadioInfo.this, BandMode.class); |
| 1059 | startActivity(intent); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 1060 | return true; |
| 1061 | } |
| 1062 | }; |
johnwang | 342101a | 2009-09-23 16:22:34 -0700 | [diff] [blame] | 1063 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 1064 | private MenuItem.OnMenuItemClickListener mToggleData = new MenuItem.OnMenuItemClickListener() { |
| 1065 | public boolean onMenuItemClick(MenuItem item) { |
| 1066 | int state = mTelephonyManager.getDataState(); |
| 1067 | switch (state) { |
| 1068 | case TelephonyManager.DATA_CONNECTED: |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 1069 | //FIXME: Replace with a TelephonyManager call |
Robert Greenwalt | 0d4c500 | 2014-05-21 20:02:32 -0700 | [diff] [blame] | 1070 | phone.setDataEnabled(false); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 1071 | break; |
| 1072 | case TelephonyManager.DATA_DISCONNECTED: |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 1073 | //FIXME: Replace with a TelephonyManager call |
Robert Greenwalt | 0d4c500 | 2014-05-21 20:02:32 -0700 | [diff] [blame] | 1074 | phone.setDataEnabled(true); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 1075 | break; |
| 1076 | default: |
| 1077 | // do nothing |
| 1078 | break; |
| 1079 | } |
| 1080 | return true; |
| 1081 | } |
| 1082 | }; |
| 1083 | |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 1084 | private boolean isRadioOn() { |
| 1085 | //FIXME: Replace with a TelephonyManager call |
| 1086 | return phone.getServiceState().getState() != ServiceState.STATE_POWER_OFF; |
| 1087 | } |
| 1088 | |
| 1089 | private void updateRadioPowerState() { |
| 1090 | //delightful hack to prevent on-checked-changed calls from |
| 1091 | //actually forcing the radio preference to its transient/current value. |
| 1092 | radioPowerOnSwitch.setOnCheckedChangeListener(null); |
| 1093 | radioPowerOnSwitch.setChecked(isRadioOn()); |
| 1094 | radioPowerOnSwitch.setOnCheckedChangeListener(mRadioPowerOnChangeListener); |
| 1095 | } |
| 1096 | |
| 1097 | OnCheckedChangeListener mRadioPowerOnChangeListener = new OnCheckedChangeListener() { |
| 1098 | @Override |
| 1099 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
| 1100 | log("toggle radio power: currently " + (isRadioOn()?"on":"off")); |
| 1101 | phone.setRadioPower(isChecked); |
| 1102 | } |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 1103 | }; |
| 1104 | |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 1105 | void setImsVoLteProvisionedState( boolean state ) { |
| 1106 | log(String.format("toggle VoLTE provisioned: %s", ((state) ? "on":"off"))); |
Wink Saville | bf47128 | 2013-04-05 15:04:05 -0700 | [diff] [blame] | 1107 | |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 1108 | if (phone != null && mImsManager != null) { |
| 1109 | QueuedWork.singleThreadExecutor().submit(new Runnable() { |
| 1110 | public void run() { |
| 1111 | try { |
| 1112 | mImsManager.getConfigInterface().setProvisionedValue( |
| 1113 | ImsConfig.ConfigConstants.VLT_SETTING_ENABLED, |
| 1114 | state? 1 : 0); |
| 1115 | } catch (ImsException e) { |
| 1116 | Log.e(TAG, "setImsVoLteProvisioned() exception:", e); |
| 1117 | } |
Pavel Zhamaitsiak | cb267a6 | 2015-01-21 18:25:14 -0800 | [diff] [blame] | 1118 | } |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 1119 | }); |
Pavel Zhamaitsiak | cb267a6 | 2015-01-21 18:25:14 -0800 | [diff] [blame] | 1120 | } |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 1121 | } |
Pavel Zhamaitsiak | cb267a6 | 2015-01-21 18:25:14 -0800 | [diff] [blame] | 1122 | |
| 1123 | private boolean isImsVoLteProvisioned() { |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 1124 | if (phone != null && mImsManager != null) { |
| 1125 | return mImsManager.isVolteEnabledByPlatform(phone.getContext()) |
| 1126 | && mImsManager.isVolteProvisionedOnDevice(phone.getContext()); |
Pavel Zhamaitsiak | cb267a6 | 2015-01-21 18:25:14 -0800 | [diff] [blame] | 1127 | } |
| 1128 | return false; |
| 1129 | } |
| 1130 | |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 1131 | OnCheckedChangeListener mImsVoLteCheckedChangeListener = new OnCheckedChangeListener() { |
Wink Saville | 426fc66 | 2011-09-25 14:39:02 -0700 | [diff] [blame] | 1132 | @Override |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 1133 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
| 1134 | setImsVoLteProvisionedState(isChecked); |
| 1135 | } |
Wink Saville | 426fc66 | 2011-09-25 14:39:02 -0700 | [diff] [blame] | 1136 | }; |
| 1137 | |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 1138 | private void updateImsVoLteProvisionedState() { |
| 1139 | log("updateImsVoLteProvisionedState isImsVoLteProvisioned()=" + isImsVoLteProvisioned()); |
| 1140 | //delightful hack to prevent on-checked-changed calls from |
| 1141 | //actually forcing the ims provisioning to its transient/current value. |
| 1142 | imsVoLteProvisionedSwitch.setOnCheckedChangeListener(null); |
| 1143 | imsVoLteProvisionedSwitch.setChecked(isImsVoLteProvisioned()); |
| 1144 | imsVoLteProvisionedSwitch.setOnCheckedChangeListener(mImsVoLteCheckedChangeListener); |
Wink Saville | 426fc66 | 2011-09-25 14:39:02 -0700 | [diff] [blame] | 1145 | } |
| 1146 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 1147 | OnClickListener mDnsCheckButtonHandler = new OnClickListener() { |
| 1148 | public void onClick(View v) { |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 1149 | //FIXME: Replace with a TelephonyManager call |
Wink Saville | c388668 | 2009-04-02 11:00:56 -0700 | [diff] [blame] | 1150 | phone.disableDnsCheck(!phone.isDnsCheckDisabled()); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 1151 | updateDnsCheckState(); |
| 1152 | } |
| 1153 | }; |
johnwang | 342101a | 2009-09-23 16:22:34 -0700 | [diff] [blame] | 1154 | |
Tammo Spalink | a5f4c8f | 2009-10-15 20:08:58 +0800 | [diff] [blame] | 1155 | OnClickListener mOemInfoButtonHandler = new OnClickListener() { |
| 1156 | public void onClick(View v) { |
| 1157 | Intent intent = new Intent("com.android.settings.OEM_RADIO_INFO"); |
| 1158 | try { |
| 1159 | startActivity(intent); |
| 1160 | } catch (android.content.ActivityNotFoundException ex) { |
Wink Saville | bf47128 | 2013-04-05 15:04:05 -0700 | [diff] [blame] | 1161 | log("OEM-specific Info/Settings Activity Not Found : " + ex); |
Tammo Spalink | a5f4c8f | 2009-10-15 20:08:58 +0800 | [diff] [blame] | 1162 | // If the activity does not exist, there are no OEM |
| 1163 | // settings, and so we can just do nothing... |
| 1164 | } |
| 1165 | } |
| 1166 | }; |
| 1167 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 1168 | OnClickListener mPingButtonHandler = new OnClickListener() { |
| 1169 | public void onClick(View v) { |
| 1170 | updatePingState(); |
| 1171 | } |
| 1172 | }; |
| 1173 | |
| 1174 | OnClickListener mUpdateSmscButtonHandler = new OnClickListener() { |
| 1175 | public void onClick(View v) { |
| 1176 | updateSmscButton.setEnabled(false); |
jsh | 21dd407 | 2009-05-12 11:26:55 -0700 | [diff] [blame] | 1177 | phone.setSmscAddress(smsc.getText().toString(), |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 1178 | mHandler.obtainMessage(EVENT_UPDATE_SMSC_DONE)); |
| 1179 | } |
| 1180 | }; |
| 1181 | |
| 1182 | OnClickListener mRefreshSmscButtonHandler = new OnClickListener() { |
| 1183 | public void onClick(View v) { |
| 1184 | refreshSmsc(); |
| 1185 | } |
| 1186 | }; |
| 1187 | |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 1188 | AdapterView.OnItemSelectedListener mPreferredNetworkHandler = |
| 1189 | new AdapterView.OnItemSelectedListener() { |
| 1190 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 1191 | public void onItemSelected(AdapterView parent, View v, int pos, long id) { |
Nathan Harold | cea413a | 2015-11-23 15:48:10 -0800 | [diff] [blame] | 1192 | if (mPreferredNetworkTypeResult != pos && pos >= 0 |
| 1193 | && pos <= mPreferredNetworkLabels.length - 2) { |
| 1194 | mPreferredNetworkTypeResult = pos; |
| 1195 | Message msg = mHandler.obtainMessage(EVENT_SET_PREFERRED_TYPE_DONE); |
| 1196 | phone.setPreferredNetworkType(mPreferredNetworkTypeResult, msg); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 1197 | } |
| 1198 | } |
| 1199 | |
| 1200 | public void onNothingSelected(AdapterView parent) { |
| 1201 | } |
| 1202 | }; |
| 1203 | |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 1204 | AdapterView.OnItemSelectedListener mCellInfoRefreshRateHandler = |
| 1205 | new AdapterView.OnItemSelectedListener() { |
Wink Saville | bf47128 | 2013-04-05 15:04:05 -0700 | [diff] [blame] | 1206 | |
Nathan Harold | 2b77d74 | 2016-03-19 13:22:10 -0700 | [diff] [blame^] | 1207 | public void onItemSelected(AdapterView parent, View v, int pos, long id) { |
| 1208 | mCellInfoRefreshRateIndex = pos; |
| 1209 | phone.setCellInfoListRate(mCellInfoRefreshRates[pos]); |
| 1210 | updateAllCellInfo(); |
| 1211 | } |
| 1212 | |
| 1213 | public void onNothingSelected(AdapterView parent) { |
| 1214 | } |
| 1215 | }; |
| 1216 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 1217 | } |