[automerger skipped] Merge "DO NOT MERGE Move IMS registration state to SIM status screen"
am: e8b70d7422  -s ours

Change-Id: I16c7823773e1a1ca070bfc5189be080996f0d38e
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 2e4738b..5e1a468 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -316,26 +316,6 @@
         <item>Never time out</item>
     </string-array>
 
-    <!-- Bluetooth developer settings: Titles for maximum number of connected audio devices -->
-    <string-array name="bluetooth_max_connected_audio_devices">
-        <item>Use System Default: <xliff:g id="default_bluetooth_max_connected_audio_devices">%1$d</xliff:g></item>
-        <item>1</item>
-        <item>2</item>
-        <item>3</item>
-        <item>4</item>
-        <item>5</item>
-    </string-array>
-
-    <!-- Bluetooth developer settings: Values for maximum number of connected audio devices -->
-    <string-array translatable="false" name="bluetooth_max_connected_audio_devices_values">
-        <item></item>
-        <item>1</item>
-        <item>2</item>
-        <item>3</item>
-        <item>4</item>
-        <item>5</item>
-    </string-array>
-
     <!-- Match this with drawable.wifi_signal. --> <skip />
     <!-- Wi-Fi settings. The signal strength a Wi-Fi network has. -->
     <string-array name="wifi_signal">
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0d7b095..79e8452 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -779,10 +779,8 @@
     <string name="encryption_and_credential_settings_title">Encryption &amp; credentials</string>
     <!-- Security Settings screen Encryption and crendential summary -->
     <string name="encryption_and_credential_settings_summary" product="default">Phone encrypted</string>
-    <string name="decryption_settings_summary" product="default">Phone not encrypted</string>
     <!-- Security Settings screen Encryption and crendential summary -->
     <string name="encryption_and_credential_settings_summary" product="tablet">Device encrypted</string>
-    <string name="decryption_settings_summary" product="tablet">Device not encrypted</string>
     <!-- Security Settings screen setting option title for the item to take you to the lock screen preference screen [CHAR LIMIT=60] -->
     <string name="lockscreen_settings_title">Lock screen preferences</string>
 
@@ -1608,16 +1606,6 @@
     <!-- 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 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>
-    <!-- Bluetooth developer settings: Maximum number of connected audio devices -->
-    <string name="bluetooth_max_connected_audio_devices_dialog_title">Select maximum number of connected Bluetooth audio devices</string>
-
     <!-- Wifi Display settings. The title of the screen. [CHAR LIMIT=40] -->
     <string name="wifi_display_settings_title">Cast</string>
     <!-- Wifi Display settings. The title of a menu item to enable wireless display [CHAR LIMIT=40] -->
diff --git a/res/values/styles_preference.xml b/res/values/styles_preference.xml
index 99ccdfc..056d55a 100644
--- a/res/values/styles_preference.xml
+++ b/res/values/styles_preference.xml
@@ -36,9 +36,4 @@
         <item name="android:widgetLayout">@layout/preference_widget_sync_toggle</item>
     </style>
 
-    <style name="SettingsMultiSelectListPreference" parent="Preference.SettingsBase">
-        <item name="android:positiveButtonText">@android:string/ok</item>
-        <item name="android:negativeButtonText">@android:string/cancel</item>
-    </style>
-
 </resources>
\ No newline at end of file
diff --git a/res/xml/apn_editor.xml b/res/xml/apn_editor.xml
index 742a436..b1e332b 100644
--- a/res/xml/apn_editor.xml
+++ b/res/xml/apn_editor.xml
@@ -157,7 +157,6 @@
         android:entries="@array/bearer_entries"
         android:entryValues="@array/bearer_values"
         android:persistent="false"
-        style="@style/SettingsMultiSelectListPreference"
         />
     <ListPreference
         android:title="@string/mvno_type"
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index db01394..bf83a5e 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -228,11 +228,6 @@
             android:title="@string/bluetooth_disable_inband_ringing"
             android:summary="@string/bluetooth_disable_inband_ringing_summary"/>
 
