Loading res/layout/radio_info.xml +12 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,18 @@ <TextView android:id="@+id/roaming" 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" /> Loading res/values/strings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -471,6 +471,10 @@ <!-- HTTP proxy settings. Title for Proxy-Auto Config URL. [CHAR LIMIT=25] --> <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 --> Loading src/com/android/settings/RadioInfo.java +40 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -27,6 +29,10 @@ import android.content.pm.PackageManager; 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; Loading Loading @@ -197,6 +203,8 @@ public class RadioInfo extends Activity { private TextView mHttpClientTest; private TextView mPhyChanConfig; private TextView dnsCheckState; private TextView mDownlinkKbps; private TextView mUplinkKbps; private EditText smsc; private Switch radioPowerOnSwitch; private Button cellInfoRefreshRateButton; Loading @@ -214,6 +222,7 @@ public class RadioInfo extends Activity { private Spinner preferredNetworkType; private Spinner cellInfoRefreshRateSpinner; private ConnectivityManager mConnectivityManager; private TelephonyManager mTelephonyManager; private ImsManager mImsManager = null; private Phone phone = null; Loading @@ -231,6 +240,19 @@ public class RadioInfo extends Activity { 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) { Loading Loading @@ -389,6 +411,7 @@ public class RadioInfo extends Activity { 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? Loading Loading @@ -444,6 +467,10 @@ public class RadioInfo extends Activity { 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); Loading Loading @@ -529,6 +556,9 @@ public class RadioInfo extends Activity { | PhoneStateListener.LISTEN_SIGNAL_STRENGTHS | PhoneStateListener.LISTEN_PHYSICAL_CHANNEL_CONFIGURATION); mConnectivityManager.registerNetworkCallback( mDefaultNetworkRequest, mNetworkCallback, mHandler); smsc.clearFocus(); } Loading @@ -540,6 +570,8 @@ public class RadioInfo extends Activity { mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE); mTelephonyManager.setCellInfoListRate(CELL_INFO_LIST_RATE_DISABLED); mConnectivityManager.unregisterNetworkCallback(mNetworkCallback); } private void restoreFromBundle(Bundle b) { Loading Loading @@ -619,6 +651,14 @@ public class RadioInfo extends Activity { "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(); Loading Loading
res/layout/radio_info.xml +12 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,18 @@ <TextView android:id="@+id/roaming" 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" /> Loading
res/values/strings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -471,6 +471,10 @@ <!-- HTTP proxy settings. Title for Proxy-Auto Config URL. [CHAR LIMIT=25] --> <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 --> Loading
src/com/android/settings/RadioInfo.java +40 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -27,6 +29,10 @@ import android.content.pm.PackageManager; 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; Loading Loading @@ -197,6 +203,8 @@ public class RadioInfo extends Activity { private TextView mHttpClientTest; private TextView mPhyChanConfig; private TextView dnsCheckState; private TextView mDownlinkKbps; private TextView mUplinkKbps; private EditText smsc; private Switch radioPowerOnSwitch; private Button cellInfoRefreshRateButton; Loading @@ -214,6 +222,7 @@ public class RadioInfo extends Activity { private Spinner preferredNetworkType; private Spinner cellInfoRefreshRateSpinner; private ConnectivityManager mConnectivityManager; private TelephonyManager mTelephonyManager; private ImsManager mImsManager = null; private Phone phone = null; Loading @@ -231,6 +240,19 @@ public class RadioInfo extends Activity { 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) { Loading Loading @@ -389,6 +411,7 @@ public class RadioInfo extends Activity { 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? Loading Loading @@ -444,6 +467,10 @@ public class RadioInfo extends Activity { 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); Loading Loading @@ -529,6 +556,9 @@ public class RadioInfo extends Activity { | PhoneStateListener.LISTEN_SIGNAL_STRENGTHS | PhoneStateListener.LISTEN_PHYSICAL_CHANNEL_CONFIGURATION); mConnectivityManager.registerNetworkCallback( mDefaultNetworkRequest, mNetworkCallback, mHandler); smsc.clearFocus(); } Loading @@ -540,6 +570,8 @@ public class RadioInfo extends Activity { mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE); mTelephonyManager.setCellInfoListRate(CELL_INFO_LIST_RATE_DISABLED); mConnectivityManager.unregisterNetworkCallback(mNetworkCallback); } private void restoreFromBundle(Bundle b) { Loading Loading @@ -619,6 +651,14 @@ public class RadioInfo extends Activity { "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(); Loading