diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index f4ff282..fc3888b 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -102,8 +102,6 @@
     <uses-permission android:name="android.permission.CAMERA" />
     <uses-permission android:name="android.permission.MEDIA_CONTENT_CONTROL" />
 
-    <protected-broadcast android:name="com.android.settings.DELETE_SIM_PROFILE_RESULT"/>
-
     <application android:label="@string/settings_label"
             android:icon="@drawable/ic_launcher_settings"
             android:theme="@style/Theme.Settings"
diff --git a/res/layout/master_clear.xml b/res/layout/master_clear.xml
index bf22b88..04c8f8d 100644
--- a/res/layout/master_clear.xml
+++ b/res/layout/master_clear.xml
@@ -21,7 +21,7 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:orientation="vertical"
-    android:theme="@style/SudThemeGlifV3.DayNight"
+    android:theme="@style/GlifV3Theme.Footer"
     android:icon="@drawable/ic_delete_accent"
     app:sucHeaderText="@string/master_clear_title">
 
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 171fe42..250078e 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -7335,7 +7335,7 @@
     <string name="keywords_assist_gesture_launch">gesture</string>
     <string name="keywords_face_unlock">face, unlock, auth, sign in</string>
     <string name="keywords_imei_info">imei, meid, min, prl version, imei sv</string>
-    <string name="keywords_sim_status">network, mobile network state, service state, signal strength, mobile network type, roaming, iccid</string>
+    <string name="keywords_sim_status">network, mobile network state, service state, signal strength, mobile network type, roaming, iccid, eid</string>
     <string name="keywords_model_and_hardware">serial number, hardware version</string>
     <string name="keywords_android_version">android security patch level, baseband version, kernel version</string>
     <!-- Search keywords for dark mode settings [CHAR LIMIT=NONE] -->
@@ -7889,8 +7889,8 @@
     <!-- Configure Notifications: section header for prioritizer settings  [CHAR LIMIT=80] -->
     <string name="smart_notifications_title">Adaptive notifications</string>
 
-    <!-- Configure Notifications: setting title [CHAR LIMIT=80] -->
-    <string name="asst_capability_prioritizer_title">Automatic Prioritization</string>
+    <!-- Configure Notifications: setting title [CHAR LIMIT=80 BACKUP_MESSAGE_ID=6691908606916292167] -->
+    <string name="asst_capability_prioritizer_title">Adaptive notification priority</string>
 
     <!-- Configure Notifications: setting summary [CHAR LIMIT=200] -->
     <string name="asst_capability_prioritizer_summary">Automatically set lower priority notifications to Gentle</string>
@@ -7901,6 +7901,9 @@
     <!-- Configure Notifications: setting summary [CHAR LIMIT=200] -->
     <string name="asst_capabilities_actions_replies_summary">Automatically show suggested actions &amp; replies</string>
 
+    <!-- Configure Notifications: setting title, whether the snooze menu is shown on notifications [CHAR LIMIT=80] -->
+    <string name="snooze_options_title">Allow notification snoozing</string>
+
     <!-- Configure Notifications: setting title [CHAR LIMIT=80] -->
     <string name="hide_silent_icons_title">Hide icons from gentle notifications</string>
 
@@ -8101,7 +8104,7 @@
     <string name="notification_silence_title">Silent</string>
 
     <!-- [CHAR LIMIT=100] Notification Importance title -->
-    <string name="notification_alert_title">Prioritized</string>
+    <string name="notification_alert_title">Alerting</string>
 
     <!-- [CHAR LIMIT=40] Notification importance title. This setting controls how notifications in older apps may alert the user (eg, sound, visual, vibrate). -->
     <string name="allow_interruption">Allow interruptions</string>
@@ -10197,6 +10200,15 @@
     <!-- Search keywords for System Navigation settings. [CHAR_LIMIT=NONE]-->
     <string name="keywords_system_navigation">system navigation, 2 button navigation, 3 button navigation, gesture navigation</string>
 
+    <!-- Message for the alert dialog which says that the current default home app does not support gesture navigation. [CHAR LIMIT=NONE] -->
+    <string name="gesture_not_supported_dialog_message">Not supported by your default home app, <xliff:g id="default_home_app" example="Pixel Launcher">%s</xliff:g></string>
+
+    <!-- Positive button for the alert dialog when gesture nav not supported by launcher [CHAR LIMIT=40] -->
+    <string name="gesture_not_supported_positive_button">Switch default home app</string>
+
+    <!-- Content description for the Information icon [CHAR LIMIT=30] -->
+    <string name="information_label">Information</string>
+
     <!-- Preference and settings suggestion title text for ambient display double tap (phone) [CHAR LIMIT=60]-->
     <string name="ambient_display_title" product="default">Double-tap to check phone</string>
     <!-- Preference and settings suggestion title text for ambient display double tap (tablet) [CHAR LIMIT=60]-->
diff --git a/res/values/themes.xml b/res/values/themes.xml
index 8316971..3eda345 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -126,6 +126,8 @@
 
     <style name="Theme.AlertDialog" parent="Theme.AlertDialog.Base">
         <item name="android:windowSoftInputMode">adjustResize</item>
+        <item name="android:clipToPadding">true</item>
+        <item name="android:clipChildren">true</item>
 
         <!-- Redefine the ActionBar style for contentInsetStart -->
         <item name="android:actionBarStyle">@style/Widget.ActionBar</item>
diff --git a/res/values/themes_suw.xml b/res/values/themes_suw.xml
index add2fed..f7f1d16 100644
--- a/res/values/themes_suw.xml
+++ b/res/values/themes_suw.xml
@@ -112,6 +112,11 @@
         <item name="*android:lockPatternStyle">@style/LockPatternStyle.Setup</item>
     </style>
 
+    <style name="GlifV3Theme.Footer" parent="@style/SudThemeGlifV3.DayNight">
+        <item name="android:clipChildren">true</item>
+        <item name="android:clipToPadding">true</item>
+    </style>
+
     <style name="GlifV3Theme.Light" parent="SudThemeGlifV3.Light">
         <!-- For all AndroidX Alert Dialogs -->
         <item name="alertDialogTheme">@style/GlifV2ThemeAlertDialog.Light</item>
@@ -209,4 +214,4 @@
         <item name="colorAccent">@*android:color/accent_device_default_light</item>
         <item name="dialogCornerRadius">@*android:dimen/config_dialogCornerRadius</item>
     </style>
-</resources>
\ No newline at end of file
+</resources>
diff --git a/res/xml/configure_notification_settings.xml b/res/xml/configure_notification_settings.xml
index 224a910..63f6751 100644
--- a/res/xml/configure_notification_settings.xml
+++ b/res/xml/configure_notification_settings.xml
@@ -80,6 +80,11 @@
         settings:initialExpandedChildrenCount="0">
 
         <SwitchPreference
+            android:key="show_snooze_options"
+            android:title="@string/snooze_options_title"
+            settings:controller="com.android.settings.notification.SnoozeNotificationPreferenceController" />
+
+        <SwitchPreference
             android:key="asst_capabilities_actions_replies"
             android:title="@string/asst_capabilities_actions_replies_title"
             android:summary="@string/asst_capabilities_actions_replies_summary"
diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml
index c537f3f..25982fe8 100644
--- a/res/xml/development_settings.xml
+++ b/res/xml/development_settings.xml
@@ -248,6 +248,11 @@
             android:summary="@string/wifi_verbose_logging_summary" />
 
         <SwitchPreference
+            android:key="wifi_scan_throttling"
+            android:title="@string/wifi_scan_throttling"
+            android:summary="@string/wifi_scan_throttling_summary" />
+
+        <SwitchPreference
             android:key="mobile_data_always_on"
             android:title="@string/mobile_data_always_on"
             android:summary="@string/mobile_data_always_on_summary" />
@@ -522,6 +527,11 @@
             android:title="@string/show_notification_channel_warnings"
             android:summary="@string/show_notification_channel_warnings_summary" />
 
+        <SwitchPreference
+            android:key="asst_capability_prioritizer"
+            android:title="@string/asst_capability_prioritizer_title"
+            settings:controller="com.android.settings.notification.AssistantCapabilityPreferenceController" />
+
         <Preference
             android:key="inactive_apps"
             android:title="@string/inactive_apps_title"
diff --git a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
index 9dcc222..bca5ded 100644
--- a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
+++ b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
@@ -432,6 +432,7 @@
         controllers.add(new CameraLaserSensorPreferenceController(context));
         controllers.add(new WifiDisplayCertificationPreferenceController(context));
         controllers.add(new WifiVerboseLoggingPreferenceController(context));
+        controllers.add(new WifiScanThrottlingPreferenceController(context));
         controllers.add(new MobileDataAlwaysOnPreferenceController(context));
         controllers.add(new TetheringHardwareAccelPreferenceController(context));
         controllers.add(new BluetoothDeviceNoNamePreferenceController(context));
diff --git a/src/com/android/settings/development/WifiScanThrottlingPreferenceController.java b/src/com/android/settings/development/WifiScanThrottlingPreferenceController.java
new file mode 100644
index 0000000..a069827
--- /dev/null
+++ b/src/com/android/settings/development/WifiScanThrottlingPreferenceController.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2019 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.development;
+
+import android.content.Context;
+import android.provider.Settings;
+
+import androidx.annotation.VisibleForTesting;
+import androidx.preference.Preference;
+import androidx.preference.SwitchPreference;
+
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.development.DeveloperOptionsPreferenceController;
+
+public class WifiScanThrottlingPreferenceController extends DeveloperOptionsPreferenceController
+        implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
+    private static final String WIFI_SCAN_THROTTLING_KEY = "wifi_scan_throttling";
+    @VisibleForTesting
+    static final int SETTING_THROTTLING_ENABLE_VALUE_ON = 1;  // default is throttling enabled.
+    @VisibleForTesting
+    static final int SETTING_THROTTLING_ENABLE_VALUE_OFF = 0;
+
+    public WifiScanThrottlingPreferenceController(Context context) {
+        super(context);
+    }
+
+    @Override
+    public String getPreferenceKey() {
+        return WIFI_SCAN_THROTTLING_KEY;
+    }
+
+    @Override
+    public boolean onPreferenceChange(Preference preference, Object newValue) {
+        final boolean isEnabled = (Boolean) newValue;
+        Settings.Global.putInt(mContext.getContentResolver(),
+                Settings.Global.WIFI_SCAN_THROTTLE_ENABLED,
+                isEnabled
+                        ? SETTING_THROTTLING_ENABLE_VALUE_ON
+                        : SETTING_THROTTLING_ENABLE_VALUE_OFF);
+        return true;
+    }
+
+    @Override
+    public void updateState(Preference preference) {
+        final int scanThrottleEnabled = Settings.Global.getInt(
+                mContext.getContentResolver(), Settings.Global.WIFI_SCAN_THROTTLE_ENABLED,
+                SETTING_THROTTLING_ENABLE_VALUE_ON);
+        ((SwitchPreference) mPreference).setChecked(
+                scanThrottleEnabled == SETTING_THROTTLING_ENABLE_VALUE_ON);
+    }
+
+    @Override
+    protected void onDeveloperOptionsSwitchDisabled() {
+        super.onDeveloperOptionsSwitchDisabled();
+        Settings.Global.putInt(mContext.getContentResolver(),
+                Settings.Global.WIFI_SCAN_THROTTLE_ENABLED, SETTING_THROTTLING_ENABLE_VALUE_ON);
+        ((SwitchPreference) mPreference).setChecked(true);
+    }
+}
diff --git a/src/com/android/settings/network/MobileNetworkListFragment.java b/src/com/android/settings/network/MobileNetworkListFragment.java
index c90827e..4690a28 100644
--- a/src/com/android/settings/network/MobileNetworkListFragment.java
+++ b/src/com/android/settings/network/MobileNetworkListFragment.java
@@ -18,6 +18,7 @@
 
 import android.app.settings.SettingsEnums;
 import android.content.Context;
+import android.os.UserManager;
 import android.provider.SearchIndexableResource;
 
 import com.android.settings.R;
@@ -66,5 +67,10 @@
                     result.add(sir);
                     return result;
                 }
+
+                @Override
+                protected boolean isPageSearchEnabled(Context context) {
+                    return context.getSystemService(UserManager.class).isAdminUser();
+                }
             };
 }
diff --git a/src/com/android/settings/network/SubscriptionsPreferenceController.java b/src/com/android/settings/network/SubscriptionsPreferenceController.java
index ae31b56..e9cdb46 100644
--- a/src/com/android/settings/network/SubscriptionsPreferenceController.java
+++ b/src/com/android/settings/network/SubscriptionsPreferenceController.java
@@ -19,16 +19,22 @@
 import static androidx.lifecycle.Lifecycle.Event.ON_PAUSE;
 import static androidx.lifecycle.Lifecycle.Event.ON_RESUME;
 
+import static com.android.settings.network.telephony.MobileNetworkUtils.NO_CELL_DATA_TYPE_ICON;
+
 import android.content.Context;
 import android.content.Intent;