-        <SwitchPreference
-            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"
             android:title="@string/bluetooth_select_avrcp_version_string"
@@ -275,13 +270,6 @@
             android:entries="@array/bluetooth_a2dp_codec_ldac_playback_quality_titles"
             android:entryValues="@array/bluetooth_a2dp_codec_ldac_playback_quality_values" />
 
-        <ListPreference
-            android:key="bluetooth_max_connected_audio_devices"
-            android:title="@string/bluetooth_max_connected_audio_devices_string"
-            android:dialogTitle="@string/bluetooth_max_connected_audio_devices_dialog_title"
-            android:entries="@array/bluetooth_max_connected_audio_devices"
-            android:entryValues="@array/bluetooth_max_connected_audio_devices_values" />
-
         <com.android.settings.development.PrivateDnsModeDialogPreference
             android:key="select_private_dns_configuration"
             android:title="@string/select_private_dns_configuration_title"
diff --git a/res/xml/device_info_sim_status.xml b/res/xml/device_info_sim_status.xml
index e95d009..aa8896c 100644
--- a/res/xml/device_info_sim_status.xml
+++ b/res/xml/device_info_sim_status.xml
@@ -66,13 +66,6 @@
         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 b381d04..3456f91 100644
--- a/res/xml/device_info_status.xml
+++ b/res/xml/device_info_status.xml
@@ -89,4 +89,10 @@
         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/res/xml/security_settings_misc.xml b/res/xml/security_settings_misc.xml
index ade4782..7946dd9 100644
--- a/res/xml/security_settings_misc.xml
+++ b/res/xml/security_settings_misc.xml
@@ -60,6 +60,7 @@
     <Preference
         android:key="encryption_and_credential"
         android:title="@string/encryption_and_credential_settings_title"
+        android:summary="@string/encryption_and_credential_settings_summary"
         android:fragment="com.android.settings.EncryptionAndCredential"/>
 
     <Preference android:key="manage_trust_agents"
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index 23b149a..55f21fd 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -427,17 +427,6 @@
         mEnterprisePrivacyPreferenceController.displayPreference(root);
         mEnterprisePrivacyPreferenceController.onResume();
 
-        final Preference encryptioncredential = root.findPreference(KEY_ENCRYPTION_AND_CREDENTIALS);
-        if (LockPatternUtils.isDeviceEncryptionEnabled()) {
-                final String summaryencrypt = getContext().getString(
-                        R.string.encryption_and_credential_settings_summary);
-                encryptioncredential.setSummary(summaryencrypt);
-        } else {
-                final String summarydecrypt = getContext().getString(
-                        R.string.decryption_settings_summary);
-                encryptioncredential.setSummary(summarydecrypt);
-        }
-
         return root;
     }
 
diff --git a/src/com/android/settings/development/DevelopmentSettings.java b/src/com/android/settings/development/DevelopmentSettings.java
index e0ae111..2d5c70f 100644
--- a/src/com/android/settings/development/DevelopmentSettings.java
+++ b/src/com/android/settings/development/DevelopmentSettings.java
@@ -214,22 +214,14 @@
                                     "persist.bluetooth.disableinbandringing";
     private static final String BLUETOOTH_BTSNOOP_ENABLE_PROPERTY =
                                     "persist.bluetooth.btsnoopenable";
-    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_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";
     private static final String BLUETOOTH_SELECT_A2DP_BITS_PER_SAMPLE_KEY = "bluetooth_select_a2dp_bits_per_sample";
     private static final String BLUETOOTH_SELECT_A2DP_CHANNEL_MODE_KEY = "bluetooth_select_a2dp_channel_mode";
     private static final String BLUETOOTH_SELECT_A2DP_LDAC_PLAYBACK_QUALITY_KEY = "bluetooth_select_a2dp_ldac_playback_quality";
-    private static final String BLUETOOTH_MAX_CONNECTED_AUDIO_DEVICES_KEY =
-            "bluetooth_max_connected_audio_devices";
 
     private static final String PRIVATE_DNS_PREF_KEY = "select_private_dns_configuration";
 
