[Telephony Debug Menu] Add Link Capacity Estimate
Register for the Link capacity estimate for the cellular default data connection and report it in the debug menu. Bug: 78791811 Test: manual Change-Id: I73d945dfa192873936107902e0de6d58fc69059b
This commit is contained in:
@@ -91,6 +91,18 @@
|
|||||||
<TextView android:id="@+id/roaming" style="@style/info_value" />
|
<TextView android:id="@+id/roaming" style="@style/info_value" />
|
||||||
</LinearLayout>
|
</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 -->
|
<!-- Physical Channel Config -->
|
||||||
<LinearLayout style="@style/entry_layout">
|
<LinearLayout style="@style/entry_layout">
|
||||||
<TextView android:text="@string/radio_info_phy_chan_config" style="@style/info_label" />
|
<TextView android:text="@string/radio_info_phy_chan_config" style="@style/info_label" />
|
||||||
|
@@ -471,6 +471,10 @@
|
|||||||
<!-- HTTP proxy settings. Title for Proxy-Auto Config URL. [CHAR LIMIT=25] -->
|
<!-- HTTP proxy settings. Title for Proxy-Auto Config URL. [CHAR LIMIT=25] -->
|
||||||
<string name="proxy_url_title">"PAC URL: "</string>
|
<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 -->
|
<!-- 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>
|
<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 -->
|
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
|
||||||
|
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
|
import static android.net.ConnectivityManager.NetworkCallback;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
@@ -27,6 +29,10 @@ 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.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.TrafficStats;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncResult;
|
import android.os.AsyncResult;
|
||||||
@@ -197,6 +203,8 @@ public class RadioInfo extends Activity {
|
|||||||
private TextView mHttpClientTest;
|
private TextView mHttpClientTest;
|
||||||
private TextView mPhyChanConfig;
|
private TextView mPhyChanConfig;
|
||||||
private TextView dnsCheckState;
|
private TextView dnsCheckState;
|
||||||
|
private TextView mDownlinkKbps;
|
||||||
|
private TextView mUplinkKbps;
|
||||||
private EditText smsc;
|
private EditText smsc;
|
||||||
private Switch radioPowerOnSwitch;
|
private Switch radioPowerOnSwitch;
|
||||||
private Button cellInfoRefreshRateButton;
|
private Button cellInfoRefreshRateButton;
|
||||||
@@ -214,6 +222,7 @@ public class RadioInfo extends Activity {
|
|||||||
private Spinner preferredNetworkType;
|
private Spinner preferredNetworkType;
|
||||||
private Spinner cellInfoRefreshRateSpinner;
|
private Spinner cellInfoRefreshRateSpinner;
|
||||||
|
|
||||||
|
private ConnectivityManager mConnectivityManager;
|
||||||
private TelephonyManager mTelephonyManager;
|
private TelephonyManager mTelephonyManager;
|
||||||
private ImsManager mImsManager = null;
|
private ImsManager mImsManager = null;
|
||||||
private Phone phone = null;
|
private Phone phone = null;
|
||||||
@@ -231,6 +240,19 @@ public class RadioInfo extends Activity {
|
|||||||
private int mPreferredNetworkTypeResult;
|
private int mPreferredNetworkTypeResult;
|
||||||
private int mCellInfoRefreshRateIndex;
|
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() {
|
private final PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onDataConnectionStateChanged(int state) {
|
public void onDataConnectionStateChanged(int state) {
|
||||||
@@ -389,6 +411,7 @@ public class RadioInfo extends Activity {
|
|||||||
log("Started onCreate");
|
log("Started onCreate");
|
||||||
|
|
||||||
mTelephonyManager = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
|
mTelephonyManager = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
|
||||||
|
mConnectivityManager = (ConnectivityManager)getSystemService(CONNECTIVITY_SERVICE);
|
||||||
phone = PhoneFactory.getDefaultPhone();
|
phone = PhoneFactory.getDefaultPhone();
|
||||||
|
|
||||||
//TODO: Need to update this if the default phoneId changes?
|
//TODO: Need to update this if the default phoneId changes?
|
||||||
@@ -444,6 +467,10 @@ public class RadioInfo extends Activity {
|
|||||||
|
|
||||||
radioPowerOnSwitch = (Switch) findViewById(R.id.radio_power);
|
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 = (Button) findViewById(R.id.ping_test);
|
||||||
pingTestButton.setOnClickListener(mPingButtonHandler);
|
pingTestButton.setOnClickListener(mPingButtonHandler);
|
||||||
updateSmscButton = (Button) findViewById(R.id.update_smsc);
|
updateSmscButton = (Button) findViewById(R.id.update_smsc);
|
||||||
@@ -529,6 +556,9 @@ public class RadioInfo extends Activity {
|
|||||||
| PhoneStateListener.LISTEN_SIGNAL_STRENGTHS
|
| PhoneStateListener.LISTEN_SIGNAL_STRENGTHS
|
||||||
| PhoneStateListener.LISTEN_PHYSICAL_CHANNEL_CONFIGURATION);
|
| PhoneStateListener.LISTEN_PHYSICAL_CHANNEL_CONFIGURATION);
|
||||||
|
|
||||||
|
mConnectivityManager.registerNetworkCallback(
|
||||||
|
mDefaultNetworkRequest, mNetworkCallback, mHandler);
|
||||||
|
|
||||||
smsc.clearFocus();
|
smsc.clearFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -540,6 +570,8 @@ public class RadioInfo extends Activity {
|
|||||||
|
|
||||||
mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
|
mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
|
||||||
mTelephonyManager.setCellInfoListRate(CELL_INFO_LIST_RATE_DISABLED);
|
mTelephonyManager.setCellInfoListRate(CELL_INFO_LIST_RATE_DISABLED);
|
||||||
|
mConnectivityManager.unregisterNetworkCallback(mNetworkCallback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void restoreFromBundle(Bundle b) {
|
private void restoreFromBundle(Bundle b) {
|
||||||
@@ -619,6 +651,14 @@ public class RadioInfo extends Activity {
|
|||||||
"0.0.0.0 allowed" :"0.0.0.0 not allowed");
|
"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
|
private final void
|
||||||
updateSignalStrength(SignalStrength signalStrength) {
|
updateSignalStrength(SignalStrength signalStrength) {
|
||||||
Resources r = getResources();
|
Resources r = getResources();
|
||||||
|
Reference in New Issue
Block a user