+import android.graphics.drawable.Drawable;
 import android.net.ConnectivityManager;
 import android.net.Network;
 import android.net.NetworkCapabilities;
 import android.provider.Settings;
+import android.telephony.SignalStrength;
 import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
+import android.util.ArraySet;
 
+import androidx.annotation.VisibleForTesting;
 import androidx.collection.ArrayMap;
 import androidx.lifecycle.Lifecycle;
 import androidx.lifecycle.LifecycleObserver;
@@ -40,9 +46,14 @@
 import com.android.settings.R;
 import com.android.settings.network.telephony.DataConnectivityListener;
 import com.android.settings.network.telephony.MobileNetworkActivity;
+import com.android.settings.network.telephony.MobileNetworkUtils;
+import com.android.settings.network.telephony.SignalStrengthListener;
 import com.android.settingslib.core.AbstractPreferenceController;
+import com.android.settingslib.net.SignalStrengthUtil;
 
+import java.util.Collections;
 import java.util.Map;
+import java.util.Set;
 
 /**
  * This manages a set of Preferences it places into a PreferenceGroup owned by some parent
@@ -51,7 +62,8 @@
  */
 public class SubscriptionsPreferenceController extends AbstractPreferenceController implements
         LifecycleObserver, SubscriptionsChangeListener.SubscriptionsChangeListenerClient,
-        MobileDataEnabledListener.Client, DataConnectivityListener.Client {
+        MobileDataEnabledListener.Client, DataConnectivityListener.Client,
+        SignalStrengthListener.Callback {
     private static final String TAG = "SubscriptionsPrefCntrlr";
 
     private UpdateListener mUpdateListener;
@@ -62,6 +74,8 @@
     private SubscriptionsChangeListener mSubscriptionsListener;
     private MobileDataEnabledListener mDataEnabledListener;
     private DataConnectivityListener mConnectivityListener;
+    private SignalStrengthListener mSignalStrengthListener;
+
 
     // Map of subscription id to Preference
     private Map<Integer, Preference> mSubscriptionPreferences;
@@ -102,6 +116,7 @@
         mSubscriptionsListener = new SubscriptionsChangeListener(context, this);
         mDataEnabledListener = new MobileDataEnabledListener(context, this);
         mConnectivityListener = new DataConnectivityListener(context, this);
+        mSignalStrengthListener = new SignalStrengthListener(context, this);
         lifecycle.addObserver(this);
     }
 
@@ -110,6 +125,7 @@
         mSubscriptionsListener.start();
         mDataEnabledListener.start(SubscriptionManager.getDefaultDataSubscriptionId());
         mConnectivityListener.start();
+        mSignalStrengthListener.resume();
         update();
     }
 
@@ -118,6 +134,7 @@
         mSubscriptionsListener.stop();
         mDataEnabledListener.stop();
         mConnectivityListener.stop();
+        mSignalStrengthListener.pause();
     }
 
     @Override
@@ -136,6 +153,7 @@
                 mPreferenceGroup.removePreference(pref);
             }
             mSubscriptionPreferences.clear();
+            mSignalStrengthListener.updateSubscriptionIds(Collections.emptySet());
             mUpdateListener.onChildrenUpdated();
             return;
         }
@@ -144,16 +162,20 @@
         mSubscriptionPreferences = new ArrayMap<>();
 
         int order = mStartOrder;
+        final Set<Integer> activeSubIds = new ArraySet<>();
+        final int dataDefaultSubId = SubscriptionManager.getDefaultDataSubscriptionId();
         for (SubscriptionInfo info : SubscriptionUtil.getActiveSubscriptions(mManager)) {
             final int subId = info.getSubscriptionId();
+            activeSubIds.add(subId);
             Preference pref = existingPrefs.remove(subId);
             if (pref == null) {
                 pref = new Preference(mPreferenceGroup.getContext());
                 mPreferenceGroup.addPreference(pref);
             }
             pref.setTitle(info.getDisplayName());
-            pref.setSummary(getSummary(subId));
-            pref.setIcon(R.drawable.ic_network_cell);
+            final boolean isDefaultForData = (subId == dataDefaultSubId);
+            pref.setSummary(getSummary(subId, isDefaultForData));
+            setIcon(pref, subId, isDefaultForData);
             pref.setOrder(order++);
 
             pref.setOnPreferenceClickListener(clickedPref -> {
@@ -165,6 +187,7 @@
 
             mSubscriptionPreferences.put(subId, pref);
         }
+        mSignalStrengthListener.updateSubscriptionIds(activeSubIds);
 
         // Remove any old preferences that no longer map to a subscription.
         for (Preference pref : existingPrefs.values()) {
@@ -173,6 +196,32 @@
         mUpdateListener.onChildrenUpdated();
     }
 
+    @VisibleForTesting
+    boolean shouldInflateSignalStrength(int subId) {
+        return SignalStrengthUtil.shouldInflateSignalStrength(mContext, subId);
+    }
+
+    @VisibleForTesting
+    void setIcon(Preference pref, int subId, boolean isDefaultForData) {
+        final TelephonyManager mgr = mContext.getSystemService(
+                TelephonyManager.class).createForSubscriptionId(subId);
+        final SignalStrength strength = mgr.getSignalStrength();
+        int level = (strength == null) ? 0 : strength.getLevel();
+        int numLevels = SignalStrength.NUM_SIGNAL_STRENGTH_BINS;
+        if (shouldInflateSignalStrength(subId)) {
+            level += 1;
+            numLevels += 1;
+        }
+        final boolean showCutOut = !isDefaultForData || !mgr.isDataEnabled();
+        pref.setIcon(getIcon(level, numLevels, showCutOut));
+    }
+
+    @VisibleForTesting
+    Drawable getIcon(int level, int numLevels, boolean cutOut) {
+        return MobileNetworkUtils.getSignalStrengthIcon(mContext, level, numLevels,
+                NO_CELL_DATA_TYPE_ICON, cutOut);
+    }
+
     private boolean activeNetworkIsCellular() {
         final Network activeNetwork = mConnectivityManager.getActiveNetwork();
         if (activeNetwork == null) {
@@ -197,10 +246,9 @@
      *
      * If a subscription isn't the default for anything, we just say it is available.
      */
-    protected String getSummary(int subId) {
+    protected String getSummary(int subId, boolean isDefaultForData) {
         final int callsDefaultSubId = SubscriptionManager.getDefaultVoiceSubscriptionId();
         final int smsDefaultSubId = SubscriptionManager.getDefaultSmsSubscriptionId();
-        final int dataDefaultSubId = SubscriptionManager.getDefaultDataSubscriptionId();
 
         String line1 = null;
         if (subId == callsDefaultSubId && subId == smsDefaultSubId) {
@@ -212,10 +260,10 @@
         }
 
         String line2 = null;
-        if (subId == dataDefaultSubId) {
+        if (isDefaultForData) {
             final TelephonyManager telMgrForSub = mContext.getSystemService(
                     TelephonyManager.class).createForSubscriptionId(subId);
-            boolean dataEnabled = telMgrForSub.isDataEnabled();
+            final boolean dataEnabled = telMgrForSub.isDataEnabled();
             if (dataEnabled && activeNetworkIsCellular()) {
                 line2 = mContext.getString(R.string.mobile_data_active);
             } else if (!dataEnabled) {
@@ -277,4 +325,9 @@
     public void onDataConnectivityChange() {
         update();
     }
+
+    @Override
+    public void onSignalStrengthChanged() {
+        update();
+    }
 }
diff --git a/src/com/android/settings/network/telephony/DeleteSimProfileConfirmationDialog.java b/src/com/android/settings/network/telephony/DeleteSimProfileConfirmationDialog.java
deleted file mode 100644
index 13bfa92..0000000
--- a/src/com/android/settings/network/telephony/DeleteSimProfileConfirmationDialog.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2019 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.network.telephony;
-
-import android.app.Dialog;
-import android.app.settings.SettingsEnums;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.os.Bundle;
-import android.telephony.SubscriptionInfo;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.annotation.VisibleForTesting;
-import androidx.appcompat.app.AlertDialog;
-
-import com.android.settings.R;
-import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
-
-public class DeleteSimProfileConfirmationDialog extends InstrumentedDialogFragment implements
-        DialogInterface.OnClickListener {
-    public static final String TAG = "confirm_delete_sim";
-    public static final String KEY_SUBSCRIPTION_INFO = "subscription_info";
-    private SubscriptionInfo mInfo;
-
-    public static DeleteSimProfileConfirmationDialog newInstance(SubscriptionInfo info) {
-        final DeleteSimProfileConfirmationDialog dialog =
-                new DeleteSimProfileConfirmationDialog();
-        final Bundle args = new Bundle();
-        args.putParcelable(KEY_SUBSCRIPTION_INFO, info);
-        dialog.setArguments(args);
-        return dialog;
-    }
-
-    @NonNull
-    @Override
-    public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
-        mInfo = getArguments().getParcelable(KEY_SUBSCRIPTION_INFO);
-        Context context = getContext();
-        final String message = context.getString(R.string.mobile_network_erase_sim_dialog_body,
-                mInfo.getCarrierName(), mInfo.getCarrierName());
-        return new AlertDialog.Builder(context)
-                .setTitle(R.string.mobile_network_erase_sim_dialog_title)
-                .setMessage(message)
-                .setNegativeButton(R.string.cancel, null)
-                .setPositiveButton(R.string.mobile_network_erase_sim_dialog_ok, this)
-                .create();
-    }
-
-    @Override
-    public void onClick(DialogInterface dialog, int which) {
-        if (which == DialogInterface.BUTTON_POSITIVE) {
-            beginDeletionWithProgress();
-        }
-    }
-
-    @VisibleForTesting
-    void beginDeletionWithProgress() {
-        final DeleteSimProfileProgressDialog progress =
-                DeleteSimProfileProgressDialog.newInstance(mInfo.getSubscriptionId());
-        progress.setTargetFragment(getTargetFragment(), 0);
-        progress.show(getFragmentManager(), DeleteSimProfileProgressDialog.TAG);
-    }
-
-    @Override
-    public int getMetricsCategory() {
-        return SettingsEnums.DIALOG_DELETE_SIM_CONFIRMATION;
-    }
-}
diff --git a/src/com/android/settings/network/telephony/DeleteSimProfilePreferenceController.java b/src/com/android/settings/network/telephony/DeleteSimProfilePreferenceController.java
index 22ff2b6..daabf8b 100644
--- a/src/com/android/settings/network/telephony/DeleteSimProfilePreferenceController.java
+++ b/src/com/android/settings/network/telephony/DeleteSimProfilePreferenceController.java
@@ -17,7 +17,9 @@
 package com.android.settings.network.telephony;
 
 import android.content.Context;
+import android.content.Intent;
 import android.telephony.SubscriptionInfo;
+import android.telephony.euicc.EuiccManager;
 
 import androidx.fragment.app.Fragment;
 import androidx.preference.Preference;
@@ -31,12 +33,13 @@
 
     private SubscriptionInfo mSubscriptionInfo;
     private Fragment mParentFragment;
+    private int mRequestCode;
 
     public DeleteSimProfilePreferenceController(Context context, String preferenceKey) {
         super(context, preferenceKey);
     }
 
-    public void init(int subscriptionId, Fragment parentFragment) {
+    public void init(int subscriptionId, Fragment parentFragment, int requestCode) {
         mParentFragment = parentFragment;
 
         for (SubscriptionInfo info : SubscriptionUtil.getAvailableSubscriptions(
@@ -46,6 +49,7 @@
                 break;
             }
         }
+        mRequestCode = requestCode;
     }
 
     @Override
@@ -53,11 +57,10 @@
         super.displayPreference(screen);
         final Preference pref = screen.findPreference(getPreferenceKey());
         pref.setOnPreferenceClickListener(p -> {
-            final DeleteSimProfileConfirmationDialog dialogFragment =
-                    DeleteSimProfileConfirmationDialog.newInstance(mSubscriptionInfo);
-            dialogFragment.setTargetFragment(mParentFragment, 0);
-            dialogFragment.show(mParentFragment.getFragmentManager(),
-                    DeleteSimProfileConfirmationDialog.TAG);
+            final Intent intent = new Intent(EuiccManager.ACTION_DELETE_SUBSCRIPTION_PRIVILEGED);
+            intent.putExtra(EuiccManager.EXTRA_SUBSCRIPTION_ID,
+                    mSubscriptionInfo.getSubscriptionId());
+            mParentFragment.startActivityForResult(intent, mRequestCode);
             return true;
         });
     }
diff --git a/src/com/android/settings/network/telephony/DeleteSimProfileProgressDialog.java b/src/com/android/settings/network/telephony/DeleteSimProfileProgressDialog.java
deleted file mode 100644
index c176f3c..0000000
--- a/src/com/android/settings/network/telephony/DeleteSimProfileProgressDialog.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2019 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.network.telephony;
-
-import android.app.Activity;
-import android.app.Dialog;
-import android.app.PendingIntent;
-import android.app.ProgressDialog;
-import android.app.settings.SettingsEnums;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.os.Bundle;
-import android.telephony.euicc.EuiccManager;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.annotation.VisibleForTesting;
-
-import com.android.settings.R;
-import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
-
-public class DeleteSimProfileProgressDialog extends InstrumentedDialogFragment {
-    public static final String TAG = "delete_sim_progress";
-
-    // Note that this must be listed in AndroidManfiest.xml in a <protected-broadcast> tag
-    @VisibleForTesting
-    static final String PENDING_INTENT =
-            "com.android.settings.DELETE_SIM_PROFILE_RESULT";
-    private static final int PENDING_INTENT_REQUEST_CODE = 1;
-    private static final String KEY_SUBSCRIPTION_ID = "subscription_id";
-    @VisibleForTesting
-    static final String KEY_DELETE_STARTED = "delete_started";
-
-    private boolean mDeleteStarted;
-    private BroadcastReceiver mReceiver;
-
-    public static DeleteSimProfileProgressDialog newInstance(int subscriptionId) {
-        final DeleteSimProfileProgressDialog dialog = new DeleteSimProfileProgressDialog();
-        final Bundle args = new Bundle();
-        args.putInt(KEY_SUBSCRIPTION_ID, subscriptionId);
-        dialog.setArguments(args);
-        return dialog;
-    }
-
-    @Override
-    public void onSaveInstanceState(@NonNull Bundle outState) {
-        super.onSaveInstanceState(outState);
-        outState.putBoolean(KEY_DELETE_STARTED, mDeleteStarted);
-    }
-
-    @NonNull
-    @Override
-    public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
-        if (savedInstanceState != null) {
-            mDeleteStarted = savedInstanceState.getBoolean(KEY_DELETE_STARTED, false);
-        }
-        final Context context = getContext();
-        final ProgressDialog progressDialog = new ProgressDialog(context);
-        progressDialog.setMessage(
-                context.getString(R.string.mobile_network_erase_sim_dialog_progress));
-
-        mReceiver = new BroadcastReceiver() {
-            @Override
-            public void onReceive(Context context, Intent intent) {
-                dismiss();
-                final Activity activity = getActivity();
-                if (activity != null && !activity.isFinishing()) {
-                    activity.finish();
-                }
-            }
-        };
-        context.registerReceiver(mReceiver, new IntentFilter(PENDING_INTENT));
-
-        if (!mDeleteStarted) {
-            final PendingIntent pendingIntent = PendingIntent.getBroadcast(context,
-                    PENDING_INTENT_REQUEST_CODE, new Intent(PENDING_INTENT),
-                    PendingIntent.FLAG_ONE_SHOT);
-
-            final EuiccManager euiccManager = context.getSystemService(EuiccManager.class);
-            final int subId = getArguments().getInt(KEY_SUBSCRIPTION_ID);
-            euiccManager.deleteSubscription(subId, pendingIntent);
-            mDeleteStarted = true;
-        }
-
-        return progressDialog;
-    }
-
-    @Override
-    public void onDismiss(@NonNull DialogInterface dialog) {
-        if (mReceiver != null) {
-            final Context context = getContext();
-            if (context != null) {
-                context.unregisterReceiver(mReceiver);
-            }
-            mReceiver = null;
-        }
-    }
-
-    @Override
-    public int getMetricsCategory() {
-        return SettingsEnums.DIALOG_DELETE_SIM_PROGRESS;
-    }
-}
diff --git a/src/com/android/settings/network/telephony/MobileNetworkSettings.java b/src/com/android/settings/network/telephony/MobileNetworkSettings.java
index e18971d..838aa12 100644
--- a/src/com/android/settings/network/telephony/MobileNetworkSettings.java
+++ b/src/com/android/settings/network/telephony/MobileNetworkSettings.java
@@ -61,6 +61,7 @@
 
     private static final String LOG_TAG = "NetworkSettings";
     public static final int REQUEST_CODE_EXIT_ECM = 17;
+    public static final int REQUEST_CODE_DELETE_SUBSCRIPTION = 18;
     @VisibleForTesting
     static final String KEY_CLICKED_PREF = "key_clicked_pref";
 
@@ -138,7 +139,8 @@
             use(BillingCyclePreferenceController.class).init(mSubId);
             use(MmsMessagePreferenceController.class).init(mSubId);
             use(DisabledSubscriptionController.class).init(getLifecycle(), mSubId);
-            use(DeleteSimProfilePreferenceController.class).init(mSubId, this);
+            use(DeleteSimProfilePreferenceController.class).init(mSubId, this,
+                    REQUEST_CODE_DELETE_SUBSCRIPTION);
         }
         use(MobileDataPreferenceController.class).init(getFragmentManager(), mSubId);
         use(RoamingPreferenceController.class).init(getFragmentManager(), mSubId);
@@ -226,6 +228,13 @@
                 }
                 break;
 
+            case REQUEST_CODE_DELETE_SUBSCRIPTION:
+                final Activity activity = getActivity();
+                if (activity != null && !activity.isFinishing()) {
+                    activity.finish();
+                }
+                break;
+
             default:
                 break;
         }
@@ -268,5 +277,11 @@
                     result.add(sir);
                     return result;
                 }
+
+                /** suppress full page if user is not admin */
+                @Override
+                protected boolean isPageSearchEnabled(Context context) {
+                    return context.getSystemService(UserManager.class).isAdminUser();
+                }
             };
 }