@@ -300,7 +292,6 @@
     private SwitchPreference mBluetoothShowDevicesWithoutNames;
     private SwitchPreference mBluetoothDisableAbsVolume;
     private SwitchPreference mBluetoothDisableInbandRinging;
-    private SwitchPreference mBluetoothDisableAvdtpDelayReport;
 
     private BluetoothA2dp mBluetoothA2dp;
     private final Object mBluetoothA2dpLock = new Object();
@@ -310,7 +301,6 @@
     private ListPreference mBluetoothSelectA2dpBitsPerSample;
     private ListPreference mBluetoothSelectA2dpChannelMode;
     private ListPreference mBluetoothSelectA2dpLdacPlaybackQuality;
-    private ListPreference mBluetoothSelectMaxConnectedAudioDevices;
 
     private SwitchPreference mOtaDisableAutomaticUpdate;
     private SwitchPreference mWifiAllowScansWithTraffic;
@@ -530,7 +520,6 @@
             removePreference(mBluetoothDisableInbandRinging);
             mBluetoothDisableInbandRinging = null;
         }
-        mBluetoothDisableAvdtpDelayReport = findAndInitSwitchPref(BLUETOOTH_DISABLE_AVDTP_DELAY_REPORT_KEY);
 
         mBluetoothSelectAvrcpVersion = addListPreference(BLUETOOTH_SELECT_AVRCP_VERSION_KEY);
         mBluetoothSelectA2dpCodec = addListPreference(BLUETOOTH_SELECT_A2DP_CODEC_KEY);
@@ -538,7 +527,6 @@
         mBluetoothSelectA2dpBitsPerSample = addListPreference(BLUETOOTH_SELECT_A2DP_BITS_PER_SAMPLE_KEY);
         mBluetoothSelectA2dpChannelMode = addListPreference(BLUETOOTH_SELECT_A2DP_CHANNEL_MODE_KEY);
         mBluetoothSelectA2dpLdacPlaybackQuality = addListPreference(BLUETOOTH_SELECT_A2DP_LDAC_PLAYBACK_QUALITY_KEY);
-        mBluetoothSelectMaxConnectedAudioDevices = addListPreference(BLUETOOTH_MAX_CONNECTED_AUDIO_DEVICES_KEY);
         initBluetoothConfigurationValues();
 
         updatePrivateDnsSummary();
@@ -873,7 +861,6 @@
         updateBluetoothShowDevicesWithoutUserFriendlyNameOptions();
         updateBluetoothDisableAbsVolumeOptions();
         updateBluetoothDisableInbandRingingOptions();
-        updateBluetoothDisableAvdtpDelayReportOptions();
         updateBluetoothA2dpConfigurationValues();
         updatePrivateDnsSummary();
     }
@@ -901,7 +888,6 @@
         }
         writeOverlayDisplayDevicesOptions(null);
         writeAppProcessLimitOptions(null);
-        writeBluetoothMaxConnectedAudioDevices("");
         mHaveDebugSettings = false;
         updateAllOptions();
         mDontPokeProperties = false;
@@ -1549,16 +1535,6 @@
         }
     }
 
