Enhancement+Cleanup of RadioInfo Test Menu
-Re-format CellInfo to a Table -Improve performance on several blocking calls -Add IPv6 ping test -Re-order layout to improve logical grouping -Semantic changes/cosmetic improvements to a few strings -Expand list of selectable network types to include recent RATs Change-Id: I02d15987e7cb79fe0bbd13e5d1eb734e3531f11f
This commit is contained in:
@@ -51,13 +51,13 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<LinearLayout style="@style/entry_layout">
|
<LinearLayout style="@style/entry_layout">
|
||||||
<TextView android:text="@string/radio_info_ping_ipaddr" style="@style/info_label" />
|
<TextView android:text="@string/radio_info_ping_hostname_v4" style="@style/info_label" />
|
||||||
<TextView android:id="@+id/pingIpAddr" style="@style/info_value" />
|
<TextView android:id="@+id/pingHostnameV4" style="@style/info_value" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout style="@style/entry_layout">
|
<LinearLayout style="@style/entry_layout">
|
||||||
<TextView android:text="@string/radio_info_ping_hostname" style="@style/info_label" />
|
<TextView android:text="@string/radio_info_ping_hostname_v6" style="@style/info_label" />
|
||||||
<TextView android:id="@+id/pingHostname" style="@style/info_value" />
|
<TextView android:id="@+id/pingHostnameV6" style="@style/info_value" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout style="@style/entry_layout">
|
<LinearLayout style="@style/entry_layout">
|
||||||
@@ -71,6 +71,14 @@
|
|||||||
<TextView android:id="@+id/dbm" style="@style/info_value" />
|
<TextView android:id="@+id/dbm" style="@style/info_value" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- CellInfoListRate -->
|
||||||
|
<Button android:id="@+id/cell_info_list_rate"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:layout_marginTop="8dip"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- Location -->
|
<!-- Location -->
|
||||||
<LinearLayout style="@style/entry_layout">
|
<LinearLayout style="@style/entry_layout">
|
||||||
<TextView android:text="@string/radio_info_signal_location_label" style="@style/info_label" />
|
<TextView android:text="@string/radio_info_signal_location_label" style="@style/info_label" />
|
||||||
@@ -88,6 +96,8 @@
|
|||||||
<LinearLayout style="@style/entry_layout">
|
<LinearLayout style="@style/entry_layout">
|
||||||
<TextView android:text="@string/radio_info_cellinfo_label"
|
<TextView android:text="@string/radio_info_cellinfo_label"
|
||||||
style="@style/info_label" />
|
style="@style/info_label" />
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout style="@style/entry_layout">
|
||||||
<TextView android:id="@+id/cellinfo" style="@style/info_value" />
|
<TextView android:id="@+id/cellinfo" style="@style/info_value" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@@ -140,7 +150,6 @@
|
|||||||
<TextView android:id="@+id/call" style="@style/info_value" />
|
<TextView android:id="@+id/call" style="@style/info_value" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
<!-- Radio Resets -->
|
<!-- Radio Resets -->
|
||||||
<LinearLayout style="@style/entry_layout">
|
<LinearLayout style="@style/entry_layout">
|
||||||
<TextView android:text="@string/radio_info_radio_resets_label" style="@style/info_label" />
|
<TextView android:text="@string/radio_info_radio_resets_label" style="@style/info_label" />
|
||||||
@@ -210,14 +219,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- CellInfoListRate -->
|
|
||||||
<Button android:id="@+id/cell_info_list_rate"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:layout_marginTop="8dip"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- IMS registration required -->
|
<!-- IMS registration required -->
|
||||||
<Button android:id="@+id/ims_reg_required"
|
<Button android:id="@+id/ims_reg_required"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
|
@@ -110,11 +110,6 @@
|
|||||||
android:text="@string/ping_test_label"
|
android:text="@string/ping_test_label"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<LinearLayout style="@style/entry_layout">
|
|
||||||
<TextView android:text="@string/radio_info_ping_ipaddr" style="@style/info_label" />
|
|
||||||
<TextView android:id="@+id/pingIpAddr" style="@style/info_value" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout style="@style/entry_layout">
|
<LinearLayout style="@style/entry_layout">
|
||||||
<TextView android:text="@string/radio_info_ping_hostname" style="@style/info_label" />
|
<TextView android:text="@string/radio_info_ping_hostname" style="@style/info_label" />
|
||||||
<TextView android:id="@+id/pingHostname" style="@style/info_value" />
|
<TextView android:id="@+id/pingHostname" style="@style/info_value" />
|
||||||
|
@@ -403,7 +403,7 @@
|
|||||||
<string name="radio_info_data_attempts_label">Data attempts:</string>
|
<string name="radio_info_data_attempts_label">Data attempts:</string>
|
||||||
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
|
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
|
||||||
|
|
||||||
<string name="radio_info_gprs_service_label">GPRS service:</string>
|
<string name="radio_info_gprs_service_label">Data Technology:</string>
|
||||||
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
|
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
|
||||||
<string name="radio_info_roaming_label">Roaming:</string>
|
<string name="radio_info_roaming_label">Roaming:</string>
|
||||||
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
|
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
|
||||||
@@ -421,7 +421,7 @@
|
|||||||
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
|
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
|
||||||
<string name="radio_info_ppp_received_label">PPP received:</string>
|
<string name="radio_info_ppp_received_label">PPP received:</string>
|
||||||
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
|
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
|
||||||
<string name="radio_info_gsm_service_label">GSM service:</string>
|
<string name="radio_info_gsm_service_label">Voice Technology:</string>
|
||||||
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
|
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
|
||||||
<string name="radio_info_signal_strength_label">Signal strength:</string>
|
<string name="radio_info_signal_strength_label">Signal strength:</string>
|
||||||
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
|
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
|
||||||
@@ -441,9 +441,9 @@
|
|||||||
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
|
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
|
||||||
<string name="radio_info_set_perferred_label">Set preferred network type:</string>
|
<string name="radio_info_set_perferred_label">Set preferred network type:</string>
|
||||||
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
|
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
|
||||||
<string name="radio_info_ping_ipaddr">Ping IpAddr:</string>
|
<string name="radio_info_ping_hostname_v4">Ping Hostname(www.google.com) IPv4:</string>
|
||||||
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
|
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
|
||||||
<string name="radio_info_ping_hostname">Ping Hostname(www.google.com):</string>
|
<string name="radio_info_ping_hostname_v6">Ping Hostname(www.google.com) IPv6:</string>
|
||||||
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
|
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
|
||||||
<string name="radio_info_http_client_test">HTTP Client test:</string>
|
<string name="radio_info_http_client_test">HTTP Client test:</string>
|
||||||
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
|
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
|
||||||
|
@@ -22,6 +22,7 @@ import android.content.Intent;
|
|||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
import android.graphics.Typeface;
|
||||||
import android.net.TrafficStats;
|
import android.net.TrafficStats;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncResult;
|
import android.os.AsyncResult;
|
||||||
@@ -30,11 +31,24 @@ import android.os.Handler;
|
|||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
import android.telephony.CellInfo;
|
import android.telephony.CellInfo;
|
||||||
|
import android.telephony.CellInfoCdma;
|
||||||
|
import android.telephony.CellInfoGsm;
|
||||||
|
import android.telephony.CellInfoLte;
|
||||||
|
import android.telephony.CellInfoWcdma;
|
||||||
|
import android.telephony.CellIdentityCdma;
|
||||||
|
import android.telephony.CellIdentityGsm;
|
||||||
|
import android.telephony.CellIdentityLte;
|
||||||
|
import android.telephony.CellIdentityWcdma;
|
||||||
import android.telephony.CellLocation;
|
import android.telephony.CellLocation;
|
||||||
|
import android.telephony.CellSignalStrengthCdma;
|
||||||
|
import android.telephony.CellSignalStrengthGsm;
|
||||||
|
import android.telephony.CellSignalStrengthLte;
|
||||||
|
import android.telephony.CellSignalStrengthWcdma;
|
||||||
import android.telephony.DataConnectionRealTimeInfo;
|
import android.telephony.DataConnectionRealTimeInfo;
|
||||||
import android.telephony.NeighboringCellInfo;
|
import android.telephony.NeighboringCellInfo;
|
||||||
import android.telephony.PhoneStateListener;
|
import android.telephony.PhoneStateListener;
|
||||||
import android.telephony.ServiceState;
|
import android.telephony.ServiceState;
|
||||||
|
import android.telephony.SubscriptionManager;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.telephony.cdma.CdmaCellLocation;
|
import android.telephony.cdma.CdmaCellLocation;
|
||||||
import android.telephony.gsm.GsmCellLocation;
|
import android.telephony.gsm.GsmCellLocation;
|
||||||
@@ -57,6 +71,7 @@ import com.android.internal.telephony.Phone;
|
|||||||
import com.android.internal.telephony.PhoneConstants;
|
import com.android.internal.telephony.PhoneConstants;
|
||||||
import com.android.internal.telephony.PhoneFactory;
|
import com.android.internal.telephony.PhoneFactory;
|
||||||
import com.android.internal.telephony.PhoneStateIntentReceiver;
|
import com.android.internal.telephony.PhoneStateIntentReceiver;
|
||||||
|
import com.android.internal.telephony.RILConstants;
|
||||||
import com.android.internal.telephony.TelephonyProperties;
|
import com.android.internal.telephony.TelephonyProperties;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -76,7 +91,6 @@ public class RadioInfo extends Activity {
|
|||||||
|
|
||||||
private static final int EVENT_QUERY_PREFERRED_TYPE_DONE = 1000;
|
private static final int EVENT_QUERY_PREFERRED_TYPE_DONE = 1000;
|
||||||
private static final int EVENT_SET_PREFERRED_TYPE_DONE = 1001;
|
private static final int EVENT_SET_PREFERRED_TYPE_DONE = 1001;
|
||||||
private static final int EVENT_QUERY_NEIGHBORING_CIDS_DONE = 1002;
|
|
||||||
private static final int EVENT_QUERY_SMSC_DONE = 1005;
|
private static final int EVENT_QUERY_SMSC_DONE = 1005;
|
||||||
private static final int EVENT_UPDATE_SMSC_DONE = 1006;
|
private static final int EVENT_UPDATE_SMSC_DONE = 1006;
|
||||||
|
|
||||||
@@ -112,8 +126,8 @@ public class RadioInfo extends Activity {
|
|||||||
private TextView sentSinceReceived;
|
private TextView sentSinceReceived;
|
||||||
private TextView sent;
|
private TextView sent;
|
||||||
private TextView received;
|
private TextView received;
|
||||||
private TextView mPingIpAddr;
|
private TextView mPingHostnameV4;
|
||||||
private TextView mPingHostname;
|
private TextView mPingHostnameV6;
|
||||||
private TextView mHttpClientTest;
|
private TextView mHttpClientTest;
|
||||||
private TextView dnsCheckState;
|
private TextView dnsCheckState;
|
||||||
private EditText smsc;
|
private EditText smsc;
|
||||||
@@ -127,15 +141,21 @@ public class RadioInfo extends Activity {
|
|||||||
private Spinner preferredNetworkType;
|
private Spinner preferredNetworkType;
|
||||||
|
|
||||||
private TelephonyManager mTelephonyManager;
|
private TelephonyManager mTelephonyManager;
|
||||||
|
private ImsManager mImsManager = null;
|
||||||
private Phone phone = null;
|
private Phone phone = null;
|
||||||
private PhoneStateIntentReceiver mPhoneStateReceiver;
|
private PhoneStateIntentReceiver mPhoneStateReceiver;
|
||||||
|
|
||||||
private String mPingIpAddrResult;
|
private String mPingHostnameResultV4;
|
||||||
private String mPingHostnameResult;
|
private String mPingHostnameResultV6;
|
||||||
private String mHttpClientTestResult;
|
private String mHttpClientTestResult;
|
||||||
private boolean mMwiValue = false;
|
private boolean mMwiValue = false;
|
||||||
private boolean mCfiValue = false;
|
private boolean mCfiValue = false;
|
||||||
private List<CellInfo> mCellInfoValue;
|
|
||||||
|
private List<CellInfo> mCellInfoResult = null;
|
||||||
|
private CellLocation mCellLocationResult = null;
|
||||||
|
private List<NeighboringCellInfo> mNeighboringCellResult = null;
|
||||||
|
|
||||||
|
private int mPreferredNetworkTypeResult;
|
||||||
|
|
||||||
private PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
|
private PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -171,7 +191,8 @@ public class RadioInfo extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
public void onCellInfoChanged(List<CellInfo> arrayCi) {
|
public void onCellInfoChanged(List<CellInfo> arrayCi) {
|
||||||
log("onCellInfoChanged: arrayCi=" + arrayCi);
|
log("onCellInfoChanged: arrayCi=" + arrayCi);
|
||||||
updateCellInfoTv(arrayCi);
|
mCellInfoResult = arrayCi;
|
||||||
|
updateCellInfo(mCellInfoResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -181,7 +202,19 @@ public class RadioInfo extends Activity {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private void updatePreferredNetworkType(int type) {
|
||||||
|
if (type >= mPreferredNetworkLabels.length || type < 0) {
|
||||||
|
log("EVENT_QUERY_PREFERRED_TYPE_DONE: unknown " +
|
||||||
|
"type=" + type);
|
||||||
|
type = mPreferredNetworkLabels.length - 1; //set to Unknown
|
||||||
|
}
|
||||||
|
mPreferredNetworkTypeResult = type;
|
||||||
|
|
||||||
|
preferredNetworkType.setSelection(mPreferredNetworkTypeResult, true);
|
||||||
|
}
|
||||||
|
|
||||||
private Handler mHandler = new Handler() {
|
private Handler mHandler = new Handler() {
|
||||||
|
@Override
|
||||||
public void handleMessage(Message msg) {
|
public void handleMessage(Message msg) {
|
||||||
AsyncResult ar;
|
AsyncResult ar;
|
||||||
switch (msg.what) {
|
switch (msg.what) {
|
||||||
@@ -201,31 +234,17 @@ public class RadioInfo extends Activity {
|
|||||||
|
|
||||||
case EVENT_QUERY_PREFERRED_TYPE_DONE:
|
case EVENT_QUERY_PREFERRED_TYPE_DONE:
|
||||||
ar= (AsyncResult) msg.obj;
|
ar= (AsyncResult) msg.obj;
|
||||||
if (ar.exception == null) {
|
if (ar.exception == null && ar.result != null) {
|
||||||
int type = ((int[])ar.result)[0];
|
updatePreferredNetworkType(((int[])ar.result)[0]);
|
||||||
if (type >= mPreferredNetworkLabels.length) {
|
|
||||||
log("EVENT_QUERY_PREFERRED_TYPE_DONE: unknown " +
|
|
||||||
"type=" + type);
|
|
||||||
type = mPreferredNetworkLabels.length - 1;
|
|
||||||
}
|
|
||||||
preferredNetworkType.setSelection(type, true);
|
|
||||||
} else {
|
} else {
|
||||||
preferredNetworkType.setSelection(mPreferredNetworkLabels.length - 1, true);
|
//In case of an exception, we will set this to unknown
|
||||||
|
updatePreferredNetworkType(mPreferredNetworkLabels.length-1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EVENT_SET_PREFERRED_TYPE_DONE:
|
case EVENT_SET_PREFERRED_TYPE_DONE:
|
||||||
ar= (AsyncResult) msg.obj;
|
ar= (AsyncResult) msg.obj;
|
||||||
if (ar.exception != null) {
|
if (ar.exception != null) {
|
||||||
phone.getPreferredNetworkType(
|
log("Set preferred network type success.");
|
||||||
obtainMessage(EVENT_QUERY_PREFERRED_TYPE_DONE));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case EVENT_QUERY_NEIGHBORING_CIDS_DONE:
|
|
||||||
ar= (AsyncResult) msg.obj;
|
|
||||||
if (ar.exception == null) {
|
|
||||||
updateNeighboringCids((ArrayList<NeighboringCellInfo>)ar.result);
|
|
||||||
} else {
|
|
||||||
mNeighboringCids.setText("unknown");
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EVENT_QUERY_SMSC_DONE:
|
case EVENT_QUERY_SMSC_DONE:
|
||||||
@@ -244,6 +263,7 @@ public class RadioInfo extends Activity {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
super.handleMessage(msg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -256,9 +276,16 @@ public class RadioInfo extends Activity {
|
|||||||
|
|
||||||
setContentView(R.layout.radio_info);
|
setContentView(R.layout.radio_info);
|
||||||
|
|
||||||
|
log("Started onCreate");
|
||||||
|
|
||||||
mTelephonyManager = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
|
mTelephonyManager = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
|
||||||
phone = PhoneFactory.getDefaultPhone();
|
phone = PhoneFactory.getDefaultPhone();
|
||||||
|
|
||||||
|
//TODO: Need to update this if the default phoneId changes?
|
||||||
|
// Better to have an instance per phone?
|
||||||
|
mImsManager = ImsManager.getInstance(getApplicationContext(),
|
||||||
|
SubscriptionManager.getDefaultVoicePhoneId());
|
||||||
|
|
||||||
mDeviceId= (TextView) findViewById(R.id.imei);
|
mDeviceId= (TextView) findViewById(R.id.imei);
|
||||||
number = (TextView) findViewById(R.id.number);
|
number = (TextView) findViewById(R.id.number);
|
||||||
callState = (TextView) findViewById(R.id.call);
|
callState = (TextView) findViewById(R.id.call);
|
||||||
@@ -273,6 +300,7 @@ public class RadioInfo extends Activity {
|
|||||||
mLocation = (TextView) findViewById(R.id.location);
|
mLocation = (TextView) findViewById(R.id.location);
|
||||||
mNeighboringCids = (TextView) findViewById(R.id.neighboring);
|
mNeighboringCids = (TextView) findViewById(R.id.neighboring);
|
||||||
mCellInfo = (TextView) findViewById(R.id.cellinfo);
|
mCellInfo = (TextView) findViewById(R.id.cellinfo);
|
||||||
|
mCellInfo.setTypeface(Typeface.MONOSPACE);
|
||||||
mDcRtInfoTv = (TextView) findViewById(R.id.dcrtinfo);
|
mDcRtInfoTv = (TextView) findViewById(R.id.dcrtinfo);
|
||||||
|
|
||||||
resets = (TextView) findViewById(R.id.resets);
|
resets = (TextView) findViewById(R.id.resets);
|
||||||
@@ -284,9 +312,8 @@ public class RadioInfo extends Activity {
|
|||||||
received = (TextView) findViewById(R.id.received);
|
received = (TextView) findViewById(R.id.received);
|
||||||
smsc = (EditText) findViewById(R.id.smsc);
|
smsc = (EditText) findViewById(R.id.smsc);
|
||||||
dnsCheckState = (TextView) findViewById(R.id.dnsCheckState);
|
dnsCheckState = (TextView) findViewById(R.id.dnsCheckState);
|
||||||
|
mPingHostnameV4 = (TextView) findViewById(R.id.pingHostnameV4);
|
||||||
mPingIpAddr = (TextView) findViewById(R.id.pingIpAddr);
|
mPingHostnameV6 = (TextView) findViewById(R.id.pingHostnameV6);
|
||||||
mPingHostname = (TextView) findViewById(R.id.pingHostname);
|
|
||||||
mHttpClientTest = (TextView) findViewById(R.id.httpClientTest);
|
mHttpClientTest = (TextView) findViewById(R.id.httpClientTest);
|
||||||
|
|
||||||
preferredNetworkType = (Spinner) findViewById(R.id.preferredNetworkType);
|
preferredNetworkType = (Spinner) findViewById(R.id.preferredNetworkType);
|
||||||
@@ -337,28 +364,26 @@ public class RadioInfo extends Activity {
|
|||||||
mPhoneStateReceiver.notifyServiceState(EVENT_SERVICE_STATE_CHANGED);
|
mPhoneStateReceiver.notifyServiceState(EVENT_SERVICE_STATE_CHANGED);
|
||||||
mPhoneStateReceiver.notifyPhoneCallState(EVENT_PHONE_STATE_CHANGED);
|
mPhoneStateReceiver.notifyPhoneCallState(EVENT_PHONE_STATE_CHANGED);
|
||||||
|
|
||||||
|
mPreferredNetworkTypeResult = mPreferredNetworkLabels.length - 1; //Unknown
|
||||||
|
|
||||||
|
//FIXME: Replace with TelephonyManager call
|
||||||
phone.getPreferredNetworkType(
|
phone.getPreferredNetworkType(
|
||||||
mHandler.obtainMessage(EVENT_QUERY_PREFERRED_TYPE_DONE));
|
mHandler.obtainMessage(EVENT_QUERY_PREFERRED_TYPE_DONE));
|
||||||
phone.getNeighboringCids(
|
|
||||||
mHandler.obtainMessage(EVENT_QUERY_NEIGHBORING_CIDS_DONE));
|
|
||||||
|
|
||||||
CellLocation.requestLocationUpdate();
|
restoreFromBundle(icicle);
|
||||||
|
|
||||||
// Get current cell info
|
|
||||||
mCellInfoValue = mTelephonyManager.getAllCellInfo();
|
|
||||||
log("onCreate: mCellInfoValue=" + mCellInfoValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
|
log("Started onResume");
|
||||||
|
|
||||||
updatePhoneState();
|
updatePhoneState();
|
||||||
updateSignalStrength();
|
updateSignalStrength();
|
||||||
updateMessageWaiting();
|
updateMessageWaiting();
|
||||||
updateCallRedirect();
|
updateCallRedirect();
|
||||||
updateServiceState();
|
updateServiceState();
|
||||||
updateLocation(mTelephonyManager.getCellLocation());
|
|
||||||
updateDataState();
|
updateDataState();
|
||||||
updateDataStats();
|
updateDataStats();
|
||||||
updateDataStats2();
|
updateDataStats2();
|
||||||
@@ -371,7 +396,13 @@ public class RadioInfo extends Activity {
|
|||||||
updateProperties();
|
updateProperties();
|
||||||
updateDnsCheckState();
|
updateDnsCheckState();
|
||||||
|
|
||||||
log("onResume: register phone & data intents");
|
updateNeighboringCids(mNeighboringCellResult);
|
||||||
|
updateLocation(mCellLocationResult);
|
||||||
|
updateCellInfo(mCellInfoResult);
|
||||||
|
|
||||||
|
mPingHostnameV4.setText(mPingHostnameResultV4);
|
||||||
|
mPingHostnameV6.setText(mPingHostnameResultV6);
|
||||||
|
mHttpClientTest.setText(mHttpClientTestResult);
|
||||||
|
|
||||||
mPhoneStateReceiver.registerIntent();
|
mPhoneStateReceiver.registerIntent();
|
||||||
mTelephonyManager.listen(mPhoneStateListener,
|
mTelephonyManager.listen(mPhoneStateListener,
|
||||||
@@ -385,7 +416,7 @@ public class RadioInfo extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
protected void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
|
|
||||||
log("onPause: unregister phone & data intents");
|
log("onPause: unregister phone & data intents");
|
||||||
@@ -394,6 +425,30 @@ public class RadioInfo extends Activity {
|
|||||||
mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
|
mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void restoreFromBundle(Bundle b) {
|
||||||
|
if( b == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mPingHostnameResultV4 = b.getString("mPingHostnameResultV4","");
|
||||||
|
mPingHostnameResultV6 = b.getString("mPingHostnameResultV6","");
|
||||||
|
mHttpClientTestResult = b.getString("mHttpClientTestResult","");
|
||||||
|
|
||||||
|
mPingHostnameV4.setText(mPingHostnameResultV4);
|
||||||
|
mPingHostnameV6.setText(mPingHostnameResultV6);
|
||||||
|
mHttpClientTest.setText(mHttpClientTestResult);
|
||||||
|
|
||||||
|
mPreferredNetworkTypeResult = b.getInt("mPreferredNetworkTypeResult", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onSaveInstanceState(Bundle outState) {
|
||||||
|
outState.putString("mPingHostnameResultV4", mPingHostnameResultV4);
|
||||||
|
outState.putString("mPingHostnameResultV6", mPingHostnameResultV6);
|
||||||
|
outState.putString("mHttpClientTestResult", mHttpClientTestResult);
|
||||||
|
outState.putInt("mPreferredNetworkTypeResult", mPreferredNetworkTypeResult);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
menu.add(0, MENU_ITEM_SELECT_BAND, 0, R.string.radio_info_band_mode_label)
|
menu.add(0, MENU_ITEM_SELECT_BAND, 0, R.string.radio_info_band_mode_label)
|
||||||
@@ -436,6 +491,7 @@ public class RadioInfo extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isRadioOn() {
|
private boolean isRadioOn() {
|
||||||
|
//FIXME: Replace with a TelephonyManager call
|
||||||
return phone.getServiceState().getState() != ServiceState.STATE_POWER_OFF;
|
return phone.getServiceState().getState() != ServiceState.STATE_POWER_OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -447,11 +503,24 @@ public class RadioInfo extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateCellInfoListRate() {
|
private void updateCellInfoListRate() {
|
||||||
cellInfoListRateButton.setText("CellInfoListRate " + mCellInfoListRateHandler.getRate());
|
int rate = mCellInfoListRateHandler.getRate();
|
||||||
updateCellInfoTv(mTelephonyManager.getAllCellInfo());
|
String rateStr;
|
||||||
|
switch(rate) {
|
||||||
|
case Integer.MAX_VALUE:
|
||||||
|
rateStr = "Off";
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
rateStr = "Immediate";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rateStr = (new Integer(rate)).toString() + "ms";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
cellInfoListRateButton.setText("CellInfoListRate "+ rateStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateDnsCheckState() {
|
private void updateDnsCheckState() {
|
||||||
|
//FIXME: Replace with a TelephonyManager call
|
||||||
dnsCheckState.setText(phone.isDnsCheckDisabled() ?
|
dnsCheckState.setText(phone.isDnsCheckDisabled() ?
|
||||||
"0.0.0.0 allowed" :"0.0.0.0 not allowed");
|
"0.0.0.0 allowed" :"0.0.0.0 not allowed");
|
||||||
}
|
}
|
||||||
@@ -521,7 +590,7 @@ public class RadioInfo extends Activity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final void updateNeighboringCids(ArrayList<NeighboringCellInfo> cids) {
|
private final void updateNeighboringCids(List<NeighboringCellInfo> cids) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
if (cids != null) {
|
if (cids != null) {
|
||||||
@@ -538,22 +607,128 @@ public class RadioInfo extends Activity {
|
|||||||
mNeighboringCids.setText(sb.toString());
|
mNeighboringCids.setText(sb.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private final void updateCellInfoTv(List<CellInfo> arrayCi) {
|
private final String getCellInfoDisplayString(int i) {
|
||||||
mCellInfoValue = arrayCi;
|
return (i != Integer.MAX_VALUE) ? Integer.toString(i) : "";
|
||||||
StringBuilder value = new StringBuilder();
|
}
|
||||||
if (mCellInfoValue != null) {
|
|
||||||
int index = 0;
|
private final String getCellInfoDisplayString(long i) {
|
||||||
for (CellInfo ci : mCellInfoValue) {
|
return (i != Long.MAX_VALUE) ? Long.toString(i) : "";
|
||||||
value.append('[');
|
}
|
||||||
value.append(index);
|
|
||||||
value.append("]=");
|
private final String buildCdmaInfoString(CellInfoCdma ci) {
|
||||||
value.append(ci.toString());
|
CellIdentityCdma cidCdma = ci.getCellIdentity();
|
||||||
if (++index < mCellInfoValue.size()) {
|
CellSignalStrengthCdma ssCdma = ci.getCellSignalStrength();
|
||||||
value.append("\n");
|
|
||||||
|
return String.format("%-3.3s %-5.5s %-5.5s %-5.5s %-6.6s %-6.6s %-6.6s %-6.6s %-5.5s",
|
||||||
|
ci.isRegistered() ? "S " : " ",
|
||||||
|
getCellInfoDisplayString(cidCdma.getSystemId()),
|
||||||
|
getCellInfoDisplayString(cidCdma.getNetworkId()),
|
||||||
|
getCellInfoDisplayString(cidCdma.getBasestationId()),
|
||||||
|
getCellInfoDisplayString(ssCdma.getCdmaDbm()),
|
||||||
|
getCellInfoDisplayString(ssCdma.getCdmaEcio()),
|
||||||
|
getCellInfoDisplayString(ssCdma.getEvdoDbm()),
|
||||||
|
getCellInfoDisplayString(ssCdma.getEvdoEcio()),
|
||||||
|
getCellInfoDisplayString(ssCdma.getEvdoSnr()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private final String buildGsmInfoString(CellInfoGsm ci) {
|
||||||
|
CellIdentityGsm cidGsm = ci.getCellIdentity();
|
||||||
|
CellSignalStrengthGsm ssGsm = ci.getCellSignalStrength();
|
||||||
|
|
||||||
|
return String.format("%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-4.4s %-4.4s\n",
|
||||||
|
ci.isRegistered() ? "S " : " ",
|
||||||
|
getCellInfoDisplayString(cidGsm.getMcc()),
|
||||||
|
getCellInfoDisplayString(cidGsm.getMnc()),
|
||||||
|
getCellInfoDisplayString(cidGsm.getLac()),
|
||||||
|
getCellInfoDisplayString(cidGsm.getCid()),
|
||||||
|
// TODO: Add BSIC support once integrated
|
||||||
|
// getCellInfoDisplayString(cidGsm.getBsic()),
|
||||||
|
" ",
|
||||||
|
getCellInfoDisplayString(ssGsm.getDbm()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private final String buildLteInfoString(CellInfoLte ci) {
|
||||||
|
CellIdentityLte cidLte = ci.getCellIdentity();
|
||||||
|
CellSignalStrengthLte ssLte = ci.getCellSignalStrength();
|
||||||
|
|
||||||
|
return String.format(
|
||||||
|
"%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-3.3s %-4.4s %-4.4s %-2.2s\n",
|
||||||
|
ci.isRegistered() ? "S " : " ",
|
||||||
|
getCellInfoDisplayString(cidLte.getMcc()),
|
||||||
|
getCellInfoDisplayString(cidLte.getMnc()),
|
||||||
|
getCellInfoDisplayString(cidLte.getTac()),
|
||||||
|
getCellInfoDisplayString(cidLte.getCi()),
|
||||||
|
getCellInfoDisplayString(cidLte.getPci()),
|
||||||
|
getCellInfoDisplayString(ssLte.getDbm()),
|
||||||
|
getCellInfoDisplayString(ssLte.getRsrq()),
|
||||||
|
getCellInfoDisplayString(ssLte.getTimingAdvance()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private final String buildWcdmaInfoString(CellInfoWcdma ci) {
|
||||||
|
CellIdentityWcdma cidWcdma = ci.getCellIdentity();
|
||||||
|
CellSignalStrengthWcdma ssWcdma = ci.getCellSignalStrength();
|
||||||
|
|
||||||
|
return String.format("%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-5.5s %-4.4s\n",
|
||||||
|
ci.isRegistered() ? "S " : " ",
|
||||||
|
getCellInfoDisplayString(cidWcdma.getMcc()),
|
||||||
|
getCellInfoDisplayString(cidWcdma.getMnc()),
|
||||||
|
getCellInfoDisplayString(cidWcdma.getLac()),
|
||||||
|
getCellInfoDisplayString(cidWcdma.getCid()),
|
||||||
|
getCellInfoDisplayString(cidWcdma.getPsc()),
|
||||||
|
getCellInfoDisplayString(ssWcdma.getDbm()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private final String buildCellInfoString(List<CellInfo> arrayCi) {
|
||||||
|
String value = new String();
|
||||||
|
StringBuilder cdmaCells = new StringBuilder(),
|
||||||
|
gsmCells = new StringBuilder(),
|
||||||
|
lteCells = new StringBuilder(),
|
||||||
|
wcdmaCells = new StringBuilder();
|
||||||
|
|
||||||
|
if (arrayCi != null) {
|
||||||
|
for (CellInfo ci : arrayCi) {
|
||||||
|
|
||||||
|
if (ci instanceof CellInfoLte) {
|
||||||
|
lteCells.append(buildLteInfoString((CellInfoLte) ci));
|
||||||
|
} else if (ci instanceof CellInfoWcdma) {
|
||||||
|
wcdmaCells.append(buildWcdmaInfoString((CellInfoWcdma) ci));
|
||||||
|
} else if (ci instanceof CellInfoGsm) {
|
||||||
|
gsmCells.append(buildGsmInfoString((CellInfoGsm) ci));
|
||||||
|
} else if (ci instanceof CellInfoCdma) {
|
||||||
|
cdmaCells.append(buildCdmaInfoString((CellInfoCdma) ci));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (lteCells.length() != 0) {
|
||||||
|
value += String.format(
|
||||||
|
"LTE\n%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-3.3s %-4.4s %-4.4s %-2.2s\n",
|
||||||
|
"SRV", "MCC", "MNC", "TAC", "CID", "PCI", "RSRP", "RSRQ", "TA");
|
||||||
|
value += lteCells.toString();
|
||||||
}
|
}
|
||||||
mCellInfo.setText(value.toString());
|
if (wcdmaCells.length() != 0) {
|
||||||
|
value += String.format("WCDMA\n%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-5.5s %-4.4s\n",
|
||||||
|
"SRV", "MCC", "MNC", "LAC", "CID", "PSC", "RSCP");
|
||||||
|
value += wcdmaCells.toString();
|
||||||
|
}
|
||||||
|
if (gsmCells.length() != 0) {
|
||||||
|
value += String.format("GSM\n%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-4.4s %-4.4s\n",
|
||||||
|
"SRV", "MCC", "MNC", "LAC", "CID", "BSIC", "RSSI");
|
||||||
|
value += gsmCells.toString();
|
||||||
|
}
|
||||||
|
if (cdmaCells.length() != 0) {
|
||||||
|
value += String.format(
|
||||||
|
"CDMA/EVDO\n%-3.3s %-5.5s %-5.5s %-5.5s %-6.6s %-6.6s %-6.6s %-6.6s %-5.5s\n",
|
||||||
|
"SRV", "SID", "NID", "BSID", "C-RSSI", "C-ECIO", "E-RSSI", "E-ECIO", "E-SNR");
|
||||||
|
value += cdmaCells.toString();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
value ="unknown";
|
||||||
|
}
|
||||||
|
|
||||||
|
return value.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private final void updateCellInfo(List<CellInfo> arrayCi) {
|
||||||
|
mCellInfo.setText(buildCellInfoString(arrayCi));
|
||||||
}
|
}
|
||||||
|
|
||||||
private final void updateDcRtInfoTv(DataConnectionRealTimeInfo dcRtInfo) {
|
private final void updateDcRtInfoTv(DataConnectionRealTimeInfo dcRtInfo) {
|
||||||
@@ -664,7 +839,7 @@ public class RadioInfo extends Activity {
|
|||||||
if (s == null) s = r.getString(R.string.radioInfo_unknown);
|
if (s == null) s = r.getString(R.string.radioInfo_unknown);
|
||||||
mDeviceId.setText(s);
|
mDeviceId.setText(s);
|
||||||
|
|
||||||
|
//FIXME: Replace with a TelephonyManager call
|
||||||
s = phone.getLine1Number();
|
s = phone.getLine1Number();
|
||||||
if (s == null) s = r.getString(R.string.radioInfo_unknown);
|
if (s == null) s = r.getString(R.string.radioInfo_unknown);
|
||||||
number.setText(s);
|
number.setText(s);
|
||||||
@@ -704,46 +879,35 @@ public class RadioInfo extends Activity {
|
|||||||
received.setText(rxPackets + " " + packets + ", " + rxBytes + " " + bytes);
|
received.setText(rxPackets + " " + packets + ", " + rxBytes + " " + bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Ping a IP address.
|
|
||||||
*/
|
|
||||||
private final void pingIpAddr() {
|
|
||||||
try {
|
|
||||||
// This is hardcoded IP addr. This is for testing purposes.
|
|
||||||
// We would need to get rid of this before release.
|
|
||||||
String ipAddress = "74.125.47.104";
|
|
||||||
Process p = Runtime.getRuntime().exec("ping -c 1 " + ipAddress);
|
|
||||||
int status = p.waitFor();
|
|
||||||
if (status == 0) {
|
|
||||||
mPingIpAddrResult = "Pass";
|
|
||||||
} else {
|
|
||||||
mPingIpAddrResult = "Fail: IP addr not reachable";
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
mPingIpAddrResult = "Fail: IOException";
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
mPingIpAddrResult = "Fail: InterruptedException";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ping a host name
|
* Ping a host name
|
||||||
*/
|
*/
|
||||||
private final void pingHostname() {
|
private final void pingHostname() {
|
||||||
try {
|
try {
|
||||||
Process p = Runtime.getRuntime().exec("ping -c 1 www.google.com");
|
try {
|
||||||
int status = p.waitFor();
|
Process p4 = Runtime.getRuntime().exec("ping -c 1 www.google.com");
|
||||||
if (status == 0) {
|
int status4 = p4.waitFor();
|
||||||
mPingHostnameResult = "Pass";
|
if (status4 == 0) {
|
||||||
|
mPingHostnameResultV4 = "Pass";
|
||||||
} else {
|
} else {
|
||||||
mPingHostnameResult = "Fail: Host unreachable";
|
mPingHostnameResultV4 = String.format("Fail(%d)", status4);
|
||||||
}
|
}
|
||||||
} catch (UnknownHostException e) {
|
|
||||||
mPingHostnameResult = "Fail: Unknown Host";
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
mPingHostnameResult= "Fail: IOException";
|
mPingHostnameResultV4 = "Fail: IOException";
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Process p6 = Runtime.getRuntime().exec("ping6 -c 1 www.google.com");
|
||||||
|
int status6 = p6.waitFor();
|
||||||
|
if (status6 == 0) {
|
||||||
|
mPingHostnameResultV6 = "Pass";
|
||||||
|
} else {
|
||||||
|
mPingHostnameResultV6 = String.format("Fail(%d)", status6);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
mPingHostnameResultV6 = "Fail: IOException";
|
||||||
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
mPingHostnameResult = "Fail: InterruptedException";
|
mPingHostnameResultV4 = mPingHostnameResultV6 = "Fail: InterruptedException";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -771,41 +935,60 @@ public class RadioInfo extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void refreshSmsc() {
|
private void refreshSmsc() {
|
||||||
|
//FIXME: Replace with a TelephonyManager call
|
||||||
phone.getSmscAddress(mHandler.obtainMessage(EVENT_QUERY_SMSC_DONE));
|
phone.getSmscAddress(mHandler.obtainMessage(EVENT_QUERY_SMSC_DONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final void updateAllCellInfo() {
|
||||||
|
|
||||||
|
mCellInfo.setText("");
|
||||||
|
mNeighboringCids.setText("");
|
||||||
|
mLocation.setText("");
|
||||||
|
|
||||||
|
final Runnable updateAllCellInfoResults = new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
updateNeighboringCids(mNeighboringCellResult);
|
||||||
|
updateLocation(mCellLocationResult);
|
||||||
|
updateCellInfo(mCellInfoResult);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Thread locThread = new Thread() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
mCellInfoResult = mTelephonyManager.getAllCellInfo();
|
||||||
|
mCellLocationResult = mTelephonyManager.getCellLocation();
|
||||||
|
mNeighboringCellResult = mTelephonyManager.getNeighboringCellInfo();
|
||||||
|
|
||||||
|
mHandler.post(updateAllCellInfoResults);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
locThread.start();
|
||||||
|
}
|
||||||
|
|
||||||
private final void updatePingState() {
|
private final void updatePingState() {
|
||||||
final Handler handler = new Handler();
|
|
||||||
// Set all to unknown since the threads will take a few secs to update.
|
// Set all to unknown since the threads will take a few secs to update.
|
||||||
mPingIpAddrResult = getResources().getString(R.string.radioInfo_unknown);
|
mPingHostnameResultV4 = getResources().getString(R.string.radioInfo_unknown);
|
||||||
mPingHostnameResult = getResources().getString(R.string.radioInfo_unknown);
|
mPingHostnameResultV6 = getResources().getString(R.string.radioInfo_unknown);
|
||||||
mHttpClientTestResult = getResources().getString(R.string.radioInfo_unknown);
|
mHttpClientTestResult = getResources().getString(R.string.radioInfo_unknown);
|
||||||
|
|
||||||
mPingIpAddr.setText(mPingIpAddrResult);
|
mPingHostnameV4.setText(mPingHostnameResultV4);
|
||||||
mPingHostname.setText(mPingHostnameResult);
|
mPingHostnameV6.setText(mPingHostnameResultV6);
|
||||||
mHttpClientTest.setText(mHttpClientTestResult);
|
mHttpClientTest.setText(mHttpClientTestResult);
|
||||||
|
|
||||||
final Runnable updatePingResults = new Runnable() {
|
final Runnable updatePingResults = new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
mPingIpAddr.setText(mPingIpAddrResult);
|
mPingHostnameV4.setText(mPingHostnameResultV4);
|
||||||
mPingHostname.setText(mPingHostnameResult);
|
mPingHostnameV6.setText(mPingHostnameResultV6);
|
||||||
mHttpClientTest.setText(mHttpClientTestResult);
|
mHttpClientTest.setText(mHttpClientTestResult);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Thread ipAddr = new Thread() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
pingIpAddr();
|
|
||||||
handler.post(updatePingResults);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
ipAddr.start();
|
|
||||||
|
|
||||||
Thread hostname = new Thread() {
|
Thread hostname = new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
pingHostname();
|
pingHostname();
|
||||||
handler.post(updatePingResults);
|
mHandler.post(updatePingResults);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
hostname.start();
|
hostname.start();
|
||||||
@@ -814,7 +997,7 @@ public class RadioInfo extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
httpClientTest();
|
httpClientTest();
|
||||||
handler.post(updatePingResults);
|
mHandler.post(updatePingResults);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
httpClient.start();
|
httpClient.start();
|
||||||
@@ -910,6 +1093,7 @@ public class RadioInfo extends Activity {
|
|||||||
|
|
||||||
private MenuItem.OnMenuItemClickListener mGetPdpList = new MenuItem.OnMenuItemClickListener() {
|
private MenuItem.OnMenuItemClickListener mGetPdpList = new MenuItem.OnMenuItemClickListener() {
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
//FIXME: Replace with a TelephonyManager call
|
||||||
phone.getDataCallList(null);
|
phone.getDataCallList(null);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -929,9 +1113,11 @@ public class RadioInfo extends Activity {
|
|||||||
int state = mTelephonyManager.getDataState();
|
int state = mTelephonyManager.getDataState();
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case TelephonyManager.DATA_CONNECTED:
|
case TelephonyManager.DATA_CONNECTED:
|
||||||
|
//FIXME: Replace with a TelephonyManager call
|
||||||
phone.setDataEnabled(false);
|
phone.setDataEnabled(false);
|
||||||
break;
|
break;
|
||||||
case TelephonyManager.DATA_DISCONNECTED:
|
case TelephonyManager.DATA_DISCONNECTED:
|
||||||
|
//FIXME: Replace with a TelephonyManager call
|
||||||
phone.setDataEnabled(true);
|
phone.setDataEnabled(true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -945,12 +1131,13 @@ public class RadioInfo extends Activity {
|
|||||||
OnClickListener mPowerButtonHandler = new OnClickListener() {
|
OnClickListener mPowerButtonHandler = new OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
//log("toggle radio power: currently " + (isRadioOn()?"on":"off"));
|
//log("toggle radio power: currently " + (isRadioOn()?"on":"off"));
|
||||||
|
//FIXME: Replace with a TelephonyManager call
|
||||||
phone.setRadioPower(!isRadioOn());
|
phone.setRadioPower(!isRadioOn());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class CellInfoListRateHandler implements OnClickListener {
|
class CellInfoListRateHandler implements OnClickListener {
|
||||||
int rates[] = {Integer.MAX_VALUE, 0, 1000};
|
int rates[] = {Integer.MAX_VALUE, 0, 5000};
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
public int getRate() {
|
public int getRate() {
|
||||||
@@ -960,11 +1147,13 @@ public class RadioInfo extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
index += 1;
|
index += 1;
|
||||||
if (index >= rates.length) {
|
index %= rates.length;
|
||||||
index = 0;
|
|
||||||
}
|
// FIXME: Replace with a TelephonyManager call
|
||||||
phone.setCellInfoListRate(rates[index]);
|
phone.setCellInfoListRate(rates[index]);
|
||||||
updateCellInfoListRate();
|
updateCellInfoListRate();
|
||||||
|
|
||||||
|
updateAllCellInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CellInfoListRateHandler mCellInfoListRateHandler = new CellInfoListRateHandler();
|
CellInfoListRateHandler mCellInfoListRateHandler = new CellInfoListRateHandler();
|
||||||
@@ -1020,12 +1209,12 @@ public class RadioInfo extends Activity {
|
|||||||
(isImsVoLteProvisioned() ? "on":"off")));
|
(isImsVoLteProvisioned() ? "on":"off")));
|
||||||
final boolean newValue = !isImsVoLteProvisioned();
|
final boolean newValue = !isImsVoLteProvisioned();
|
||||||
if (phone != null) {
|
if (phone != null) {
|
||||||
final ImsManager imsManager = ImsManager.getInstance(phone.getContext(), phone.getSubId());
|
//TODO: Why does this have to be called within the phone's context?
|
||||||
if (imsManager != null) {
|
if (mImsManager != null) {
|
||||||
QueuedWork.singleThreadExecutor().submit(new Runnable() {
|
QueuedWork.singleThreadExecutor().submit(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
imsManager.getConfigInterface().setProvisionedValue(
|
mImsManager.getConfigInterface().setProvisionedValue(
|
||||||
ImsConfig.ConfigConstants.VLT_SETTING_ENABLED,
|
ImsConfig.ConfigConstants.VLT_SETTING_ENABLED,
|
||||||
newValue? 1 : 0);
|
newValue? 1 : 0);
|
||||||
} catch (ImsException e) {
|
} catch (ImsException e) {
|
||||||
@@ -1041,8 +1230,10 @@ public class RadioInfo extends Activity {
|
|||||||
|
|
||||||
private boolean isImsVoLteProvisioned() {
|
private boolean isImsVoLteProvisioned() {
|
||||||
if (phone != null) {
|
if (phone != null) {
|
||||||
ImsManager imsManager = ImsManager.getInstance(phone.getContext(), phone.getSubId());
|
//TODO: Why does this have to be called within the phone's context?
|
||||||
return imsManager.isVolteProvisionedOnDevice(phone.getContext());
|
if(mImsManager != null ) {
|
||||||
|
return mImsManager.isVolteProvisionedOnDevice(phone.getContext());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1090,6 +1281,7 @@ public class RadioInfo extends Activity {
|
|||||||
|
|
||||||
OnClickListener mDnsCheckButtonHandler = new OnClickListener() {
|
OnClickListener mDnsCheckButtonHandler = new OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
//FIXME: Replace with a TelephonyManager call
|
||||||
phone.disableDnsCheck(!phone.isDnsCheckDisabled());
|
phone.disableDnsCheck(!phone.isDnsCheckDisabled());
|
||||||
updateDnsCheckState();
|
updateDnsCheckState();
|
||||||
}
|
}
|
||||||
@@ -1128,12 +1320,15 @@ public class RadioInfo extends Activity {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
AdapterView.OnItemSelectedListener
|
AdapterView.OnItemSelectedListener mPreferredNetworkHandler =
|
||||||
mPreferredNetworkHandler = new AdapterView.OnItemSelectedListener() {
|
new AdapterView.OnItemSelectedListener() {
|
||||||
|
|
||||||
public void onItemSelected(AdapterView parent, View v, int pos, long id) {
|
public void onItemSelected(AdapterView parent, View v, int pos, long id) {
|
||||||
|
if (mPreferredNetworkTypeResult != pos && pos >= 0
|
||||||
|
&& pos <= mPreferredNetworkLabels.length - 2) {
|
||||||
|
mPreferredNetworkTypeResult = pos;
|
||||||
Message msg = mHandler.obtainMessage(EVENT_SET_PREFERRED_TYPE_DONE);
|
Message msg = mHandler.obtainMessage(EVENT_SET_PREFERRED_TYPE_DONE);
|
||||||
if (pos>=0 && pos<=(mPreferredNetworkLabels.length - 2)) {
|
phone.setPreferredNetworkType(mPreferredNetworkTypeResult, msg);
|
||||||
phone.setPreferredNetworkType(pos, msg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1149,11 +1344,21 @@ public class RadioInfo extends Activity {
|
|||||||
"CDMA auto (PRL)",
|
"CDMA auto (PRL)",
|
||||||
"CDMA only",
|
"CDMA only",
|
||||||
"EvDo only",
|
"EvDo only",
|
||||||
"GSM/CDMA auto (PRL)",
|
"Global auto (PRL)",
|
||||||
"LTE/CDMA auto (PRL)",
|
"LTE/CDMA auto (PRL)",
|
||||||
"LTE/GSM auto (PRL)",
|
"LTE/UMTS auto (PRL)",
|
||||||
"LTE/GSM/CDMA auto (PRL)",
|
"LTE/CDMA/UMTS auto (PRL)",
|
||||||
"LTE only",
|
"LTE only",
|
||||||
|
"LTE/WCDMA",
|
||||||
|
"TD-SCDMA only",
|
||||||
|
"TD-SCDMA/WCDMA",
|
||||||
|
"LTE/TD-SCDMA",
|
||||||
|
"TD-SCDMA/GSM",
|
||||||
|
"TD-SCDMA/UMTS",
|
||||||
|
"LTE/TD-SCDMA/WCDMA",
|
||||||
|
"LTE/TD-SCDMA/UMTS",
|
||||||
|
"TD-SCDMA/CDMA/UMTS",
|
||||||
|
"Global/TD-SCDMA",
|
||||||
"Unknown"};
|
"Unknown"};
|
||||||
|
|
||||||
private void log(String s) {
|
private void log(String s) {
|
||||||
|
@@ -148,8 +148,7 @@ public class WifiStatusTest extends Activity {
|
|||||||
mScanList = (TextView) findViewById(R.id.scan_list);
|
mScanList = (TextView) findViewById(R.id.scan_list);
|
||||||
|
|
||||||
|
|
||||||
mPingIpAddr = (TextView) findViewById(R.id.pingIpAddr);
|
mPingHostname = (TextView) findViewById(R.id.pingHostnameV4);
|
||||||
mPingHostname = (TextView) findViewById(R.id.pingHostname);
|
|
||||||
mHttpClientTest = (TextView) findViewById(R.id.httpClientTest);
|
mHttpClientTest = (TextView) findViewById(R.id.httpClientTest);
|
||||||
|
|
||||||
pingTestButton = (Button) findViewById(R.id.ping_test);
|
pingTestButton = (Button) findViewById(R.id.ping_test);
|
||||||
@@ -317,19 +316,10 @@ public class WifiStatusTest extends Activity {
|
|||||||
|
|
||||||
final Runnable updatePingResults = new Runnable() {
|
final Runnable updatePingResults = new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
mPingIpAddr.setText(mPingIpAddrResult);
|
|
||||||
mPingHostname.setText(mPingHostnameResult);
|
mPingHostname.setText(mPingHostnameResult);
|
||||||
mHttpClientTest.setText(mHttpClientTestResult);
|
mHttpClientTest.setText(mHttpClientTestResult);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Thread ipAddrThread = new Thread() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
pingIpAddr();
|
|
||||||
handler.post(updatePingResults);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
ipAddrThread.start();
|
|
||||||
|
|
||||||
Thread hostnameThread = new Thread() {
|
Thread hostnameThread = new Thread() {
|
||||||
@Override
|
@Override
|
||||||
@@ -350,28 +340,6 @@ public class WifiStatusTest extends Activity {
|
|||||||
httpClientThread.start();
|
httpClientThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The ping functions have been borrowed from Radio diagnostic app to
|
|
||||||
* enable quick access on the wifi status screen
|
|
||||||
*/
|
|
||||||
private final void pingIpAddr() {
|
|
||||||
try {
|
|
||||||
// TODO: Hardcoded for now, make it UI configurable
|
|
||||||
String ipAddress = "74.125.47.104";
|
|
||||||
Process p = Runtime.getRuntime().exec("ping -c 1 -w 100 " + ipAddress);
|
|
||||||
int status = p.waitFor();
|
|
||||||
if (status == 0) {
|
|
||||||
mPingIpAddrResult = "Pass";
|
|
||||||
} else {
|
|
||||||
mPingIpAddrResult = "Fail: IP addr not reachable";
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
mPingIpAddrResult = "Fail: IOException";
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
mPingIpAddrResult = "Fail: InterruptedException";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private final void pingHostname() {
|
private final void pingHostname() {
|
||||||
try {
|
try {
|
||||||
// TODO: Hardcoded for now, make it UI configurable
|
// TODO: Hardcoded for now, make it UI configurable
|
||||||
|
Reference in New Issue
Block a user