diff --git a/src/com/android/settings/network/telephony/MobileNetworkUtils.java b/src/com/android/settings/network/telephony/MobileNetworkUtils.java
index c0b4590..0e5eaa8 100644
--- a/src/com/android/settings/network/telephony/MobileNetworkUtils.java
+++ b/src/com/android/settings/network/telephony/MobileNetworkUtils.java
@@ -24,6 +24,10 @@
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.database.Cursor;
+import android.graphics.Color;
+import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.LayerDrawable;
 import android.os.PersistableBundle;
 import android.os.SystemProperties;
 import android.provider.Settings;
@@ -37,6 +41,7 @@
 import android.telephony.ims.feature.ImsFeature;
 import android.text.TextUtils;
 import android.util.Log;
+import android.view.Gravity;
 
 import androidx.annotation.VisibleForTesting;
 
@@ -45,7 +50,10 @@
 import com.android.internal.telephony.Phone;
 import com.android.internal.telephony.PhoneConstants;
 import com.android.internal.util.ArrayUtils;
+import com.android.settings.R;
+import com.android.settings.Utils;
 import com.android.settings.core.BasePreferenceController;
+import com.android.settingslib.graph.SignalDrawable;
 
 import java.util.Arrays;
 import java.util.List;
@@ -65,6 +73,10 @@
     private static final String LEGACY_ACTION_CONFIGURE_PHONE_ACCOUNT =
             "android.telecom.action.CONNECTION_SERVICE_CONFIGURE";
 
+    // The following constants are used to draw signal icon.
+    public static final int NO_CELL_DATA_TYPE_ICON = 0;
+    public static final Drawable EMPTY_DRAWABLE = new ColorDrawable(Color.TRANSPARENT);
+
     /**
      * Returns if DPC APNs are enforced.
      */
@@ -495,4 +507,32 @@
 
         return false;
     }
+
+    public static Drawable getSignalStrengthIcon(Context context, int level, int numLevels,
+            int iconType, boolean cutOut) {
+        SignalDrawable signalDrawable = new SignalDrawable(context);
+        signalDrawable.setLevel(
+                SignalDrawable.getState(level, numLevels, cutOut));
+
+        // Make the network type drawable
+        Drawable networkDrawable =
+                iconType == NO_CELL_DATA_TYPE_ICON
+                        ? EMPTY_DRAWABLE
+                        : context
+                                .getResources().getDrawable(iconType, context.getTheme());
+
+        // Overlay the two drawables
+        final Drawable[] layers = {networkDrawable, signalDrawable};
+        final int iconSize =
+                context.getResources().getDimensionPixelSize(R.dimen.signal_strength_icon_size);
+
+        LayerDrawable icons = new LayerDrawable(layers);
+        // Set the network type icon at the top left
+        icons.setLayerGravity(0 /* index of networkDrawable */, Gravity.TOP | Gravity.LEFT);
+        // Set the signal strength icon at the bottom right
+        icons.setLayerGravity(1 /* index of SignalDrawable */, Gravity.BOTTOM | Gravity.RIGHT);
+        icons.setLayerSize(1 /* index of SignalDrawable */, iconSize, iconSize);
+        icons.setTintList(Utils.getColorAttr(context, android.R.attr.colorControlNormal));
+        return icons;
+    }
 }
diff --git a/src/com/android/settings/network/telephony/NetworkOperatorPreference.java b/src/com/android/settings/network/telephony/NetworkOperatorPreference.java
index 2359399..77f40da 100644
--- a/src/com/android/settings/network/telephony/NetworkOperatorPreference.java
+++ b/src/com/android/settings/network/telephony/NetworkOperatorPreference.java
@@ -16,22 +16,17 @@
 
 package com.android.settings.network.telephony;
 
+import static android.telephony.SignalStrength.NUM_SIGNAL_STRENGTH_BINS;
+
 import android.content.Context;
-import android.graphics.Color;
-import android.graphics.drawable.ColorDrawable;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.LayerDrawable;
 import android.telephony.CellInfo;
 import android.telephony.CellSignalStrength;
-import android.telephony.SignalStrength;
 import android.util.Log;
-import android.view.Gravity;
 
 import androidx.preference.Preference;
 
 import com.android.settings.R;
 import com.android.settings.Utils;
-import com.android.settingslib.graph.SignalDrawable;
 
 import java.util.List;
 
@@ -45,18 +40,12 @@
 
     private static final int LEVEL_NONE = -1;
 
-    // number of signal strength level
-    public static final int NUMBER_OF_LEVELS = SignalStrength.NUM_SIGNAL_STRENGTH_BINS;
     private CellInfo mCellInfo;
     private List<String> mForbiddenPlmns;
     private int mLevel = LEVEL_NONE;
     private boolean mShow4GForLTE;
     private boolean mUseNewApi;
 
-    // The following constants are used to draw signal icon.
-    private static final Drawable EMPTY_DRAWABLE = new ColorDrawable(Color.TRANSPARENT);
-    private static final int NO_CELL_DATA_CONNECTED_ICON = 0;
-
     public NetworkOperatorPreference(
             CellInfo cellinfo, Context context, List<String> forbiddenPlmns, boolean show4GForLTE) {
         super(context);
@@ -113,39 +102,16 @@
             case CellInfo.TYPE_CDMA:
                 return R.drawable.signal_strength_1x;
             default:
-                return 0;
+                return MobileNetworkUtils.NO_CELL_DATA_TYPE_ICON;
         }
     }
 
     private void updateIcon(int level) {
-        if (!mUseNewApi || level < 0 || level >= NUMBER_OF_LEVELS) {
+        if (!mUseNewApi || level < 0 || level >= NUM_SIGNAL_STRENGTH_BINS) {
             return;
         }
         Context context = getContext();
-        SignalDrawable signalDrawable = new SignalDrawable(getContext());
-        signalDrawable.setLevel(
-                SignalDrawable.getState(level, NUMBER_OF_LEVELS, false /* cutOut */));
-
-        // Make the network type drawable
-        int iconType = getIconIdForCell(mCellInfo);
-        Drawable networkDrawable =
-                iconType == NO_CELL_DATA_CONNECTED_ICON
-                        ? EMPTY_DRAWABLE
-                        : getContext()
-                                .getResources().getDrawable(iconType, getContext().getTheme());
-
-        // Overlay the two drawables
-        final Drawable[] layers = {networkDrawable, signalDrawable};
-        final int iconSize =
-                context.getResources().getDimensionPixelSize(R.dimen.signal_strength_icon_size);
-
-        LayerDrawable icons = new LayerDrawable(layers);
-        // Set the network type icon at the top left
-        icons.setLayerGravity(0 /* index of networkDrawable */, Gravity.TOP | Gravity.LEFT);
-        // Set the signal strength icon at the bottom right
-        icons.setLayerGravity(1 /* index of SignalDrawable */, Gravity.BOTTOM | Gravity.RIGHT);
-        icons.setLayerSize(1 /* index of SignalDrawable */, iconSize, iconSize);
-        icons.setTintList(Utils.getColorAttr(context, android.R.attr.colorControlNormal));
-        setIcon(icons);
+        setIcon(MobileNetworkUtils.getSignalStrengthIcon(context, level, NUM_SIGNAL_STRENGTH_BINS,
+                getIconIdForCell(mCellInfo), false));
     }
 }