-    private void updateBluetoothDisableAvdtpDelayReportOptions() {
-        updateSwitchPreference(mBluetoothDisableAvdtpDelayReport,
-                SystemProperties.getBoolean(BLUETOOTH_DISABLE_AVDTP_DELAY_REPORTS_PROPERTY, false));
-    }
-
-    private void writeBluetoothDisableAvdtpDelayReportOptions() {
-        SystemProperties.set(BLUETOOTH_DISABLE_AVDTP_DELAY_REPORTS_PROPERTY,
-                mBluetoothDisableAvdtpDelayReport.isChecked() ? "true" : "false");
-    }
-
     private void updateMobileDataAlwaysOnOptions() {
         updateSwitchPreference(mMobileDataAlwaysOn, Settings.Global.getInt(
                 getActivity().getContentResolver(),
@@ -1884,45 +1860,6 @@
         index = 3;
         mBluetoothSelectA2dpLdacPlaybackQuality.setValue(values[index]);
         mBluetoothSelectA2dpLdacPlaybackQuality.setSummary(summaries[index]);
-
-        // Init the maximum connected devices
-        initBluetoothMaxConnectedAudioDevicesPreference();
-        updateBluetoothMaxConnectedAudioDevicesPreference();
-    }
-
-    private void initBluetoothMaxConnectedAudioDevicesPreference() {
-        int defaultMaxConnectedAudioDevices = getResources().getInteger(
-                com.android.internal.R.integer.config_bluetooth_max_connected_audio_devices);
-        final CharSequence[] entries = mBluetoothSelectMaxConnectedAudioDevices.getEntries();
-        entries[0] = String.format(entries[0].toString(), defaultMaxConnectedAudioDevices);
-        mBluetoothSelectMaxConnectedAudioDevices.setEntries(entries);
-    }
-
-    private void updateBluetoothMaxConnectedAudioDevicesPreference() {
-        final CharSequence[] entries = mBluetoothSelectMaxConnectedAudioDevices.getEntries();
-        final String currentValue =
-                SystemProperties.get(BLUETOOTH_MAX_CONNECTED_AUDIO_DEVICES_PROPERTY);
-        int index = 0;
-        if (!currentValue.isEmpty()) {
-            index = mBluetoothSelectMaxConnectedAudioDevices.findIndexOfValue(currentValue);
-            if (index < 0) {
-                // Reset property value when value is illegal
-                SystemProperties.set(BLUETOOTH_MAX_CONNECTED_AUDIO_DEVICES_PROPERTY, "");
-                index = 0;
-            }
-        }
-        mBluetoothSelectMaxConnectedAudioDevices.setValueIndex(index);
-        mBluetoothSelectMaxConnectedAudioDevices.setSummary(entries[index]);
-    }
-
-    private void writeBluetoothMaxConnectedAudioDevices(Object newValue) {
-        String newValueString = newValue.toString();
-        if (mBluetoothSelectMaxConnectedAudioDevices.findIndexOfValue(newValueString) <= 0) {
-            // Reset property value when default is chosen or when value is illegal
-            newValueString = "";
-        }
-        SystemProperties.set(BLUETOOTH_MAX_CONNECTED_AUDIO_DEVICES_PROPERTY, newValueString);
-        updateBluetoothMaxConnectedAudioDevicesPreference();
     }
 
     private void writeBluetoothAvrcpVersion(Object newValue) {
@@ -2656,8 +2593,6 @@
             writeBluetoothDisableAbsVolumeOptions();
         } else if (preference == mBluetoothDisableInbandRinging) {
             writeBluetoothDisableInbandRingingOptions();
-        } else if (preference == mBluetoothDisableAvdtpDelayReport) {
-            writeBluetoothDisableAvdtpDelayReportOptions();
         } else if (SHORTCUT_MANAGER_RESET_KEY.equals(preference.getKey())) {
             resetShortcutManagerThrottling();
         } else {
@@ -2689,9 +2624,6 @@
                    (preference == mBluetoothSelectA2dpLdacPlaybackQuality)) {
             writeBluetoothConfigurationOption(preference, newValue);
             return true;
-        } else if (preference == mBluetoothSelectMaxConnectedAudioDevices) {
-            writeBluetoothMaxConnectedAudioDevices(newValue);
-            return true;
         } else if (preference == mLogdSize) {
             writeLogdSizeOption(newValue);
             return true;
diff --git a/src/com/android/settings/deviceinfo/SimStatus.java b/src/com/android/settings/deviceinfo/SimStatus.java
index 9a6d1cd..2cc76e7 100644
--- a/src/com/android/settings/deviceinfo/SimStatus.java
+++ b/src/com/android/settings/deviceinfo/SimStatus.java
@@ -30,9 +30,7 @@
 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;
@@ -91,9 +89,6 @@
     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";
 
@@ -106,10 +101,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;
@@ -153,6 +148,8 @@
 
         mRes = getResources();
         mDefaultText = mRes.getString(R.string.device_info_default);
+        // Note - missing in zaku build, be careful later...
+        mSignalStrength = findPreference(KEY_SIGNAL_STRENGTH);
     }
 
     @Override
@@ -205,11 +202,10 @@
     public void onResume() {
         super.onResume();
         if (mPhone != null) {
-            updatePreference(false /* isTabChanged */);
+            updatePreference();
 
             updateSignalStrength(mPhone.getSignalStrength());
             updateServiceState(mPhone.getServiceState());
-            updateImsRegistrationState();
             updateDataState();
             mTelephonyManager.listen(mPhoneStateListener,
                     PhoneStateListener.LISTEN_DATA_CONNECTION_STATE
@@ -327,7 +323,7 @@
                 break;
             case ServiceState.STATE_OUT_OF_SERVICE:
                 // Set signal strength to 0 when service state is STATE_OUT_OF_SERVICE
-                setSummaryText(KEY_SIGNAL_STRENGTH, "0");
+                mSignalStrength.setSummary("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
@@ -336,7 +332,7 @@
             case ServiceState.STATE_POWER_OFF:
                 display = mRes.getString(R.string.radioInfo_service_off);
                 // Also set signal strength to 0
-                setSummaryText(KEY_SIGNAL_STRENGTH, "0");
+                mSignalStrength.setSummary("0");
                 break;
         }
 
@@ -357,46 +353,32 @@
     }
 
     void updateSignalStrength(SignalStrength signalStrength) {
-        final int state = mPhone.getServiceState().getState();
+        if (mSignalStrength != null) {
+            final int state = mPhone.getServiceState().getState();
 
-        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));
-    }
-
-    @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 ((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));
+        }
+    }
+
+    private void updatePreference() {
         if (mPhone.getPhoneType() != TelephonyManager.PHONE_TYPE_CDMA) {
             mShowLatestAreaInfo = Resources.getSystem().getBoolean(
                     com.android.internal.R.bool.config_showAreaUpdateInfoSettings);
@@ -405,8 +387,7 @@
                 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,
@@ -431,10 +412,6 @@
         if (hideSignalStrength) {
             removePreferenceFromScreen(KEY_SIGNAL_STRENGTH);
         }
-
-        if (!mShowImsRegState) {
-            removePreferenceFromScreen(KEY_IMS_REGISTRATION_STATE);
-        }
     }
 
     private void updatePhoneInfos() {
@@ -471,36 +448,29 @@
                     @Override
                     public void onServiceStateChanged(ServiceState serviceState) {
                         updateServiceState(serviceState);
-                        updateImsRegistrationState();
                     }
                 };
             }
         }
     }
