Merge changes from topic "telephony-debug-pi-tweaks"
* changes:
[Telephony Debug Menu] Redo Layout
[Telephony Debug Menu] Remove DcRtInfo
[Telephony Debug Menu] Remove NeighboringCellInfo
[Telephony Debug Menu] Add Link Capacity Estimate
[Telephony Debug Menu] Add Physical Channel Config
[Telephony Debug Menu] LTE BW and Serving CellInfo
diff --git a/res/layout/radio_info.xml b/res/layout/radio_info.xml
index 502505c..c1d6ff6 100644
--- a/res/layout/radio_info.xml
+++ b/res/layout/radio_info.xml
@@ -49,16 +49,10 @@
<TextView android:id="@+id/operator" style="@style/info_value" />
</LinearLayout>
- <!-- Signal Strength -->
+ <!-- Roaming -->
<LinearLayout style="@style/entry_layout">
- <TextView android:text="@string/radio_info_signal_strength_label" style="@style/info_label" />
- <TextView android:id="@+id/dbm" style="@style/info_value" />
- </LinearLayout>
-
- <!-- Voice Service Status -->
- <LinearLayout style="@style/entry_layout">
- <TextView android:text="@string/radio_info_gsm_service_label" style="@style/info_label" />
- <TextView android:id="@+id/gsm" style="@style/info_value" />
+ <TextView android:text="@string/radio_info_roaming_label" style="@style/info_label" />
+ <TextView android:id="@+id/roaming" style="@style/info_value" />
</LinearLayout>
<!-- Data Service Status -->
@@ -67,30 +61,54 @@
<TextView android:id="@+id/gprs" style="@style/info_value" />
</LinearLayout>
- <!-- Network Type -->
- <LinearLayout style="@style/entry_layout">
- <TextView android:text="@string/radio_info_voice_network_type_label" style="@style/info_label" />
- <TextView android:id="@+id/voice_network" style="@style/info_value" />
- </LinearLayout>
-
- <!-- Network Type -->
+ <!-- Data Network Type -->
<LinearLayout style="@style/entry_layout">
<TextView android:text="@string/radio_info_data_network_type_label" style="@style/info_label" />
<TextView android:id="@+id/data_network" style="@style/info_value" />
</LinearLayout>
- <!-- Call Status -->
+ <!-- Voice Service Status -->
<LinearLayout style="@style/entry_layout">
- <TextView android:text="@string/radio_info_call_status_label" style="@style/info_label" />
- <TextView android:id="@+id/call" style="@style/info_value" />
+ <TextView android:text="@string/radio_info_gsm_service_label" style="@style/info_label" />
+ <TextView android:id="@+id/gsm" style="@style/info_value" />
</LinearLayout>
- <!-- Roaming -->
+ <!-- Voice Network Type -->
<LinearLayout style="@style/entry_layout">
- <TextView android:text="@string/radio_info_roaming_label" style="@style/info_label" />
- <TextView android:id="@+id/roaming" style="@style/info_value" />
+ <TextView android:text="@string/radio_info_voice_network_type_label" style="@style/info_label" />
+ <TextView android:id="@+id/voice_network" style="@style/info_value" />
</LinearLayout>
+ <!-- Signal Strength -->
+ <LinearLayout style="@style/entry_layout">
+ <TextView android:text="@string/radio_info_signal_strength_label" style="@style/info_label" />
+ <TextView android:id="@+id/dbm" style="@style/info_value" />
+ </LinearLayout>
+
+ <!-- Link Bandwidth -->
+ <LinearLayout style="@style/entry_layout" android:orientation="horizontal">
+ <TextView android:text="@string/radio_info_dl_kbps" style="@style/info_label" />
+ <TextView android:id="@+id/dl_kbps" style="@style/info_value" />
+ </LinearLayout>
+
+ <!-- Link Bandwidth -->
+ <LinearLayout style="@style/entry_layout" android:orientation="horizontal">
+ <TextView android:text="@string/radio_info_ul_kbps" style="@style/info_label" />
+ <TextView android:id="@+id/ul_kbps" style="@style/info_value" />
+ </LinearLayout>
+
+ <!-- Physical Channel Config -->
+ <LinearLayout style="@style/entry_layout">
+ <TextView android:text="@string/radio_info_phy_chan_config" style="@style/info_label" />
+ <TextView android:id="@+id/phy_chan_config" style="@style/info_value" />
+ </LinearLayout>
+
+ <!-- Horizontal Rule -->
+ <View
+ android:layout_width="fill_parent"
+ android:layout_height="1dip"
+ android:background="#000000" />
+
<!-- Preferred Network Type -->
<TextView
android:layout_width="match_parent"
@@ -110,76 +128,6 @@
android:layout_height="1dip"
android:background="#000000" />
- <!-- Ping stats -->
- <Button android:id="@+id/ping_test"
- android:textSize="14sp"
- android:layout_marginTop="8dip"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/ping_test_label"
- />
-
- <LinearLayout style="@style/entry_layout">
- <TextView android:text="@string/radio_info_ping_hostname_v4" style="@style/info_label" />
- <TextView android:id="@+id/pingHostnameV4" style="@style/info_value" />
- </LinearLayout>
-
- <LinearLayout style="@style/entry_layout">
- <TextView android:text="@string/radio_info_ping_hostname_v6" style="@style/info_label" />
- <TextView android:id="@+id/pingHostnameV6" style="@style/info_value" />
- </LinearLayout>
-
- <LinearLayout style="@style/entry_layout">
- <TextView android:text="@string/radio_info_http_client_test" style="@style/info_label" />
- <TextView android:id="@+id/httpClientTest" style="@style/info_value" />
- </LinearLayout>
-
- <!-- Horizontal Rule -->
- <View
- android:layout_width="fill_parent"
- android:layout_height="1dip"
- android:background="#000000" />
-
- <!-- DcRtInfo - DataConnectionRealTimeInfo -->
- <LinearLayout style="@style/entry_layout">
- <TextView android:text="@string/radio_info_dcrtinfo_label"
- style="@style/info_label" />
- <TextView android:id="@+id/dcrtinfo" style="@style/info_value" />
- </LinearLayout>
-
- <!-- Message Waiting Indicator -->
- <LinearLayout style="@style/entry_layout">
- <TextView android:text="@string/radio_info_message_waiting_label" style="@style/info_label" />
- <TextView android:id="@+id/mwi" style="@style/info_value" />
- </LinearLayout>
-
- <!-- Call Forwarding Indicator -->
- <LinearLayout style="@style/entry_layout">
- <TextView android:text="@string/radio_info_call_redirect_label" style="@style/info_label" />
- <TextView android:id="@+id/cfi" style="@style/info_value" />
- </LinearLayout>
-
- <!-- PPP Sent -->
- <LinearLayout style="@style/entry_layout">
- <TextView android:text="@string/radio_info_ppp_sent_label"
- style="@style/info_label" />
- <TextView android:id="@+id/sent" style="@style/info_value" />
- </LinearLayout>
-
- <!-- PPP Received -->
- <LinearLayout style="@style/entry_layout">
- <TextView android:text="@string/radio_info_ppp_received_label"
- style="@style/info_label" />
- <TextView android:id="@+id/received" style="@style/info_value" />
- </LinearLayout>
-
- <!-- PPP Sent since last received -->
- <LinearLayout style="@style/entry_layout">
- <TextView android:text="@string/radio_info_ppp_resets_label"
- style="@style/info_label" />
- <TextView android:id="@+id/sentSinceReceived" style="@style/info_value" />
- </LinearLayout>
-
<!-- Radio Power -->
<Switch android:id="@+id/radio_power"
android:textSize="14sp"
@@ -220,6 +168,157 @@
android:layout_height="wrap_content"
android:text="@string/eab_provisioned_switch_string"/>
+ <!-- Horizontal Rule -->
+ <View
+ android:layout_width="fill_parent"
+ android:layout_height="1dip"
+ android:background="#000000" />
+
+ <!-- Ping stats -->
+ <Button android:id="@+id/ping_test"
+ android:textSize="14sp"
+ android:layout_marginTop="8dip"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/ping_test_label"
+ />
+
+ <LinearLayout style="@style/entry_layout">
+ <TextView android:text="@string/radio_info_ping_hostname_v4" style="@style/info_label" />
+ <TextView android:id="@+id/pingHostnameV4" style="@style/info_value" />
+ </LinearLayout>
+
+ <LinearLayout style="@style/entry_layout">
+ <TextView android:text="@string/radio_info_ping_hostname_v6" style="@style/info_label" />
+ <TextView android:id="@+id/pingHostnameV6" style="@style/info_value" />
+ </LinearLayout>
+
+ <LinearLayout style="@style/entry_layout">
+ <TextView android:text="@string/radio_info_http_client_test" style="@style/info_label" />
+ <TextView android:id="@+id/httpClientTest" style="@style/info_value" />
+ </LinearLayout>
+
+ <!-- Horizontal Rule -->
+ <View
+ android:layout_width="fill_parent"
+ android:layout_height="1dip"
+ android:background="#000000" />
+
+ <!-- PPP Sent -->
+ <LinearLayout style="@style/entry_layout">
+ <TextView android:text="@string/radio_info_ppp_sent_label"
+ style="@style/info_label" />
+ <TextView android:id="@+id/sent" style="@style/info_value" />
+ </LinearLayout>
+
+ <!-- PPP Received -->
+ <LinearLayout style="@style/entry_layout">
+ <TextView android:text="@string/radio_info_ppp_received_label"
+ style="@style/info_label" />
+ <TextView android:id="@+id/received" style="@style/info_value" />
+ </LinearLayout>
+
+ <!-- PPP Sent since last received -->
+ <LinearLayout style="@style/entry_layout">
+ <TextView android:text="@string/radio_info_ppp_resets_label"
+ style="@style/info_label" />
+ <TextView android:id="@+id/sentSinceReceived" style="@style/info_value" />
+ </LinearLayout>
+
+ <!-- Horizontal Rule -->
+ <View
+ android:layout_width="fill_parent"
+ android:layout_height="1dip"
+ android:background="#000000" />
+
+ <!-- Call Status -->
+ <LinearLayout style="@style/entry_layout">
+ <TextView android:text="@string/radio_info_call_status_label" style="@style/info_label" />
+ <TextView android:id="@+id/call" style="@style/info_value" />
+ </LinearLayout>
+
+ <!-- Message Waiting Indicator -->
+ <LinearLayout style="@style/entry_layout">
+ <TextView android:text="@string/radio_info_message_waiting_label" style="@style/info_label" />
+ <TextView android:id="@+id/mwi" style="@style/info_value" />
+ </LinearLayout>
+
+ <!-- Call Forwarding Indicator -->
+ <LinearLayout style="@style/entry_layout">
+ <TextView android:text="@string/radio_info_call_redirect_label" style="@style/info_label" />
+ <TextView android:id="@+id/cfi" style="@style/info_value" />
+ </LinearLayout>
+
+ <!-- Horizontal Rule -->
+ <View
+ android:layout_width="fill_parent"
+ android:layout_height="1dip"
+ android:background="#000000" />
+
+ <!-- CellInfoListRate Selection -->
+ <!-- Location -->
+ <LinearLayout style="@style/entry_layout">
+ <TextView android:text="@string/radio_info_signal_location_label" style="@style/info_label" />
+ <TextView android:id="@+id/location" style="@style/info_value" />
+ </LinearLayout>
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/radio_info_cell_info_refresh_rate"
+ style="@style/info_label"
+ />
+
+ <Spinner android:id="@+id/cell_info_rate_select"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ />
+
+ <!-- CellInfo -->
+ <LinearLayout style="@style/entry_layout">
+ <TextView android:text="@string/radio_info_cellinfo_label"
+ style="@style/info_label" />
+ </LinearLayout>
+ <LinearLayout style="@style/entry_layout">
+ <TextView android:id="@+id/cellinfo"
+ style="@style/info_value"
+ android:minHeight="300dip"
+ android:textSize="12sp" />
+ </LinearLayout>
+
+ <!-- Horizontal Rule -->
+ <View
+ android:layout_width="fill_parent"
+ android:layout_height="1dip"
+ android:background="#000000" />
+
+ <!-- Launch OEM-specific Info/Settings Activity (if any) -->
+ <!-- Carrier Provisioning -->
+ <LinearLayout style="@style/entry_layout"
+ android:orientation="horizontal" >
+ <Button android:id="@+id/carrier_provisioning"
+ android:layout_marginTop="8dip"
+ android:layout_weight="1"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:text="@string/carrier_provisioning"
+ android:textSize="14sp"/>
+ <Button android:id="@+id/trigger_carrier_provisioning"
+ android:layout_marginTop="8dip"
+ android:layout_weight="1"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:text="@string/trigger_carrier_provisioning"
+ android:textSize="14sp"/>
+ <Button android:id="@+id/oem_info"
+ android:layout_marginTop="8dip"
+ android:layout_weight="1"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:text="@string/oem_radio_info_label"
+ android:textSize="14sp"/>
+ </LinearLayout>
+
<!-- SMSC -->
<RelativeLayout android:layout_width="match_parent"
android:layout_height="wrap_content">
@@ -263,74 +362,6 @@
<TextView android:id="@+id/dnsCheckState" style="@style/info_value" />
</LinearLayout>
- <!-- Launch OEM-specific Info/Settings Activity (if any) -->
- <Button android:id="@+id/oem_info"
- android:textSize="14sp"
- android:layout_marginTop="8dip"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/oem_radio_info_label"
- />
-
- <!-- Horizontal Rule -->
- <View
- android:layout_width="fill_parent"
- android:layout_height="1dip"
- android:background="#000000" />
-
- <!-- CellInfoListRate Selection -->
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/radio_info_cell_info_refresh_rate"
- style="@style/info_label"
- />
-
- <Spinner android:id="@+id/cell_info_rate_select"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- />
-
- <!-- Location -->
- <LinearLayout style="@style/entry_layout">
- <TextView android:text="@string/radio_info_signal_location_label" style="@style/info_label" />
- <TextView android:id="@+id/location" style="@style/info_value" />
- </LinearLayout>
-
- <!-- Neighboring Cids -->
- <LinearLayout style="@style/entry_layout">
- <TextView android:text="@string/radio_info_neighboring_location_label"
- style="@style/info_label" />
- <TextView android:id="@+id/neighboring" style="@style/info_value" />
- </LinearLayout>
-
- <!-- CellInfo -->
- <LinearLayout style="@style/entry_layout">
- <TextView android:text="@string/radio_info_cellinfo_label"
- style="@style/info_label" />
- </LinearLayout>
- <LinearLayout style="@style/entry_layout">
- <TextView android:id="@+id/cellinfo"
- style="@style/info_value"
- android:minHeight="300dip"
- android:textSize="12sp" />
- </LinearLayout>
-
- <!-- Carrier Provisioning -->
- <LinearLayout style="@style/entry_layout">
- <Button android:id="@+id/carrier_provisioning"
- android:layout_marginTop="8dip"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/carrier_provisioning"
- android:textSize="14sp"/>
- <Button android:id="@+id/trigger_carrier_provisioning"
- android:layout_marginTop="8dip"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/trigger_carrier_provisioning"
- android:textSize="14sp"/>
- </LinearLayout>
</LinearLayout>
</ScrollView>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0d7b095..93b93e4 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -447,16 +447,18 @@
<string name="proxy_url_title">"PAC URL: "</string>
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
+ <string name="radio_info_dl_kbps">DL Bandwidth (kbps):</string>
+ <!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
+ <string name="radio_info_ul_kbps">UL Bandwidth (kbps):</string>
+ <!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
<string name="radio_info_signal_location_label">Cell Location Info (deprecated):</string>
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
- <string name="radio_info_neighboring_location_label">Neighbor Cell Info (deprecated):</string>
+ <string name="radio_info_phy_chan_config">LTE Physical Channel Configuration:</string>
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
<string name="radio_info_cell_info_refresh_rate">Cell Info Refresh Rate:</string>
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
<string name="radio_info_cellinfo_label">All Cell Measurement Info:</string>
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
- <string name="radio_info_dcrtinfo_label">Data Connection Real-Time Info:</string>
- <!-- 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">Data Service:</string>
<!-- 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>
diff --git a/src/com/android/settings/RadioInfo.java b/src/com/android/settings/RadioInfo.java
index b885483..c04269c 100644
--- a/src/com/android/settings/RadioInfo.java
+++ b/src/com/android/settings/RadioInfo.java
@@ -16,6 +16,8 @@
package com.android.settings;
+import static android.net.ConnectivityManager.NetworkCallback;
+
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
@@ -27,6 +29,10 @@
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.graphics.Typeface;
+import android.net.ConnectivityManager;
+import android.net.Network;
+import android.net.NetworkCapabilities;
+import android.net.NetworkRequest;
import android.net.TrafficStats;
import android.net.Uri;
import android.os.AsyncResult;
@@ -48,16 +54,16 @@
import android.telephony.CellSignalStrengthGsm;
import android.telephony.CellSignalStrengthLte;
import android.telephony.CellSignalStrengthWcdma;
-import android.telephony.DataConnectionRealTimeInfo;
-import android.telephony.NeighboringCellInfo;
import android.telephony.PreciseCallState;
import android.telephony.PhoneStateListener;
+import android.telephony.PhysicalChannelConfig;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.cdma.CdmaCellLocation;
import android.telephony.gsm.GsmCellLocation;
+import android.text.TextUtils;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
@@ -185,15 +191,16 @@
private TextView mMwi;
private TextView mCfi;
private TextView mLocation;
- private TextView mNeighboringCids;
private TextView mCellInfo;
- private TextView mDcRtInfoTv;
private TextView sent;
private TextView received;
private TextView mPingHostnameV4;
private TextView mPingHostnameV6;
private TextView mHttpClientTest;
+ private TextView mPhyChanConfig;
private TextView dnsCheckState;
+ private TextView mDownlinkKbps;
+ private TextView mUplinkKbps;
private EditText smsc;
private Switch radioPowerOnSwitch;
private Button cellInfoRefreshRateButton;
@@ -211,6 +218,7 @@
private Spinner preferredNetworkType;
private Spinner cellInfoRefreshRateSpinner;
+ private ConnectivityManager mConnectivityManager;
private TelephonyManager mTelephonyManager;
private ImsManager mImsManager = null;
private Phone phone = null;
@@ -223,11 +231,23 @@
private List<CellInfo> mCellInfoResult = null;
private CellLocation mCellLocationResult = null;
- private List<NeighboringCellInfo> mNeighboringCellResult = null;
private int mPreferredNetworkTypeResult;
private int mCellInfoRefreshRateIndex;
+ private final NetworkRequest mDefaultNetworkRequest = new NetworkRequest.Builder()
+ .addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR)
+ .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
+ .build();
+
+ private final NetworkCallback mNetworkCallback = new NetworkCallback() {
+ public void onCapabilitiesChanged(Network n, NetworkCapabilities nc) {
+ int dlbw = nc.getLinkDownstreamBandwidthKbps();
+ int ulbw = nc.getLinkUpstreamBandwidthKbps();
+ updateBandwidths(dlbw, ulbw);
+ }
+ };
+
private final PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
@Override
public void onDataConnectionStateChanged(int state) {
@@ -276,12 +296,6 @@
}
@Override
- public void onDataConnectionRealTimeInfoChanged(DataConnectionRealTimeInfo dcRtInfo) {
- log("onDataConnectionRealTimeInfoChanged: dcRtInfo=" + dcRtInfo);
- updateDcRtInfoTv(dcRtInfo);
- }
-
- @Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
log("onSignalStrengthChanged: SignalStrength=" +signalStrength);
updateSignalStrength(signalStrength);
@@ -295,8 +309,29 @@
updateNetworkType();
updateImsProvisionedState();
}
+
+ @Override
+ public void onPhysicalChannelConfigurationChanged(
+ List<PhysicalChannelConfig> configs) {
+ updatePhysicalChannelConfiguration(configs);
+ }
+
};
+ private void updatePhysicalChannelConfiguration(List<PhysicalChannelConfig> configs) {
+ StringBuilder sb = new StringBuilder();
+ String div = "";
+ sb.append("{");
+ if (configs != null) {
+ for(PhysicalChannelConfig c : configs) {
+ sb.append(div).append(c);
+ div = ",";
+ }
+ }
+ sb.append("}");
+ mPhyChanConfig.setText(sb.toString());
+ }
+
private void updatePreferredNetworkType(int type) {
if (type >= mPreferredNetworkLabels.length || type < 0) {
log("EVENT_QUERY_PREFERRED_TYPE_DONE: unknown " +
@@ -365,6 +400,7 @@
log("Started onCreate");
mTelephonyManager = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
+ mConnectivityManager = (ConnectivityManager)getSystemService(CONNECTIVITY_SERVICE);
phone = PhoneFactory.getDefaultPhone();
//TODO: Need to update this if the default phoneId changes?
@@ -386,10 +422,8 @@
mMwi = (TextView) findViewById(R.id.mwi);
mCfi = (TextView) findViewById(R.id.cfi);
mLocation = (TextView) findViewById(R.id.location);
- mNeighboringCids = (TextView) findViewById(R.id.neighboring);
mCellInfo = (TextView) findViewById(R.id.cellinfo);
mCellInfo.setTypeface(Typeface.MONOSPACE);
- mDcRtInfoTv = (TextView) findViewById(R.id.dcrtinfo);
sent = (TextView) findViewById(R.id.sent);
received = (TextView) findViewById(R.id.received);
@@ -399,6 +433,8 @@
mPingHostnameV6 = (TextView) findViewById(R.id.pingHostnameV6);
mHttpClientTest = (TextView) findViewById(R.id.httpClientTest);
+ mPhyChanConfig = (TextView) findViewById(R.id.phy_chan_config);
+
preferredNetworkType = (Spinner) findViewById(R.id.preferredNetworkType);
ArrayAdapter<String> adapter = new ArrayAdapter<String> (this,
android.R.layout.simple_spinner_item, mPreferredNetworkLabels);
@@ -418,6 +454,10 @@
radioPowerOnSwitch = (Switch) findViewById(R.id.radio_power);
+ mDownlinkKbps = (TextView) findViewById(R.id.dl_kbps);
+ mUplinkKbps = (TextView) findViewById(R.id.ul_kbps);
+ updateBandwidths(0, 0);
+
pingTestButton = (Button) findViewById(R.id.ping_test);
pingTestButton.setOnClickListener(mPingButtonHandler);
updateSmscButton = (Button) findViewById(R.id.update_smsc);
@@ -467,7 +507,6 @@
updateDnsCheckState();
updateNetworkType();
- updateNeighboringCids(mNeighboringCellResult);
updateLocation(mCellLocationResult);
updateCellInfo(mCellInfoResult);
@@ -501,7 +540,10 @@
| PhoneStateListener.LISTEN_CELL_INFO
| PhoneStateListener.LISTEN_SERVICE_STATE
| PhoneStateListener.LISTEN_SIGNAL_STRENGTHS
- | PhoneStateListener.LISTEN_DATA_CONNECTION_REAL_TIME_INFO);
+ | PhoneStateListener.LISTEN_PHYSICAL_CHANNEL_CONFIGURATION);
+
+ mConnectivityManager.registerNetworkCallback(
+ mDefaultNetworkRequest, mNetworkCallback, mHandler);
smsc.clearFocus();
}
@@ -514,6 +556,8 @@
mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
mTelephonyManager.setCellInfoListRate(CELL_INFO_LIST_RATE_DISABLED);
+ mConnectivityManager.unregisterNetworkCallback(mNetworkCallback);
+
}
private void restoreFromBundle(Bundle b) {
@@ -593,6 +637,14 @@
"0.0.0.0 allowed" :"0.0.0.0 not allowed");
}
+ private void updateBandwidths(int dlbw, int ulbw) {
+ dlbw = (dlbw < 0 || dlbw == Integer.MAX_VALUE) ? -1 : dlbw;
+ ulbw = (ulbw < 0 || ulbw == Integer.MAX_VALUE) ? -1 : ulbw;
+ mDownlinkKbps.setText(String.format("%-5d", dlbw));
+ mUplinkKbps.setText(String.format("%-5d", ulbw));
+ }
+
+
private final void
updateSignalStrength(SignalStrength signalStrength) {
Resources r = getResources();
@@ -648,23 +700,6 @@
}
- private final void updateNeighboringCids(List<NeighboringCellInfo> cids) {
- StringBuilder sb = new StringBuilder();
-
- if (cids != null) {
- if (cids.isEmpty()) {
- sb.append("no neighboring cells");
- } else {
- for (NeighboringCellInfo cell : cids) {
- sb.append(cell.toString()).append(" ");
- }
- }
- } else {
- sb.append("unknown");
- }
- mNeighboringCids.setText(sb.toString());
- }
-
private final String getCellInfoDisplayString(int i) {
return (i != Integer.MAX_VALUE) ? Integer.toString(i) : "";
}
@@ -673,12 +708,34 @@
return (i != Long.MAX_VALUE) ? Long.toString(i) : "";
}
+ private final String getConnectionStatusString(CellInfo ci) {
+ String regStr = "";
+ String connStatStr = "";
+ String connector = "";
+
+ if (ci.isRegistered()) {
+ regStr = "R";
+ }
+ switch (ci.getCellConnectionStatus()) {
+ case CellInfo.CONNECTION_PRIMARY_SERVING: connStatStr = "P"; break;
+ case CellInfo.CONNECTION_SECONDARY_SERVING: connStatStr = "S"; break;
+ case CellInfo.CONNECTION_NONE: connStatStr = "N"; break;
+ case CellInfo.CONNECTION_UNKNOWN: /* Field is unsupported */ break;
+ default: break;
+ }
+ if (!TextUtils.isEmpty(regStr) && !TextUtils.isEmpty(connStatStr)) {
+ connector = "+";
+ }
+
+ return regStr + connector + connStatStr;
+ }
+
private final String buildCdmaInfoString(CellInfoCdma ci) {
CellIdentityCdma cidCdma = ci.getCellIdentity();
CellSignalStrengthCdma ssCdma = ci.getCellSignalStrength();
return String.format("%-3.3s %-5.5s %-5.5s %-5.5s %-6.6s %-6.6s %-6.6s %-6.6s %-5.5s",
- ci.isRegistered() ? "S " : " ",
+ getConnectionStatusString(ci),
getCellInfoDisplayString(cidCdma.getSystemId()),
getCellInfoDisplayString(cidCdma.getNetworkId()),
getCellInfoDisplayString(cidCdma.getBasestationId()),
@@ -694,7 +751,7 @@
CellSignalStrengthGsm ssGsm = ci.getCellSignalStrength();
return String.format("%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-6.6s %-4.4s %-4.4s\n",
- ci.isRegistered() ? "S " : " ",
+ getConnectionStatusString(ci),
getCellInfoDisplayString(cidGsm.getMcc()),
getCellInfoDisplayString(cidGsm.getMnc()),
getCellInfoDisplayString(cidGsm.getLac()),
@@ -709,14 +766,15 @@
CellSignalStrengthLte ssLte = ci.getCellSignalStrength();
return String.format(
- "%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-3.3s %-6.6s %-4.4s %-4.4s %-2.2s\n",
- ci.isRegistered() ? "S " : " ",
+ "%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-3.3s %-6.6s %-2.2s %-4.4s %-4.4s %-2.2s\n",
+ getConnectionStatusString(ci),
getCellInfoDisplayString(cidLte.getMcc()),
getCellInfoDisplayString(cidLte.getMnc()),
getCellInfoDisplayString(cidLte.getTac()),
getCellInfoDisplayString(cidLte.getCi()),
getCellInfoDisplayString(cidLte.getPci()),
getCellInfoDisplayString(cidLte.getEarfcn()),
+ getCellInfoDisplayString(cidLte.getBandwidth()),
getCellInfoDisplayString(ssLte.getDbm()),
getCellInfoDisplayString(ssLte.getRsrq()),
getCellInfoDisplayString(ssLte.getTimingAdvance()));
@@ -727,7 +785,7 @@
CellSignalStrengthWcdma ssWcdma = ci.getCellSignalStrength();
return String.format("%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-6.6s %-3.3s %-4.4s\n",
- ci.isRegistered() ? "S " : " ",
+ getConnectionStatusString(ci),
getCellInfoDisplayString(cidWcdma.getMcc()),
getCellInfoDisplayString(cidWcdma.getMnc()),
getCellInfoDisplayString(cidWcdma.getLac()),
@@ -759,17 +817,21 @@
}
if (lteCells.length() != 0) {
value += String.format(
- "LTE\n%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-3.3s %-6.6s %-4.4s %-4.4s %-2.2s\n",
- "SRV", "MCC", "MNC", "TAC", "CID", "PCI", "EARFCN", "RSRP", "RSRQ", "TA");
+ "LTE\n%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-3.3s"
+ + " %-6.6s %-2.2s %-4.4s %-4.4s %-2.2s\n",
+ "SRV", "MCC", "MNC", "TAC", "CID", "PCI",
+ "EARFCN", "BW", "RSRP", "RSRQ", "TA");
value += lteCells.toString();
}
if (wcdmaCells.length() != 0) {
- value += String.format("WCDMA\n%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-6.6s %-3.3s %-4.4s\n",
+ value += String.format(
+ "WCDMA\n%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-6.6s %-3.3s %-4.4s\n",
"SRV", "MCC", "MNC", "LAC", "CID", "UARFCN", "PSC", "RSCP");
value += wcdmaCells.toString();
}
if (gsmCells.length() != 0) {
- value += String.format("GSM\n%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-6.6s %-4.4s %-4.4s\n",
+ value += String.format(
+ "GSM\n%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-6.6s %-4.4s %-4.4s\n",
"SRV", "MCC", "MNC", "LAC", "CID", "ARFCN", "BSIC", "RSSI");
value += gsmCells.toString();
}
@@ -790,10 +852,6 @@
mCellInfo.setText(buildCellInfoString(arrayCi));
}
- private final void updateDcRtInfoTv(DataConnectionRealTimeInfo dcRtInfo) {
- mDcRtInfoTv.setText(dcRtInfo.toString());
- }
-
private final void
updateMessageWaiting() {
mMwi.setText(String.valueOf(mMwiValue));
@@ -986,12 +1044,10 @@
private final void updateAllCellInfo() {
mCellInfo.setText("");
- mNeighboringCids.setText("");
mLocation.setText("");
final Runnable updateAllCellInfoResults = new Runnable() {
public void run() {
- updateNeighboringCids(mNeighboringCellResult);
updateLocation(mCellLocationResult);
updateCellInfo(mCellInfoResult);
}
@@ -1002,7 +1058,6 @@
public void run() {
mCellInfoResult = mTelephonyManager.getAllCellInfo();
mCellLocationResult = mTelephonyManager.getCellLocation();
- mNeighboringCellResult = mTelephonyManager.getNeighboringCellInfo();
mHandler.post(updateAllCellInfoResults);
}