diff --git a/src/com/android/settings/network/telephony/NetworkSelectSettings.java b/src/com/android/settings/network/telephony/NetworkSelectSettings.java
index 98bfc0d..62947d1 100644
--- a/src/com/android/settings/network/telephony/NetworkSelectSettings.java
+++ b/src/com/android/settings/network/telephony/NetworkSelectSettings.java
@@ -29,6 +29,7 @@
 import android.telephony.CellInfo;
 import android.telephony.NetworkRegistrationInfo;
 import android.telephony.ServiceState;
+import android.telephony.SignalStrength;
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
 import android.util.Log;
@@ -336,7 +337,7 @@
                 pref.setSummary(R.string.network_connected);
                 // Update the signal strength icon, since the default signalStrength value would be
                 // zero (it would be quite confusing why the connected network has no signal)
-                pref.setIcon(NetworkOperatorPreference.NUMBER_OF_LEVELS - 1);
+                pref.setIcon(SignalStrength.NUM_SIGNAL_STRENGTH_BINS - 1);
                 mConnectedPreferenceCategory.addPreference(pref);
             } else {
                 // Remove the connected network operators category
diff --git a/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragment.java b/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragment.java
index f7e7de5..82554c2 100644
--- a/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragment.java
+++ b/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragment.java
@@ -95,13 +95,9 @@
         builder.setTitle(R.string.mobile_network_sim_name)
                 .setView(view)
                 .setPositiveButton(R.string.mobile_network_sim_name_rename, (dialog, which) -> {
-                    SubscriptionInfo currentInfo = mSubscriptionManager.getActiveSubscriptionInfo(
-                            mSubId);
                     String newName = mNameView.getText().toString();
-                    if (currentInfo != null && !currentInfo.getDisplayName().equals(newName)) {
-                        mSubscriptionManager.setDisplayName(newName, mSubId,
-                                SubscriptionManager.NAME_SOURCE_USER_INPUT);
-                    }
+                    mSubscriptionManager.setDisplayName(newName, mSubId,
+                            SubscriptionManager.NAME_SOURCE_USER_INPUT);
                 })
                 .setNegativeButton(android.R.string.cancel, null);
         return builder.create();
diff --git a/src/com/android/settings/network/telephony/SignalStrengthListener.java b/src/com/android/settings/network/telephony/SignalStrengthListener.java
new file mode 100644
index 0000000..0e29a45
--- /dev/null
+++ b/src/com/android/settings/network/telephony/SignalStrengthListener.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2019 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.network.telephony;
+
+import android.content.Context;
+import android.telephony.PhoneStateListener;
+import android.telephony.SignalStrength;
+import android.telephony.TelephonyManager;
+import android.util.ArraySet;
+
+import com.google.common.collect.Sets;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+/** Helper class to manage listening to signal strength changes on a set of mobile network
+ *  subscriptions */
+public class SignalStrengthListener {
+
+    private TelephonyManager mBaseTelephonyManager;
+    private Callback mCallback;
+    private Map<Integer, PhoneStateListener> mListeners;
+
+    public interface Callback {
+        void onSignalStrengthChanged();
+    }
+
+    public SignalStrengthListener(Context context, Callback callback) {
+        mBaseTelephonyManager = context.getSystemService(TelephonyManager.class);
+        mCallback = callback;
+        mListeners = new TreeMap<>();
+    }
+
+    /** Resumes listening for signal strength changes for the set of ids from the last call to
+     * {@link #updateSubscriptionIds(Set)}  */
+    public void resume() {
+        for (int subId : mListeners.keySet()) {
+            startListening(subId);
+        }
+    }
+
+    /** Pauses listening for signal strength changes */
+    public void pause() {
+        for (int subId : mListeners.keySet()) {
+            stopListening(subId);
+        }
+    }
+
+    /** Updates the set of ids we want to be listening for, beginning to listen for any new ids and
+     * stopping listening for any ids not contained in the new set */
+    public void updateSubscriptionIds(Set<Integer> ids) {
+        Set<Integer> currentIds = new ArraySet<>(mListeners.keySet());
+        for (int idToRemove : Sets.difference(currentIds, ids)) {
+            stopListening(idToRemove);
+            mListeners.remove(idToRemove);
+        }
+        for (int idToAdd : Sets.difference(ids, currentIds)) {
+            PhoneStateListener listener = new PhoneStateListener() {
+                @Override
+                public void onSignalStrengthsChanged(SignalStrength signalStrength) {
+                    mCallback.onSignalStrengthChanged();
+                }
+            };
+            mListeners.put(idToAdd, listener);
+            startListening(idToAdd);
+        }
+    }
+
+    private void startListening(int subId) {
+        TelephonyManager mgr = mBaseTelephonyManager.createForSubscriptionId(subId);
+        mgr.listen(mListeners.get(subId), PhoneStateListener.LISTEN_SIGNAL_STRENGTHS);
+    }
+
+    private void stopListening(int subId) {
+        TelephonyManager mgr = mBaseTelephonyManager.createForSubscriptionId(subId);
+        mgr.listen(mListeners.get(subId), PhoneStateListener.LISTEN_NONE);
+    }
+}
diff --git a/src/com/android/settings/notification/AudioHelper.java b/src/com/android/settings/notification/AudioHelper.java
index d178113..01945fd 100644
--- a/src/com/android/settings/notification/AudioHelper.java
+++ b/src/com/android/settings/notification/AudioHelper.java
@@ -22,6 +22,7 @@
 import android.media.AudioSystem;
 import android.os.UserHandle;
 import android.os.UserManager;
+import android.util.Log;
 
 import com.android.settings.Utils;
 
@@ -30,6 +31,7 @@
  */
 public class AudioHelper {
 
+    private static final String TAG = "AudioHelper";
     private Context mContext;
     private AudioManager mAudioManager;
 
@@ -76,6 +78,15 @@
     }
 
     public int getMinVolume(int stream) {
-        return mAudioManager.getStreamMinVolume(stream);
+        int minVolume;
+        try {
+            minVolume = mAudioManager.getStreamMinVolume(stream);
+        } catch (IllegalArgumentException e) {
+            Log.w(TAG, "Invalid stream type " + stream);
+            // Fallback to STREAM_VOICE_CALL because CallVolumePreferenceController.java default
+            // return STREAM_VOICE_CALL in getAudioStream
+            minVolume = mAudioManager.getStreamMinVolume(AudioManager.STREAM_VOICE_CALL);
+        }
+        return minVolume;
     }
 }