-
     private OnTabChangeListener mTabListener = new OnTabChangeListener() {
         @Override
         public void onTabChanged(String tabId) {
-            doTabChanged(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();
         }
     };
 
-    @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 8073304..228774f 100644
--- a/src/com/android/settings/deviceinfo/Status.java
+++ b/src/com/android/settings/deviceinfo/Status.java
@@ -28,12 +28,16 @@
 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;
@@ -61,6 +65,7 @@
     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 = {
@@ -90,6 +95,7 @@
     private Preference mIpAddress;
     private Preference mWifiMacAddress;
     private Preference mWimaxMacAddress;
+    private Preference mImsStatus;
 
     private Handler mHandler;
 
@@ -168,6 +174,7 @@
         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);
@@ -275,11 +282,31 @@
         }
     }
 
+    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/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index d61b71c..190af4d 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -37,7 +37,6 @@
 import android.net.wifi.WpsInfo;
 import android.nfc.NfcAdapter;
 import android.os.Bundle;
-import android.os.Handler;
 import android.os.HandlerThread;
 import android.os.PowerManager;
 import android.os.Process;
@@ -704,10 +703,6 @@
     private void updateAccessPointsDelayed() {
         // Safeguard from some delayed event handling
         if (getActivity() != null && !mIsRestricted && mWifiManager.isWifiEnabled()) {
-            Handler handler = getView().getHandler();
-            if (handler != null && handler.hasCallbacks(mUpdateAccessPointsRunnable)) {
-                return;
-            }
             setProgressBarVisible(true);
             getView().postDelayed(mUpdateAccessPointsRunnable, 300 /* delay milliseconds */);
         }
diff --git a/tests/app/Android.mk b/tests/app/Android.mk
index 02883e3..c0c0ccf 100644
--- a/tests/app/Android.mk
+++ b/tests/app/Android.mk
@@ -21,7 +21,6 @@
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
 LOCAL_PACKAGE_NAME := SettingsTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
 
 LOCAL_INSTRUMENTATION_FOR := Settings
 
diff --git a/tests/robotests/src/com/android/settings/core/instrumentation/InstrumentableFragmentCodeInspector.java b/tests/robotests/src/com/android/settings/core/instrumentation/InstrumentableFragmentCodeInspector.java
index be1a599..4455549 100644
--- a/tests/robotests/src/com/android/settings/core/instrumentation/InstrumentableFragmentCodeInspector.java
+++ b/tests/robotests/src/com/android/settings/core/instrumentation/InstrumentableFragmentCodeInspector.java
@@ -16,8 +16,6 @@
 
 package com.android.settings.core.instrumentation;
 
-import static com.google.common.truth.Truth.assertWithMessage;
-
 import android.app.Fragment;
 import android.util.ArraySet;
 
@@ -27,6 +25,8 @@
 import java.util.List;
 import java.util.Set;
 
+import static com.google.common.truth.Truth.assertWithMessage;
+
 /**
  * {@link CodeInspector} that verifies all fragments implements Instrumentable.
  */
@@ -67,5 +67,7 @@
         assertWithMessage(sb.toString())
                 .that(broken.isEmpty())
                 .isTrue();
+        assertNoObsoleteInGrandfatherList("grandfather_not_implementing_instrumentable",
+                grandfather_notImplementingInstrumentable);
     }
 }
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/SimStatusTest.java b/tests/robotests/src/com/android/settings/deviceinfo/SimStatusTest.java
deleted file mode 100644
index 4bcd104..0000000
--- a/tests/robotests/src/com/android/settings/deviceinfo/SimStatusTest.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * 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/search/SearchIndexProviderCodeInspector.java b/tests/robotests/src/com/android/settings/search/SearchIndexProviderCodeInspector.java
index 0769af5..b4a91c5 100644
--- a/tests/robotests/src/com/android/settings/search/SearchIndexProviderCodeInspector.java
+++ b/tests/robotests/src/com/android/settings/search/SearchIndexProviderCodeInspector.java
@@ -16,8 +16,6 @@
 
 package com.android.settings.search;
 
