blob: db6bd9b8983b6f5203bb0025568bb8a0a912c6a0 [file] [log] [blame]
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001/*
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
17package com.android.settings;
18
Nathan Haroldf10ea322018-04-24 13:31:07 -070019import static android.net.ConnectivityManager.NetworkCallback;
Nathan Harolddaea8be2018-06-05 14:02:35 -070020import static android.provider.Settings.Global.PREFERRED_NETWORK_MODE;
Nathan Haroldf10ea322018-04-24 13:31:07 -070021
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -080022import android.app.Activity;
Pavel Zhamaitsiakcb267a62015-01-21 18:25:14 -080023import android.app.QueuedWork;
Youhan Wangfd781e92016-12-16 15:53:16 -080024import android.content.ComponentName;
Meng Wang586741c2017-04-26 15:02:51 -070025import android.content.Context;
Pengquan Meng7f602c72019-01-28 19:12:18 -080026import android.content.DialogInterface;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -080027import android.content.Intent;
Tammo Spalinka5f4c8f2009-10-15 20:08:58 +080028import android.content.pm.PackageManager;
29import android.content.pm.ResolveInfo;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -080030import android.content.res.Resources;
Nathan Haroldcea413a2015-11-23 15:48:10 -080031import android.graphics.Typeface;
Nathan Haroldf10ea322018-04-24 13:31:07 -070032import android.net.ConnectivityManager;
33import android.net.Network;
34import android.net.NetworkCapabilities;
35import android.net.NetworkRequest;
Jeff Sharkey93029862011-05-27 18:26:15 -070036import android.net.TrafficStats;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -080037import android.net.Uri;
38import android.os.AsyncResult;
Sreekanth Badidac888e192018-02-05 17:18:40 +010039import android.os.Build;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -080040import android.os.Bundle;
41import android.os.Handler;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -080042import android.os.Message;
Nathan Harolddaea8be2018-06-05 14:02:35 -070043import android.provider.Settings;
Pengquan Meng7f602c72019-01-28 19:12:18 -080044import android.provider.Telephony;
Meng Wang586741c2017-04-26 15:02:51 -070045import android.telephony.CarrierConfigManager;
Fan Zhangc7162cd2018-06-18 15:21:41 -070046import android.telephony.CellIdentityCdma;
47import android.telephony.CellIdentityGsm;
48import android.telephony.CellIdentityLte;
49import android.telephony.CellIdentityWcdma;
Wink Saville79bff2a2012-06-01 14:37:21 -070050import android.telephony.CellInfo;
Nathan Haroldcea413a2015-11-23 15:48:10 -080051import android.telephony.CellInfoCdma;
52import android.telephony.CellInfoGsm;
53import android.telephony.CellInfoLte;
54import android.telephony.CellInfoWcdma;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -080055import android.telephony.CellLocation;
Nathan Haroldcea413a2015-11-23 15:48:10 -080056import android.telephony.CellSignalStrengthCdma;
57import android.telephony.CellSignalStrengthGsm;
58import android.telephony.CellSignalStrengthLte;
59import android.telephony.CellSignalStrengthWcdma;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -080060import android.telephony.PhoneStateListener;
Nathan Harold433ca442018-04-23 18:20:43 -070061import android.telephony.PhysicalChannelConfig;
Fan Zhangc7162cd2018-06-18 15:21:41 -070062import android.telephony.PreciseCallState;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -080063import android.telephony.ServiceState;
Nathan Harold2b77d742016-03-19 13:22:10 -070064import android.telephony.SignalStrength;
Nathan Haroldcea413a2015-11-23 15:48:10 -080065import android.telephony.SubscriptionManager;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -080066import android.telephony.TelephonyManager;
jsh534f5ae2009-09-24 09:19:22 -070067import android.telephony.cdma.CdmaCellLocation;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -080068import android.telephony.gsm.GsmCellLocation;
Nathan Harold6e16fdf2018-04-17 17:01:32 -070069import android.text.TextUtils;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -080070import android.util.Log;
71import android.view.Menu;
72import android.view.MenuItem;
73import android.view.View;
74import android.view.View.OnClickListener;
75import android.widget.AdapterView;
76import android.widget.ArrayAdapter;
77import android.widget.Button;
Nathan Harold2b77d742016-03-19 13:22:10 -070078import android.widget.CompoundButton;
79import android.widget.CompoundButton.OnCheckedChangeListener;
Jason Monk39b46742015-09-10 15:52:51 -040080import android.widget.EditText;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -080081import android.widget.Spinner;
Nathan Harold2b77d742016-03-19 13:22:10 -070082import android.widget.Switch;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -080083import android.widget.TextView;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -080084
Fan Zhang23f8d592018-08-28 15:11:40 -070085import androidx.appcompat.app.AlertDialog;
Pengquan Meng7f602c72019-01-28 19:12:18 -080086import androidx.appcompat.app.AlertDialog.Builder;
Fan Zhang23f8d592018-08-28 15:11:40 -070087
Jason Monk39b46742015-09-10 15:52:51 -040088import com.android.ims.ImsConfig;
89import com.android.ims.ImsException;
90import com.android.ims.ImsManager;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -080091import com.android.internal.telephony.Phone;
Pengquan Meng7f602c72019-01-28 19:12:18 -080092import com.android.internal.telephony.PhoneConfigurationManager;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -080093import com.android.internal.telephony.PhoneFactory;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -080094
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -080095import java.io.IOException;
Jason Monk39b46742015-09-10 15:52:51 -040096import java.net.HttpURLConnection;
97import java.net.URL;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -080098import java.util.List;
99
Pengquan Meng7f602c72019-01-28 19:12:18 -0800100// TODO(b/123598192) consider to move this activity to telephony package.
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800101public class RadioInfo extends Activity {
Nathan Harold2b77d742016-03-19 13:22:10 -0700102 private static final String TAG = "RadioInfo";
johnwang342101a2009-09-23 16:22:34 -0700103
Nathan Harold2b77d742016-03-19 13:22:10 -0700104 private static final String[] mPreferredNetworkLabels = {
105 "WCDMA preferred",
106 "GSM only",
107 "WCDMA only",
108 "GSM auto (PRL)",
109 "CDMA auto (PRL)",
110 "CDMA only",
111 "EvDo only",
112 "Global auto (PRL)",
113 "LTE/CDMA auto (PRL)",
114 "LTE/UMTS auto (PRL)",
115 "LTE/CDMA/UMTS auto (PRL)",
116 "LTE only",
117 "LTE/WCDMA",
118 "TD-SCDMA only",
119 "TD-SCDMA/WCDMA",
120 "LTE/TD-SCDMA",
121 "TD-SCDMA/GSM",
122 "TD-SCDMA/UMTS",
123 "LTE/TD-SCDMA/WCDMA",
124 "LTE/TD-SCDMA/UMTS",
125 "TD-SCDMA/CDMA/UMTS",
126 "Global/TD-SCDMA",
127 "Unknown"
128 };
129
130
131 private static final int CELL_INFO_LIST_RATE_DISABLED = Integer.MAX_VALUE;
132 private static final int CELL_INFO_LIST_RATE_MAX = 0;
133
Nathan Harold12e1f552016-06-17 13:55:38 -0700134
135 private static final int IMS_VOLTE_PROVISIONED_CONFIG_ID =
136 ImsConfig.ConfigConstants.VLT_SETTING_ENABLED;
137
138 private static final int IMS_VT_PROVISIONED_CONFIG_ID =
139 ImsConfig.ConfigConstants.LVC_SETTING_ENABLED;
140
141 private static final int IMS_WFC_PROVISIONED_CONFIG_ID =
142 ImsConfig.ConfigConstants.VOICE_OVER_WIFI_SETTING_ENABLED;
143
Meng Wang586741c2017-04-26 15:02:51 -0700144 private static final int EAB_PROVISIONED_CONFIG_ID =
145 ImsConfig.ConfigConstants.EAB_SETTING_ENABLED;
146
Nathan Harold2b77d742016-03-19 13:22:10 -0700147 //Values in must match mCellInfoRefreshRates
148 private static final String[] mCellInfoRefreshRateLabels = {
149 "Disabled",
150 "Immediate",
151 "Min 5s",
152 "Min 10s",
153 "Min 60s"
154 };
155
156 //Values in seconds, must match mCellInfoRefreshRateLabels
157 private static final int mCellInfoRefreshRates[] = {
158 CELL_INFO_LIST_RATE_DISABLED,
159 CELL_INFO_LIST_RATE_MAX,
160 5000,
161 10000,
162 60000
163 };
164
165 private void log(String s) {
166 Log.d(TAG, s);
167 }
168
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800169 private static final int EVENT_CFI_CHANGED = 302;
170
171 private static final int EVENT_QUERY_PREFERRED_TYPE_DONE = 1000;
172 private static final int EVENT_SET_PREFERRED_TYPE_DONE = 1001;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800173 private static final int EVENT_QUERY_SMSC_DONE = 1005;
174 private static final int EVENT_UPDATE_SMSC_DONE = 1006;
175
176 private static final int MENU_ITEM_SELECT_BAND = 0;
177 private static final int MENU_ITEM_VIEW_ADN = 1;
178 private static final int MENU_ITEM_VIEW_FDN = 2;
179 private static final int MENU_ITEM_VIEW_SDN = 3;
Nathan Harolde272c202016-10-27 13:45:00 -0700180 private static final int MENU_ITEM_GET_IMS_STATUS = 4;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800181 private static final int MENU_ITEM_TOGGLE_DATA = 5;
Tammo Spalinka5f4c8f2009-10-15 20:08:58 +0800182
Wink Savillec3886682009-04-02 11:00:56 -0700183 private TextView mDeviceId; //DeviceId is the IMEI in GSM and the MEID in CDMA
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800184 private TextView number;
Meng Wang9053f172017-06-23 16:02:14 -0700185 private TextView mSubscriberId;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800186 private TextView callState;
187 private TextView operatorName;
188 private TextView roamingState;
189 private TextView gsmState;
190 private TextView gprsState;
Nathan Harold2b77d742016-03-19 13:22:10 -0700191 private TextView voiceNetwork;
192 private TextView dataNetwork;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800193 private TextView dBm;
194 private TextView mMwi;
195 private TextView mCfi;
196 private TextView mLocation;
Wink Saville79bff2a2012-06-01 14:37:21 -0700197 private TextView mCellInfo;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800198 private TextView sent;
199 private TextView received;
Nathan Haroldcea413a2015-11-23 15:48:10 -0800200 private TextView mPingHostnameV4;
201 private TextView mPingHostnameV6;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800202 private TextView mHttpClientTest;
Nathan Harold433ca442018-04-23 18:20:43 -0700203 private TextView mPhyChanConfig;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800204 private TextView dnsCheckState;
Nathan Haroldf10ea322018-04-24 13:31:07 -0700205 private TextView mDownlinkKbps;
206 private TextView mUplinkKbps;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800207 private EditText smsc;
Nathan Harold2b77d742016-03-19 13:22:10 -0700208 private Switch radioPowerOnSwitch;
209 private Button cellInfoRefreshRateButton;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800210 private Button dnsCheckToggleButton;
211 private Button pingTestButton;
212 private Button updateSmscButton;
213 private Button refreshSmscButton;
Tammo Spalinka5f4c8f2009-10-15 20:08:58 +0800214 private Button oemInfoButton;
Youhan Wangfd781e92016-12-16 15:53:16 -0800215 private Button carrierProvisioningButton;
216 private Button triggercarrierProvisioningButton;
Nathan Harold12e1f552016-06-17 13:55:38 -0700217 private Switch imsVolteProvisionedSwitch;
218 private Switch imsVtProvisionedSwitch;
219 private Switch imsWfcProvisionedSwitch;
Meng Wang586741c2017-04-26 15:02:51 -0700220 private Switch eabProvisionedSwitch;
Naina Nallurid1b57f62019-01-08 15:19:58 -0800221 private Switch cbrsDataSwitch;
Pengquan Meng7f602c72019-01-28 19:12:18 -0800222 private Switch dsdsSwitch;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800223 private Spinner preferredNetworkType;
Nathan Harold2b77d742016-03-19 13:22:10 -0700224 private Spinner cellInfoRefreshRateSpinner;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800225
Nathan Haroldf10ea322018-04-24 13:31:07 -0700226 private ConnectivityManager mConnectivityManager;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800227 private TelephonyManager mTelephonyManager;
Nathan Haroldcea413a2015-11-23 15:48:10 -0800228 private ImsManager mImsManager = null;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800229 private Phone phone = null;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800230
Nathan Haroldcea413a2015-11-23 15:48:10 -0800231 private String mPingHostnameResultV4;
232 private String mPingHostnameResultV6;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800233 private String mHttpClientTestResult;
234 private boolean mMwiValue = false;
235 private boolean mCfiValue = false;
Nathan Haroldcea413a2015-11-23 15:48:10 -0800236
237 private List<CellInfo> mCellInfoResult = null;
238 private CellLocation mCellLocationResult = null;
Nathan Haroldcea413a2015-11-23 15:48:10 -0800239
240 private int mPreferredNetworkTypeResult;
Nathan Harold2b77d742016-03-19 13:22:10 -0700241 private int mCellInfoRefreshRateIndex;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800242
Nathan Haroldf10ea322018-04-24 13:31:07 -0700243 private final NetworkRequest mDefaultNetworkRequest = new NetworkRequest.Builder()
244 .addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR)
245 .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
246 .build();
247
248 private final NetworkCallback mNetworkCallback = new NetworkCallback() {
249 public void onCapabilitiesChanged(Network n, NetworkCapabilities nc) {
250 int dlbw = nc.getLinkDownstreamBandwidthKbps();
251 int ulbw = nc.getLinkUpstreamBandwidthKbps();
252 updateBandwidths(dlbw, ulbw);
253 }
254 };
255
Nathan Harold2b77d742016-03-19 13:22:10 -0700256 private final PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800257 @Override
258 public void onDataConnectionStateChanged(int state) {
259 updateDataState();
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800260 updateNetworkType();
261 }
262
263 @Override
264 public void onDataActivity(int direction) {
265 updateDataStats2();
266 }
267
268 @Override
Nathan Harold2b77d742016-03-19 13:22:10 -0700269 public void onCallStateChanged(int state, String incomingNumber) {
270 updateNetworkType();
271 updatePhoneState(state);
272 }
273
274 @Override
275 public void onPreciseCallStateChanged(PreciseCallState preciseState) {
276 updateNetworkType();
277 }
278
279 @Override
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800280 public void onCellLocationChanged(CellLocation location) {
281 updateLocation(location);
282 }
283
284 @Override
285 public void onMessageWaitingIndicatorChanged(boolean mwi) {
286 mMwiValue = mwi;
287 updateMessageWaiting();
288 }
289
290 @Override
291 public void onCallForwardingIndicatorChanged(boolean cfi) {
292 mCfiValue = cfi;
293 updateCallRedirect();
294 }
Wink Saville79bff2a2012-06-01 14:37:21 -0700295
296 @Override
297 public void onCellInfoChanged(List<CellInfo> arrayCi) {
Wink Savillebf471282013-04-05 15:04:05 -0700298 log("onCellInfoChanged: arrayCi=" + arrayCi);
Nathan Haroldcea413a2015-11-23 15:48:10 -0800299 mCellInfoResult = arrayCi;
300 updateCellInfo(mCellInfoResult);
Wink Saville79bff2a2012-06-01 14:37:21 -0700301 }
Wink Saville4f0d8812014-04-15 22:05:24 -0700302
303 @Override
Nathan Harold2b77d742016-03-19 13:22:10 -0700304 public void onSignalStrengthsChanged(SignalStrength signalStrength) {
305 log("onSignalStrengthChanged: SignalStrength=" +signalStrength);
306 updateSignalStrength(signalStrength);
307 }
308
309 @Override
310 public void onServiceStateChanged(ServiceState serviceState) {
311 log("onServiceStateChanged: ServiceState=" + serviceState);
312 updateServiceState(serviceState);
313 updateRadioPowerState();
314 updateNetworkType();
Nathan Harold12e1f552016-06-17 13:55:38 -0700315 updateImsProvisionedState();
Nathan Harold2b77d742016-03-19 13:22:10 -0700316 }
Nathan Harold433ca442018-04-23 18:20:43 -0700317
318 @Override
319 public void onPhysicalChannelConfigurationChanged(
320 List<PhysicalChannelConfig> configs) {
321 updatePhysicalChannelConfiguration(configs);
322 }
323
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800324 };
325
Nathan Harold433ca442018-04-23 18:20:43 -0700326 private void updatePhysicalChannelConfiguration(List<PhysicalChannelConfig> configs) {
327 StringBuilder sb = new StringBuilder();
328 String div = "";
329 sb.append("{");
330 if (configs != null) {
331 for(PhysicalChannelConfig c : configs) {
332 sb.append(div).append(c);
333 div = ",";
334 }
335 }
336 sb.append("}");
337 mPhyChanConfig.setText(sb.toString());
338 }
339
Nathan Haroldcea413a2015-11-23 15:48:10 -0800340 private void updatePreferredNetworkType(int type) {
341 if (type >= mPreferredNetworkLabels.length || type < 0) {
342 log("EVENT_QUERY_PREFERRED_TYPE_DONE: unknown " +
343 "type=" + type);
344 type = mPreferredNetworkLabels.length - 1; //set to Unknown
345 }
346 mPreferredNetworkTypeResult = type;
347
348 preferredNetworkType.setSelection(mPreferredNetworkTypeResult, true);
349 }
350
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800351 private Handler mHandler = new Handler() {
Nathan Haroldcea413a2015-11-23 15:48:10 -0800352 @Override
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800353 public void handleMessage(Message msg) {
354 AsyncResult ar;
355 switch (msg.what) {
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800356 case EVENT_QUERY_PREFERRED_TYPE_DONE:
357 ar= (AsyncResult) msg.obj;
Nathan Haroldcea413a2015-11-23 15:48:10 -0800358 if (ar.exception == null && ar.result != null) {
359 updatePreferredNetworkType(((int[])ar.result)[0]);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800360 } else {
Nathan Haroldcea413a2015-11-23 15:48:10 -0800361 //In case of an exception, we will set this to unknown
362 updatePreferredNetworkType(mPreferredNetworkLabels.length-1);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800363 }
364 break;
365 case EVENT_SET_PREFERRED_TYPE_DONE:
366 ar= (AsyncResult) msg.obj;
367 if (ar.exception != null) {
Nathan Harolded38afa2016-04-13 00:29:30 -0700368 log("Set preferred network type failed.");
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800369 }
370 break;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800371 case EVENT_QUERY_SMSC_DONE:
372 ar= (AsyncResult) msg.obj;
373 if (ar.exception != null) {
374 smsc.setText("refresh error");
375 } else {
jsh21dd4072009-05-12 11:26:55 -0700376 smsc.setText((String)ar.result);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800377 }
378 break;
379 case EVENT_UPDATE_SMSC_DONE:
380 updateSmscButton.setEnabled(true);
381 ar= (AsyncResult) msg.obj;
382 if (ar.exception != null) {
383 smsc.setText("update error");
384 }
385 break;
386 default:
Nathan Haroldcea413a2015-11-23 15:48:10 -0800387 super.handleMessage(msg);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800388 break;
389
390 }
391 }
392 };
393
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800394 @Override
395 public void onCreate(Bundle icicle) {
396 super.onCreate(icicle);
fionaxub54cb2d2016-09-22 15:01:05 -0700397 if (!android.os.Process.myUserHandle().isSystem()) {
398 Log.e(TAG, "Not run from system user, don't do anything.");
399 finish();
400 return;
401 }
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800402
403 setContentView(R.layout.radio_info);
404
Nathan Haroldcea413a2015-11-23 15:48:10 -0800405 log("Started onCreate");
406
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800407 mTelephonyManager = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
Nathan Haroldf10ea322018-04-24 13:31:07 -0700408 mConnectivityManager = (ConnectivityManager)getSystemService(CONNECTIVITY_SERVICE);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800409 phone = PhoneFactory.getDefaultPhone();
410
Nathan Haroldcea413a2015-11-23 15:48:10 -0800411 //TODO: Need to update this if the default phoneId changes?
412 // Better to have an instance per phone?
413 mImsManager = ImsManager.getInstance(getApplicationContext(),
414 SubscriptionManager.getDefaultVoicePhoneId());
415
Meng Wang9053f172017-06-23 16:02:14 -0700416 mDeviceId = (TextView) findViewById(R.id.imei);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800417 number = (TextView) findViewById(R.id.number);
Meng Wang9053f172017-06-23 16:02:14 -0700418 mSubscriberId = (TextView) findViewById(R.id.imsi);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800419 callState = (TextView) findViewById(R.id.call);
420 operatorName = (TextView) findViewById(R.id.operator);
421 roamingState = (TextView) findViewById(R.id.roaming);
422 gsmState = (TextView) findViewById(R.id.gsm);
423 gprsState = (TextView) findViewById(R.id.gprs);
Nathan Harold2b77d742016-03-19 13:22:10 -0700424 voiceNetwork = (TextView) findViewById(R.id.voice_network);
425 dataNetwork = (TextView) findViewById(R.id.data_network);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800426 dBm = (TextView) findViewById(R.id.dbm);
427 mMwi = (TextView) findViewById(R.id.mwi);
428 mCfi = (TextView) findViewById(R.id.cfi);
429 mLocation = (TextView) findViewById(R.id.location);
Wink Saville79bff2a2012-06-01 14:37:21 -0700430 mCellInfo = (TextView) findViewById(R.id.cellinfo);
Nathan Haroldcea413a2015-11-23 15:48:10 -0800431 mCellInfo.setTypeface(Typeface.MONOSPACE);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800432
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800433 sent = (TextView) findViewById(R.id.sent);
434 received = (TextView) findViewById(R.id.received);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800435 smsc = (EditText) findViewById(R.id.smsc);
436 dnsCheckState = (TextView) findViewById(R.id.dnsCheckState);
Nathan Haroldcea413a2015-11-23 15:48:10 -0800437 mPingHostnameV4 = (TextView) findViewById(R.id.pingHostnameV4);
438 mPingHostnameV6 = (TextView) findViewById(R.id.pingHostnameV6);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800439 mHttpClientTest = (TextView) findViewById(R.id.httpClientTest);
440
Nathan Harold433ca442018-04-23 18:20:43 -0700441 mPhyChanConfig = (TextView) findViewById(R.id.phy_chan_config);
442
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800443 preferredNetworkType = (Spinner) findViewById(R.id.preferredNetworkType);
444 ArrayAdapter<String> adapter = new ArrayAdapter<String> (this,
445 android.R.layout.simple_spinner_item, mPreferredNetworkLabels);
johnwang342101a2009-09-23 16:22:34 -0700446 adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800447 preferredNetworkType.setAdapter(adapter);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800448
Nathan Harold2b77d742016-03-19 13:22:10 -0700449 cellInfoRefreshRateSpinner = (Spinner) findViewById(R.id.cell_info_rate_select);
450 ArrayAdapter<String> cellInfoAdapter = new ArrayAdapter<String>(this,
451 android.R.layout.simple_spinner_item, mCellInfoRefreshRateLabels);
452 cellInfoAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
453 cellInfoRefreshRateSpinner.setAdapter(cellInfoAdapter);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800454
Nathan Harold12e1f552016-06-17 13:55:38 -0700455 imsVolteProvisionedSwitch = (Switch) findViewById(R.id.volte_provisioned_switch);
456 imsVtProvisionedSwitch = (Switch) findViewById(R.id.vt_provisioned_switch);
457 imsWfcProvisionedSwitch = (Switch) findViewById(R.id.wfc_provisioned_switch);
Meng Wang69439b52017-05-01 08:31:14 -0700458 eabProvisionedSwitch = (Switch) findViewById(R.id.eab_provisioned_switch);
Wink Savillebf471282013-04-05 15:04:05 -0700459
Naina Nallurid1b57f62019-01-08 15:19:58 -0800460 cbrsDataSwitch = (Switch) findViewById(R.id.cbrs_data_switch);
461 cbrsDataSwitch.setVisibility(isCbrsSupported() ? View.VISIBLE : View.GONE);
462
Pengquan Meng7f602c72019-01-28 19:12:18 -0800463 dsdsSwitch = findViewById(R.id.dsds_switch);
464 if (isDsdsSupported()) {
465 dsdsSwitch.setVisibility(View.VISIBLE);
466 dsdsSwitch.setOnClickListener(v -> {
467 if (mTelephonyManager.isRebootRequiredForModemConfigChange()) {
468 // Undo the click action until user clicks the confirm dialog.
469 dsdsSwitch.toggle();
470 showDsdsChangeDialog();
471 } else {
472 performDsdsSwitch();
473 }
474 });
475 dsdsSwitch.setChecked(isDsdsEnabled());
476 } else {
477 dsdsSwitch.setVisibility(View.GONE);
478 }
479
Nathan Harold2b77d742016-03-19 13:22:10 -0700480 radioPowerOnSwitch = (Switch) findViewById(R.id.radio_power);
Wink Saville426fc662011-09-25 14:39:02 -0700481
Nathan Haroldf10ea322018-04-24 13:31:07 -0700482 mDownlinkKbps = (TextView) findViewById(R.id.dl_kbps);
483 mUplinkKbps = (TextView) findViewById(R.id.ul_kbps);
484 updateBandwidths(0, 0);
485
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800486 pingTestButton = (Button) findViewById(R.id.ping_test);
487 pingTestButton.setOnClickListener(mPingButtonHandler);
488 updateSmscButton = (Button) findViewById(R.id.update_smsc);
489 updateSmscButton.setOnClickListener(mUpdateSmscButtonHandler);
490 refreshSmscButton = (Button) findViewById(R.id.refresh_smsc);
491 refreshSmscButton.setOnClickListener(mRefreshSmscButtonHandler);
492 dnsCheckToggleButton = (Button) findViewById(R.id.dns_check_toggle);
493 dnsCheckToggleButton.setOnClickListener(mDnsCheckButtonHandler);
Youhan Wangfd781e92016-12-16 15:53:16 -0800494 carrierProvisioningButton = (Button) findViewById(R.id.carrier_provisioning);
495 carrierProvisioningButton.setOnClickListener(mCarrierProvisioningButtonHandler);
496 triggercarrierProvisioningButton = (Button) findViewById(R.id.trigger_carrier_provisioning);
497 triggercarrierProvisioningButton.setOnClickListener(
498 mTriggerCarrierProvisioningButtonHandler);
johnwang342101a2009-09-23 16:22:34 -0700499
Tammo Spalinka5f4c8f2009-10-15 20:08:58 +0800500 oemInfoButton = (Button) findViewById(R.id.oem_info);
501 oemInfoButton.setOnClickListener(mOemInfoButtonHandler);
502 PackageManager pm = getPackageManager();
503 Intent oemInfoIntent = new Intent("com.android.settings.OEM_RADIO_INFO");
504 List<ResolveInfo> oemInfoIntentList = pm.queryIntentActivities(oemInfoIntent, 0);
505 if (oemInfoIntentList.size() == 0) {
506 oemInfoButton.setEnabled(false);
507 }
508
Nathan Harolded38afa2016-04-13 00:29:30 -0700509 mCellInfoRefreshRateIndex = 0; //disabled
Nathan Haroldcea413a2015-11-23 15:48:10 -0800510 mPreferredNetworkTypeResult = mPreferredNetworkLabels.length - 1; //Unknown
511
512 //FIXME: Replace with TelephonyManager call
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800513 phone.getPreferredNetworkType(
514 mHandler.obtainMessage(EVENT_QUERY_PREFERRED_TYPE_DONE));
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800515
Nathan Haroldcea413a2015-11-23 15:48:10 -0800516 restoreFromBundle(icicle);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800517 }
518
519 @Override
520 protected void onResume() {
521 super.onResume();
522
Nathan Haroldcea413a2015-11-23 15:48:10 -0800523 log("Started onResume");
524
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800525 updateMessageWaiting();
526 updateCallRedirect();
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800527 updateDataState();
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800528 updateDataStats2();
Nathan Harold2b77d742016-03-19 13:22:10 -0700529 updateRadioPowerState();
Nathan Harold12e1f552016-06-17 13:55:38 -0700530 updateImsProvisionedState();
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800531 updateProperties();
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800532 updateDnsCheckState();
Nathan Harold2b77d742016-03-19 13:22:10 -0700533 updateNetworkType();
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800534
Nathan Haroldcea413a2015-11-23 15:48:10 -0800535 updateLocation(mCellLocationResult);
536 updateCellInfo(mCellInfoResult);
537
538 mPingHostnameV4.setText(mPingHostnameResultV4);
539 mPingHostnameV6.setText(mPingHostnameResultV6);
540 mHttpClientTest.setText(mHttpClientTestResult);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800541
Nathan Harold2b77d742016-03-19 13:22:10 -0700542 cellInfoRefreshRateSpinner.setOnItemSelectedListener(mCellInfoRefreshRateHandler);
Nathan Harolded38afa2016-04-13 00:29:30 -0700543 //set selection after registering listener to force update
544 cellInfoRefreshRateSpinner.setSelection(mCellInfoRefreshRateIndex);
545
546 //set selection before registering to prevent update
547 preferredNetworkType.setSelection(mPreferredNetworkTypeResult, true);
Nathan Harold2b77d742016-03-19 13:22:10 -0700548 preferredNetworkType.setOnItemSelectedListener(mPreferredNetworkHandler);
Nathan Harolded38afa2016-04-13 00:29:30 -0700549
Nathan Harold2b77d742016-03-19 13:22:10 -0700550 radioPowerOnSwitch.setOnCheckedChangeListener(mRadioPowerOnChangeListener);
Nathan Harold12e1f552016-06-17 13:55:38 -0700551 imsVolteProvisionedSwitch.setOnCheckedChangeListener(mImsVolteCheckedChangeListener);
552 imsVtProvisionedSwitch.setOnCheckedChangeListener(mImsVtCheckedChangeListener);
553 imsWfcProvisionedSwitch.setOnCheckedChangeListener(mImsWfcCheckedChangeListener);
Meng Wang586741c2017-04-26 15:02:51 -0700554 eabProvisionedSwitch.setOnCheckedChangeListener(mEabCheckedChangeListener);
Nathan Harold2b77d742016-03-19 13:22:10 -0700555
Naina Nallurid1b57f62019-01-08 15:19:58 -0800556 if (isCbrsSupported()) {
557 cbrsDataSwitch.setChecked(getCbrsDataState());
558 cbrsDataSwitch.setOnCheckedChangeListener(mCbrsDataSwitchChangeListener);
559 }
560
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800561 mTelephonyManager.listen(mPhoneStateListener,
Nathan Harold2b77d742016-03-19 13:22:10 -0700562 PhoneStateListener.LISTEN_CALL_STATE
563 //b/27803938 - RadioInfo currently cannot read PRECISE_CALL_STATE
564 // | PhoneStateListener.LISTEN_PRECISE_CALL_STATE
565 | PhoneStateListener.LISTEN_DATA_CONNECTION_STATE
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800566 | PhoneStateListener.LISTEN_DATA_ACTIVITY
567 | PhoneStateListener.LISTEN_CELL_LOCATION
568 | PhoneStateListener.LISTEN_MESSAGE_WAITING_INDICATOR
Wink Saville79bff2a2012-06-01 14:37:21 -0700569 | PhoneStateListener.LISTEN_CALL_FORWARDING_INDICATOR
Wink Saville4f0d8812014-04-15 22:05:24 -0700570 | PhoneStateListener.LISTEN_CELL_INFO
Nathan Harold2b77d742016-03-19 13:22:10 -0700571 | PhoneStateListener.LISTEN_SERVICE_STATE
572 | PhoneStateListener.LISTEN_SIGNAL_STRENGTHS
Nathan Harold433ca442018-04-23 18:20:43 -0700573 | PhoneStateListener.LISTEN_PHYSICAL_CHANNEL_CONFIGURATION);
Nathan Harolded38afa2016-04-13 00:29:30 -0700574
Nathan Haroldf10ea322018-04-24 13:31:07 -0700575 mConnectivityManager.registerNetworkCallback(
576 mDefaultNetworkRequest, mNetworkCallback, mHandler);
577
Nathan Harolded38afa2016-04-13 00:29:30 -0700578 smsc.clearFocus();
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800579 }
580
581 @Override
Nathan Haroldcea413a2015-11-23 15:48:10 -0800582 protected void onPause() {
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800583 super.onPause();
584
Wink Savillebf471282013-04-05 15:04:05 -0700585 log("onPause: unregister phone & data intents");
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800586
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800587 mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
Sooraj Sasindran5cce06b2016-08-18 15:49:49 -0700588 mTelephonyManager.setCellInfoListRate(CELL_INFO_LIST_RATE_DISABLED);
Nathan Haroldf10ea322018-04-24 13:31:07 -0700589 mConnectivityManager.unregisterNetworkCallback(mNetworkCallback);
590
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800591 }
592
Nathan Haroldcea413a2015-11-23 15:48:10 -0800593 private void restoreFromBundle(Bundle b) {
Nathan Harolde272c202016-10-27 13:45:00 -0700594 if(b == null) {
Nathan Haroldcea413a2015-11-23 15:48:10 -0800595 return;
596 }
597
598 mPingHostnameResultV4 = b.getString("mPingHostnameResultV4","");
599 mPingHostnameResultV6 = b.getString("mPingHostnameResultV6","");
600 mHttpClientTestResult = b.getString("mHttpClientTestResult","");
601
602 mPingHostnameV4.setText(mPingHostnameResultV4);
603 mPingHostnameV6.setText(mPingHostnameResultV6);
604 mHttpClientTest.setText(mHttpClientTestResult);
605
Nathan Harold2b77d742016-03-19 13:22:10 -0700606 mPreferredNetworkTypeResult = b.getInt("mPreferredNetworkTypeResult",
607 mPreferredNetworkLabels.length - 1);
608
609 mCellInfoRefreshRateIndex = b.getInt("mCellInfoRefreshRateIndex", 0);
Nathan Haroldcea413a2015-11-23 15:48:10 -0800610 }
611
612 @Override
613 protected void onSaveInstanceState(Bundle outState) {
614 outState.putString("mPingHostnameResultV4", mPingHostnameResultV4);
615 outState.putString("mPingHostnameResultV6", mPingHostnameResultV6);
616 outState.putString("mHttpClientTestResult", mHttpClientTestResult);
Nathan Harold2b77d742016-03-19 13:22:10 -0700617
Nathan Haroldcea413a2015-11-23 15:48:10 -0800618 outState.putInt("mPreferredNetworkTypeResult", mPreferredNetworkTypeResult);
Nathan Harold2b77d742016-03-19 13:22:10 -0700619 outState.putInt("mCellInfoRefreshRateIndex", mCellInfoRefreshRateIndex);
620
Nathan Haroldcea413a2015-11-23 15:48:10 -0800621 }
622
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800623 @Override
624 public boolean onCreateOptionsMenu(Menu menu) {
Wink Savillec3886682009-04-02 11:00:56 -0700625 menu.add(0, MENU_ITEM_SELECT_BAND, 0, R.string.radio_info_band_mode_label)
626 .setOnMenuItemClickListener(mSelectBandCallback)
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800627 .setAlphabeticShortcut('b');
628 menu.add(1, MENU_ITEM_VIEW_ADN, 0,
629 R.string.radioInfo_menu_viewADN).setOnMenuItemClickListener(mViewADNCallback);
630 menu.add(1, MENU_ITEM_VIEW_FDN, 0,
631 R.string.radioInfo_menu_viewFDN).setOnMenuItemClickListener(mViewFDNCallback);
632 menu.add(1, MENU_ITEM_VIEW_SDN, 0,
633 R.string.radioInfo_menu_viewSDN).setOnMenuItemClickListener(mViewSDNCallback);
Nathan Harolde272c202016-10-27 13:45:00 -0700634 menu.add(1, MENU_ITEM_GET_IMS_STATUS,
635 0, R.string.radioInfo_menu_getIMS).setOnMenuItemClickListener(mGetImsStatus);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800636 menu.add(1, MENU_ITEM_TOGGLE_DATA,
Nathan Harold2b77d742016-03-19 13:22:10 -0700637 0, R.string.radio_info_data_connection_disable).setOnMenuItemClickListener(mToggleData);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800638 return true;
639 }
640
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800641 @Override
Wink Savillec3886682009-04-02 11:00:56 -0700642 public boolean onPrepareOptionsMenu(Menu menu) {
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800643 // Get the TOGGLE DATA menu item in the right state.
644 MenuItem item = menu.findItem(MENU_ITEM_TOGGLE_DATA);
645 int state = mTelephonyManager.getDataState();
646 boolean visible = true;
647
648 switch (state) {
649 case TelephonyManager.DATA_CONNECTED:
650 case TelephonyManager.DATA_SUSPENDED:
Nathan Harold2b77d742016-03-19 13:22:10 -0700651 item.setTitle(R.string.radio_info_data_connection_disable);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800652 break;
653 case TelephonyManager.DATA_DISCONNECTED:
Nathan Harold2b77d742016-03-19 13:22:10 -0700654 item.setTitle(R.string.radio_info_data_connection_enable);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800655 break;
656 default:
657 visible = false;
658 break;
659 }
660 item.setVisible(visible);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800661 return true;
662 }
663
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800664 private void updateDnsCheckState() {
Nathan Haroldcea413a2015-11-23 15:48:10 -0800665 //FIXME: Replace with a TelephonyManager call
Mike Lockwood5304c7e2009-04-05 11:37:45 -0700666 dnsCheckState.setText(phone.isDnsCheckDisabled() ?
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800667 "0.0.0.0 allowed" :"0.0.0.0 not allowed");
668 }
Wink Savillee2a14e32009-05-29 14:06:30 -0700669
Nathan Haroldf10ea322018-04-24 13:31:07 -0700670 private void updateBandwidths(int dlbw, int ulbw) {
671 dlbw = (dlbw < 0 || dlbw == Integer.MAX_VALUE) ? -1 : dlbw;
672 ulbw = (ulbw < 0 || ulbw == Integer.MAX_VALUE) ? -1 : ulbw;
673 mDownlinkKbps.setText(String.format("%-5d", dlbw));
674 mUplinkKbps.setText(String.format("%-5d", ulbw));
675 }
676
677
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800678 private final void
Nathan Harold2b77d742016-03-19 13:22:10 -0700679 updateSignalStrength(SignalStrength signalStrength) {
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800680 Resources r = getResources();
681
Nathan Harold2b77d742016-03-19 13:22:10 -0700682 int signalDbm = signalStrength.getDbm();
Wink Savillee2a14e32009-05-29 14:06:30 -0700683
Nathan Harold2b77d742016-03-19 13:22:10 -0700684 int signalAsu = signalStrength.getAsuLevel();
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800685
686 if (-1 == signalAsu) signalAsu = 0;
687
688 dBm.setText(String.valueOf(signalDbm) + " "
689 + r.getString(R.string.radioInfo_display_dbm) + " "
690 + String.valueOf(signalAsu) + " "
691 + r.getString(R.string.radioInfo_display_asu));
692 }
693
694 private final void updateLocation(CellLocation location) {
jsh534f5ae2009-09-24 09:19:22 -0700695 Resources r = getResources();
Wink Savillec3886682009-04-02 11:00:56 -0700696 if (location instanceof GsmCellLocation) {
697 GsmCellLocation loc = (GsmCellLocation)location;
jsh534f5ae2009-09-24 09:19:22 -0700698 int lac = loc.getLac();
699 int cid = loc.getCid();
700 mLocation.setText(r.getString(R.string.radioInfo_lac) + " = "
701 + ((lac == -1) ? "unknown" : Integer.toHexString(lac))
702 + " "
703 + r.getString(R.string.radioInfo_cid) + " = "
704 + ((cid == -1) ? "unknown" : Integer.toHexString(cid)));
705 } else if (location instanceof CdmaCellLocation) {
706 CdmaCellLocation loc = (CdmaCellLocation)location;
707 int bid = loc.getBaseStationId();
708 int sid = loc.getSystemId();
709 int nid = loc.getNetworkId();
710 int lat = loc.getBaseStationLatitude();
711 int lon = loc.getBaseStationLongitude();
712 mLocation.setText("BID = "
713 + ((bid == -1) ? "unknown" : Integer.toHexString(bid))
714 + " "
715 + "SID = "
716 + ((sid == -1) ? "unknown" : Integer.toHexString(sid))
717 + " "
718 + "NID = "
719 + ((nid == -1) ? "unknown" : Integer.toHexString(nid))
720 + "\n"
721 + "LAT = "
722 + ((lat == -1) ? "unknown" : Integer.toHexString(lat))
723 + " "
724 + "LONG = "
725 + ((lon == -1) ? "unknown" : Integer.toHexString(lon)));
726 } else {
727 mLocation.setText("unknown");
Wink Savillec3886682009-04-02 11:00:56 -0700728 }
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800729
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800730
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800731 }
732
Nathan Haroldcea413a2015-11-23 15:48:10 -0800733 private final String getCellInfoDisplayString(int i) {
734 return (i != Integer.MAX_VALUE) ? Integer.toString(i) : "";
735 }
736
737 private final String getCellInfoDisplayString(long i) {
738 return (i != Long.MAX_VALUE) ? Long.toString(i) : "";
739 }
740
Nathan Harold6e16fdf2018-04-17 17:01:32 -0700741 private final String getConnectionStatusString(CellInfo ci) {
742 String regStr = "";
743 String connStatStr = "";
744 String connector = "";
745
746 if (ci.isRegistered()) {
747 regStr = "R";
748 }
749 switch (ci.getCellConnectionStatus()) {
750 case CellInfo.CONNECTION_PRIMARY_SERVING: connStatStr = "P"; break;
751 case CellInfo.CONNECTION_SECONDARY_SERVING: connStatStr = "S"; break;
752 case CellInfo.CONNECTION_NONE: connStatStr = "N"; break;
753 case CellInfo.CONNECTION_UNKNOWN: /* Field is unsupported */ break;
754 default: break;
755 }
756 if (!TextUtils.isEmpty(regStr) && !TextUtils.isEmpty(connStatStr)) {
757 connector = "+";
758 }
759
760 return regStr + connector + connStatStr;
761 }
762
Nathan Haroldcea413a2015-11-23 15:48:10 -0800763 private final String buildCdmaInfoString(CellInfoCdma ci) {
764 CellIdentityCdma cidCdma = ci.getCellIdentity();
765 CellSignalStrengthCdma ssCdma = ci.getCellSignalStrength();
766
767 return String.format("%-3.3s %-5.5s %-5.5s %-5.5s %-6.6s %-6.6s %-6.6s %-6.6s %-5.5s",
Nathan Harold6e16fdf2018-04-17 17:01:32 -0700768 getConnectionStatusString(ci),
Nathan Haroldcea413a2015-11-23 15:48:10 -0800769 getCellInfoDisplayString(cidCdma.getSystemId()),
770 getCellInfoDisplayString(cidCdma.getNetworkId()),
771 getCellInfoDisplayString(cidCdma.getBasestationId()),
772 getCellInfoDisplayString(ssCdma.getCdmaDbm()),
773 getCellInfoDisplayString(ssCdma.getCdmaEcio()),
774 getCellInfoDisplayString(ssCdma.getEvdoDbm()),
775 getCellInfoDisplayString(ssCdma.getEvdoEcio()),
776 getCellInfoDisplayString(ssCdma.getEvdoSnr()));
777 }
778
779 private final String buildGsmInfoString(CellInfoGsm ci) {
780 CellIdentityGsm cidGsm = ci.getCellIdentity();
781 CellSignalStrengthGsm ssGsm = ci.getCellSignalStrength();
782
Nathan Harold2b77d742016-03-19 13:22:10 -0700783 return String.format("%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-6.6s %-4.4s %-4.4s\n",
Nathan Harold6e16fdf2018-04-17 17:01:32 -0700784 getConnectionStatusString(ci),
Nathan Haroldcea413a2015-11-23 15:48:10 -0800785 getCellInfoDisplayString(cidGsm.getMcc()),
786 getCellInfoDisplayString(cidGsm.getMnc()),
787 getCellInfoDisplayString(cidGsm.getLac()),
788 getCellInfoDisplayString(cidGsm.getCid()),
Nathan Harold2b77d742016-03-19 13:22:10 -0700789 getCellInfoDisplayString(cidGsm.getArfcn()),
790 getCellInfoDisplayString(cidGsm.getBsic()),
Nathan Haroldcea413a2015-11-23 15:48:10 -0800791 getCellInfoDisplayString(ssGsm.getDbm()));
792 }
793
794 private final String buildLteInfoString(CellInfoLte ci) {
795 CellIdentityLte cidLte = ci.getCellIdentity();
796 CellSignalStrengthLte ssLte = ci.getCellSignalStrength();
797
798 return String.format(
Nathan Harold6e16fdf2018-04-17 17:01:32 -0700799 "%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-3.3s %-6.6s %-2.2s %-4.4s %-4.4s %-2.2s\n",
800 getConnectionStatusString(ci),
Nathan Haroldcea413a2015-11-23 15:48:10 -0800801 getCellInfoDisplayString(cidLte.getMcc()),
802 getCellInfoDisplayString(cidLte.getMnc()),
803 getCellInfoDisplayString(cidLte.getTac()),
804 getCellInfoDisplayString(cidLte.getCi()),
805 getCellInfoDisplayString(cidLte.getPci()),
Nathan Harold2b77d742016-03-19 13:22:10 -0700806 getCellInfoDisplayString(cidLte.getEarfcn()),
Nathan Harold6e16fdf2018-04-17 17:01:32 -0700807 getCellInfoDisplayString(cidLte.getBandwidth()),
Nathan Haroldcea413a2015-11-23 15:48:10 -0800808 getCellInfoDisplayString(ssLte.getDbm()),
809 getCellInfoDisplayString(ssLte.getRsrq()),
810 getCellInfoDisplayString(ssLte.getTimingAdvance()));
811 }
812
813 private final String buildWcdmaInfoString(CellInfoWcdma ci) {
814 CellIdentityWcdma cidWcdma = ci.getCellIdentity();
815 CellSignalStrengthWcdma ssWcdma = ci.getCellSignalStrength();
816
Nathan Harold2b77d742016-03-19 13:22:10 -0700817 return String.format("%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-6.6s %-3.3s %-4.4s\n",
Nathan Harold6e16fdf2018-04-17 17:01:32 -0700818 getConnectionStatusString(ci),
Nathan Haroldcea413a2015-11-23 15:48:10 -0800819 getCellInfoDisplayString(cidWcdma.getMcc()),
820 getCellInfoDisplayString(cidWcdma.getMnc()),
821 getCellInfoDisplayString(cidWcdma.getLac()),
822 getCellInfoDisplayString(cidWcdma.getCid()),
Nathan Harold2b77d742016-03-19 13:22:10 -0700823 getCellInfoDisplayString(cidWcdma.getUarfcn()),
Nathan Haroldcea413a2015-11-23 15:48:10 -0800824 getCellInfoDisplayString(cidWcdma.getPsc()),
825 getCellInfoDisplayString(ssWcdma.getDbm()));
826 }
827
828 private final String buildCellInfoString(List<CellInfo> arrayCi) {
829 String value = new String();
830 StringBuilder cdmaCells = new StringBuilder(),
831 gsmCells = new StringBuilder(),
832 lteCells = new StringBuilder(),
833 wcdmaCells = new StringBuilder();
834
835 if (arrayCi != null) {
836 for (CellInfo ci : arrayCi) {
837
838 if (ci instanceof CellInfoLte) {
839 lteCells.append(buildLteInfoString((CellInfoLte) ci));
840 } else if (ci instanceof CellInfoWcdma) {
841 wcdmaCells.append(buildWcdmaInfoString((CellInfoWcdma) ci));
842 } else if (ci instanceof CellInfoGsm) {
843 gsmCells.append(buildGsmInfoString((CellInfoGsm) ci));
844 } else if (ci instanceof CellInfoCdma) {
845 cdmaCells.append(buildCdmaInfoString((CellInfoCdma) ci));
Wink Saville79bff2a2012-06-01 14:37:21 -0700846 }
847 }
Nathan Haroldcea413a2015-11-23 15:48:10 -0800848 if (lteCells.length() != 0) {
849 value += String.format(
Nathan Harold6e16fdf2018-04-17 17:01:32 -0700850 "LTE\n%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-3.3s"
851 + " %-6.6s %-2.2s %-4.4s %-4.4s %-2.2s\n",
852 "SRV", "MCC", "MNC", "TAC", "CID", "PCI",
853 "EARFCN", "BW", "RSRP", "RSRQ", "TA");
Nathan Haroldcea413a2015-11-23 15:48:10 -0800854 value += lteCells.toString();
855 }
856 if (wcdmaCells.length() != 0) {
Nathan Harold6e16fdf2018-04-17 17:01:32 -0700857 value += String.format(
858 "WCDMA\n%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-6.6s %-3.3s %-4.4s\n",
Nathan Harold2b77d742016-03-19 13:22:10 -0700859 "SRV", "MCC", "MNC", "LAC", "CID", "UARFCN", "PSC", "RSCP");
Nathan Haroldcea413a2015-11-23 15:48:10 -0800860 value += wcdmaCells.toString();
861 }
862 if (gsmCells.length() != 0) {
Nathan Harold6e16fdf2018-04-17 17:01:32 -0700863 value += String.format(
864 "GSM\n%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-6.6s %-4.4s %-4.4s\n",
Nathan Harold2b77d742016-03-19 13:22:10 -0700865 "SRV", "MCC", "MNC", "LAC", "CID", "ARFCN", "BSIC", "RSSI");
Nathan Haroldcea413a2015-11-23 15:48:10 -0800866 value += gsmCells.toString();
867 }
868 if (cdmaCells.length() != 0) {
869 value += String.format(
870 "CDMA/EVDO\n%-3.3s %-5.5s %-5.5s %-5.5s %-6.6s %-6.6s %-6.6s %-6.6s %-5.5s\n",
871 "SRV", "SID", "NID", "BSID", "C-RSSI", "C-ECIO", "E-RSSI", "E-ECIO", "E-SNR");
872 value += cdmaCells.toString();
873 }
874 } else {
875 value ="unknown";
Wink Saville79bff2a2012-06-01 14:37:21 -0700876 }
Nathan Haroldcea413a2015-11-23 15:48:10 -0800877
878 return value.toString();
879 }
880
881 private final void updateCellInfo(List<CellInfo> arrayCi) {
882 mCellInfo.setText(buildCellInfoString(arrayCi));
Wink Saville79bff2a2012-06-01 14:37:21 -0700883 }
884
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800885 private final void
886 updateMessageWaiting() {
887 mMwi.setText(String.valueOf(mMwiValue));
888 }
889
890 private final void
891 updateCallRedirect() {
892 mCfi.setText(String.valueOf(mCfiValue));
893 }
894
895
896 private final void
Nathan Harold2b77d742016-03-19 13:22:10 -0700897 updateServiceState(ServiceState serviceState) {
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800898 int state = serviceState.getState();
899 Resources r = getResources();
900 String display = r.getString(R.string.radioInfo_unknown);
johnwang342101a2009-09-23 16:22:34 -0700901
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800902 switch (state) {
903 case ServiceState.STATE_IN_SERVICE:
904 display = r.getString(R.string.radioInfo_service_in);
905 break;
906 case ServiceState.STATE_OUT_OF_SERVICE:
907 case ServiceState.STATE_EMERGENCY_ONLY:
908 display = r.getString(R.string.radioInfo_service_emergency);
909 break;
910 case ServiceState.STATE_POWER_OFF:
911 display = r.getString(R.string.radioInfo_service_off);
912 break;
913 }
johnwang342101a2009-09-23 16:22:34 -0700914
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800915 gsmState.setText(display);
johnwang342101a2009-09-23 16:22:34 -0700916
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800917 if (serviceState.getRoaming()) {
918 roamingState.setText(R.string.radioInfo_roaming_in);
919 } else {
920 roamingState.setText(R.string.radioInfo_roaming_not);
921 }
922
923 operatorName.setText(serviceState.getOperatorAlphaLong());
924 }
925
926 private final void
Nathan Harold2b77d742016-03-19 13:22:10 -0700927 updatePhoneState(int state) {
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800928 Resources r = getResources();
929 String display = r.getString(R.string.radioInfo_unknown);
930
931 switch (state) {
Nathan Harold2b77d742016-03-19 13:22:10 -0700932 case TelephonyManager.CALL_STATE_IDLE:
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800933 display = r.getString(R.string.radioInfo_phone_idle);
934 break;
Nathan Harold2b77d742016-03-19 13:22:10 -0700935 case TelephonyManager.CALL_STATE_RINGING:
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800936 display = r.getString(R.string.radioInfo_phone_ringing);
937 break;
Nathan Harold2b77d742016-03-19 13:22:10 -0700938 case TelephonyManager.CALL_STATE_OFFHOOK:
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800939 display = r.getString(R.string.radioInfo_phone_offhook);
940 break;
941 }
942
943 callState.setText(display);
944 }
945
946 private final void
947 updateDataState() {
948 int state = mTelephonyManager.getDataState();
949 Resources r = getResources();
950 String display = r.getString(R.string.radioInfo_unknown);
951
952 switch (state) {
953 case TelephonyManager.DATA_CONNECTED:
954 display = r.getString(R.string.radioInfo_data_connected);
955 break;
956 case TelephonyManager.DATA_CONNECTING:
957 display = r.getString(R.string.radioInfo_data_connecting);
958 break;
959 case TelephonyManager.DATA_DISCONNECTED:
960 display = r.getString(R.string.radioInfo_data_disconnected);
961 break;
962 case TelephonyManager.DATA_SUSPENDED:
963 display = r.getString(R.string.radioInfo_data_suspended);
964 break;
965 }
johnwang342101a2009-09-23 16:22:34 -0700966
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800967 gprsState.setText(display);
968 }
969
970 private final void updateNetworkType() {
Nathan Harolde272c202016-10-27 13:45:00 -0700971 if(phone != null) {
Nathan Harold2b77d742016-03-19 13:22:10 -0700972 ServiceState ss = phone.getServiceState();
973 dataNetwork.setText(ServiceState.rilRadioTechnologyToString(
974 phone.getServiceState().getRilDataRadioTechnology()));
975 voiceNetwork.setText(ServiceState.rilRadioTechnologyToString(
976 phone.getServiceState().getRilVoiceRadioTechnology()));
977 }
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800978 }
979
980 private final void
981 updateProperties() {
982 String s;
983 Resources r = getResources();
984
985 s = phone.getDeviceId();
johnwang342101a2009-09-23 16:22:34 -0700986 if (s == null) s = r.getString(R.string.radioInfo_unknown);
Wink Savillec3886682009-04-02 11:00:56 -0700987 mDeviceId.setText(s);
johnwang342101a2009-09-23 16:22:34 -0700988
Meng Wang9053f172017-06-23 16:02:14 -0700989 s = phone.getSubscriberId();
990 if (s == null) s = r.getString(R.string.radioInfo_unknown);
991 mSubscriberId.setText(s);
992
Nathan Haroldcea413a2015-11-23 15:48:10 -0800993 //FIXME: Replace with a TelephonyManager call
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800994 s = phone.getLine1Number();
johnwang342101a2009-09-23 16:22:34 -0700995 if (s == null) s = r.getString(R.string.radioInfo_unknown);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800996 number.setText(s);
997 }
998
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800999 private final void updateDataStats2() {
1000 Resources r = getResources();
1001
Jeff Sharkey93029862011-05-27 18:26:15 -07001002 long txPackets = TrafficStats.getMobileTxPackets();
1003 long rxPackets = TrafficStats.getMobileRxPackets();
1004 long txBytes = TrafficStats.getMobileTxBytes();
1005 long rxBytes = TrafficStats.getMobileRxBytes();
johnwang342101a2009-09-23 16:22:34 -07001006
Jeff Sharkey93029862011-05-27 18:26:15 -07001007 String packets = r.getString(R.string.radioInfo_display_packets);
1008 String bytes = r.getString(R.string.radioInfo_display_bytes);
johnwang342101a2009-09-23 16:22:34 -07001009
Jeff Sharkey93029862011-05-27 18:26:15 -07001010 sent.setText(txPackets + " " + packets + ", " + txBytes + " " + bytes);
1011 received.setText(rxPackets + " " + packets + ", " + rxBytes + " " + bytes);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001012 }
1013
1014 /**
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001015 * Ping a host name
1016 */
1017 private final void pingHostname() {
1018 try {
Nathan Haroldcea413a2015-11-23 15:48:10 -08001019 try {
1020 Process p4 = Runtime.getRuntime().exec("ping -c 1 www.google.com");
1021 int status4 = p4.waitFor();
1022 if (status4 == 0) {
1023 mPingHostnameResultV4 = "Pass";
1024 } else {
1025 mPingHostnameResultV4 = String.format("Fail(%d)", status4);
1026 }
1027 } catch (IOException e) {
1028 mPingHostnameResultV4 = "Fail: IOException";
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001029 }
Nathan Haroldcea413a2015-11-23 15:48:10 -08001030 try {
1031 Process p6 = Runtime.getRuntime().exec("ping6 -c 1 www.google.com");
1032 int status6 = p6.waitFor();
1033 if (status6 == 0) {
1034 mPingHostnameResultV6 = "Pass";
1035 } else {
1036 mPingHostnameResultV6 = String.format("Fail(%d)", status6);
1037 }
1038 } catch (IOException e) {
1039 mPingHostnameResultV6 = "Fail: IOException";
1040 }
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001041 } catch (InterruptedException e) {
Nathan Haroldcea413a2015-11-23 15:48:10 -08001042 mPingHostnameResultV4 = mPingHostnameResultV6 = "Fail: InterruptedException";
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001043 }
1044 }
1045
1046 /**
1047 * This function checks for basic functionality of HTTP Client.
1048 */
1049 private void httpClientTest() {
Narayan Kamathf25627c2014-12-12 13:53:28 +00001050 HttpURLConnection urlConnection = null;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001051 try {
Narayan Kamathf25627c2014-12-12 13:53:28 +00001052 // TODO: Hardcoded for now, make it UI configurable
Alex Klyubinb0090232015-04-02 11:08:51 -07001053 URL url = new URL("https://www.google.com");
Narayan Kamathf25627c2014-12-12 13:53:28 +00001054 urlConnection = (HttpURLConnection) url.openConnection();
1055 if (urlConnection.getResponseCode() == 200) {
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001056 mHttpClientTestResult = "Pass";
1057 } else {
Narayan Kamathf25627c2014-12-12 13:53:28 +00001058 mHttpClientTestResult = "Fail: Code: " + urlConnection.getResponseMessage();
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001059 }
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001060 } catch (IOException e) {
1061 mHttpClientTestResult = "Fail: IOException";
Narayan Kamathf25627c2014-12-12 13:53:28 +00001062 } finally {
1063 if (urlConnection != null) {
1064 urlConnection.disconnect();
1065 }
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001066 }
1067 }
1068
1069 private void refreshSmsc() {
Nathan Haroldcea413a2015-11-23 15:48:10 -08001070 //FIXME: Replace with a TelephonyManager call
jsh21dd4072009-05-12 11:26:55 -07001071 phone.getSmscAddress(mHandler.obtainMessage(EVENT_QUERY_SMSC_DONE));
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001072 }
1073
Nathan Haroldcea413a2015-11-23 15:48:10 -08001074 private final void updateAllCellInfo() {
1075
1076 mCellInfo.setText("");
Nathan Haroldcea413a2015-11-23 15:48:10 -08001077 mLocation.setText("");
1078
1079 final Runnable updateAllCellInfoResults = new Runnable() {
1080 public void run() {
Nathan Haroldcea413a2015-11-23 15:48:10 -08001081 updateLocation(mCellLocationResult);
1082 updateCellInfo(mCellInfoResult);
1083 }
1084 };
1085
1086 Thread locThread = new Thread() {
1087 @Override
1088 public void run() {
1089 mCellInfoResult = mTelephonyManager.getAllCellInfo();
1090 mCellLocationResult = mTelephonyManager.getCellLocation();
Nathan Haroldcea413a2015-11-23 15:48:10 -08001091
1092 mHandler.post(updateAllCellInfoResults);
1093 }
1094 };
1095 locThread.start();
1096 }
1097
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001098 private final void updatePingState() {
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001099 // Set all to unknown since the threads will take a few secs to update.
Nathan Haroldcea413a2015-11-23 15:48:10 -08001100 mPingHostnameResultV4 = getResources().getString(R.string.radioInfo_unknown);
1101 mPingHostnameResultV6 = getResources().getString(R.string.radioInfo_unknown);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001102 mHttpClientTestResult = getResources().getString(R.string.radioInfo_unknown);
1103
Nathan Haroldcea413a2015-11-23 15:48:10 -08001104 mPingHostnameV4.setText(mPingHostnameResultV4);
1105 mPingHostnameV6.setText(mPingHostnameResultV6);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001106 mHttpClientTest.setText(mHttpClientTestResult);
1107
1108 final Runnable updatePingResults = new Runnable() {
1109 public void run() {
Nathan Haroldcea413a2015-11-23 15:48:10 -08001110 mPingHostnameV4.setText(mPingHostnameResultV4);
1111 mPingHostnameV6.setText(mPingHostnameResultV6);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001112 mHttpClientTest.setText(mHttpClientTestResult);
1113 }
1114 };
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001115
1116 Thread hostname = new Thread() {
1117 @Override
1118 public void run() {
1119 pingHostname();
Nathan Haroldcea413a2015-11-23 15:48:10 -08001120 mHandler.post(updatePingResults);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001121 }
1122 };
1123 hostname.start();
1124
1125 Thread httpClient = new Thread() {
1126 @Override
1127 public void run() {
1128 httpClientTest();
Nathan Haroldcea413a2015-11-23 15:48:10 -08001129 mHandler.post(updatePingResults);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001130 }
1131 };
1132 httpClient.start();
1133 }
1134
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001135 private MenuItem.OnMenuItemClickListener mViewADNCallback = new MenuItem.OnMenuItemClickListener() {
1136 public boolean onMenuItemClick(MenuItem item) {
1137 Intent intent = new Intent(Intent.ACTION_VIEW);
1138 // XXX We need to specify the component here because if we don't
1139 // the activity manager will try to resolve the type by calling
1140 // the content provider, which causes it to be loaded in a process
1141 // other than the Dialer process, which causes a lot of stuff to
1142 // break.
1143 intent.setClassName("com.android.phone",
1144 "com.android.phone.SimContacts");
1145 startActivity(intent);
1146 return true;
1147 }
1148 };
1149
1150 private MenuItem.OnMenuItemClickListener mViewFDNCallback = new MenuItem.OnMenuItemClickListener() {
1151 public boolean onMenuItemClick(MenuItem item) {
1152 Intent intent = new Intent(Intent.ACTION_VIEW);
1153 // XXX We need to specify the component here because if we don't
1154 // the activity manager will try to resolve the type by calling
1155 // the content provider, which causes it to be loaded in a process
1156 // other than the Dialer process, which causes a lot of stuff to
1157 // break.
1158 intent.setClassName("com.android.phone",
Andrew Leeda90d682014-10-31 13:12:20 -07001159 "com.android.phone.settings.fdn.FdnList");
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001160 startActivity(intent);
1161 return true;
1162 }
1163 };
1164
1165 private MenuItem.OnMenuItemClickListener mViewSDNCallback = new MenuItem.OnMenuItemClickListener() {
1166 public boolean onMenuItemClick(MenuItem item) {
1167 Intent intent = new Intent(
Wink Savillec3886682009-04-02 11:00:56 -07001168 Intent.ACTION_VIEW, Uri.parse("content://icc/sdn"));
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001169 // XXX We need to specify the component here because if we don't
1170 // the activity manager will try to resolve the type by calling
1171 // the content provider, which causes it to be loaded in a process
1172 // other than the Dialer process, which causes a lot of stuff to
1173 // break.
1174 intent.setClassName("com.android.phone",
1175 "com.android.phone.ADNList");
1176 startActivity(intent);
1177 return true;
1178 }
1179 };
1180
Nathan Harolde272c202016-10-27 13:45:00 -07001181 private MenuItem.OnMenuItemClickListener mGetImsStatus = new MenuItem.OnMenuItemClickListener() {
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001182 public boolean onMenuItemClick(MenuItem item) {
Nathan Harolde272c202016-10-27 13:45:00 -07001183 boolean isImsRegistered = phone.isImsRegistered();
1184 boolean availableVolte = phone.isVolteEnabled();
1185 boolean availableWfc = phone.isWifiCallingEnabled();
1186 boolean availableVt = phone.isVideoEnabled();
1187 boolean availableUt = phone.isUtEnabled();
1188
1189 final String imsRegString = isImsRegistered ?
1190 getString(R.string.radio_info_ims_reg_status_registered) :
1191 getString(R.string.radio_info_ims_reg_status_not_registered);
1192
1193 final String available = getString(R.string.radio_info_ims_feature_status_available);
1194 final String unavailable = getString(
1195 R.string.radio_info_ims_feature_status_unavailable);
1196
1197 String imsStatus = getString(R.string.radio_info_ims_reg_status,
1198 imsRegString,
1199 availableVolte ? available : unavailable,
1200 availableWfc ? available : unavailable,
1201 availableVt ? available : unavailable,
1202 availableUt ? available : unavailable);
1203
1204 AlertDialog imsDialog = new AlertDialog.Builder(RadioInfo.this)
1205 .setMessage(imsStatus)
1206 .setTitle(getString(R.string.radio_info_ims_reg_status_title))
1207 .create();
1208
1209 imsDialog.show();
1210
Tammo Spalinka5f4c8f2009-10-15 20:08:58 +08001211 return true;
1212 }
1213 };
1214
1215 private MenuItem.OnMenuItemClickListener mSelectBandCallback = new MenuItem.OnMenuItemClickListener() {
1216 public boolean onMenuItemClick(MenuItem item) {
1217 Intent intent = new Intent();
1218 intent.setClass(RadioInfo.this, BandMode.class);
1219 startActivity(intent);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001220 return true;
1221 }
1222 };
johnwang342101a2009-09-23 16:22:34 -07001223
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001224 private MenuItem.OnMenuItemClickListener mToggleData = new MenuItem.OnMenuItemClickListener() {
1225 public boolean onMenuItemClick(MenuItem item) {
1226 int state = mTelephonyManager.getDataState();
1227 switch (state) {
1228 case TelephonyManager.DATA_CONNECTED:
Jack Yu50972ed2018-12-13 11:51:20 -08001229 mTelephonyManager.setDataEnabled(false);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001230 break;
1231 case TelephonyManager.DATA_DISCONNECTED:
Jack Yu50972ed2018-12-13 11:51:20 -08001232 mTelephonyManager.setDataEnabled(true);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001233 break;
1234 default:
1235 // do nothing
1236 break;
1237 }
1238 return true;
1239 }
1240 };
1241
Nathan Harold2b77d742016-03-19 13:22:10 -07001242 private boolean isRadioOn() {
1243 //FIXME: Replace with a TelephonyManager call
1244 return phone.getServiceState().getState() != ServiceState.STATE_POWER_OFF;
1245 }
1246
1247 private void updateRadioPowerState() {
1248 //delightful hack to prevent on-checked-changed calls from
1249 //actually forcing the radio preference to its transient/current value.
1250 radioPowerOnSwitch.setOnCheckedChangeListener(null);
1251 radioPowerOnSwitch.setChecked(isRadioOn());
1252 radioPowerOnSwitch.setOnCheckedChangeListener(mRadioPowerOnChangeListener);
1253 }
1254
Nathan Harolde272c202016-10-27 13:45:00 -07001255 void setImsVolteProvisionedState(boolean state) {
Nathan Harold12e1f552016-06-17 13:55:38 -07001256 Log.d(TAG, "setImsVolteProvisioned state: " + ((state)? "on":"off"));
Nathan Harolde272c202016-10-27 13:45:00 -07001257 setImsConfigProvisionedState(IMS_VOLTE_PROVISIONED_CONFIG_ID, state);
Nathan Harold12e1f552016-06-17 13:55:38 -07001258 }
1259
Nathan Harolde272c202016-10-27 13:45:00 -07001260 void setImsVtProvisionedState(boolean state) {
Nathan Harold12e1f552016-06-17 13:55:38 -07001261 Log.d(TAG, "setImsVtProvisioned() state: " + ((state)? "on":"off"));
Nathan Harolde272c202016-10-27 13:45:00 -07001262 setImsConfigProvisionedState(IMS_VT_PROVISIONED_CONFIG_ID, state);
Nathan Harold12e1f552016-06-17 13:55:38 -07001263 }
1264
Nathan Harolde272c202016-10-27 13:45:00 -07001265 void setImsWfcProvisionedState(boolean state) {
Nathan Harold12e1f552016-06-17 13:55:38 -07001266 Log.d(TAG, "setImsWfcProvisioned() state: " + ((state)? "on":"off"));
Nathan Harolde272c202016-10-27 13:45:00 -07001267 setImsConfigProvisionedState(IMS_WFC_PROVISIONED_CONFIG_ID, state);
Nathan Harold12e1f552016-06-17 13:55:38 -07001268 }
1269
Meng Wang586741c2017-04-26 15:02:51 -07001270 void setEabProvisionedState(boolean state) {
1271 Log.d(TAG, "setEabProvisioned() state: " + ((state)? "on":"off"));
1272 setImsConfigProvisionedState(EAB_PROVISIONED_CONFIG_ID, state);
1273 }
1274
Nathan Harolde272c202016-10-27 13:45:00 -07001275 void setImsConfigProvisionedState(int configItem, boolean state) {
Nathan Harold12e1f552016-06-17 13:55:38 -07001276 if (phone != null && mImsManager != null) {
Philip P. Moltmann5c449ae2017-02-14 12:43:02 -08001277 QueuedWork.queue(new Runnable() {
Nathan Harold12e1f552016-06-17 13:55:38 -07001278 public void run() {
1279 try {
1280 mImsManager.getConfigInterface().setProvisionedValue(
1281 configItem,
1282 state? 1 : 0);
1283 } catch (ImsException e) {
1284 Log.e(TAG, "setImsConfigProvisioned() exception:", e);
1285 }
1286 }
Philip P. Moltmann5c449ae2017-02-14 12:43:02 -08001287 }, false);
Nathan Harold12e1f552016-06-17 13:55:38 -07001288 }
1289 }
1290
Nathan Harold2b77d742016-03-19 13:22:10 -07001291 OnCheckedChangeListener mRadioPowerOnChangeListener = new OnCheckedChangeListener() {
1292 @Override
1293 public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
1294 log("toggle radio power: currently " + (isRadioOn()?"on":"off"));
1295 phone.setRadioPower(isChecked);
1296 }
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001297 };
1298
Nathan Harold12e1f552016-06-17 13:55:38 -07001299 private boolean isImsVolteProvisioned() {
Nathan Harold2b77d742016-03-19 13:22:10 -07001300 if (phone != null && mImsManager != null) {
1301 return mImsManager.isVolteEnabledByPlatform(phone.getContext())
1302 && mImsManager.isVolteProvisionedOnDevice(phone.getContext());
Pavel Zhamaitsiakcb267a62015-01-21 18:25:14 -08001303 }
1304 return false;
1305 }
1306
Nathan Harold12e1f552016-06-17 13:55:38 -07001307 OnCheckedChangeListener mImsVolteCheckedChangeListener = new OnCheckedChangeListener() {
Wink Saville426fc662011-09-25 14:39:02 -07001308 @Override
Nathan Harold2b77d742016-03-19 13:22:10 -07001309 public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
Nathan Harold12e1f552016-06-17 13:55:38 -07001310 setImsVolteProvisionedState(isChecked);
Nathan Harolde272c202016-10-27 13:45:00 -07001311 }
Wink Saville426fc662011-09-25 14:39:02 -07001312 };
1313
Nathan Harold12e1f552016-06-17 13:55:38 -07001314 private boolean isImsVtProvisioned() {
1315 if (phone != null && mImsManager != null) {
1316 return mImsManager.isVtEnabledByPlatform(phone.getContext())
1317 && mImsManager.isVtProvisionedOnDevice(phone.getContext());
1318 }
1319 return false;
1320 }
1321
1322 OnCheckedChangeListener mImsVtCheckedChangeListener = new OnCheckedChangeListener() {
1323 @Override
1324 public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
1325 setImsVtProvisionedState(isChecked);
Nathan Harolde272c202016-10-27 13:45:00 -07001326 }
Nathan Harold12e1f552016-06-17 13:55:38 -07001327 };
1328
1329 private boolean isImsWfcProvisioned() {
1330 if (phone != null && mImsManager != null) {
1331 return mImsManager.isWfcEnabledByPlatform(phone.getContext())
1332 && mImsManager.isWfcProvisionedOnDevice(phone.getContext());
1333 }
1334 return false;
1335 }
1336
1337 OnCheckedChangeListener mImsWfcCheckedChangeListener = new OnCheckedChangeListener() {
1338 @Override
1339 public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
1340 setImsWfcProvisionedState(isChecked);
Nathan Harolde272c202016-10-27 13:45:00 -07001341 }
Nathan Harold12e1f552016-06-17 13:55:38 -07001342 };
1343
Meng Wang586741c2017-04-26 15:02:51 -07001344 private boolean isEabProvisioned() {
1345 return isFeatureProvisioned(EAB_PROVISIONED_CONFIG_ID, false);
1346 }
1347
1348 OnCheckedChangeListener mEabCheckedChangeListener = new OnCheckedChangeListener() {
1349 @Override
1350 public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
1351 setEabProvisionedState(isChecked);
1352 }
1353 };
1354
1355 private boolean isFeatureProvisioned(int featureId, boolean defaultValue) {
1356 boolean provisioned = defaultValue;
1357 if (mImsManager != null) {
1358 try {
1359 ImsConfig imsConfig = mImsManager.getConfigInterface();
1360 if (imsConfig != null) {
1361 provisioned =
1362 (imsConfig.getProvisionedValue(featureId)
1363 == ImsConfig.FeatureValueConstants.ON);
1364 }
1365 } catch (ImsException ex) {
1366 Log.e(TAG, "isFeatureProvisioned() exception:", ex);
1367 }
1368 }
1369
1370 log("isFeatureProvisioned() featureId=" + featureId + " provisioned=" + provisioned);
1371 return provisioned;
1372 }
1373
1374 private static boolean isEabEnabledByPlatform(Context context) {
1375 if (context != null) {
1376 CarrierConfigManager configManager = (CarrierConfigManager)
1377 context.getSystemService(Context.CARRIER_CONFIG_SERVICE);
1378 if (configManager != null && configManager.getConfig().getBoolean(
1379 CarrierConfigManager.KEY_USE_RCS_PRESENCE_BOOL)) {
1380 return true;
1381 }
1382 }
1383 return false;
1384 }
1385
Nathan Harold12e1f552016-06-17 13:55:38 -07001386 private void updateImsProvisionedState() {
1387 log("updateImsProvisionedState isImsVolteProvisioned()=" + isImsVolteProvisioned());
Nathan Harold2b77d742016-03-19 13:22:10 -07001388 //delightful hack to prevent on-checked-changed calls from
1389 //actually forcing the ims provisioning to its transient/current value.
Nathan Harold12e1f552016-06-17 13:55:38 -07001390 imsVolteProvisionedSwitch.setOnCheckedChangeListener(null);
1391 imsVolteProvisionedSwitch.setChecked(isImsVolteProvisioned());
1392 imsVolteProvisionedSwitch.setOnCheckedChangeListener(mImsVolteCheckedChangeListener);
Sreekanth Badidac888e192018-02-05 17:18:40 +01001393 imsVolteProvisionedSwitch.setEnabled(!Build.IS_USER
1394 && mImsManager.isVolteEnabledByPlatform(phone.getContext()));
Nathan Harold12e1f552016-06-17 13:55:38 -07001395
1396 imsVtProvisionedSwitch.setOnCheckedChangeListener(null);
1397 imsVtProvisionedSwitch.setChecked(isImsVtProvisioned());
1398 imsVtProvisionedSwitch.setOnCheckedChangeListener(mImsVtCheckedChangeListener);
Sreekanth Badidac888e192018-02-05 17:18:40 +01001399 imsVtProvisionedSwitch.setEnabled(!Build.IS_USER
1400 && mImsManager.isVtEnabledByPlatform(phone.getContext()));
Nathan Harold12e1f552016-06-17 13:55:38 -07001401
1402 imsWfcProvisionedSwitch.setOnCheckedChangeListener(null);
1403 imsWfcProvisionedSwitch.setChecked(isImsWfcProvisioned());
1404 imsWfcProvisionedSwitch.setOnCheckedChangeListener(mImsWfcCheckedChangeListener);
Sreekanth Badidac888e192018-02-05 17:18:40 +01001405 imsWfcProvisionedSwitch.setEnabled(!Build.IS_USER
1406 && mImsManager.isWfcEnabledByPlatform(phone.getContext()));
Meng Wang586741c2017-04-26 15:02:51 -07001407
1408 eabProvisionedSwitch.setOnCheckedChangeListener(null);
1409 eabProvisionedSwitch.setChecked(isEabProvisioned());
1410 eabProvisionedSwitch.setOnCheckedChangeListener(mEabCheckedChangeListener);
Sreekanth Badidac888e192018-02-05 17:18:40 +01001411 eabProvisionedSwitch.setEnabled(!Build.IS_USER
1412 && isEabEnabledByPlatform(phone.getContext()));
Wink Saville426fc662011-09-25 14:39:02 -07001413 }
1414
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001415 OnClickListener mDnsCheckButtonHandler = new OnClickListener() {
1416 public void onClick(View v) {
Nathan Haroldcea413a2015-11-23 15:48:10 -08001417 //FIXME: Replace with a TelephonyManager call
Wink Savillec3886682009-04-02 11:00:56 -07001418 phone.disableDnsCheck(!phone.isDnsCheckDisabled());
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001419 updateDnsCheckState();
1420 }
1421 };
johnwang342101a2009-09-23 16:22:34 -07001422
Tammo Spalinka5f4c8f2009-10-15 20:08:58 +08001423 OnClickListener mOemInfoButtonHandler = new OnClickListener() {
1424 public void onClick(View v) {
1425 Intent intent = new Intent("com.android.settings.OEM_RADIO_INFO");
1426 try {
1427 startActivity(intent);
1428 } catch (android.content.ActivityNotFoundException ex) {
Wink Savillebf471282013-04-05 15:04:05 -07001429 log("OEM-specific Info/Settings Activity Not Found : " + ex);
Tammo Spalinka5f4c8f2009-10-15 20:08:58 +08001430 // If the activity does not exist, there are no OEM
1431 // settings, and so we can just do nothing...
1432 }
1433 }
1434 };
1435
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001436 OnClickListener mPingButtonHandler = new OnClickListener() {
1437 public void onClick(View v) {
1438 updatePingState();
1439 }
1440 };
1441
1442 OnClickListener mUpdateSmscButtonHandler = new OnClickListener() {
1443 public void onClick(View v) {
1444 updateSmscButton.setEnabled(false);
jsh21dd4072009-05-12 11:26:55 -07001445 phone.setSmscAddress(smsc.getText().toString(),
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001446 mHandler.obtainMessage(EVENT_UPDATE_SMSC_DONE));
1447 }
1448 };
1449
1450 OnClickListener mRefreshSmscButtonHandler = new OnClickListener() {
1451 public void onClick(View v) {
1452 refreshSmsc();
1453 }
1454 };
1455
Youhan Wangfd781e92016-12-16 15:53:16 -08001456 OnClickListener mCarrierProvisioningButtonHandler = new OnClickListener() {
1457 public void onClick(View v) {
Meng Wanga04449b2017-08-03 14:34:35 -07001458 final Intent intent = new Intent("com.android.settings.CARRIER_PROVISIONING");
1459 final ComponentName serviceComponent = ComponentName.unflattenFromString(
1460 "com.android.omadm.service/.DMIntentReceiver");
Youhan Wangfd781e92016-12-16 15:53:16 -08001461 intent.setComponent(serviceComponent);
Meng Wanga04449b2017-08-03 14:34:35 -07001462 sendBroadcast(intent);
Youhan Wangfd781e92016-12-16 15:53:16 -08001463 }
1464 };
1465
1466 OnClickListener mTriggerCarrierProvisioningButtonHandler = new OnClickListener() {
1467 public void onClick(View v) {
Meng Wanga04449b2017-08-03 14:34:35 -07001468 final Intent intent = new Intent("com.android.settings.TRIGGER_CARRIER_PROVISIONING");
1469 final ComponentName serviceComponent = ComponentName.unflattenFromString(
1470 "com.android.omadm.service/.DMIntentReceiver");
Youhan Wangfd781e92016-12-16 15:53:16 -08001471 intent.setComponent(serviceComponent);
Meng Wanga04449b2017-08-03 14:34:35 -07001472 sendBroadcast(intent);
Youhan Wangfd781e92016-12-16 15:53:16 -08001473 }
1474 };
1475
Nathan Haroldcea413a2015-11-23 15:48:10 -08001476 AdapterView.OnItemSelectedListener mPreferredNetworkHandler =
1477 new AdapterView.OnItemSelectedListener() {
1478
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001479 public void onItemSelected(AdapterView parent, View v, int pos, long id) {
Nathan Haroldcea413a2015-11-23 15:48:10 -08001480 if (mPreferredNetworkTypeResult != pos && pos >= 0
1481 && pos <= mPreferredNetworkLabels.length - 2) {
1482 mPreferredNetworkTypeResult = pos;
Nathan Harolddaea8be2018-06-05 14:02:35 -07001483
1484 // TODO: Possibly migrate this to TelephonyManager.setPreferredNetworkType()
1485 // which today still has some issues (mostly that the "set" is conditional
1486 // on a successful modem call, which is not what we want). Instead we always
1487 // want this setting to be set, so that if the radio hiccups and this setting
1488 // is for some reason unsuccessful, future calls to the radio will reflect
1489 // the users's preference which is set here.
1490 final int subId = phone.getSubId();
1491 if (SubscriptionManager.isUsableSubIdValue(subId)) {
1492 Settings.Global.putInt(phone.getContext().getContentResolver(),
1493 PREFERRED_NETWORK_MODE + subId, mPreferredNetworkTypeResult);
1494 }
1495 log("Calling setPreferredNetworkType(" + mPreferredNetworkTypeResult + ")");
Nathan Haroldcea413a2015-11-23 15:48:10 -08001496 Message msg = mHandler.obtainMessage(EVENT_SET_PREFERRED_TYPE_DONE);
1497 phone.setPreferredNetworkType(mPreferredNetworkTypeResult, msg);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001498 }
1499 }
1500
1501 public void onNothingSelected(AdapterView parent) {
1502 }
1503 };
1504
Nathan Harold2b77d742016-03-19 13:22:10 -07001505 AdapterView.OnItemSelectedListener mCellInfoRefreshRateHandler =
1506 new AdapterView.OnItemSelectedListener() {
Wink Savillebf471282013-04-05 15:04:05 -07001507
Nathan Harold2b77d742016-03-19 13:22:10 -07001508 public void onItemSelected(AdapterView parent, View v, int pos, long id) {
1509 mCellInfoRefreshRateIndex = pos;
Sooraj Sasindran5cce06b2016-08-18 15:49:49 -07001510 mTelephonyManager.setCellInfoListRate(mCellInfoRefreshRates[pos]);
Nathan Harold2b77d742016-03-19 13:22:10 -07001511 updateAllCellInfo();
1512 }
1513
1514 public void onNothingSelected(AdapterView parent) {
1515 }
1516 };
1517
Naina Nallurid1b57f62019-01-08 15:19:58 -08001518 boolean isCbrsSupported() {
1519 return getResources().getBoolean(
1520 com.android.internal.R.bool.config_cbrs_supported);
1521 }
1522
1523 void updateCbrsDataState(boolean state) {
1524 Log.d(TAG, "setCbrsDataSwitchState() state:" + ((state)? "on":"off"));
1525 if (mTelephonyManager != null) {
1526 QueuedWork.queue(new Runnable() {
1527 public void run() {
1528 mTelephonyManager.setOpportunisticNetworkState(state);
1529 cbrsDataSwitch.setChecked(getCbrsDataState());
1530 }
1531 }, false);
1532 }
1533 }
1534
1535 boolean getCbrsDataState() {
1536 boolean state = false;
1537 if (mTelephonyManager != null) {
1538 state = mTelephonyManager.isOpportunisticNetworkEnabled();
1539 }
1540 Log.d(TAG, "getCbrsDataState() state:" +((state)? "on":"off"));
1541 return state;
1542 }
1543
1544 OnCheckedChangeListener mCbrsDataSwitchChangeListener = new OnCheckedChangeListener() {
1545 @Override
1546 public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
1547 updateCbrsDataState(isChecked);
1548 }
1549 };
1550
Pengquan Meng7f602c72019-01-28 19:12:18 -08001551 private void showDsdsChangeDialog() {
1552 final AlertDialog confirmDialog = new Builder(RadioInfo.this)
1553 .setTitle(R.string.dsds_dialog_title)
1554 .setMessage(R.string.dsds_dialog_message)
1555 .setPositiveButton(R.string.dsds_dialog_confirm, mOnDsdsDialogConfirmedListener)
1556 .setNegativeButton(R.string.dsds_dialog_cancel, mOnDsdsDialogConfirmedListener)
1557 .create();
1558 confirmDialog.show();
1559 }
Naina Nallurid1b57f62019-01-08 15:19:58 -08001560
Pengquan Meng7f602c72019-01-28 19:12:18 -08001561 private static boolean isDsdsSupported() {
1562 return PhoneConfigurationManager.getInstance().getStaticPhoneCapability()
1563 .logicalModemList.size() >= 2
1564 && !TelephonyManager.getDefault().isMultisimCarrierRestricted();
1565 }
1566
1567 private static boolean isDsdsEnabled() {
1568 return TelephonyManager.getDefault().getPhoneCount() > 1;
1569 }
1570
1571 private void performDsdsSwitch() {
1572 mTelephonyManager.switchMultiSimConfig(dsdsSwitch.isChecked() ? 2 : 1);
1573 }
1574
1575 DialogInterface.OnClickListener mOnDsdsDialogConfirmedListener =
1576 new DialogInterface.OnClickListener() {
1577 @Override
1578 public void onClick(DialogInterface dialog, int which) {
1579 if (which == DialogInterface.BUTTON_POSITIVE) {
1580 dsdsSwitch.toggle();
1581 performDsdsSwitch();
1582 }
1583 }
1584 };
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001585}