diff --git a/src/com/android/settings/notification/SnoozeNotificationPreferenceController.java b/src/com/android/settings/notification/SnoozeNotificationPreferenceController.java
new file mode 100644
index 0000000..03170e4
--- /dev/null
+++ b/src/com/android/settings/notification/SnoozeNotificationPreferenceController.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2019 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.notification;
+
+import static android.provider.Settings.Secure.SHOW_NOTIFICATION_SNOOZE;
+
+import android.content.Context;
+import android.provider.Settings;
+
+import com.android.settings.core.TogglePreferenceController;
+
+import androidx.annotation.VisibleForTesting;
+
+public class SnoozeNotificationPreferenceController extends TogglePreferenceController {
+
+    private static final String TAG = "SnoozeNotifPrefContr";
+    @VisibleForTesting
+    static final int ON = 1;
+    @VisibleForTesting
+    static final int OFF = 0;
+
+    public SnoozeNotificationPreferenceController(Context context, String preferenceKey) {
+        super(context, preferenceKey);
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return AVAILABLE;
+    }
+
+    @Override
+    public boolean isChecked() {
+        return Settings.Secure.getInt(mContext.getContentResolver(),
+                SHOW_NOTIFICATION_SNOOZE, OFF) == ON;
+    }
+
+    @Override
+    public boolean setChecked(boolean isChecked) {
+        return Settings.Secure.putInt(mContext.getContentResolver(),
+                SHOW_NOTIFICATION_SNOOZE, isChecked ? ON : OFF);
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/development/WifiScanThrottlingPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/WifiScanThrottlingPreferenceControllerTest.java
new file mode 100644
index 0000000..605bd0d
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/development/WifiScanThrottlingPreferenceControllerTest.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2019 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.development;
+
+import static com.android.settings.development.WifiScanThrottlingPreferenceController.SETTING_THROTTLING_ENABLE_VALUE_OFF;
+import static com.android.settings.development.WifiScanThrottlingPreferenceController.SETTING_THROTTLING_ENABLE_VALUE_ON;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.provider.Settings;
+
+import androidx.preference.PreferenceScreen;
+import androidx.preference.SwitchPreference;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public class WifiScanThrottlingPreferenceControllerTest {
+
+    @Mock
+    private SwitchPreference mPreference;
+    @Mock
+    private PreferenceScreen mPreferenceScreen;
+
+    private Context mContext;
+    private WifiScanThrottlingPreferenceController mController;
+
+    @Before
+    public void setup() {
+        MockitoAnnotations.initMocks(this);
+        mContext = RuntimeEnvironment.application;
+        mController = new WifiScanThrottlingPreferenceController(mContext);
+        when(mPreferenceScreen.findPreference(mController.getPreferenceKey()))
+                .thenReturn(mPreference);
+        mController.displayPreference(mPreferenceScreen);
+    }
+
+    @Test
+    public void onPreferenceChanged_turnOnScanThrottling() {
+        mController.onPreferenceChange(mPreference, true /* new value */);
+
+        final int mode = Settings.Global.getInt(mContext.getContentResolver(),
+                Settings.Global.WIFI_SCAN_THROTTLE_ENABLED, 1 /* default */);
+
+        assertThat(mode).isEqualTo(SETTING_THROTTLING_ENABLE_VALUE_ON);
+    }
+
+    @Test
+    public void onPreferenceChanged_turnOffScanThrottling() {
+        mController.onPreferenceChange(mPreference, false /* new value */);
+
+        final int mode = Settings.Global.getInt(mContext.getContentResolver(),
+                Settings.Global.WIFI_SCAN_THROTTLE_ENABLED, 1 /* default */);
+
+        assertThat(mode).isEqualTo(SETTING_THROTTLING_ENABLE_VALUE_OFF);
+    }
+
+    @Test
+    public void updateState_preferenceShouldBeChecked() {
+        Settings.Global.putInt(mContext.getContentResolver(),
+                Settings.Global.WIFI_SCAN_THROTTLE_ENABLED,
+                SETTING_THROTTLING_ENABLE_VALUE_ON);
+        mController.updateState(mPreference);
+
+        verify(mPreference).setChecked(true);
+    }
+
+    @Test
+    public void updateState_preferenceShouldNotBeChecked() {
+        Settings.Global.putInt(mContext.getContentResolver(),
+                Settings.Global.WIFI_SCAN_THROTTLE_ENABLED,
+                SETTING_THROTTLING_ENABLE_VALUE_OFF);
+        mController.updateState(mPreference);
+
+        verify(mPreference).setChecked(false);
+    }
+
+    @Test
+    public void onDeveloperOptionsDisabled_shouldDisablePreference() {
+        mController.onDeveloperOptionsDisabled();
+        final int mode = Settings.Global.getInt(mContext.getContentResolver(),
+                Settings.Global.WIFI_SCAN_THROTTLE_ENABLED, 1 /* default */);
+
+        assertThat(mode).isEqualTo(SETTING_THROTTLING_ENABLE_VALUE_ON);
+        verify(mPreference).setEnabled(false);
+        verify(mPreference).setChecked(true);
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/network/MobileNetworkListFragmentTest.java b/tests/robotests/src/com/android/settings/network/MobileNetworkListFragmentTest.java
new file mode 100644
index 0000000..a65ff24
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/network/MobileNetworkListFragmentTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2019 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.network;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.os.UserManager;
+
+import com.android.settings.search.BaseSearchIndexProvider;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.util.ReflectionHelpers;
+
+
+@RunWith(RobolectricTestRunner.class)
+public class MobileNetworkListFragmentTest {
+    @Mock
+    private Context mContext;
+    @Mock
+    private UserManager mUserManager;
+
+    private MobileNetworkListFragment mFragment;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mFragment = new MobileNetworkListFragment();
+    }
+
+    @Test
+    public void isPageSearchEnabled_adminUser_shouldReturnTrue() {
+        when(mContext.getSystemService(UserManager.class)).thenReturn(mUserManager);
+        when(mUserManager.isAdminUser()).thenReturn(true);
+        final BaseSearchIndexProvider provider =
+                (BaseSearchIndexProvider) mFragment.SEARCH_INDEX_DATA_PROVIDER;
+
+        final Object obj = ReflectionHelpers.callInstanceMethod(provider, "isPageSearchEnabled",
+                ReflectionHelpers.ClassParameter.from(Context.class, mContext));
+        final boolean isEnabled = (Boolean) obj;
+
+        assertThat(isEnabled).isTrue();
+    }
+
+    @Test
+    public void isPageSearchEnabled_nonAdminUser_shouldReturnFalse() {
+        when(mContext.getSystemService(UserManager.class)).thenReturn(mUserManager);
+        when(mUserManager.isAdminUser()).thenReturn(false);
+        final BaseSearchIndexProvider provider =
+                (BaseSearchIndexProvider) mFragment.SEARCH_INDEX_DATA_PROVIDER;
+
+        final Object obj = ReflectionHelpers.callInstanceMethod(provider, "isPageSearchEnabled",
+                ReflectionHelpers.ClassParameter.from(Context.class, mContext));
+        final boolean isEnabled = (Boolean) obj;
+
+        assertThat(isEnabled).isFalse();
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/network/SubscriptionsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/SubscriptionsPreferenceControllerTest.java
index d6edcc7..51f8ec0 100644
--- a/tests/robotests/src/com/android/settings/network/SubscriptionsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/SubscriptionsPreferenceControllerTest.java
@@ -16,11 +16,17 @@
 
 package com.android.settings.network;
 
+import static android.telephony.SignalStrength.NUM_SIGNAL_STRENGTH_BINS;
+import static android.telephony.SignalStrength.SIGNAL_STRENGTH_GOOD;
+import static android.telephony.SignalStrength.SIGNAL_STRENGTH_GREAT;
+import static android.telephony.SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
+import static android.telephony.SignalStrength.SIGNAL_STRENGTH_POOR;
 import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID;
 
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
 import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.doReturn;
@@ -33,16 +39,20 @@
 import android.app.Activity;
 import android.content.Context;
 import android.content.Intent;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.LayerDrawable;
 import android.net.ConnectivityManager;
 import android.net.Network;
 import android.net.NetworkCapabilities;
 import android.provider.Settings;
+import android.telephony.SignalStrength;
 import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
 
 import com.android.settings.R;
 import com.android.settingslib.core.lifecycle.Lifecycle;
+import com.android.settingslib.graph.SignalDrawable;
 
 import org.junit.After;
 import org.junit.Before;
@@ -84,6 +94,8 @@
     private Network mActiveNetwork;
     @Mock
     private NetworkCapabilities mCapabilities;
+    @Mock
+    private Drawable mSignalStrengthIcon;
 
     private Context mContext;
     private LifecycleOwner mLifecycleOwner;
@@ -109,8 +121,10 @@
         mOnChildUpdatedCount = 0;
         mUpdateListener = () -> mOnChildUpdatedCount++;
 
-        mController = new SubscriptionsPreferenceController(mContext, mLifecycle, mUpdateListener,
-                KEY, 5);
+        mController = spy(
+                new SubscriptionsPreferenceController(mContext, mLifecycle, mUpdateListener,
+                        KEY, 5));
+        doReturn(mSignalStrengthIcon).when(mController).getIcon(anyInt(), anyInt(), anyBoolean());
     }
 
     @After
@@ -120,32 +134,25 @@
 
     @Test
     public void isAvailable_oneSubscription_availableFalse() {
-        SubscriptionUtil.setActiveSubscriptionsForTesting(
-                Arrays.asList(mock(SubscriptionInfo.class)));
+        setupMockSubscriptions(1);
         assertThat(mController.isAvailable()).isFalse();
     }
 
     @Test
     public void isAvailable_twoSubscriptions_availableTrue() {
-        SubscriptionUtil.setActiveSubscriptionsForTesting(
-                Arrays.asList(mock(SubscriptionInfo.class), mock(SubscriptionInfo.class)));
+        setupMockSubscriptions(2);
         assertThat(mController.isAvailable()).isTrue();
     }
 
     @Test
     public void isAvailable_fiveSubscriptions_availableTrue() {
-        final ArrayList<SubscriptionInfo> subs = new ArrayList<>();
-        for (int i = 0; i < 5; i++) {
-            subs.add(mock(SubscriptionInfo.class));
-        }
-        SubscriptionUtil.setActiveSubscriptionsForTesting(subs);
+        setupMockSubscriptions(5);
         assertThat(mController.isAvailable()).isTrue();
     }
 
     @Test
     public void isAvailable_airplaneModeOn_availableFalse() {
-        SubscriptionUtil.setActiveSubscriptionsForTesting(
-                Arrays.asList(mock(SubscriptionInfo.class), mock(SubscriptionInfo.class)));
+        setupMockSubscriptions(2);
         assertThat(mController.isAvailable()).isTrue();
         Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 1);
         assertThat(mController.isAvailable()).isFalse();
@@ -153,8 +160,7 @@
 
     @Test
     public void onAirplaneModeChanged_airplaneModeTurnedOn_eventFired() {
-        SubscriptionUtil.setActiveSubscriptionsForTesting(
-                Arrays.asList(mock(SubscriptionInfo.class), mock(SubscriptionInfo.class)));
+        setupMockSubscriptions(2);
         mController.onResume();
         mController.displayPreference(mScreen);
         assertThat(mController.isAvailable()).isTrue();
@@ -169,8 +175,7 @@
     @Test
     public void onAirplaneModeChanged_airplaneModeTurnedOff_eventFired() {
         Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 1);
-        SubscriptionUtil.setActiveSubscriptionsForTesting(
-                Arrays.asList(mock(SubscriptionInfo.class), mock(SubscriptionInfo.class)));
+        setupMockSubscriptions(2);
         mController.onResume();
         mController.displayPreference(mScreen);
         assertThat(mController.isAvailable()).isFalse();
@@ -184,15 +189,14 @@
 
     @Test
     public void onSubscriptionsChanged_countBecameTwo_eventFired() {
-        final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
-        final SubscriptionInfo sub2 = mock(SubscriptionInfo.class);
-        SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(sub1));
+        final List<SubscriptionInfo> subs = setupMockSubscriptions(2);
+        SubscriptionUtil.setActiveSubscriptionsForTesting(subs.subList(0, 1));
         mController.onResume();
         mController.displayPreference(mScreen);
         assertThat(mController.isAvailable()).isFalse();
 
         final int updateCountBeforeSubscriptionChange = mOnChildUpdatedCount;
-        SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(sub1, sub2));
+        SubscriptionUtil.setActiveSubscriptionsForTesting(subs);
         mController.onSubscriptionsChanged();
         assertThat(mController.isAvailable()).isTrue();
         assertThat(mOnChildUpdatedCount).isEqualTo(updateCountBeforeSubscriptionChange + 1);
@@ -200,18 +204,14 @@
 
     @Test
     public void onSubscriptionsChanged_countBecameOne_eventFiredAndPrefsRemoved() {
-        final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
-        final SubscriptionInfo sub2 = mock(SubscriptionInfo.class);
-        when(sub1.getSubscriptionId()).thenReturn(1);
-        when(sub2.getSubscriptionId()).thenReturn(2);
-        SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(sub1, sub2));
+        final List<SubscriptionInfo> subs = setupMockSubscriptions(2);
         mController.onResume();
         mController.displayPreference(mScreen);
         assertThat(mController.isAvailable()).isTrue();
         verify(mPreferenceCategory, times(2)).addPreference(any(Preference.class));
 
         final int updateCountBeforeSubscriptionChange = mOnChildUpdatedCount;
-        SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(sub1));
+        SubscriptionUtil.setActiveSubscriptionsForTesting(subs.subList(0, 1));
         mController.onSubscriptionsChanged();
         assertThat(mController.isAvailable()).isFalse();
         assertThat(mOnChildUpdatedCount).isEqualTo(updateCountBeforeSubscriptionChange + 1);
@@ -219,21 +219,12 @@
         verify(mPreferenceCategory, times(2)).removePreference(any(Preference.class));
     }
 
-
     @Test
     public void onSubscriptionsChanged_subscriptionReplaced_preferencesChanged() {
-        final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
-        final SubscriptionInfo sub2 = mock(SubscriptionInfo.class);
-        final SubscriptionInfo sub3 = mock(SubscriptionInfo.class);
-        when(sub1.getDisplayName()).thenReturn("sub1");
-        when(sub2.getDisplayName()).thenReturn("sub2");
-        when(sub3.getDisplayName()).thenReturn("sub3");
-        when(sub1.getSubscriptionId()).thenReturn(1);
-        when(sub2.getSubscriptionId()).thenReturn(2);
-        when(sub3.getSubscriptionId()).thenReturn(3);
+        final List<SubscriptionInfo> subs = setupMockSubscriptions(3);
 
         // Start out with only sub1 and sub2.
-        SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(sub1, sub2));
+        SubscriptionUtil.setActiveSubscriptionsForTesting(subs.subList(0, 2));
         mController.onResume();
         mController.displayPreference(mScreen);
         final ArgumentCaptor<Preference> captor = ArgumentCaptor.forClass(Preference.class);
@@ -245,7 +236,7 @@
         // Now replace sub2 with sub3, and make sure the old preference was removed and the new
         // preference was added.
         final int updateCountBeforeSubscriptionChange = mOnChildUpdatedCount;
-        SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(sub1, sub3));
+        SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(subs.get(0), subs.get(2)));
         mController.onSubscriptionsChanged();
         assertThat(mController.isAvailable()).isTrue();
         assertThat(mOnChildUpdatedCount).isEqualTo(updateCountBeforeSubscriptionChange + 1);
@@ -264,14 +255,8 @@
      * @param subscriptionCount the number of subscriptions
      * @param selectedPrefIndex index of the subscription to click on
      */
-    private void runPreferenceClickTest(int subscriptionCount, int selectedPrefIndex) {
-        final ArrayList<SubscriptionInfo> subscriptions = new ArrayList<>();
-        for (int i = 0; i < subscriptionCount; i++) {
-            final SubscriptionInfo sub = mock(SubscriptionInfo.class);
-            doReturn(i + 1).when(sub).getSubscriptionId();
-            subscriptions.add(sub);
-        }
-        SubscriptionUtil.setActiveSubscriptionsForTesting(subscriptions);
+    private void runPreferenceClickTest(final int subscriptionCount, final int selectedPrefIndex) {
+        final List<SubscriptionInfo> subs = setupMockSubscriptions(subscriptionCount);
         mController.displayPreference(mScreen);
         final ArgumentCaptor<Preference> prefCaptor = ArgumentCaptor.forClass(Preference.class);
         verify(mPreferenceCategory, times(subscriptionCount)).addPreference(prefCaptor.capture());
@@ -286,7 +271,7 @@
         final int subIdFromIntent = intent.getIntExtra(Settings.EXTRA_SUB_ID,
                 INVALID_SUBSCRIPTION_ID);
         assertThat(subIdFromIntent).isEqualTo(
-                subscriptions.get(selectedPrefIndex).getSubscriptionId());
+                subs.get(selectedPrefIndex).getSubscriptionId());
     }
 
     @Test
@@ -311,86 +296,248 @@
 
     @Test
     public void getSummary_twoSubsOneDefaultForEverythingDataActive() {
-        final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
-        final SubscriptionInfo sub2 = mock(SubscriptionInfo.class);
-        when(sub1.getSubscriptionId()).thenReturn(11);
-        when(sub2.getSubscriptionId()).thenReturn(22);
-        SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(sub1, sub2));
+        setupMockSubscriptions(2);
 
-        ShadowSubscriptionManager.setDefaultDataSubscriptionId(11);
         ShadowSubscriptionManager.setDefaultSmsSubscriptionId(11);
         ShadowSubscriptionManager.setDefaultVoiceSubscriptionId(11);
         when(mTelephonyManager.isDataEnabled()).thenReturn(true);
         when(mCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR)).thenReturn(true);
 