-import static com.google.common.truth.Truth.assertWithMessage;
-
 import android.util.ArraySet;
 import android.util.Log;
 
@@ -30,6 +28,8 @@
 import java.util.List;
 import java.util.Set;
 
+import static com.google.common.truth.Truth.assertWithMessage;
+
 /**
  * {@link CodeInspector} to ensure fragments implement search components correctly.
  */
@@ -144,6 +144,15 @@
         assertWithMessage(notInProviderRegistryError)
                 .that(notInSearchProviderRegistry)
                 .isEmpty();
+        assertNoObsoleteInGrandfatherList("grandfather_not_implementing_indexable",
+                notImplementingIndexableGrandfatherList);
+        assertNoObsoleteInGrandfatherList("grandfather_not_implementing_index_provider",
+                notImplementingIndexProviderGrandfatherList);
+        assertNoObsoleteInGrandfatherList("grandfather_not_in_search_index_provider_registry",
+                notInSearchIndexableRegistryGrandfatherList);
+        assertNoObsoleteInGrandfatherList(
+                "grandfather_not_sharing_pref_controllers_with_search_provider",
+                notSharingPrefControllersGrandfatherList);
     }
 
     private boolean hasSearchIndexProvider(Class clazz) {
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowPhoneFactory.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowPhoneFactory.java
deleted file mode 100644
index 33017d1..0000000
--- a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowPhoneFactory.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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;
-    }
-}