Merge "IMS: Use the slot based ImsManager factory reset API."
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 dab8e87..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>
@@ -1608,10 +1610,10 @@
<!-- Summary of checkbox for disabling Bluetooth inband ringing in Development Settings -->
<string name="bluetooth_disable_inband_ringing_summary">Don’t play custom phone ringtones on Bluetooth headsets</string>
- <!-- Setting title for enabling Bluetooth delay reporting in Development Settings -->
- <string name="bluetooth_enable_avdtp_delay_reports">Enable Bluetooth Audio Delay Report handling</string>
- <!-- Summary of checkbox for enabling Bluetooth delay reporting in Development Settings -->
- <string name="bluetooth_enable_avdtp_delay_reports_summary">Handle Audio Delay Reports recieved from remote devices</string>
+ <!-- Setting title for disabling Bluetooth delay reporting in Development Settings -->
+ <string name="bluetooth_disable_avdtp_delay_reports">Disable Bluetooth Audio Delay Report handling</string>
+ <!-- Summary of checkbox for disabling Bluetooth delay reporting in Development Settings -->
+ <string name="bluetooth_disable_avdtp_delay_reports_summary">Stop Handling Audio Delay Reports received from remote devices</string>
<!-- Bluetooth developer settings: Maximum number of connected audio devices -->
<string name="bluetooth_max_connected_audio_devices_string">Maximum number of connected Bluetooth audio devices</string>
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index 1993857..db01394 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -229,9 +229,9 @@
android:summary="@string/bluetooth_disable_inband_ringing_summary"/>
<SwitchPreference
- android:key="bluetooth_enable_avdtp_delay_reports"
- android:title="@string/bluetooth_enable_avdtp_delay_reports"
- android:summary="@string/bluetooth_enable_avdtp_delay_reports_summary"/>
+ android:key="bluetooth_disable_avdtp_delay_reports"
+ android:title="@string/bluetooth_disable_avdtp_delay_reports"
+ android:summary="@string/bluetooth_disable_avdtp_delay_reports_summary"/>
<ListPreference
android:key="bluetooth_select_avrcp_version"
diff --git a/res/xml/device_info_sim_status.xml b/res/xml/device_info_sim_status.xml
index aa8896c..e95d009 100644
--- a/res/xml/device_info_sim_status.xml
+++ b/res/xml/device_info_sim_status.xml
@@ -66,6 +66,13 @@
android:summary="@string/device_info_not_available"
android:persistent="false" />
+ <Preference android:key="ims_reg_state"
+ android:enabled="false"
+ android:shouldDisableView="false"
+ android:title="@string/ims_reg_title"
+ android:summary="@string/device_info_not_available"
+ android:persistent="false" />
+
<Preference android:key="number"
android:enabled="false"
android:shouldDisableView="false"
diff --git a/res/xml/device_info_status.xml b/res/xml/device_info_status.xml
index 3456f91..b381d04 100644
--- a/res/xml/device_info_status.xml
+++ b/res/xml/device_info_status.xml
@@ -89,10 +89,4 @@
android:title="@string/status_wimax_mac_address"
android:summary="@string/summary_placeholder"
android:persistent="false" />
- <Preference
- android:key="ims_reg_state"
- android:enabled="false"
- android:shouldDisableView="false"
- android:title="@string/ims_reg_title"
- android:persistent="false" />
</PreferenceScreen>
diff --git a/src/com/android/settings/ApnSettings.java b/src/com/android/settings/ApnSettings.java
index d554301..35d2b9f 100755
--- a/src/com/android/settings/ApnSettings.java
+++ b/src/com/android/settings/ApnSettings.java
@@ -44,6 +44,7 @@
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
+import android.telephony.data.ApnSetting;
import android.text.TextUtils;
import android.util.Log;
import android.view.Menu;
@@ -56,7 +57,7 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.TelephonyIntents;
-import com.android.internal.telephony.dataconnection.ApnSetting;
+import com.android.internal.telephony.dataconnection.ApnSettingUtils;
import com.android.internal.telephony.uicc.IccRecords;
import com.android.internal.telephony.uicc.UiccController;
import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
@@ -330,7 +331,8 @@
ArrayList<ApnPreference> mvnoList, IccRecords r, String mvnoType,
String mvnoMatchData) {
if (r != null && !TextUtils.isEmpty(mvnoType) && !TextUtils.isEmpty(mvnoMatchData)) {
- if (ApnSetting.mvnoMatches(r, mvnoType, mvnoMatchData)) {
+ if (ApnSettingUtils.mvnoMatches(r, ApnSetting.getMvnoTypeIntFromString(mvnoType),
+ mvnoMatchData)) {
mvnoList.add(pref);
// Since adding to mvno list, save mvno info
mMvnoType = mvnoType;
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);
}
diff --git a/src/com/android/settings/SetFullBackupPassword.java b/src/com/android/settings/SetFullBackupPassword.java
index 4ab096b..b6a03d5 100644
--- a/src/com/android/settings/SetFullBackupPassword.java
+++ b/src/com/android/settings/SetFullBackupPassword.java
@@ -21,6 +21,7 @@
import android.os.Bundle;
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
@@ -45,7 +46,7 @@
if (!newPw.equals(confirmPw)) {
// Mismatch between new pw and its confirmation re-entry
-Log.i(TAG, "password mismatch");
+ Log.i(TAG, "password mismatch");
Toast.makeText(SetFullBackupPassword.this,
R.string.local_backup_password_toast_confirmation_mismatch,
Toast.LENGTH_LONG).show();
@@ -56,14 +57,14 @@
if (setBackupPassword(curPw, newPw)) {
// success
-Log.i(TAG, "password set successfully");
+ Log.i(TAG, "password set successfully");
Toast.makeText(SetFullBackupPassword.this,
R.string.local_backup_password_toast_success,
Toast.LENGTH_LONG).show();
finish();
} else {
// failure -- bad existing pw, usually
-Log.i(TAG, "failure; password mismatch?");
+ Log.i(TAG, "failure; password mismatch?");
Toast.makeText(SetFullBackupPassword.this,
R.string.local_backup_password_toast_validation_failure,
Toast.LENGTH_LONG).show();
@@ -96,6 +97,11 @@
}
private boolean setBackupPassword(String currentPw, String newPw) {
+ // new password can't be empty
+ if (TextUtils.isEmpty(newPw)) {
+ return false;
+ }
+
try {
return mBackupManager.setBackupPassword(currentPw, newPw);
} catch (RemoteException e) {
diff --git a/src/com/android/settings/development/DevelopmentSettings.java b/src/com/android/settings/development/DevelopmentSettings.java
index 078489e..e0ae111 100644
--- a/src/com/android/settings/development/DevelopmentSettings.java
+++ b/src/com/android/settings/development/DevelopmentSettings.java
@@ -214,14 +214,14 @@
"persist.bluetooth.disableinbandringing";
private static final String BLUETOOTH_BTSNOOP_ENABLE_PROPERTY =
"persist.bluetooth.btsnoopenable";
- private static final String BLUETOOTH_ENABLE_AVDTP_DELAY_REPORTS_PROPERTY =
- "persist.bluetooth.enabledelayreports";
+ private static final String BLUETOOTH_DISABLE_AVDTP_DELAY_REPORTS_PROPERTY =
+ "persist.bluetooth.disabledelayreports";
static final String BLUETOOTH_MAX_CONNECTED_AUDIO_DEVICES_PROPERTY =
"persist.bluetooth.maxconnectedaudiodevices";
private static final String BLUETOOTH_DISABLE_INBAND_RINGING_KEY = "bluetooth_disable_inband_ringing";
- private static final String BLUETOOTH_ENABLE_AVDTP_DELAY_REPORT_KEY = "bluetooth_enable_avdtp_delay_reports";
+ private static final String BLUETOOTH_DISABLE_AVDTP_DELAY_REPORT_KEY = "bluetooth_disable_avdtp_delay_reports";
private static final String BLUETOOTH_SELECT_AVRCP_VERSION_KEY = "bluetooth_select_avrcp_version";
private static final String BLUETOOTH_SELECT_A2DP_CODEC_KEY = "bluetooth_select_a2dp_codec";
private static final String BLUETOOTH_SELECT_A2DP_SAMPLE_RATE_KEY = "bluetooth_select_a2dp_sample_rate";
@@ -300,7 +300,7 @@
private SwitchPreference mBluetoothShowDevicesWithoutNames;
private SwitchPreference mBluetoothDisableAbsVolume;
private SwitchPreference mBluetoothDisableInbandRinging;
- private SwitchPreference mBluetoothEnableAvdtpDelayReport;
+ private SwitchPreference mBluetoothDisableAvdtpDelayReport;
private BluetoothA2dp mBluetoothA2dp;
private final Object mBluetoothA2dpLock = new Object();
@@ -530,7 +530,7 @@
removePreference(mBluetoothDisableInbandRinging);
mBluetoothDisableInbandRinging = null;
}
- mBluetoothEnableAvdtpDelayReport = findAndInitSwitchPref(BLUETOOTH_ENABLE_AVDTP_DELAY_REPORT_KEY);
+ mBluetoothDisableAvdtpDelayReport = findAndInitSwitchPref(BLUETOOTH_DISABLE_AVDTP_DELAY_REPORT_KEY);
mBluetoothSelectAvrcpVersion = addListPreference(BLUETOOTH_SELECT_AVRCP_VERSION_KEY);
mBluetoothSelectA2dpCodec = addListPreference(BLUETOOTH_SELECT_A2DP_CODEC_KEY);
@@ -873,7 +873,7 @@
updateBluetoothShowDevicesWithoutUserFriendlyNameOptions();
updateBluetoothDisableAbsVolumeOptions();
updateBluetoothDisableInbandRingingOptions();
- updateBluetoothEnableAvdtpDelayReportOptions();
+ updateBluetoothDisableAvdtpDelayReportOptions();
updateBluetoothA2dpConfigurationValues();
updatePrivateDnsSummary();
}
@@ -1549,14 +1549,14 @@
}
}
- private void updateBluetoothEnableAvdtpDelayReportOptions() {
- updateSwitchPreference(mBluetoothEnableAvdtpDelayReport,
- SystemProperties.getBoolean(BLUETOOTH_ENABLE_AVDTP_DELAY_REPORTS_PROPERTY, false));
+ private void updateBluetoothDisableAvdtpDelayReportOptions() {
+ updateSwitchPreference(mBluetoothDisableAvdtpDelayReport,
+ SystemProperties.getBoolean(BLUETOOTH_DISABLE_AVDTP_DELAY_REPORTS_PROPERTY, false));
}
- private void writeBluetoothEnableAvdtpDelayReportOptions() {
- SystemProperties.set(BLUETOOTH_ENABLE_AVDTP_DELAY_REPORTS_PROPERTY,
- mBluetoothEnableAvdtpDelayReport.isChecked() ? "true" : "false");
+ private void writeBluetoothDisableAvdtpDelayReportOptions() {
+ SystemProperties.set(BLUETOOTH_DISABLE_AVDTP_DELAY_REPORTS_PROPERTY,
+ mBluetoothDisableAvdtpDelayReport.isChecked() ? "true" : "false");
}
private void updateMobileDataAlwaysOnOptions() {
@@ -2656,8 +2656,8 @@
writeBluetoothDisableAbsVolumeOptions();
} else if (preference == mBluetoothDisableInbandRinging) {
writeBluetoothDisableInbandRingingOptions();
- } else if (preference == mBluetoothEnableAvdtpDelayReport) {
- writeBluetoothEnableAvdtpDelayReportOptions();
+ } else if (preference == mBluetoothDisableAvdtpDelayReport) {
+ writeBluetoothDisableAvdtpDelayReportOptions();
} else if (SHORTCUT_MANAGER_RESET_KEY.equals(preference.getKey())) {
resetShortcutManagerThrottling();
} else {
diff --git a/src/com/android/settings/deviceinfo/SimStatus.java b/src/com/android/settings/deviceinfo/SimStatus.java
index 2cc76e7..9a6d1cd 100644
--- a/src/com/android/settings/deviceinfo/SimStatus.java
+++ b/src/com/android/settings/deviceinfo/SimStatus.java
@@ -30,7 +30,9 @@
import android.os.PersistableBundle;
import android.os.UserHandle;
import android.os.UserManager;
+import android.support.annotation.VisibleForTesting;
import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceScreen;
import android.telephony.CarrierConfigManager;
import android.telephony.CellBroadcastMessage;
import android.telephony.PhoneStateListener;
@@ -89,6 +91,9 @@
private static final String KEY_IMEI_SV = "imei_sv";
private static final String KEY_ICCID = "iccid";
+ @VisibleForTesting
+ static final String KEY_IMS_REGISTRATION_STATE = "ims_reg_state";
+
static private final String CB_AREA_INFO_RECEIVED_ACTION =
"com.android.cellbroadcastreceiver.CB_AREA_INFO_RECEIVED";
@@ -101,10 +106,10 @@
private CarrierConfigManager mCarrierConfigManager;
private Phone mPhone = null;
private Resources mRes;
- private Preference mSignalStrength;
private SubscriptionInfo mSir;
private boolean mShowLatestAreaInfo;
private boolean mShowICCID;
+ private boolean mShowImsRegState;
// Default summary for items
private String mDefaultText;
@@ -148,8 +153,6 @@
mRes = getResources();
mDefaultText = mRes.getString(R.string.device_info_default);
- // Note - missing in zaku build, be careful later...
- mSignalStrength = findPreference(KEY_SIGNAL_STRENGTH);
}
@Override
@@ -202,10 +205,11 @@
public void onResume() {
super.onResume();
if (mPhone != null) {
- updatePreference();
+ updatePreference(false /* isTabChanged */);
updateSignalStrength(mPhone.getSignalStrength());
updateServiceState(mPhone.getServiceState());
+ updateImsRegistrationState();
updateDataState();
mTelephonyManager.listen(mPhoneStateListener,
PhoneStateListener.LISTEN_DATA_CONNECTION_STATE
@@ -323,7 +327,7 @@
break;
case ServiceState.STATE_OUT_OF_SERVICE:
// Set signal strength to 0 when service state is STATE_OUT_OF_SERVICE
- mSignalStrength.setSummary("0");
+ setSummaryText(KEY_SIGNAL_STRENGTH, "0");
case ServiceState.STATE_EMERGENCY_ONLY:
// Set summary string of service state to radioInfo_service_out when
// service state is both STATE_OUT_OF_SERVICE & STATE_EMERGENCY_ONLY
@@ -332,7 +336,7 @@
case ServiceState.STATE_POWER_OFF:
display = mRes.getString(R.string.radioInfo_service_off);
// Also set signal strength to 0
- mSignalStrength.setSummary("0");
+ setSummaryText(KEY_SIGNAL_STRENGTH, "0");
break;
}
@@ -353,32 +357,46 @@
}
void updateSignalStrength(SignalStrength signalStrength) {
- if (mSignalStrength != null) {
- final int state = mPhone.getServiceState().getState();
+ final int state = mPhone.getServiceState().getState();
- if ((ServiceState.STATE_OUT_OF_SERVICE == state) ||
- (ServiceState.STATE_POWER_OFF == state)) {
- mSignalStrength.setSummary("0");
- return;
- }
-
- int signalDbm = signalStrength.getDbm();
- int signalAsu = signalStrength.getAsuLevel();
-
- if (-1 == signalDbm) {
- signalDbm = 0;
- }
-
- if (-1 == signalAsu) {
- signalAsu = 0;
- }
-
- mSignalStrength.setSummary(mRes.getString(R.string.sim_signal_strength,
- signalDbm, signalAsu));
+ if ((ServiceState.STATE_OUT_OF_SERVICE == state) ||
+ (ServiceState.STATE_POWER_OFF == state)) {
+ setSummaryText(KEY_SIGNAL_STRENGTH, "0");
+ return;
}
+
+ int signalDbm = signalStrength.getDbm();
+ int signalAsu = signalStrength.getAsuLevel();
+
+ if (-1 == signalDbm) {
+ signalDbm = 0;
+ }
+
+ if (-1 == signalAsu) {
+ signalAsu = 0;
+ }
+
+ setSummaryText(KEY_SIGNAL_STRENGTH, mRes.getString(R.string.sim_signal_strength, signalDbm,
+ signalAsu));
}
- private void updatePreference() {
+ @VisibleForTesting
+ void updateImsRegistrationState() {
+ boolean isImsRegistered = mTelephonyManager.isImsRegistered(mSir.getSubscriptionId());
+ setSummaryText(KEY_IMS_REGISTRATION_STATE, mRes.getString(isImsRegistered ?
+ R.string.ims_reg_status_registered : R.string.ims_reg_status_not_registered));
+ }
+
+ @VisibleForTesting
+ void updatePreference(boolean isTabChanged) {
+ if (isTabChanged) {
+ PreferenceScreen preferenceScreen = getPreferenceScreen();
+ if (preferenceScreen != null) {
+ preferenceScreen.removeAll();
+ addPreferencesFromResource(R.xml.device_info_sim_status);
+ }
+ }
+
if (mPhone.getPhoneType() != TelephonyManager.PHONE_TYPE_CDMA) {
mShowLatestAreaInfo = Resources.getSystem().getBoolean(
com.android.internal.R.bool.config_showAreaUpdateInfoSettings);
@@ -387,7 +405,8 @@
mSir.getSubscriptionId());
mShowICCID = carrierConfig.getBoolean(
CarrierConfigManager.KEY_SHOW_ICCID_IN_SIM_STATUS_BOOL);
-
+ mShowImsRegState = carrierConfig.getBoolean(
+ CarrierConfigManager.KEY_SHOW_IMS_REGISTRATION_STATUS_BOOL);
// If formattedNumber is null or empty, it'll display as "Unknown".
setSummaryText(KEY_PHONE_NUMBER,
@@ -412,6 +431,10 @@
if (hideSignalStrength) {
removePreferenceFromScreen(KEY_SIGNAL_STRENGTH);
}
+
+ if (!mShowImsRegState) {
+ removePreferenceFromScreen(KEY_IMS_REGISTRATION_STATE);
+ }
}
private void updatePhoneInfos() {
@@ -448,29 +471,36 @@
@Override
public void onServiceStateChanged(ServiceState serviceState) {
updateServiceState(serviceState);
+ updateImsRegistrationState();
}
};
}
}
}
+
private OnTabChangeListener mTabListener = new OnTabChangeListener() {
@Override
public void onTabChanged(String tabId) {
- final int slotId = Integer.parseInt(tabId);
- mSir = mSelectableSubInfos.get(slotId);
-
- // The User has changed tab; update the SIM information.
- updatePhoneInfos();
- mTelephonyManager.listen(mPhoneStateListener,
- PhoneStateListener.LISTEN_DATA_CONNECTION_STATE
- | PhoneStateListener.LISTEN_SIGNAL_STRENGTHS
- | PhoneStateListener.LISTEN_SERVICE_STATE);
- updateDataState();
- updateNetworkType();
- updatePreference();
+ doTabChanged(tabId);
}
};
+ @VisibleForTesting
+ void doTabChanged(String tabId) {
+ final int slotId = Integer.parseInt(tabId);
+ mSir = mSelectableSubInfos.get(slotId);
+
+ // The User has changed tab; update the SIM information.
+ updatePhoneInfos();
+ updatePreference(true /* isTabChanged */);
+ mTelephonyManager.listen(mPhoneStateListener,
+ PhoneStateListener.LISTEN_DATA_CONNECTION_STATE
+ | PhoneStateListener.LISTEN_SIGNAL_STRENGTHS
+ | PhoneStateListener.LISTEN_SERVICE_STATE);
+ updateDataState();
+ updateNetworkType();
+ }
+
private TabContentFactory mEmptyTabContent = new TabContentFactory() {
@Override
public View createTabContent(String tag) {
diff --git a/src/com/android/settings/deviceinfo/Status.java b/src/com/android/settings/deviceinfo/Status.java
index 228774f..8073304 100644
--- a/src/com/android/settings/deviceinfo/Status.java
+++ b/src/com/android/settings/deviceinfo/Status.java
@@ -28,16 +28,12 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
-import android.os.PersistableBundle;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.UserManager;
import android.provider.SearchIndexableResource;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
-import android.telephony.CarrierConfigManager;
-import android.telephony.SubscriptionManager;
-import android.telephony.TelephonyManager;
import android.text.TextUtils;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
@@ -65,7 +61,6 @@
private static final String KEY_WIMAX_MAC_ADDRESS = "wimax_mac_address";
private static final String KEY_SIM_STATUS = "sim_status";
private static final String KEY_IMEI_INFO = "imei_info";
- private static final String KEY_IMS_REGISTRATION_STATE = "ims_reg_state";
// Broadcasts to listen to for connectivity changes.
private static final String[] CONNECTIVITY_INTENTS = {
@@ -95,7 +90,6 @@
private Preference mIpAddress;
private Preference mWifiMacAddress;
private Preference mWimaxMacAddress;
- private Preference mImsStatus;
private Handler mHandler;
@@ -174,7 +168,6 @@
mWifiMacAddress = findPreference(KEY_WIFI_MAC_ADDRESS);
mWimaxMacAddress = findPreference(KEY_WIMAX_MAC_ADDRESS);
mIpAddress = findPreference(KEY_IP_ADDRESS);
- mImsStatus = findPreference(KEY_IMS_REGISTRATION_STATE);
mRes = getResources();
mUnavailable = mRes.getString(R.string.status_unavailable);
@@ -282,31 +275,11 @@
}
}
- private void setImsRegistrationStatus() {
- CarrierConfigManager configManager = (CarrierConfigManager)
- getSystemService(Context.CARRIER_CONFIG_SERVICE);
- int subId = SubscriptionManager.getDefaultDataSubscriptionId();
- PersistableBundle config = null;
- if (configManager != null) {
- config = configManager.getConfigForSubId(subId);
- }
- if (config != null && config.getBoolean(
- CarrierConfigManager.KEY_SHOW_IMS_REGISTRATION_STATUS_BOOL)) {
- TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
- mImsStatus.setSummary((tm != null && tm.isImsRegistered(subId)) ?
- R.string.ims_reg_status_registered : R.string.ims_reg_status_not_registered);
- } else {
- removePreferenceFromScreen(KEY_IMS_REGISTRATION_STATE);
- mImsStatus = null;
- }
- }
-
void updateConnectivity() {
setWimaxStatus();
setWifiStatus();
setBtStatus();
setIpAddressStatus();
- setImsRegistrationStatus();
}
void updateTimes() {
diff --git a/src/com/android/settings/network/TetherPreferenceController.java b/src/com/android/settings/network/TetherPreferenceController.java
index 1c9959e..1f19031 100644
--- a/src/com/android/settings/network/TetherPreferenceController.java
+++ b/src/com/android/settings/network/TetherPreferenceController.java
@@ -131,7 +131,8 @@
@Override
public void onCreate(Bundle savedInstanceState) {
- if (mBluetoothAdapter != null) {
+ if (mBluetoothAdapter != null &&
+ mBluetoothAdapter.getState() == BluetoothAdapter.STATE_ON) {
mBluetoothAdapter.getProfileProxy(mContext, mBtProfileServiceListener,
BluetoothProfile.PAN);
}
diff --git a/src/com/android/settings/wifi/WifiSummaryUpdater.java b/src/com/android/settings/wifi/WifiSummaryUpdater.java
index 2c56d08..c61d9ba 100644
--- a/src/com/android/settings/wifi/WifiSummaryUpdater.java
+++ b/src/com/android/settings/wifi/WifiSummaryUpdater.java
@@ -66,6 +66,7 @@
@Override
public void register(boolean register) {
if (register) {
+ notifyChangeIfNeeded();
mContext.registerReceiver(mReceiver, INTENT_FILTER);
} else {
mContext.unregisterReceiver(mReceiver);
diff --git a/tests/robotests/Android.mk b/tests/robotests/Android.mk
index ae0102f..9afd78e 100644
--- a/tests/robotests/Android.mk
+++ b/tests/robotests/Android.mk
@@ -14,7 +14,6 @@
LOCAL_JAVA_LIBRARIES := \
junit \
platform-robolectric-prebuilt \
- sdk_vcurrent \
telephony-common
LOCAL_INSTRUMENTATION_FOR := Settings
@@ -40,4 +39,4 @@
LOCAL_INSTRUMENT_SOURCE_DIRS := $(dir $(LOCAL_PATH))../src
-include prebuilts/misc/common/robolectric/run_robotests.mk
\ No newline at end of file
+include prebuilts/misc/common/robolectric/run_robotests.mk
diff --git a/tests/robotests/src/com/android/settings/accessibility/ShortcutServicePickerFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/ShortcutServicePickerFragmentTest.java
index f2d1e65..ec35d5c 100644
--- a/tests/robotests/src/com/android/settings/accessibility/ShortcutServicePickerFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/ShortcutServicePickerFragmentTest.java
@@ -20,7 +20,6 @@
import android.content.Context;
import android.os.UserManager;
-import android.test.mock.MockContentResolver;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
import com.android.settings.applications.PackageManagerWrapper;
@@ -59,7 +58,6 @@
private PackageManagerWrapper mPackageManager;
private ShortcutServicePickerFragment mFragment;
- private MockContentResolver mContentResolver;
@Before
public void setUp() {
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/SimStatusTest.java b/tests/robotests/src/com/android/settings/deviceinfo/SimStatusTest.java
new file mode 100644
index 0000000..4bcd104
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/deviceinfo/SimStatusTest.java
@@ -0,0 +1,185 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deviceinfo;
+
+import static org.mockito.Matchers.anyInt;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.atLeastOnce;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.res.Resources;
+import android.os.PersistableBundle;
+import android.os.UserManager;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceScreen;
+import android.telephony.CarrierConfigManager;
+import android.telephony.SubscriptionInfo;
+import android.telephony.TelephonyManager;
+
+import com.android.internal.telephony.Phone;
+import com.android.settings.R;
+import com.android.settings.TestConfig;
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
+import com.android.settings.testutils.shadow.ShadowPhoneFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.annotation.Config;
+import org.robolectric.RuntimeEnvironment;
+import org.robolectric.util.ReflectionHelpers;
+
+@RunWith(SettingsRobolectricTestRunner.class)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+ shadows = {
+ ShadowPhoneFactory.class
+ })
+public class SimStatusTest {
+ @Mock
+ private CarrierConfigManager mCarrierConfigManager;
+ @Mock
+ private Phone mPhone;
+ @Mock
+ private SubscriptionInfo mSubscriptionInfo;
+ @Mock
+ private TelephonyManager mTelephonyManager;
+ @Mock
+ private PreferenceScreen mMockScreen;
+ @Mock
+ private Preference mMockImsRegistrationStatePreference;
+ @Mock
+ private UserManager mMockUserManager;
+ @Mock
+ private Activity mMockActivity;
+
+ private Context mContext;
+ private Resources mResources;
+ private PersistableBundle mBundle;
+ private SimStatus mFragment;
+
+ private String mImsRegSummaryText;
+ private boolean mImsRegRemoved;
+ private boolean mResourceUpdated;
+ private List<SubscriptionInfo> mSelectableSubInfos = new ArrayList<>();
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ mContext = spy(RuntimeEnvironment.application);
+ mResources = spy(mContext.getResources());
+ mBundle = new PersistableBundle();
+ mFragment = spy(new SimStatus());
+
+ doReturn(mContext).when(mFragment).getContext();
+ doReturn(mMockScreen).when(mFragment).getPreferenceScreen();
+ doReturn(mMockImsRegistrationStatePreference).when(mFragment).findPreference(
+ SimStatus.KEY_IMS_REGISTRATION_STATE);
+ doReturn(mMockActivity).when(mFragment).getActivity();
+ doReturn(mMockUserManager).when(mContext).getSystemService(Context.USER_SERVICE);
+ doReturn(mResources).when(mContext).getResources();
+ doReturn(0).when(mResources).getIdentifier(anyString(), anyString(), anyString());
+ doReturn(false).when(mResources).getBoolean(0);
+
+ doNothing().when(mFragment).addPreferencesFromResource(anyInt());
+
+ ReflectionHelpers.setField(mFragment, "mCarrierConfigManager", mCarrierConfigManager);
+ ReflectionHelpers.setField(mFragment, "mPhone", mPhone);
+ ReflectionHelpers.setField(mFragment, "mRes", mResources);
+ ReflectionHelpers.setField(mFragment, "mSir", mSubscriptionInfo);
+ ReflectionHelpers.setField(mFragment, "mTelephonyManager", mTelephonyManager);
+ mSelectableSubInfos.add(mSubscriptionInfo);
+ ReflectionHelpers.setField(mFragment, "mSelectableSubInfos", mSelectableSubInfos);
+
+ when(mSubscriptionInfo.getSubscriptionId()).thenReturn(0);
+ when(mCarrierConfigManager.getConfigForSubId(anyInt())).thenReturn(mBundle);
+ when(mMockActivity.createPackageContext(anyString(), anyInt())).thenReturn(mContext);
+
+ ShadowPhoneFactory.setPhone(mPhone);
+ }
+
+ @Test
+ public void updateImsRegistrationState_imsRegistered_shouldSetSummaryToRegisterd() {
+ when(mTelephonyManager.isImsRegistered(anyInt())).thenReturn(true);
+
+ mFragment.updateImsRegistrationState();
+
+ // Check "Registered" is set in the summary text
+ verify(mMockImsRegistrationStatePreference).setSummary(mContext.getString(
+ R.string.ims_reg_status_registered));
+ }
+
+ @Test
+ public void updateImsRegistrationState_imsNotRegistered_shouldSetSummaryToNotRegisterd() {
+ when(mTelephonyManager.isImsRegistered(anyInt())).thenReturn(false);
+
+ mFragment.updateImsRegistrationState();
+
+ // Check "Not registered" is set in the summary text
+ verify(mMockImsRegistrationStatePreference).setSummary(mContext.getString(
+ R.string.ims_reg_status_not_registered));
+ }
+
+ @Test
+ public void updatePreference_configTrue_shouldNotRemoveImsStatusPreference() {
+ mBundle.putBoolean(CarrierConfigManager.KEY_SHOW_IMS_REGISTRATION_STATUS_BOOL, true);
+
+ mFragment.updatePreference(false);
+
+ // Check the preference is not removed if the config is true
+ verify(mMockScreen, never()).removePreference(mMockImsRegistrationStatePreference);
+ }
+
+ @Test
+ public void updatePreference_configFalse_shouldRemoveImsStatusPreference() {
+ mBundle.putBoolean(CarrierConfigManager.KEY_SHOW_IMS_REGISTRATION_STATUS_BOOL, false);
+
+ mFragment.updatePreference(false);
+
+ // Check the preference is removed if the config is false
+ verify(mMockScreen).removePreference(mMockImsRegistrationStatePreference);
+ }
+
+ @Test
+ public void updatePreference_tabChanged_shouldRemoveAndAddPreferences() {
+ mFragment.updatePreference(true);
+
+ // Check all preferences are removed once and added again
+ verify(mMockScreen).removeAll();
+ verify(mFragment).addPreferencesFromResource(R.xml.device_info_sim_status);
+ }
+
+ @Test
+ public void doTabChanged_shouldRemoveAndAddPreferences() {
+ mFragment.doTabChanged("0");
+
+ // Check all preferences are removed once and added again
+ verify(mMockScreen).removeAll();
+ verify(mFragment).addPreferencesFromResource(R.xml.device_info_sim_status);
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/network/TetherPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/TetherPreferenceControllerTest.java
index b8a6d28..da90e49 100644
--- a/tests/robotests/src/com/android/settings/network/TetherPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/TetherPreferenceControllerTest.java
@@ -78,10 +78,21 @@
@Test
public void lifeCycle_onCreate_shouldInitBluetoothPan() {
+ when(mBluetoothAdapter.getState()).thenReturn(BluetoothAdapter.STATE_ON);
mController.onCreate(null);
- verify(mBluetoothAdapter).getProfileProxy(mContext, mController.mBtProfileServiceListener,
- BluetoothProfile.PAN);
+ verify(mBluetoothAdapter).getState();
+ verify(mBluetoothAdapter)
+ .getProfileProxy(mContext, mController.mBtProfileServiceListener, BluetoothProfile.PAN);
+ }
+
+ @Test
+ public void lifeCycle_onCreate_shouldNotInitBluetoothPanWhenBluetoothOff() {
+ when(mBluetoothAdapter.getState()).thenReturn(BluetoothAdapter.STATE_OFF);
+ mController.onCreate(null);
+
+ verify(mBluetoothAdapter).getState();
+ verifyNoMoreInteractions(mBluetoothAdapter);
}
@Test
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowPhoneFactory.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowPhoneFactory.java
new file mode 100644
index 0000000..33017d1
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowPhoneFactory.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.testutils.shadow;
+
+import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.PhoneFactory;
+
+import org.robolectric.annotation.Implementation;
+import org.robolectric.annotation.Implements;
+
+@Implements(PhoneFactory.class)
+public class ShadowPhoneFactory {
+ private static Phone sMockPhone;
+
+ public static void setPhone(Phone phone) {
+ sMockPhone = phone;
+ }
+
+ @Implementation
+ public static Phone getPhone(int phoneId) {
+ return sMockPhone;
+ }
+}