-        assertThat(mController.getSummary(11)).isEqualTo(
+        assertThat(mController.getSummary(11, true)).isEqualTo(
                 mContext.getString(R.string.default_for_calls_and_sms) + System.lineSeparator()
                         + mContext.getString(R.string.mobile_data_active));
 
-        assertThat(mController.getSummary(22)).isEqualTo(
+        assertThat(mController.getSummary(22, false)).isEqualTo(
                 mContext.getString(R.string.subscription_available));
     }
 
     @Test
     public void getSummary_twoSubsOneDefaultForEverythingDataNotActive() {
-        final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
-        final SubscriptionInfo sub2 = mock(SubscriptionInfo.class);
-        when(sub1.getSubscriptionId()).thenReturn(11);
-        when(sub2.getSubscriptionId()).thenReturn(22);
-        SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(sub1, sub2));
+        setupMockSubscriptions(2, 1, true);
 
-        ShadowSubscriptionManager.setDefaultDataSubscriptionId(11);
-        ShadowSubscriptionManager.setDefaultSmsSubscriptionId(11);
-        ShadowSubscriptionManager.setDefaultVoiceSubscriptionId(11);
-        when(mTelephonyManager.isDataEnabled()).thenReturn(true);
+        ShadowSubscriptionManager.setDefaultSmsSubscriptionId(1);
+        ShadowSubscriptionManager.setDefaultVoiceSubscriptionId(1);
 
-        assertThat(mController.getSummary(11)).isEqualTo(
+        assertThat(mController.getSummary(1, true)).isEqualTo(
                 mContext.getString(R.string.default_for_calls_and_sms) + System.lineSeparator()
                         + mContext.getString(R.string.default_for_mobile_data));
 
-        assertThat(mController.getSummary(22)).isEqualTo(
+        assertThat(mController.getSummary(2, false)).isEqualTo(
                 mContext.getString(R.string.subscription_available));
     }
 
     @Test
     public void getSummary_twoSubsOneDefaultForEverythingDataDisabled() {
-        final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
-        final SubscriptionInfo sub2 = mock(SubscriptionInfo.class);
-        when(sub1.getSubscriptionId()).thenReturn(11);
-        when(sub2.getSubscriptionId()).thenReturn(22);
-        SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(sub1, sub2));
+        setupMockSubscriptions(2);
 
-        ShadowSubscriptionManager.setDefaultVoiceSubscriptionId(11);
-        ShadowSubscriptionManager.setDefaultSmsSubscriptionId(11);
-        ShadowSubscriptionManager.setDefaultDataSubscriptionId(11);
-        when(mTelephonyManager.isDataEnabled()).thenReturn(false);
+        ShadowSubscriptionManager.setDefaultVoiceSubscriptionId(1);
+        ShadowSubscriptionManager.setDefaultSmsSubscriptionId(1);
 
-        assertThat(mController.getSummary(11)).isEqualTo(
+        assertThat(mController.getSummary(1, true)).isEqualTo(
                 mContext.getString(R.string.default_for_calls_and_sms) + System.lineSeparator()
                         + mContext.getString(R.string.mobile_data_off));
 
-        assertThat(mController.getSummary(22)).isEqualTo(
+        assertThat(mController.getSummary(2, false)).isEqualTo(
                 mContext.getString(R.string.subscription_available));
     }
 
     @Test
     public void getSummary_twoSubsOneForCallsAndDataOneForSms() {
-        final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
-        final SubscriptionInfo sub2 = mock(SubscriptionInfo.class);
-        when(sub1.getSubscriptionId()).thenReturn(11);
-        when(sub2.getSubscriptionId()).thenReturn(22);
-        SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(sub1, sub2));
+        setupMockSubscriptions(2, 1, true);
 
-        ShadowSubscriptionManager.setDefaultDataSubscriptionId(11);
-        ShadowSubscriptionManager.setDefaultSmsSubscriptionId(22);
-        ShadowSubscriptionManager.setDefaultVoiceSubscriptionId(11);
-        when(mTelephonyManager.isDataEnabled()).thenReturn(true);
+        ShadowSubscriptionManager.setDefaultSmsSubscriptionId(2);
+        ShadowSubscriptionManager.setDefaultVoiceSubscriptionId(1);
 
-        assertThat(mController.getSummary(11)).isEqualTo(
+        assertThat(mController.getSummary(1, true)).isEqualTo(
                 mContext.getString(R.string.default_for_calls) + System.lineSeparator()
                         + mContext.getString(R.string.default_for_mobile_data));
 
-        assertThat(mController.getSummary(22)).isEqualTo(
+        assertThat(mController.getSummary(2, false)).isEqualTo(
                 mContext.getString(R.string.default_for_sms));
     }
+
+    @Test
+    public void setIcon_nullStrength_noCrash() {
+        final List<SubscriptionInfo> subs = setupMockSubscriptions(2);
+        setMockSubSignalStrength(subs, 0, -1);
+        final Preference pref = mock(Preference.class);
+
+        mController.setIcon(pref, 1, true /* isDefaultForData */);
+        verify(mController).getIcon(eq(0), eq(NUM_SIGNAL_STRENGTH_BINS), eq(true));
+    }
+
+    @Test
+    public void setIcon_noSignal_correctLevels() {
+        final List<SubscriptionInfo> subs = setupMockSubscriptions(2, 1, true);
+        setMockSubSignalStrength(subs, 0, SIGNAL_STRENGTH_NONE_OR_UNKNOWN);
+        setMockSubSignalStrength(subs, 1, SIGNAL_STRENGTH_NONE_OR_UNKNOWN);
+        setMockSubDataEnabled(subs, 0, true);
+        final Preference pref = mock(Preference.class);
+
+        mController.setIcon(pref, 1, true /* isDefaultForData */);
+        verify(mController).getIcon(eq(0), eq(NUM_SIGNAL_STRENGTH_BINS), eq(false));
+
+        mController.setIcon(pref, 2, false /* isDefaultForData */);
+        verify(mController).getIcon(eq(0), eq(NUM_SIGNAL_STRENGTH_BINS), eq(true));
+    }
+
+    @Test
+    public void setIcon_noSignal_withInflation_correctLevels() {
+        final List<SubscriptionInfo> subs = setupMockSubscriptions(2, 1, true);
+        setMockSubSignalStrength(subs, 0, SIGNAL_STRENGTH_NONE_OR_UNKNOWN);
+        setMockSubSignalStrength(subs, 1, SIGNAL_STRENGTH_NONE_OR_UNKNOWN);
+        final Preference pref = mock(Preference.class);
+        doReturn(true).when(mController).shouldInflateSignalStrength(anyInt());
+
+        mController.setIcon(pref, 1, true /* isDefaultForData */);
+        verify(mController).getIcon(eq(1), eq(NUM_SIGNAL_STRENGTH_BINS + 1), eq(false));
+
+        mController.setIcon(pref, 2, false /* isDefaultForData */);
+        verify(mController).getIcon(eq(1), eq(NUM_SIGNAL_STRENGTH_BINS + 1), eq(true));
+    }
+
+    @Test
+    public void setIcon_greatSignal_correctLevels() {
+        final List<SubscriptionInfo> subs = setupMockSubscriptions(2, 1, true);
+        setMockSubSignalStrength(subs, 0, SIGNAL_STRENGTH_GREAT);
+        setMockSubSignalStrength(subs, 1, SIGNAL_STRENGTH_GREAT);
+        final Preference pref = mock(Preference.class);
+
+        mController.setIcon(pref, 1, true /* isDefaultForData */);
+        verify(mController).getIcon(eq(4), eq(NUM_SIGNAL_STRENGTH_BINS), eq(false));
+
+        mController.setIcon(pref, 2, false /* isDefaultForData */);
+        verify(mController).getIcon(eq(4), eq(NUM_SIGNAL_STRENGTH_BINS), eq(true));
+    }
+
+    @Test
+    public void onSignalStrengthChanged_subTwoGoesFromGoodToGreat_correctLevels() {
+        final List<SubscriptionInfo> subs = setupMockSubscriptions(2);
+        setMockSubSignalStrength(subs, 0, SIGNAL_STRENGTH_POOR);
+        setMockSubSignalStrength(subs, 1, SIGNAL_STRENGTH_GOOD);
+
+        mController.onResume();
+        mController.displayPreference(mScreen);
+
+        // Now change the signal strength for the 2nd subscription from Good to Great
+        setMockSubSignalStrength(subs, 1, SIGNAL_STRENGTH_GREAT);
+        mController.onSignalStrengthChanged();
+
+        final ArgumentCaptor<Integer> level = ArgumentCaptor.forClass(Integer.class);
+        verify(mController, times(4)).getIcon(level.capture(), eq(NUM_SIGNAL_STRENGTH_BINS),
+                eq(true));
+        assertThat(level.getAllValues().get(0)).isEqualTo(1);
+        assertThat(level.getAllValues().get(1)).isEqualTo(3); // sub2, first time
+        assertThat(level.getAllValues().get(2)).isEqualTo(1);
+        assertThat(level.getAllValues().get(3)).isEqualTo(4); // sub2, after change
+    }
+
+    @Test
+    public void displayPreference_mobileDataOff_bothSubsHaveCutOut() {
+        setupMockSubscriptions(2, 1, false);
+
+        mController.onResume();
+        mController.displayPreference(mScreen);
+
+        verify(mController, times(2)).getIcon(eq(SIGNAL_STRENGTH_GOOD),
+                eq(NUM_SIGNAL_STRENGTH_BINS), eq(true));
+    }
+
+    @Test
+    public void displayPreference_mobileDataOn_onlyNonDefaultSubHasCutOut() {
+        final List<SubscriptionInfo> subs = setupMockSubscriptions(2, 1, true);
+        setMockSubSignalStrength(subs, 1, SIGNAL_STRENGTH_POOR);
+
+        mController.onResume();
+        mController.displayPreference(mScreen);
+
+        verify(mController).getIcon(eq(SIGNAL_STRENGTH_GOOD), eq(NUM_SIGNAL_STRENGTH_BINS),
+                eq(false));
+        verify(mController).getIcon(eq(SIGNAL_STRENGTH_POOR), eq(NUM_SIGNAL_STRENGTH_BINS),
+                eq(true));
+    }
+
+
+    @Test
+    public void onMobileDataEnabledChange_mobileDataTurnedOff_bothSubsHaveCutOut() {
+        final List<SubscriptionInfo> subs = setupMockSubscriptions(2, 1, true);
+
+        mController.onResume();
+        mController.displayPreference(mScreen);
+
+        setMockSubDataEnabled(subs, 0, false);
+        mController.onMobileDataEnabledChange();
+
+        final ArgumentCaptor<Boolean> cutOutCaptor = ArgumentCaptor.forClass(Boolean.class);
+        verify(mController, times(4)).getIcon(eq(SIGNAL_STRENGTH_GOOD),
+                eq(NUM_SIGNAL_STRENGTH_BINS), cutOutCaptor.capture());
+        assertThat(cutOutCaptor.getAllValues().get(0)).isEqualTo(false); // sub1, first time
+        assertThat(cutOutCaptor.getAllValues().get(1)).isEqualTo(true);
+        assertThat(cutOutCaptor.getAllValues().get(2)).isEqualTo(true); // sub1, second time
+        assertThat(cutOutCaptor.getAllValues().get(3)).isEqualTo(true);
+    }
+
+    private List<SubscriptionInfo> setupMockSubscriptions(int count) {
+        return setupMockSubscriptions(count, 0, true);
+    }
+
+    /** Helper method to setup several mock active subscriptions. The generated subscription id's
+     * start at 1.
+     *
+     * @param count How many subscriptions to create
+     * @param defaultDataSubId The subscription id of the default data subscription - pass
+     *                         INVALID_SUBSCRIPTION_ID if there should not be one
+     * @param mobileDataEnabled Whether mobile data should be considered enabled for the default
+     *                          data subscription
+     */
+    private List<SubscriptionInfo> setupMockSubscriptions(int count, int defaultDataSubId,
+            boolean mobileDataEnabled) {
+        if (defaultDataSubId != INVALID_SUBSCRIPTION_ID) {
+            ShadowSubscriptionManager.setDefaultDataSubscriptionId(defaultDataSubId);
+        }
+        final ArrayList<SubscriptionInfo> infos = new ArrayList<>();
+        for (int i = 0; i < count; i++) {
+            final int subscriptionId = i + 1;
+            final SubscriptionInfo info = mock(SubscriptionInfo.class);
+            final TelephonyManager mgrForSub = mock(TelephonyManager.class);
+            final SignalStrength signalStrength = mock(SignalStrength.class);
+
+            if (subscriptionId == defaultDataSubId) {
+                when(mgrForSub.isDataEnabled()).thenReturn(mobileDataEnabled);
+            }
+            when(info.getSubscriptionId()).thenReturn(i + 1);
+            when(info.getDisplayName()).thenReturn("sub" + (i + 1));
+            doReturn(mgrForSub).when(mTelephonyManager).createForSubscriptionId(eq(subscriptionId));
+            when(mgrForSub.getSignalStrength()).thenReturn(signalStrength);
+            when(signalStrength.getLevel()).thenReturn(SIGNAL_STRENGTH_GOOD);
+
+            infos.add(info);
+        }
+        SubscriptionUtil.setActiveSubscriptionsForTesting(infos);
+        return infos;
+    }
+
+    /**
+     * Helper method to set the signal strength returned for a mock subscription
+     * @param subs The list of subscriptions
+     * @param index The index in of the subscription in |subs| to change
+     * @param level The signal strength level to return for the subscription. Pass -1 to force
+     *              return of a null SignalStrength object for the subscription.
+     */
+    private void setMockSubSignalStrength(List<SubscriptionInfo> subs, int index, int level) {
+        final TelephonyManager mgrForSub =
+                mTelephonyManager.createForSubscriptionId(subs.get(index).getSubscriptionId());
+        if (level == -1) {
+            when(mgrForSub.getSignalStrength()).thenReturn(null);
+        } else {
+            final SignalStrength signalStrength = mgrForSub.getSignalStrength();
+            when(signalStrength.getLevel()).thenReturn(level);
+        }
+    }
+
+    private void setMockSubDataEnabled(List<SubscriptionInfo> subs, int index, boolean enabled) {
+        final TelephonyManager mgrForSub =
+                mTelephonyManager.createForSubscriptionId(subs.get(index).getSubscriptionId());
+        when(mgrForSub.isDataEnabled()).thenReturn(enabled);
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/network/telephony/DeleteSimProfileConfirmationDialogTest.java b/tests/robotests/src/com/android/settings/network/telephony/DeleteSimProfileConfirmationDialogTest.java
deleted file mode 100644
index 9b6f551..0000000
--- a/tests/robotests/src/com/android/settings/network/telephony/DeleteSimProfileConfirmationDialogTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2019 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.network.telephony;
-
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-
-import android.app.Activity;
-import android.app.Dialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.telephony.SubscriptionInfo;
-
-import androidx.appcompat.app.AlertDialog;
-import androidx.fragment.app.FragmentActivity;
-
-import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.Robolectric;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.annotation.Config;
-import org.robolectric.shadows.androidx.fragment.FragmentController;
-
-@RunWith(RobolectricTestRunner.class)
-@Config(shadows = ShadowAlertDialogCompat.class)
-public class DeleteSimProfileConfirmationDialogTest {
-    @Mock
-    private SubscriptionInfo mSubscriptionInfo;
-
-    private DeleteSimProfileConfirmationDialog mDialogFragment;
-
-    @Before
-    public void setUp() {
-        MockitoAnnotations.initMocks(this);
-        mDialogFragment = spy(DeleteSimProfileConfirmationDialog.newInstance(mSubscriptionInfo));
-        doNothing().when(mDialogFragment).beginDeletionWithProgress();
-    }
-
-    @Test
-    public void showDialog_dialogCancelled_deleteNotCalled() {
-        FragmentController.setupFragment(mDialogFragment, FragmentActivity.class,
-                0 /* containerViewId */,
-                null /* bundle */);
-        final AlertDialog dialog = ShadowAlertDialogCompat.getLatestAlertDialog();
-        dialog.getButton(DialogInterface.BUTTON_NEGATIVE).performClick();
-        verify(mDialogFragment, never()).beginDeletionWithProgress();
-    }
-
-    @Test
-    public void showDialog_dialogOk_deleteWasCalled() {
-        FragmentController.setupFragment(mDialogFragment, FragmentActivity.class,
-                0 /* containerViewId */,
-                null /* bundle */);
-        final AlertDialog dialog = ShadowAlertDialogCompat.getLatestAlertDialog();
-        dialog.getButton(DialogInterface.BUTTON_POSITIVE).performClick();
-        verify(mDialogFragment).beginDeletionWithProgress();
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/network/telephony/DeleteSimProfilePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/telephony/DeleteSimProfilePreferenceControllerTest.java
index 21fd19b..ca8fcf8 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/DeleteSimProfilePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/DeleteSimProfilePreferenceControllerTest.java
@@ -18,11 +18,15 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
+import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
+import android.content.Intent;
 import android.telephony.SubscriptionInfo;
+import android.telephony.SubscriptionManager;
 import android.telephony.euicc.EuiccManager;
 
 import androidx.fragment.app.Fragment;
@@ -35,6 +39,7 @@
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 import org.robolectric.RobolectricTestRunner;
@@ -46,12 +51,12 @@
 @RunWith(RobolectricTestRunner.class)
 public class DeleteSimProfilePreferenceControllerTest {
     private static final String PREF_KEY = "delete_profile_key";
+    private static final int REQUEST_CODE = 4321;
     private static final int SUB_ID = 1234;
     private static final int OTHER_ID = 5678;
 
     @Mock
     private Fragment mFragment;
-
     @Mock
     private SubscriptionInfo mSubscriptionInfo;
     @Mock
@@ -85,27 +90,42 @@
     @Test
     public void getAvailabilityStatus_noSubs_notAvailable() {
         SubscriptionUtil.setAvailableSubscriptionsForTesting(new ArrayList<>());
-        mController.init(SUB_ID, mFragment);
+        mController.init(SUB_ID, mFragment, REQUEST_CODE);
         assertThat(mController.isAvailable()).isFalse();
     }
 
     @Test
     public void getAvailabilityStatus_physicalSim_notAvailable() {
         when(mSubscriptionInfo.isEmbedded()).thenReturn(false);
-        mController.init(SUB_ID, mFragment);
+        mController.init(SUB_ID, mFragment, REQUEST_CODE);
         assertThat(mController.isAvailable()).isFalse();
     }
 
     @Test
     public void getAvailabilityStatus_unknownSim_notAvailable() {
         when(mSubscriptionInfo.getSubscriptionId()).thenReturn(OTHER_ID);
-        mController.init(SUB_ID, mFragment);
+        mController.init(SUB_ID, mFragment, REQUEST_CODE);
         assertThat(mController.isAvailable()).isFalse();
     }
 
     @Test
     public void getAvailabilityStatus_knownEsim_isAvailable() {
-        mController.init(SUB_ID, mFragment);
+        mController.init(SUB_ID, mFragment, REQUEST_CODE);
         assertThat(mController.isAvailable()).isTrue();
     }
+
+    @Test
+    public void onPreferenceClick_startsIntent() {
+        mController.init(SUB_ID, mFragment, REQUEST_CODE);
+        mController.displayPreference(mScreen);
+        mPreference.performClick();
+
+        final ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
+        verify(mFragment).startActivityForResult(intentCaptor.capture(), eq(REQUEST_CODE));
+        final Intent intent = intentCaptor.getValue();
+        assertThat(intent.getAction()).isEqualTo(
+                EuiccManager.ACTION_DELETE_SUBSCRIPTION_PRIVILEGED);
+        assertThat(intent.getIntExtra(EuiccManager.EXTRA_SUBSCRIPTION_ID,
+                SubscriptionManager.INVALID_SUBSCRIPTION_ID)).isEqualTo(SUB_ID);
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/network/telephony/DeleteSimProfileProgressDialogTest.java b/tests/robotests/src/com/android/settings/network/telephony/DeleteSimProfileProgressDialogTest.java
deleted file mode 100644
index aebcc46..0000000
--- a/tests/robotests/src/com/android/settings/network/telephony/DeleteSimProfileProgressDialogTest.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (C) 2019 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.network.telephony;
-
-import static com.android.settings.network.telephony.DeleteSimProfileProgressDialog.KEY_DELETE_STARTED;
-import static com.android.settings.network.telephony.DeleteSimProfileProgressDialog.PENDING_INTENT;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.ArgumentMatchers.notNull;
-import static org.mockito.Mockito.doNothing;
-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.Dialog;
-import android.app.PendingIntent;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.os.Bundle;
-import android.telephony.euicc.EuiccManager;
-
-import androidx.fragment.app.Fragment;
-import androidx.fragment.app.FragmentActivity;
-
-import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.annotation.Config;
-
-@RunWith(RobolectricTestRunner.class)
-@Config(shadows = ShadowAlertDialogCompat.class)
-public class DeleteSimProfileProgressDialogTest {
-    private static final int SUB_ID = 111;
-
-    @Mock
-    private FragmentActivity mActivity;
-    @Mock
-    private Fragment mTargetFragment;
-    @Mock
-    private EuiccManager mEuiccManager;
-
-    private Context mContext;
-    private DeleteSimProfileProgressDialog mDialogFragment;
-
-    @Before
-    public void setUp() {
-        MockitoAnnotations.initMocks(this);
-        mContext = spy(RuntimeEnvironment.application);
-
-        when(mContext.getSystemService(EuiccManager.class)).thenReturn(mEuiccManager);
-        mDialogFragment = spy(DeleteSimProfileProgressDialog.newInstance(SUB_ID));
-        when(mDialogFragment.getContext()).thenReturn(mContext);
-        when(mDialogFragment.getTargetFragment()).thenReturn(mTargetFragment);
-        when(mDialogFragment.getActivity()).thenReturn(mActivity);
-    }
-
-    @Test
-    public void onCreateDialog_firstShowing_deleteStartedAndRecordedInOutState() {
-        mDialogFragment.onCreateDialog(null);
-        verify(mEuiccManager).deleteSubscription(eq(SUB_ID), notNull());
-
-        final Bundle outState = new Bundle();
-        mDialogFragment.onSaveInstanceState(outState);
-        assertThat(outState.containsKey(KEY_DELETE_STARTED)).isTrue();
-        assertThat(outState.getBoolean(KEY_DELETE_STARTED)).isTrue();
-    }
-
-    @Test
-    public void showDialog_secondShowing_deleteNotStarted() {
-        final Bundle inState = new Bundle();
-        inState.putBoolean(KEY_DELETE_STARTED, true);
-        mDialogFragment.onCreateDialog(inState);
-
-        verify(mEuiccManager, never()).deleteSubscription(anyInt(), any());
-
-        final Bundle outState = new Bundle();
-        mDialogFragment.onSaveInstanceState(outState);
-        assertThat(outState.containsKey(KEY_DELETE_STARTED)).isTrue();
-        assertThat(outState.getBoolean(KEY_DELETE_STARTED)).isTrue();
-    }
-
-    @Test
-    public void showDialog_pendingIntentReceiverFired_activityFinished() {
-        mDialogFragment.onCreateDialog(null);
-
-        final ArgumentCaptor<PendingIntent> intentCaptor = ArgumentCaptor.forClass(
-                PendingIntent.class);
-        verify(mEuiccManager).deleteSubscription(eq(SUB_ID), intentCaptor.capture());
-        assertThat(intentCaptor.getValue()).isNotNull();
-
-        final ArgumentCaptor<BroadcastReceiver> receiverCaptor = ArgumentCaptor.forClass(
-                BroadcastReceiver.class);
-        verify(mContext).registerReceiver(receiverCaptor.capture(), any(IntentFilter.class));
-
-        doNothing().when(mDialogFragment).dismiss();
-        receiverCaptor.getValue().onReceive(mContext, new Intent(PENDING_INTENT));
-        verify(mDialogFragment).dismiss();
-        verify(mActivity).finish();
-    }
-
-    @Test
-    public void onDismiss_receiverUnregistered() {
-        Dialog dialog = mDialogFragment.onCreateDialog(null);
-        final ArgumentCaptor<BroadcastReceiver> receiverCaptor = ArgumentCaptor.forClass(
-                BroadcastReceiver.class);
-        verify(mContext).registerReceiver(receiverCaptor.capture(), any(IntentFilter.class));
-
-        mDialogFragment.onDismiss(dialog);
-        verify(mContext).unregisterReceiver(eq(receiverCaptor.getValue()));
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/network/telephony/MobileNetworkSettingsTest.java b/tests/robotests/src/com/android/settings/network/telephony/MobileNetworkSettingsTest.java
index 011bca5..4afe0fc 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/MobileNetworkSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/MobileNetworkSettingsTest.java
@@ -16,17 +16,21 @@
 
 package com.android.settings.network.telephony;
 
+import static com.android.settings.network.telephony.MobileNetworkSettings.REQUEST_CODE_DELETE_SUBSCRIPTION;
+
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 import android.app.usage.NetworkStatsManager;
 import android.content.Context;
 import android.net.NetworkPolicyManager;
 import android.os.Bundle;
+import android.os.UserManager;
 import android.provider.Settings;
 import android.telephony.TelephonyManager;
 
@@ -35,6 +39,7 @@
 import com.android.settings.core.FeatureFlags;
 import com.android.settings.datausage.DataUsageSummaryPreferenceController;
 import com.android.settings.development.featureflags.FeatureFlagPersistent;
+import com.android.settings.search.BaseSearchIndexProvider;
 import com.android.settings.testutils.shadow.ShadowEntityHeaderController;
 import com.android.settings.widget.EntityHeaderController;
 import com.android.settingslib.core.AbstractPreferenceController;
@@ -47,6 +52,7 @@
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
 import org.robolectric.annotation.Config;
+import org.robolectric.util.ReflectionHelpers;
 
 import java.util.List;
 
@@ -80,6 +86,7 @@
         args.putInt(Settings.EXTRA_SUB_ID, subscriptionId);
         mFragment.setArguments(args);
         when(mFragment.getActivity()).thenReturn(mActivity);
+        when(mActivity.isFinishing()).thenReturn(false);
         when(mActivity.getSystemService(NetworkPolicyManager.class)).thenReturn(
                 mNetworkPolicyManager);
     }
@@ -118,4 +125,47 @@
                 .count())
                 .isEqualTo(1);
     }
+
+    @Test
+    public void onActivityResult_noActivity_noCrash() {
+        when(mFragment.getActivity()).thenReturn(null);
+        // this should not crash
+        mFragment.onActivityResult(REQUEST_CODE_DELETE_SUBSCRIPTION, 0, null);
+    }
+
+    @Test
+    public void onActivityResult_deleteSubscription_activityFinishes() {
+        mFragment.onActivityResult(REQUEST_CODE_DELETE_SUBSCRIPTION, 0, null);
+        verify(mActivity).finish();
+    }
+
+    @Test
+    public void isPageSearchEnabled_adminUser_shouldReturnTrue() {
+        final UserManager userManager = mock(UserManager.class);
+        when(mContext.getSystemService(UserManager.class)).thenReturn(userManager);
+        when(userManager.isAdminUser()).thenReturn(true);
+        final BaseSearchIndexProvider provider =
+                (BaseSearchIndexProvider) mFragment.SEARCH_INDEX_DATA_PROVIDER;
+
+        final Object obj = ReflectionHelpers.callInstanceMethod(provider, "isPageSearchEnabled",
+                ReflectionHelpers.ClassParameter.from(Context.class, mContext));
+        final boolean isEnabled = (Boolean) obj;
+
+        assertThat(isEnabled).isTrue();
+    }
+
+    @Test
+    public void isPageSearchEnabled_nonAdminUser_shouldReturnFalse() {
+        final UserManager userManager = mock(UserManager.class);
+        when(mContext.getSystemService(UserManager.class)).thenReturn(userManager);
+        when(userManager.isAdminUser()).thenReturn(false);
+        final BaseSearchIndexProvider provider =
+                (BaseSearchIndexProvider) mFragment.SEARCH_INDEX_DATA_PROVIDER;
+
+        final Object obj = ReflectionHelpers.callInstanceMethod(provider, "isPageSearchEnabled",
+                ReflectionHelpers.ClassParameter.from(Context.class, mContext));
+        final boolean isEnabled = (Boolean) obj;
+
+        assertThat(isEnabled).isFalse();
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/network/telephony/SignalStrengthListenerTest.java b/tests/robotests/src/com/android/settings/network/telephony/SignalStrengthListenerTest.java
new file mode 100644
index 0000000..406f360
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/network/telephony/SignalStrengthListenerTest.java
@@ -0,0 +1,176 @@
+/*
+ * Copyright (C) 2019 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.network.telephony;
+
+import static android.telephony.PhoneStateListener.LISTEN_NONE;
+import static android.telephony.PhoneStateListener.LISTEN_SIGNAL_STRENGTHS;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.telephony.PhoneStateListener;
+import android.telephony.TelephonyManager;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.mockito.internal.util.collections.Sets;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public class SignalStrengthListenerTest {
+    private static final int SUB_ID_1 = 111;
+    private static final int SUB_ID_2 = 222;
+    private static final int SUB_ID_3 = 333;
+
+    @Mock
+    private SignalStrengthListener.Callback mCallback;
+    @Mock
+    private TelephonyManager mBaseManager;
+    @Mock
+    private TelephonyManager mManager1;
+    @Mock
+    private TelephonyManager mManager2;
+    @Mock
+    private TelephonyManager mManager3;
+
+    private Context mContext;
+    private SignalStrengthListener mListener;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mContext = spy(RuntimeEnvironment.application);
+        when(mContext.getSystemService(TelephonyManager.class)).thenReturn(mBaseManager);
+        when(mBaseManager.createForSubscriptionId(SUB_ID_1)).thenReturn(mManager1);
+        when(mBaseManager.createForSubscriptionId(SUB_ID_2)).thenReturn(mManager2);
+        when(mBaseManager.createForSubscriptionId(SUB_ID_3)).thenReturn(mManager3);
+        mListener = new SignalStrengthListener(mContext, mCallback);
+    }
+
+    @Test
+    public void resume_noIds_noCrash() {
+        mListener.resume();
+    }
+
+    @Test
+    public void pause_noIds_noCrash() {
+        mListener.resume();
+    }
+
+    @Test
+    public void updateSubscriptionIds_beforeResume_startedListening() {
+        mListener.updateSubscriptionIds(Sets.newSet(SUB_ID_1, SUB_ID_2));
+        ArgumentCaptor<PhoneStateListener> captor1 = ArgumentCaptor.forClass(
+                PhoneStateListener.class);
+        ArgumentCaptor<PhoneStateListener> captor2 = ArgumentCaptor.forClass(
+                PhoneStateListener.class);
+        verify(mManager1).listen(captor1.capture(), eq(LISTEN_SIGNAL_STRENGTHS));
+        verify(mManager2).listen(captor2.capture(), eq(LISTEN_SIGNAL_STRENGTHS));
+        verify(mManager3, never()).listen(any(), anyInt());
+        assertThat(captor1.getValue()).isNotNull();
+        assertThat(captor2.getValue()).isNotNull();
+
+        // Make sure the two listeners are separate objects.
+        assertThat(captor1.getValue() != captor2.getValue()).isTrue();
+    }
+
+    @Test
+    public void updateSubscriptionIds_twoCalls_oneIdAdded() {
+        mListener.updateSubscriptionIds(Sets.newSet(SUB_ID_1, SUB_ID_2));
+        verify(mManager1).listen(any(PhoneStateListener.class), eq(LISTEN_SIGNAL_STRENGTHS));
+        verify(mManager2).listen(any(PhoneStateListener.class), eq(LISTEN_SIGNAL_STRENGTHS));
+
+        mListener.updateSubscriptionIds(Sets.newSet(SUB_ID_1, SUB_ID_2, SUB_ID_3));
+        verify(mManager1, never()).listen(any(PhoneStateListener.class), eq(LISTEN_NONE));
+        verify(mManager2, never()).listen(any(PhoneStateListener.class), eq(LISTEN_NONE));
+        verify(mManager3).listen(any(PhoneStateListener.class), eq(LISTEN_SIGNAL_STRENGTHS));
+    }
+
+    @Test
+    public void updateSubscriptionIds_twoCalls_oneIdRemoved() {
+        ArgumentCaptor<PhoneStateListener> captor1 = ArgumentCaptor.forClass(
+                PhoneStateListener.class);
+
+        mListener.updateSubscriptionIds(Sets.newSet(SUB_ID_1, SUB_ID_2));
+        verify(mManager1).listen(captor1.capture(), eq(LISTEN_SIGNAL_STRENGTHS));
+        verify(mManager2).listen(any(PhoneStateListener.class), eq(LISTEN_SIGNAL_STRENGTHS));
+
+        mListener.updateSubscriptionIds(Sets.newSet(SUB_ID_2));
+        verify(mManager1).listen(captor1.capture(), eq(LISTEN_NONE));
+        verify(mManager2, never()).listen(any(PhoneStateListener.class), eq(LISTEN_NONE));
+        // Make sure the correct listener was removed.
+        assertThat(captor1.getAllValues().get(0) == captor1.getAllValues().get(1)).isTrue();
+    }
+
+    @Test
+    public void updateSubscriptionIds_twoCalls_twoIdsRemovedOneAdded() {
+        ArgumentCaptor<PhoneStateListener> captor1 = ArgumentCaptor.forClass(
+                PhoneStateListener.class);
+        ArgumentCaptor<PhoneStateListener> captor2 = ArgumentCaptor.forClass(
+                PhoneStateListener.class);
+
+        mListener.updateSubscriptionIds(Sets.newSet(SUB_ID_1, SUB_ID_2));
+        verify(mManager1).listen(captor1.capture(), eq(LISTEN_SIGNAL_STRENGTHS));
+        verify(mManager2).listen(captor2.capture(), eq(LISTEN_SIGNAL_STRENGTHS));
+
+        mListener.updateSubscriptionIds(Sets.newSet(SUB_ID_3));
+        verify(mManager1).listen(captor1.capture(), eq(LISTEN_NONE));
+        verify(mManager2).listen(captor2.capture(), eq(LISTEN_NONE));
+        verify(mManager3).listen(any(PhoneStateListener.class), eq(LISTEN_SIGNAL_STRENGTHS));
+        // Make sure the correct listeners were removed.
+        assertThat(captor1.getValue() != captor2.getValue()).isTrue();
+        assertThat(captor1.getAllValues().get(0) == captor1.getAllValues().get(1)).isTrue();
+        assertThat(captor2.getAllValues().get(0) == captor2.getAllValues().get(1)).isTrue();
+    }
+
+    @Test
+    public void updateSubscriptionIds_thenPauseResume_correctlyStartsAndStops() {
+        mListener.updateSubscriptionIds(Sets.newSet(SUB_ID_1, SUB_ID_2));
+        mListener.pause();
+        mListener.resume();
+
+        ArgumentCaptor<PhoneStateListener> captor1 = ArgumentCaptor.forClass(
+                PhoneStateListener.class);
+        ArgumentCaptor<PhoneStateListener> captor2 = ArgumentCaptor.forClass(
+                PhoneStateListener.class);
+        verify(mManager1, times(2)).listen(captor1.capture(), eq(LISTEN_SIGNAL_STRENGTHS));
+        verify(mManager1).listen(captor1.capture(), eq(LISTEN_NONE));
+
+        verify(mManager2, times(2)).listen(captor2.capture(), eq(LISTEN_SIGNAL_STRENGTHS));
+        verify(mManager2).listen(captor2.capture(), eq(LISTEN_NONE));
+
+        assertThat(captor1.getAllValues().get(0) == captor1.getAllValues().get(1)).isTrue();
+        assertThat(captor1.getAllValues().get(0) == captor1.getAllValues().get(2)).isTrue();
+
+        assertThat(captor2.getAllValues().get(0) == captor2.getAllValues().get(1)).isTrue();
+        assertThat(captor2.getAllValues().get(0) == captor2.getAllValues().get(2)).isTrue();
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/notification/AudioHelperTest.java b/tests/robotests/src/com/android/settings/notification/AudioHelperTest.java
new file mode 100644
index 0000000..79d0198
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/notification/AudioHelperTest.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2019 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.notification;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public class AudioHelperTest {
+
+    private static final int START = -10;
+    private static final int END = 10;
+    private static final int DEFAULT = -100;
+
+    private Context mContext;
+    private AudioHelper mAudioHelper;
+
+    @Before
+    public void setUp() {
+        mContext = RuntimeEnvironment.application;
+        mAudioHelper = new AudioHelper(mContext);
+    }
+
+    @Test
+    public void getMaxVolume_anyStreamType_getValue() {
+        int volume = DEFAULT;
+
+        for (int i = START; i < END; i++) {
+            volume = mAudioHelper.getMaxVolume(i);
+            assertThat(volume).isNotEqualTo(DEFAULT);
+        }
+    }
+
+    @Test
+    public void getMinVolume_anyStreamType_getValue() {
+        int volume = DEFAULT;
+
+        for (int i = START; i < END; i++) {
+            volume = mAudioHelper.getMinVolume(i);
+            assertThat(volume).isNotEqualTo(DEFAULT);
+        }
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/notification/SnoozeNotificationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/SnoozeNotificationPreferenceControllerTest.java
new file mode 100644
index 0000000..6779ff1
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/notification/SnoozeNotificationPreferenceControllerTest.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2019 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.notification;
+
+import static android.provider.Settings.Secure.NOTIFICATION_BADGING;
+import static android.provider.Settings.Secure.SHOW_NOTIFICATION_SNOOZE;
+
+import static com.android.settings.notification.BadgingNotificationPreferenceController.OFF;
+import static com.android.settings.notification.BadgingNotificationPreferenceController.ON;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.provider.Settings;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Answers;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+import androidx.preference.Preference;
+import androidx.preference.PreferenceScreen;
+import androidx.preference.TwoStatePreference;
+
+@RunWith(RobolectricTestRunner.class)
+public class SnoozeNotificationPreferenceControllerTest {
+
+    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
+    private Context mContext;
+    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
+    private PreferenceScreen mScreen;
+
+    private SnoozeNotificationPreferenceController mController;
+    private Preference mPreference;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mController = new SnoozeNotificationPreferenceController(mContext,
+                "key");
+        mPreference = new Preference(RuntimeEnvironment.application);
+        mPreference.setKey(mController.getPreferenceKey());
+        when(mScreen.findPreference(mPreference.getKey())).thenReturn(mPreference);
+    }
+
+    @Test
+    public void display_configIsTrue_shouldDisplay() {
+        mController.displayPreference(mScreen);
+        assertThat(mPreference.isVisible()).isTrue();
+    }
+
+    @Test
+    public void isChecked_settingIsOff_shouldReturnFalse() {
+        Settings.Secure.putInt(mContext.getContentResolver(), SHOW_NOTIFICATION_SNOOZE, OFF);
+
+        assertThat(mController.isChecked()).isFalse();
+    }
+
+    @Test
+    public void isChecked_settingIsOn_shouldReturnTrue() {
+        Settings.Secure.putInt(mContext.getContentResolver(), SHOW_NOTIFICATION_SNOOZE, ON);
+
+        assertThat(mController.isChecked()).isTrue();
+    }
+
+    @Test
+    public void setChecked_setFalse_disablesSetting() {
+        Settings.Secure.putInt(mContext.getContentResolver(), SHOW_NOTIFICATION_SNOOZE, ON);
+
+        mController.setChecked(false);
+        int updatedValue = Settings.Secure.getInt(mContext.getContentResolver(),
+                SHOW_NOTIFICATION_SNOOZE, -1);
+
+        assertThat(updatedValue).isEqualTo(OFF);
+    }
+
+    @Test
+    public void setChecked_setTrue_enablesSetting() {
+        Settings.Secure.putInt(mContext.getContentResolver(), SHOW_NOTIFICATION_SNOOZE, OFF);
+
+        mController.setChecked(true);
+        int updatedValue = Settings.Secure.getInt(mContext.getContentResolver(),
+                SHOW_NOTIFICATION_SNOOZE, -1);
+
+        assertThat(updatedValue).isEqualTo(ON);
+    }
+}
