Merge "Let Settings query per-admin policies"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 1ecf33f..a1bb9a2 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -239,17 +239,14 @@
                 android:value="true" />
         </activity>
 
-        <activity android:name=".network.telephony.MobileNetworkActivity"
-                  android:label="@string/network_settings_title"
-                  android:exported="true"
-                  android:taskAffinity="com.android.settings.root"
-                  android:launchMode="singleTask"
-                  android:configChanges="orientation|screenSize|keyboardHidden">
-            <!-- Note: Since the framework does not support the multiple requests of network scan
-            from the UI, this singleTask can protect that there is only one
-            Settings$NetworkSelectActivity which can request the network scan.
-            If removing the "singleTask" in the future, please also modify the
-            Settings$NetworkSelectActivity's structure. -->
+        <activity
+            android:name=".Settings$MobileNetworkActivity"
+            android:label="@string/network_settings_title"
+            android:configChanges="orientation|screenSize|keyboardHidden"
+            android:launchMode="singleInstance"
+            android:exported="true">
+            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
+                       android:value="com.android.settings.network.telephony.MobileNetworkSettings"/>
             <intent-filter android:priority="1">
                 <!-- Displays the MobileNetworkActivity and opt-in dialog for capability discovery. -->
                 <action android:name="android.telephony.ims.action.SHOW_CAPABILITY_DISCOVERY_OPT_IN" />
@@ -260,14 +257,6 @@
             </intent-filter>
         </activity>
 
-        <activity
-            android:name=".Settings$SubscriptionSettingsActivity"
-            android:label="@string/network_settings_title"
-            android:exported="false">
-            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
-                       android:value="com.android.settings.network.telephony.MobileNetworkSettings"/>
-        </activity>
-
         <activity android:name=".Settings$MobileNetworkListActivity"
                   android:exported="true"
                   android:label="@string/network_settings_title">
@@ -550,7 +539,6 @@
 
         <activity android:name="Settings$ApnSettingsActivity"
                 android:label="@string/apn_settings"
-                android:launchMode="singleTask"
                 android:exported="true"
                 android:configChanges="orientation|keyboardHidden|screenSize">
             <intent-filter android:priority="1">
@@ -2975,6 +2963,12 @@
         </activity>
 
         <activity
+            android:name=".users.AddSupervisedUserActivity"
+            android:label="@*android:string/supervised_user_creation_label"
+            android:icon="@drawable/ic_settings_multiuser">
+        </activity>
+
+        <activity
             android:name="Settings$PaymentSettingsActivity"
             android:label="@string/nfc_payment_settings_title"
             android:exported="true"
diff --git a/res/layout/add_supervised_user.xml b/res/layout/add_supervised_user.xml
new file mode 100644
index 0000000..b95e0f7
--- /dev/null
+++ b/res/layout/add_supervised_user.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2021 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.
+  -->
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+             android:layout_width="match_parent"
+             android:layout_height="match_parent">
+    <Button
+        android:id="@+id/createSupervisedUser"
+        android:layout_height="wrap_content"
+        android:layout_width="wrap_content"
+        android:text="@*android:string/supervised_user_creation_label" />
+</FrameLayout>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 275ffab..d53c417 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5553,11 +5553,17 @@
     <!-- Description for the seekbar that adjust auto click time. [CHAR_LIMIT=NONE] -->
     <string name="accessibility_autoclick_seekbar_desc">Auto click time</string>
     <!-- Title for accessibility preference screen for configuring vibrations. -->
-    <string name="accessibility_vibration_settings_title">Vibration &amp; haptic strength</string>
-    <!-- Title for accessibility preference for configuring notification vibrations. -->
-    <string name="accessibility_notification_vibration_title">Notification vibration</string>
+    <string name="accessibility_vibration_settings_title">Vibration &amp; haptics</string>
+    <!-- Title for the category of preferences to configure device vibrations related to calls. [CHAR LIMIT=NONE] -->
+    <string name="accessibility_call_vibration_category_title">Calls</string>
+    <!-- Title for the category of preferences to configure device vibrations related to notifications and alarms. [CHAR LIMIT=NONE] -->
+    <string name="accessibility_notification_alarm_vibration_category_title">Notifications and alarms</string>
+    <!-- Title for the category of preferences to configure device vibrations triggered by user interaction with the device. [CHAR LIMIT=NONE] -->
+    <string name="accessibility_interactive_haptics_category_title">Interactive haptics</string>
     <!-- Title for accessibility preference for configuring ring vibrations. [CHAR LIMIT=NONE] -->
     <string name="accessibility_ring_vibration_title">Ring vibration</string>
+    <!-- Title for accessibility preference for configuring notification vibrations. -->
+    <string name="accessibility_notification_vibration_title">Notification vibration</string>
     <!-- Title for accessibility preference for configuring touch feedback vibrations. -->
     <string name="accessibility_touch_vibration_title">Touch feedback</string>
     <!-- Used in the accessibility service settings to control turning on/off the service entirely [CHAR LIMIT=60] -->
@@ -8269,8 +8275,6 @@
     <string name="keywords_wifi_notify_open_networks">Wi\u2011Fi notification, wifi notification</string>
     <!-- Search keyword for "Wi-fi data usage" settings. [CHAR_LIMIT=NONE]-->
     <string name="keywords_wifi_data_usage">data usage</string>
-    <!-- Search keyword for "Vibrate on touch" settings. [CHAR_LIMIT=NONE]-->
-    <string name="keywords_vibrate_on_touch">Stop vibration, tap, keyboard</string>
     <!-- Search keyword for "Time format" settings. [CHAR_LIMIT=NONE]-->
     <string name="keywords_time_format">Use 24-hour format</string>
     <!-- Search keyword for "Files" settings under Settings > Storage. [CHAR_LIMIT=NONE]-->
@@ -8406,11 +8410,12 @@
 
     <!-- List of synonyms for touch vibration setting (where you get a haptic response for touching things on the screen), used to match in settings search [CHAR LIMIT=NONE] -->
     <string name="keywords_touch_vibration">haptics, vibrate, screen, sensitivity</string>
-
     <!-- List of synonyms for ring vibration setting (changes whether your phone vibrates when it rings), used to match in settings search [CHAR LIMIT=NONE] -->
     <string name="keywords_ring_vibration">haptics, vibrate, phone, call, sensitivity, ring</string>
     <!-- List of synonyms for notification vibration setting (changes whether your phone vibrates when it shows a notification), used to match in settings search [CHAR LIMIT=NONE] -->
     <string name="keywords_notification_vibration">haptics, vibrate, sensitivity</string>
+    <!-- List of synonyms for vibration and haptics setting, used to match in settings search [CHAR LIMIT=NONE] -->
+    <string name="keywords_vibration">haptics, vibrate, vibration</string>
     <!-- Battery Saver: Search terms for sticky battery saver preference [CHAR_LIMIT=NONE] -->
     <string name="keywords_battery_saver_sticky">battery saver, sticky, persist, power saver, battery</string>
     <!-- Battery Saver: Search terms for battery saver schedule preference. Feel free to add additional terms when translating if appropriate [CHAR_LIMIT=NONE] -->
@@ -8522,12 +8527,6 @@
     <!-- Sound: Other sounds: Title for the option enabling touch sounds. [CHAR LIMIT=30] -->
     <string name="touch_sounds_title">Touch sounds</string>
 
-    <!-- Sound: Other sounds: Title for the option enabling haptic feedback on touch. [CHAR LIMIT=30] -->
-    <string name="vibrate_on_touch_title">Touch vibration</string>
-
-    <!-- Sound: Other sounds: Preference summary to the option enabling haptic feedback on touch. -->
-    <string name="vibrate_on_touch_summary">Haptic feedback for tap, keyboard, and more</string>
-
     <!-- Sound: Other sounds: Title for the option enabling dock audio media. [CHAR LIMIT=50] -->
     <string name="dock_audio_media_title">Dock speaker plays</string>
 
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index 61f527d..8113a9f 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -100,7 +100,8 @@
             android:icon="@drawable/ic_vibration"
             android:persistent="false"
             android:title="@string/accessibility_vibration_settings_title"
-            settings:controller="com.android.settings.accessibility.VibrationPreferenceController"/>
+            settings:controller="com.android.settings.accessibility.VibrationPreferenceController"
+            settings:keywords="@string/keywords_vibration"/>
 
     </PreferenceCategory>
 
diff --git a/res/xml/accessibility_vibration_settings.xml b/res/xml/accessibility_vibration_settings.xml
index 87c2988..ff10611 100644
--- a/res/xml/accessibility_vibration_settings.xml
+++ b/res/xml/accessibility_vibration_settings.xml
@@ -20,24 +20,49 @@
     xmlns:settings="http://schemas.android.com/apk/res-auto"
     android:title="@string/accessibility_vibration_settings_title">
 
-    <Preference
-        android:fragment="com.android.settings.accessibility.RingVibrationPreferenceFragment"
-        android:key="ring_vibration_preference_screen"
-        android:title="@string/accessibility_ring_vibration_title"
-        settings:keywords="@string/keywords_ring_vibration"
-        app:controller="com.android.settings.accessibility.RingVibrationIntensityPreferenceController" />
+    <PreferenceCategory
+        android:key="accessibility_call_vibration_category"
+        android:title="@string/accessibility_call_vibration_category_title">
 
-    <Preference
-        android:fragment="com.android.settings.accessibility.NotificationVibrationPreferenceFragment"
-        android:key="notification_vibration_preference_screen"
-        android:title="@string/accessibility_notification_vibration_title"
-        settings:keywords="@string/keywords_notification_vibration"
-        app:controller="com.android.settings.accessibility.NotificationVibrationIntensityPreferenceController" />
+        <Preference
+            android:fragment="com.android.settings.accessibility.RingVibrationPreferenceFragment"
+            android:key="ring_vibration_preference_screen"
+            android:title="@string/accessibility_ring_vibration_title"
+            settings:keywords="@string/keywords_ring_vibration"
+            app:controller="com.android.settings.accessibility.RingVibrationIntensityPreferenceController" />
 
-    <Preference
-        android:fragment="com.android.settings.accessibility.TouchVibrationPreferenceFragment"
-        android:key="touch_vibration_preference_screen"
-        android:title="@string/accessibility_touch_vibration_title"
-        settings:keywords="@string/keywords_touch_vibration"
-        app:controller="com.android.settings.accessibility.HapticFeedbackIntensityPreferenceController" />
+        <Preference
+            android:fragment="com.android.settings.sound.VibrateForCallsPreferenceFragment"
+            android:key="vibrate_for_calls"
+            android:title="@string/vibrate_when_ringing_title"
+            settings:controller="com.android.settings.sound.VibrateForCallsPreferenceController"/>
+
+    </PreferenceCategory>
+
+    <PreferenceCategory
+        android:key="accessibility_notification_alarm_vibration_category"
+        android:title="@string/accessibility_notification_alarm_vibration_category_title">
+
+        <Preference
+            android:fragment="com.android.settings.accessibility.NotificationVibrationPreferenceFragment"
+            android:key="notification_vibration_preference_screen"
+            android:title="@string/accessibility_notification_vibration_title"
+            settings:keywords="@string/keywords_notification_vibration"
+            app:controller="com.android.settings.accessibility.NotificationVibrationIntensityPreferenceController" />
+
+    </PreferenceCategory>
+
+    <PreferenceCategory
+        android:key="accessibility_interactive_haptics_category"
+        android:title="@string/accessibility_interactive_haptics_category_title">
+
+        <Preference
+            android:fragment="com.android.settings.accessibility.TouchVibrationPreferenceFragment"
+            android:key="touch_vibration_preference_screen"
+            android:title="@string/accessibility_touch_vibration_title"
+            settings:keywords="@string/keywords_touch_vibration"
+            app:controller="com.android.settings.accessibility.HapticFeedbackIntensityPreferenceController" />
+
+    </PreferenceCategory>
+
 </PreferenceScreen>
diff --git a/res/xml/other_sound_settings.xml b/res/xml/other_sound_settings.xml
index 7b3f362..d8396a4 100644
--- a/res/xml/other_sound_settings.xml
+++ b/res/xml/other_sound_settings.xml
@@ -44,12 +44,6 @@
             android:key="touch_sounds"
             android:title="@string/touch_sounds_title" />
 
-    <!-- Vibrate on touch -->
-    <SwitchPreference
-            android:key="vibrate_on_touch"
-            android:title="@string/vibrate_on_touch_title"
-            android:summary="@string/vibrate_on_touch_summary" />
-
     <!-- Dock speaker plays -->
     <DropDownPreference
             android:key="dock_audio_media"
diff --git a/res/xml/sound_settings.xml b/res/xml/sound_settings.xml
index a7b63a1..c1298db 100644
--- a/res/xml/sound_settings.xml
+++ b/res/xml/sound_settings.xml
@@ -119,14 +119,14 @@
         settings:controller="com.android.settings.sound.MediaControlsParentPreferenceController"
         settings:keywords="@string/keywords_media_controls"/>
 
-    <!-- Also vibrate for calls -->
+    <!-- Also vibration -->
     <Preference
-        android:fragment="com.android.settings.sound.VibrateForCallsPreferenceFragment"
-        android:key="vibrate_for_calls"
-        android:title="@string/vibrate_when_ringing_title"
+        android:fragment="com.android.settings.accessibility.VibrationSettings"
+        android:key="vibration_and_haptics"
+        android:title="@string/accessibility_vibration_settings_title"
         android:order="-90"
-        settings:controller="com.android.settings.sound.VibrateForCallsPreferenceController"
-        settings:keywords="@string/keywords_vibrate_for_calls"/>
+        settings:controller="com.android.settings.accessibility.VibrationPreferenceController"
+        settings:keywords="@string/keywords_vibration"/>
 
     <com.android.settingslib.PrimarySwitchPreference
         android:key="gesture_prevent_ringing_sound"
@@ -191,14 +191,6 @@
         android:title="@string/touch_sounds_title"
         android:order="-30"/>
 
-    <!-- Vibrate on touch -->
-    <SwitchPreference
-        android:key="vibrate_on_touch"
-        android:title="@string/vibrate_on_touch_title"
-        android:summary="@string/vibrate_on_touch_summary"
-        settings:keywords="@string/keywords_vibrate_on_touch"
-        android:order="-25"/>
-
     <!-- Dock speaker plays -->
     <DropDownPreference
         android:key="dock_audio_media"
diff --git a/res/xml/user_settings.xml b/res/xml/user_settings.xml
index 5cafa1a..b3dc2ea 100644
--- a/res/xml/user_settings.xml
+++ b/res/xml/user_settings.xml
@@ -43,6 +43,12 @@
         android:icon="@drawable/ic_add_40dp"
         android:order="20"/>
 
+    <com.android.settingslib.RestrictedPreference
+        android:key="supervised_user_add"
+        android:title="@*android:string/supervised_user_creation_label"
+        android:icon="@*android:drawable/ic_add_supervised_user"
+        android:order="25"/>
+
     <com.android.settingslib.RestrictedSwitchPreference
         android:key="user_settings_add_users_when_locked"
         android:title="@string/user_add_on_lockscreen_menu"
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index 4e919d6..8d04ab8 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -19,12 +19,17 @@
 import android.content.Context;
 import android.content.Intent;
 import android.os.Bundle;
+import android.telephony.SubscriptionInfo;
+import android.telephony.SubscriptionManager;
+import android.telephony.ims.ImsRcsManager;
 import android.text.TextUtils;
 import android.util.FeatureFlagUtils;
 
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.settings.core.FeatureFlags;
 import com.android.settings.enterprise.EnterprisePrivacySettings;
+import com.android.settings.network.SubscriptionUtil;
+import com.android.settings.network.telephony.MobileNetworkUtils;
 import com.android.settings.overlay.FeatureFactory;
 import com.android.settings.security.SecuritySettingsFeatureProvider;
 
@@ -304,7 +309,51 @@
     public static class WifiCallingDisclaimerActivity extends SettingsActivity { /* empty */ }
     public static class MobileNetworkListActivity extends SettingsActivity {}
     public static class PowerMenuSettingsActivity extends SettingsActivity {}
-    public static class SubscriptionSettingsActivity extends SettingsActivity {  /* empty */  }
+    public static class MobileNetworkActivity extends SettingsActivity {
+
+        public static final String EXTRA_MMS_MESSAGE = "mms_message";
+        public static final String EXTRA_SHOW_CAPABILITY_DISCOVERY_OPT_IN =
+                "show_capability_discovery_opt_in";
+
+        @Override
+        public Intent getIntent() {
+            final Intent intent = new Intent(super.getIntent());
+            int subId = intent.getIntExtra(android.provider.Settings.EXTRA_SUB_ID,
+                    SubscriptionManager.INVALID_SUBSCRIPTION_ID);
+            SubscriptionInfo subInfo = SubscriptionUtil.getSubscriptionOrDefault(
+                    getApplicationContext(), subId);
+            CharSequence title = SubscriptionUtil.getUniqueSubscriptionDisplayName(
+                    subInfo, getApplicationContext());
+            intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE, title);
+            intent.putExtra(android.provider.Settings.EXTRA_SUB_ID, subId);
+            if (android.provider.Settings.ACTION_MMS_MESSAGE_SETTING.equals(intent.getAction())) {
+                // highlight "mms_message" preference.
+                intent.putExtra(EXTRA_FRAGMENT_ARG_KEY, EXTRA_MMS_MESSAGE);
+            }
+
+            if (doesIntentContainOptInAction(intent)) {
+                intent.putExtra(EXTRA_SHOW_CAPABILITY_DISCOVERY_OPT_IN,
+                        maybeShowContactDiscoveryDialog(subId));
+            }
+
+            return intent;
+        }
+
+        private boolean maybeShowContactDiscoveryDialog(int subId) {
+            // If this activity was launched using ACTION_SHOW_CAPABILITY_DISCOVERY_OPT_IN, show the
+            // associated dialog only if the opt-in has not been granted yet.
+            return MobileNetworkUtils.isContactDiscoveryVisible(getApplicationContext(), subId)
+                    // has the user already enabled this configuration?
+                    && !MobileNetworkUtils.isContactDiscoveryEnabled(
+                            getApplicationContext(), subId);
+        }
+
+        public static boolean doesIntentContainOptInAction(Intent intent) {
+            String intentAction = (intent != null ? intent.getAction() : null);
+            return TextUtils.equals(intentAction,
+                    ImsRcsManager.ACTION_SHOW_CAPABILITY_DISCOVERY_OPT_IN);
+        }
+    }
 
     /**
      * Activity for BugReportHandlerPicker.
diff --git a/src/com/android/settings/network/MobileNetworkListController.java b/src/com/android/settings/network/MobileNetworkListController.java
index d7fc8b4..fd40c8f 100644
--- a/src/com/android/settings/network/MobileNetworkListController.java
+++ b/src/com/android/settings/network/MobileNetworkListController.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.network;
 
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
 import static androidx.lifecycle.Lifecycle.Event.ON_PAUSE;
 import static androidx.lifecycle.Lifecycle.Event.ON_RESUME;
 
@@ -34,7 +36,6 @@
 
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.settings.R;
-import com.android.settings.network.telephony.MobileNetworkActivity;
 import com.android.settings.network.telephony.MobileNetworkUtils;
 import com.android.settingslib.core.AbstractPreferenceController;
 
@@ -137,7 +138,8 @@
                         && !SubscriptionUtil.showToggleForPhysicalSim(mSubscriptionManager)) {
                     SubscriptionUtil.startToggleSubscriptionDialogActivity(mContext, subId, true);
                 } else {
-                    final Intent intent = new Intent(mContext, MobileNetworkActivity.class);
+                    final Intent intent = new Intent(Settings.ACTION_NETWORK_OPERATOR_SETTINGS);
+                    intent.setPackage(SETTINGS_PACKAGE_NAME);
                     intent.putExtra(Settings.EXTRA_SUB_ID, info.getSubscriptionId());
                     mContext.startActivity(intent);
                 }
diff --git a/src/com/android/settings/network/MobileNetworkPreferenceController.java b/src/com/android/settings/network/MobileNetworkPreferenceController.java
index 527a632..b49613a 100644
--- a/src/com/android/settings/network/MobileNetworkPreferenceController.java
+++ b/src/com/android/settings/network/MobileNetworkPreferenceController.java
@@ -18,6 +18,8 @@
 import static android.os.UserHandle.myUserId;
 import static android.os.UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS;
 
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
 import static androidx.lifecycle.Lifecycle.Event;
 
 import android.content.BroadcastReceiver;
@@ -38,7 +40,6 @@
 import androidx.preference.PreferenceScreen;
 
 import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settings.network.telephony.MobileNetworkActivity;
 import com.android.settings.network.telephony.MobileNetworkUtils;
 import com.android.settingslib.RestrictedLockUtilsInternal;
 import com.android.settingslib.RestrictedPreference;
@@ -146,7 +147,8 @@
     @Override
     public boolean handlePreferenceTreeClick(Preference preference) {
         if (KEY_MOBILE_NETWORK_SETTINGS.equals(preference.getKey())) {
-            final Intent intent = new Intent(mContext, MobileNetworkActivity.class);
+            final Intent intent = new Intent(Settings.ACTION_NETWORK_OPERATOR_SETTINGS);
+            intent.setPackage(SETTINGS_PACKAGE_NAME);
             mContext.startActivity(intent);
             return true;
         }
diff --git a/src/com/android/settings/network/telephony/MobileDataSlice.java b/src/com/android/settings/network/telephony/MobileDataSlice.java
index 22bb581..d25ae65 100644
--- a/src/com/android/settings/network/telephony/MobileDataSlice.java
+++ b/src/com/android/settings/network/telephony/MobileDataSlice.java
@@ -18,6 +18,8 @@
 
 import static android.app.slice.Slice.EXTRA_TOGGLE_STATE;
 
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
 import android.annotation.ColorInt;
 import android.app.PendingIntent;
 import android.content.Context;
@@ -27,6 +29,7 @@
 import android.net.Uri;
 import android.os.Handler;
 import android.os.Looper;
+import android.provider.Settings;
 import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
@@ -142,7 +145,8 @@
 
     @Override
     public Intent getIntent() {
-        return new Intent(mContext, MobileNetworkActivity.class);
+        return new Intent(Settings.ACTION_NETWORK_OPERATOR_SETTINGS).setPackage(
+                SETTINGS_PACKAGE_NAME);
     }
 
     @Override
diff --git a/src/com/android/settings/network/telephony/MobileNetworkActivity.java b/src/com/android/settings/network/telephony/MobileNetworkActivity.java
deleted file mode 100644
index d3ff546..0000000
--- a/src/com/android/settings/network/telephony/MobileNetworkActivity.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.network.telephony;
-
-import static com.android.settings.SettingsActivity.EXTRA_FRAGMENT_ARG_KEY;
-
-import android.app.Activity;
-import android.app.settings.SettingsEnums;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.UserManager;
-import android.provider.Settings;
-import android.telephony.SubscriptionInfo;
-import android.telephony.SubscriptionManager;
-import android.telephony.ims.ImsRcsManager;
-import android.text.TextUtils;
-import android.util.Log;
-
-
-import com.android.settings.SettingsActivity;
-import com.android.settings.Utils;
-import com.android.settings.activityembedding.ActivityEmbeddingUtils;
-import com.android.settings.network.SubscriptionUtil;
-
-/**
- * Activity for displaying MobileNetworkSettings.
- *
- * @Deprecated The MobileNetworkActivity should be removed in Android U. Instead of using the
- * singleTask activity which will cause an additional window transition when users launch the SIMs
- * page, using the {@link com.android.settings.Settings.SubscriptionSettingsActivity} which can be
- * managed by {@link SettingsActivity} and be migrated into the Settings architecture.
- */
-@Deprecated
-public class MobileNetworkActivity extends Activity {
-
-    private static final String TAG = "MobileNetworkActivity";
-    public static final String SHOW_CAPABILITY_DISCOVERY_OPT_IN =
-            "show_capability_discovery_opt_in";
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        final UserManager userManager = this.getSystemService(UserManager.class);
-        if (!userManager.isAdminUser()) {
-            this.finish();
-            return;
-        }
-
-        // TODO: Move these intent's extra into SubscriptionSettingsActivity if the
-        //  MobileNetworkActivity is removed in Android U.
-        Intent intent = getIntent();
-        if (intent == null) {
-            Log.d(TAG, "onCreate(), intent = null");
-            this.finish();
-            return;
-        }
-
-        Intent trampolineIntent;
-        final Intent subscriptionSettingsIntent = new Intent(this,
-                com.android.settings.Settings.SubscriptionSettingsActivity.class);
-        if (!ActivityEmbeddingUtils.isEmbeddingActivityEnabled(this) || !isTaskRoot()) {
-            trampolineIntent = subscriptionSettingsIntent;
-        } else {
-            trampolineIntent = new Intent(Settings.ACTION_SETTINGS_EMBED_DEEP_LINK_ACTIVITY)
-                    .setPackage(Utils.SETTINGS_PACKAGE_NAME);
-            trampolineIntent.putExtra(
-                    android.provider.Settings.EXTRA_SETTINGS_EMBEDDED_DEEP_LINK_INTENT_URI,
-                    subscriptionSettingsIntent.toUri(Intent.URI_INTENT_SCHEME));
-        }
-
-        int subId = intent.getIntExtra(Settings.EXTRA_SUB_ID,
-                SubscriptionManager.INVALID_SUBSCRIPTION_ID);
-        SubscriptionInfo subInfo = SubscriptionUtil.getSubscriptionOrDefault(this, subId);
-        CharSequence title = SubscriptionUtil.getUniqueSubscriptionDisplayName(subInfo, this);
-        trampolineIntent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE, title);
-        trampolineIntent.putExtra(Settings.EXTRA_SUB_ID, subId);
-        if (Settings.ACTION_MMS_MESSAGE_SETTING.equals(intent.getAction())) {
-            // highlight "mms_message" preference.
-            trampolineIntent.putExtra(EXTRA_FRAGMENT_ARG_KEY, "mms_message");
-        }
-
-        if (doesIntentContainOptInAction(intent)) {
-            trampolineIntent.putExtra(SHOW_CAPABILITY_DISCOVERY_OPT_IN,
-                    maybeShowContactDiscoveryDialog(subId));
-        }
-
-        startActivity(trampolineIntent);
-        if (isTaskRoot()) {
-            finishAndRemoveTask();
-        } else {
-            finish();
-        }
-    }
-
-    private boolean maybeShowContactDiscoveryDialog(int subId) {
-        // If this activity was launched using ACTION_SHOW_CAPABILITY_DISCOVERY_OPT_IN, show the
-        // associated dialog only if the opt-in has not been granted yet.
-        return MobileNetworkUtils.isContactDiscoveryVisible(this, subId)
-                // has the user already enabled this configuration?
-                && !MobileNetworkUtils.isContactDiscoveryEnabled(this, subId);
-    }
-
-    public static boolean doesIntentContainOptInAction(Intent intent) {
-        String intentAction = (intent != null ? intent.getAction() : null);
-        return TextUtils.equals(intentAction,
-                ImsRcsManager.ACTION_SHOW_CAPABILITY_DISCOVERY_OPT_IN);
-    }
-}
diff --git a/src/com/android/settings/network/telephony/MobileNetworkSettings.java b/src/com/android/settings/network/telephony/MobileNetworkSettings.java
index cf0f889..f1a4018 100644
--- a/src/com/android/settings/network/telephony/MobileNetworkSettings.java
+++ b/src/com/android/settings/network/telephony/MobileNetworkSettings.java
@@ -26,7 +26,6 @@
 import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
-import android.telephony.ims.ImsRcsManager;
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.Menu;
@@ -37,6 +36,7 @@
 import androidx.preference.Preference;
 
 import com.android.settings.R;
+import com.android.settings.Settings.MobileNetworkActivity;
 import com.android.settings.datausage.BillingCyclePreferenceController;
 import com.android.settings.datausage.DataUsageSummaryPreferenceController;
 import com.android.settings.network.ActiveSubscriptionsListener;
diff --git a/src/com/android/settings/notification/SoundSettings.java b/src/com/android/settings/notification/SoundSettings.java
index 85623b8..ab53a3f 100644
--- a/src/com/android/settings/notification/SoundSettings.java
+++ b/src/com/android/settings/notification/SoundSettings.java
@@ -256,8 +256,6 @@
                 new DockingSoundPreferenceController(context, fragment, lifecycle);
         final TouchSoundPreferenceController touchSoundPreferenceController =
                 new TouchSoundPreferenceController(context, fragment, lifecycle);
-        final VibrateOnTouchPreferenceController vibrateOnTouchPreferenceController =
-                new VibrateOnTouchPreferenceController(context, fragment, lifecycle);
         final DockAudioMediaPreferenceController dockAudioMediaPreferenceController =
                 new DockAudioMediaPreferenceController(context, fragment, lifecycle);
         final BootSoundPreferenceController bootSoundPreferenceController =
@@ -270,7 +268,6 @@
         controllers.add(chargingSoundPreferenceController);
         controllers.add(dockingSoundPreferenceController);
         controllers.add(touchSoundPreferenceController);
-        controllers.add(vibrateOnTouchPreferenceController);
         controllers.add(dockAudioMediaPreferenceController);
         controllers.add(bootSoundPreferenceController);
         controllers.add(emergencyTonePreferenceController);
@@ -281,7 +278,6 @@
                         chargingSoundPreferenceController,
                         dockingSoundPreferenceController,
                         touchSoundPreferenceController,
-                        vibrateOnTouchPreferenceController,
                         dockAudioMediaPreferenceController,
                         bootSoundPreferenceController,
                         emergencyTonePreferenceController)));
diff --git a/src/com/android/settings/notification/VibrateOnTouchPreferenceController.java b/src/com/android/settings/notification/VibrateOnTouchPreferenceController.java
deleted file mode 100644
index 0ae4c03..0000000
--- a/src/com/android/settings/notification/VibrateOnTouchPreferenceController.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2017 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.android.settings.notification.SettingPref.TYPE_SYSTEM;
-
-import android.content.Context;
-import android.os.Vibrator;
-import android.provider.Settings.System;
-
-import com.android.settings.SettingsPreferenceFragment;
-import com.android.settingslib.core.lifecycle.Lifecycle;
-
-public class VibrateOnTouchPreferenceController extends SettingPrefController {
-
-    private static final String KEY_VIBRATE_ON_TOUCH = "vibrate_on_touch";
-
-    public VibrateOnTouchPreferenceController(Context context, SettingsPreferenceFragment parent,
-            Lifecycle lifecycle) {
-        super(context, parent, lifecycle);
-        mPreference = new SettingPref(
-            TYPE_SYSTEM, KEY_VIBRATE_ON_TOUCH, System.HAPTIC_FEEDBACK_ENABLED, 0) {
-            @Override
-            public boolean isApplicable(Context context) {
-                return hasHaptic(context);
-            }
-        };
-
-    }
-
-    private static boolean hasHaptic(Context context) {
-        final Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
-        return vibrator != null && vibrator.hasVibrator();
-    }
-
-}
diff --git a/src/com/android/settings/sim/SimSelectNotification.java b/src/com/android/settings/sim/SimSelectNotification.java
index 6d15737..5902b92 100644
--- a/src/com/android/settings/sim/SimSelectNotification.java
+++ b/src/com/android/settings/sim/SimSelectNotification.java
@@ -53,7 +53,6 @@
 import com.android.settings.HelpTrampoline;
 import com.android.settings.R;
 import com.android.settings.network.SubscriptionUtil;
-import com.android.settings.network.telephony.MobileNetworkActivity;
 
 public class SimSelectNotification extends BroadcastReceiver {
     private static final String TAG = "SimSelectNotification";
@@ -261,7 +260,7 @@
 
         // Create the pending intent that will lead to the subscription setting page.
         Intent resultIntent = new Intent(Settings.ACTION_MMS_MESSAGE_SETTING);
-        resultIntent.setClass(context, MobileNetworkActivity.class);
+        resultIntent.setPackage(SETTINGS_PACKAGE_NAME);
         resultIntent.putExtra(Settings.EXTRA_SUB_ID, subId);
         PendingIntent resultPendingIntent = PendingIntent.getActivity(context, 0, resultIntent,
                 PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE);
diff --git a/src/com/android/settings/users/AddSupervisedUserActivity.java b/src/com/android/settings/users/AddSupervisedUserActivity.java
new file mode 100644
index 0000000..f3c5867
--- /dev/null
+++ b/src/com/android/settings/users/AddSupervisedUserActivity.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2021 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.users;
+
+import android.app.Activity;
+import android.app.ActivityManager;
+import android.app.AlertDialog;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.NewUserRequest;
+import android.os.NewUserResponse;
+import android.os.UserManager;
+
+import androidx.annotation.Nullable;
+
+import com.android.settings.R;
+
+import java.util.Objects;
+import java.util.concurrent.Executors;
+import java.util.function.Consumer;
+
+/**
+ * Fallback activity for supervised user creation.
+ * Built to test {@link UserManager#createUser(NewUserRequest)} API.
+ */
+// TODO(b/209659998): [to-be-removed] fallback activity for supervised user creation.
+public class AddSupervisedUserActivity extends Activity {
+
+    private UserManager mUserManager;
+    private ActivityManager mActivityManager;
+
+    @Override
+    protected void onCreate(@Nullable Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        mUserManager = getSystemService(UserManager.class);
+        mActivityManager = getSystemService(ActivityManager.class);
+        setContentView(R.layout.add_supervised_user);
+        findViewById(R.id.createSupervisedUser).setOnClickListener(v -> createUser());
+    }
+
+    private void createUserAsync(final NewUserRequest request,
+            final Consumer<NewUserResponse> onResponse) {
+        Objects.requireNonNull(onResponse);
+
+        final Handler mMainThread = new Handler(Looper.getMainLooper());
+        Executors.newSingleThreadExecutor().execute(() -> {
+            final NewUserResponse response = mUserManager.createUser(request);
+            mMainThread.post(() -> onResponse.accept(response));
+        });
+    }
+
+    private void createUser() {
+        final NewUserRequest request = new NewUserRequest.Builder().build();
+
+        final AlertDialog pleaseWaitDialog = new AlertDialog.Builder(this)
+                .setMessage(getString(R.string.creating_new_user_dialog_message))
+                .setCancelable(false)
+                .create();
+
+        pleaseWaitDialog.show();
+        createUserAsync(request, response -> {
+            pleaseWaitDialog.dismiss();
+
+            if (response.isSuccessful()) {
+                mActivityManager.switchUser(response.getUser());
+                finish();
+            } else {
+                new AlertDialog.Builder(this)
+                        .setTitle(getString(R.string.add_user_failed))
+                        .setMessage(UserManager.UserOperationResult.class.getName()
+                                + " = " + response.getOperationResult())
+                        .setNeutralButton(getString(R.string.okay), null)
+                        .show();
+            }
+        });
+    }
+}
diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index 096b6ee..c3f0439 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -115,6 +115,7 @@
     private static final String KEY_USER_GUEST = "user_guest";
     private static final String KEY_ADD_GUEST = "guest_add";
     private static final String KEY_ADD_USER = "user_add";
+    private static final String KEY_ADD_SUPERVISED_USER = "supervised_user_add";
     private static final String KEY_ADD_USER_WHEN_LOCKED = "user_settings_add_users_when_locked";
     private static final String KEY_MULTIUSER_TOP_INTRO = "multiuser_top_intro";
 
@@ -165,10 +166,13 @@
     @VisibleForTesting
     RestrictedPreference mAddUser;
     @VisibleForTesting
+    RestrictedPreference mAddSupervisedUser;
+    @VisibleForTesting
     SparseArray<Bitmap> mUserIcons = new SparseArray<>();
     private int mRemovingUserId = -1;
     private boolean mAddingUser;
     private boolean mGuestUserAutoCreated;
+    private String mConfigSupervisedUserCreationPackage;
     private String mAddingUserName;
     private UserCapabilities mUserCaps;
     private boolean mShouldUpdateUserList = true;
@@ -300,6 +304,10 @@
         }
         mAddUser.setOnPreferenceClickListener(this);
 
+        setConfigSupervisedUserCreationPackage();
+        mAddSupervisedUser = findPreference(KEY_ADD_SUPERVISED_USER);
+        mAddSupervisedUser.setOnPreferenceClickListener(this);
+
         activity.registerReceiverAsUser(
                 mUserChangeReceiver, UserHandle.ALL, USER_REMOVED_INTENT_FILTER, null, mHandler);
 
@@ -491,6 +499,21 @@
         }
     }
 
+    private void onAddSupervisedUserClicked() {
+        final Intent intent = new Intent()
+                .setAction(UserManager.ACTION_CREATE_SUPERVISED_USER)
+                .setPackage(mConfigSupervisedUserCreationPackage);
+
+        // TODO(b/209659998): [to-be-removed] fallback activity for supervised user creation.
+        if (getActivity().getPackageManager().resolveActivity(intent, 0) == null) {
+            intent
+                .setClass(getContext(), AddSupervisedUserActivity.class)
+                .setPackage(null);
+        }
+
+        startActivity(intent);
+    }
+
     private void onRemoveUserClicked(int userId) {
         synchronized (mUserLock) {
             if (mRemovingUserId == -1 && !mAddingUser) {
@@ -1058,6 +1081,7 @@
 
         updateAddGuest(context, users.stream().anyMatch(UserInfo::isGuest));
         updateAddUser(context);
+        updateAddSupervisedUser(context);
 
         if (!mUserCaps.mUserSwitcherEnabled) {
             return;
@@ -1070,6 +1094,12 @@
 
     }
 
+    @VisibleForTesting
+    void setConfigSupervisedUserCreationPackage() {
+        mConfigSupervisedUserCreationPackage = getPrefContext().getString(
+                com.android.internal.R.string.config_supervisedUserCreationPackage);
+    }
+
     private boolean isCurrentUserGuest() {
         return mUserCaps.mIsGuest;
     }
@@ -1100,28 +1130,41 @@
     }
 
     private void updateAddUser(Context context) {
+        updateAddUserCommon(context, mAddUser, mUserCaps.mCanAddRestrictedProfile);
+    }
+
+    private void updateAddSupervisedUser(Context context) {
+        if (!TextUtils.isEmpty(mConfigSupervisedUserCreationPackage)) {
+            updateAddUserCommon(context, mAddSupervisedUser, false);
+        } else {
+            mAddSupervisedUser.setVisible(false);
+        }
+    }
+
+    private void updateAddUserCommon(Context context, RestrictedPreference addUser,
+            boolean canAddRestrictedProfile) {
         if ((mUserCaps.mCanAddUser || mUserCaps.mDisallowAddUserSetByAdmin)
                 && WizardManagerHelper.isDeviceProvisioned(context)
                 && mUserCaps.mUserSwitcherEnabled) {
-            mAddUser.setVisible(true);
-            mAddUser.setSelectable(true);
+            addUser.setVisible(true);
+            addUser.setSelectable(true);
             final boolean canAddMoreUsers =
                     mUserManager.canAddMoreUsers(UserManager.USER_TYPE_FULL_SECONDARY)
-                            || (mUserCaps.mCanAddRestrictedProfile
+                            || (canAddRestrictedProfile
                             && mUserManager.canAddMoreUsers(UserManager.USER_TYPE_FULL_RESTRICTED));
-            mAddUser.setEnabled(canAddMoreUsers && !mAddingUser && canSwitchUserNow());
+            addUser.setEnabled(canAddMoreUsers && !mAddingUser && canSwitchUserNow());
             if (!canAddMoreUsers) {
-                mAddUser.setSummary(
+                addUser.setSummary(
                         getString(R.string.user_add_max_count, getRealUsersCount()));
             } else {
-                mAddUser.setSummary(null);
+                addUser.setSummary(null);
             }
-            if (mAddUser.isEnabled()) {
-                mAddUser.setDisabledByAdmin(
+            if (addUser.isEnabled()) {
+                addUser.setDisabledByAdmin(
                         mUserCaps.mDisallowAddUser ? mUserCaps.mEnforcedAdmin : null);
             }
         } else {
-            mAddUser.setVisible(false);
+            addUser.setVisible(false);
         }
     }
 
@@ -1206,6 +1249,9 @@
                 onAddUserClicked(USER_TYPE_USER);
             }
             return true;
+        } else if (pref == mAddSupervisedUser) {
+            onAddSupervisedUserClicked();
+            return true;
         } else if (pref == mAddGuest) {
             mAddGuest.setEnabled(false); // prevent multiple tap issue
             mMetricsFeatureProvider.action(getActivity(), SettingsEnums.ACTION_USER_GUEST_ADD);
diff --git a/tests/componenttests/src/com/android/settings/network/telephony/MobileDataPreferenceControllerComponentTest.java b/tests/componenttests/src/com/android/settings/network/telephony/MobileDataPreferenceControllerComponentTest.java
index d80faf2..78a2c92 100644
--- a/tests/componenttests/src/com/android/settings/network/telephony/MobileDataPreferenceControllerComponentTest.java
+++ b/tests/componenttests/src/com/android/settings/network/telephony/MobileDataPreferenceControllerComponentTest.java
@@ -37,6 +37,7 @@
 import androidx.test.filters.SmallTest;
 import androidx.test.platform.app.InstrumentationRegistry;
 
+import com.android.settings.Settings;
 import com.android.settings.testutils.CommonUtils;
 import com.android.settings.testutils.UiUtils;
 
@@ -68,7 +69,7 @@
                     Context.TELECOM_SERVICE);
 
     @Rule
-    public ActivityScenarioRule<com.android.settings.network.telephony.MobileNetworkActivity>
+    public ActivityScenarioRule<Settings.MobileNetworkActivity>
             rule = new ActivityScenarioRule<>(
             new Intent(android.provider.Settings.ACTION_DATA_ROAMING_SETTINGS)
                     .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
diff --git a/tests/robotests/src/com/android/settings/bluetooth/SavedBluetoothDeviceUpdaterTest.java b/tests/robotests/src/com/android/settings/bluetooth/SavedBluetoothDeviceUpdaterTest.java
index 78a7a69..da7516b 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/SavedBluetoothDeviceUpdaterTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/SavedBluetoothDeviceUpdaterTest.java
@@ -250,4 +250,22 @@
         verify(mBluetoothDeviceUpdater).addPreference(mCachedBluetoothDevice,
                 BluetoothDevicePreference.SortType.TYPE_NO_SORT);
     }
+
+    @Test
+    public void forceUpdate_deviceIsSubDevice_doesNothing() {
+        final List<BluetoothDevice> bluetoothDevices = new ArrayList<>();
+        bluetoothDevices.add(mBluetoothDevice);
+
+        when(mBluetoothAdapter.isEnabled()).thenReturn(true);
+        when(mBluetoothAdapter.getMostRecentlyConnectedDevices()).thenReturn(bluetoothDevices);
+        when(mBluetoothManager.getCachedDeviceManager()).thenReturn(mDeviceManager);
+        when(mDeviceManager.findDevice(mBluetoothDevice)).thenReturn(mCachedBluetoothDevice);
+        when(mDeviceManager.isSubDevice(mBluetoothDevice)).thenReturn(true);
+
+        mBluetoothDeviceUpdater.forceUpdate();
+
+        verify(mBluetoothDeviceUpdater, never()).removePreference(mCachedBluetoothDevice);
+        verify(mBluetoothDeviceUpdater, never()).addPreference(mCachedBluetoothDevice,
+                BluetoothDevicePreference.SortType.TYPE_NO_SORT);
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/network/MobileNetworkSummaryControllerTest.java b/tests/robotests/src/com/android/settings/network/MobileNetworkSummaryControllerTest.java
index b60bfb8..66536a5 100644
--- a/tests/robotests/src/com/android/settings/network/MobileNetworkSummaryControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/MobileNetworkSummaryControllerTest.java
@@ -44,7 +44,7 @@
 import androidx.lifecycle.Lifecycle;
 import androidx.preference.PreferenceScreen;
 
-import com.android.settings.network.telephony.MobileNetworkActivity;
+import com.android.settings.Settings.MobileNetworkActivity;
 import com.android.settings.widget.AddPreference;
 import com.android.settingslib.RestrictedLockUtils;
 
diff --git a/tests/robotests/src/com/android/settings/network/telephony/MobileNetworkActivityTest.java b/tests/robotests/src/com/android/settings/network/telephony/MobileNetworkActivityTest.java
deleted file mode 100644
index 5729208..0000000
--- a/tests/robotests/src/com/android/settings/network/telephony/MobileNetworkActivityTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.network.telephony;
-
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.doReturn;
-import static org.robolectric.Shadows.shadowOf;
-
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.UserManager;
-import android.provider.Settings;
-import android.telephony.SubscriptionInfo;
-import android.telephony.SubscriptionManager;
-
-import androidx.test.core.app.ActivityScenario;
-import androidx.test.core.app.ApplicationProvider;
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-
-import com.android.settings.SettingsActivity;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.shadow.api.Shadow;
-import org.robolectric.shadows.ShadowContextImpl;
-import org.robolectric.shadows.ShadowSubscriptionManager;
-import org.robolectric.shadows.ShadowSubscriptionManager.SubscriptionInfoBuilder;
-
-@RunWith(AndroidJUnit4.class)
-public class MobileNetworkActivityTest {
-
-    private static final int SUB_ID = 1;
-    private static final String DISPLAY_NAME = "SUB_ID";
-
-    private Context mContext;
-    private ShadowContextImpl mShadowContextImpl;
-    private Intent mTestIntent;
-    @Mock
-    private UserManager mUserManager;
-    private ShadowSubscriptionManager mSubscriptionManager;
-    private SubscriptionInfo mSubscriptionInfo;
-    private ActivityScenario<MobileNetworkActivity> mMobileNetworkActivity;
-
-    @Before
-    public void setUp() {
-        MockitoAnnotations.initMocks(this);
-
-        mContext = ApplicationProvider.getApplicationContext();
-        mShadowContextImpl = Shadow.extract(RuntimeEnvironment.application.getBaseContext());
-        mSubscriptionManager = shadowOf(mContext.getSystemService(SubscriptionManager.class));
-        mShadowContextImpl.setSystemService(Context.USER_SERVICE, mUserManager);
-        doReturn(true).when(mUserManager).isAdminUser();
-
-        mTestIntent = new Intent(mContext, MobileNetworkActivity.class);
-        mSubscriptionInfo = SubscriptionInfoBuilder.newBuilder()
-                .setId(SUB_ID).setDisplayName(DISPLAY_NAME).buildSubscriptionInfo();
-        mTestIntent.putExtra(Settings.EXTRA_SUB_ID, SUB_ID);
-        mTestIntent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE,
-                mSubscriptionInfo.getDisplayName());
-    }
-
-    @After
-    public void cleanUp() {
-        if (mMobileNetworkActivity != null) {
-            mMobileNetworkActivity.close();
-        }
-    }
-
-    private ActivityScenario<MobileNetworkActivity> createTargetActivity(Intent activityIntent) {
-        return ActivityScenario.launch(activityIntent);
-    }
-
-    @Test
-    public void onCreate_getExtraFromIntent() {
-        mSubscriptionManager.setActiveSubscriptionInfos(mSubscriptionInfo);
-        mMobileNetworkActivity = createTargetActivity(mTestIntent);
-
-        mMobileNetworkActivity.onActivity(activity -> {
-            final Bundle bundle = new Bundle();
-            activity.onCreate(bundle);
-            assertThat(bundle.getInt(Settings.EXTRA_SUB_ID)).isEqualTo(SUB_ID);
-            assertThat(bundle.getString(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE)).isEqualTo(
-                    DISPLAY_NAME);
-        });
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/notification/VibrateOnTouchPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/VibrateOnTouchPreferenceControllerTest.java
deleted file mode 100644
index 2b2f02c..0000000
--- a/tests/robotests/src/com/android/settings/notification/VibrateOnTouchPreferenceControllerTest.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (C) 2017 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 static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.when;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.os.Vibrator;
-import android.provider.Settings.System;
-
-import androidx.fragment.app.FragmentActivity;
-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 VibrateOnTouchPreferenceControllerTest {
-
-    @Mock
-    private PreferenceScreen mScreen;
-    @Mock
-    private FragmentActivity mActivity;
-    @Mock
-    private ContentResolver mContentResolver;
-    @Mock
-    private SoundSettings mSetting;
-    @Mock
-    private Context mContext;
-    @Mock
-    private Vibrator mVibrator;
-
-    private VibrateOnTouchPreferenceController mController;
-    private SwitchPreference mPreference;
-
-    @Before
-    public void setUp() {
-        MockitoAnnotations.initMocks(this);
-        when(mActivity.getSystemService(Context.VIBRATOR_SERVICE)).thenReturn(mVibrator);
-        when(mContext.getSystemService(Context.VIBRATOR_SERVICE)).thenReturn(mVibrator);
-        when(mVibrator.hasVibrator()).thenReturn(true);
-        when(mSetting.getActivity()).thenReturn(mActivity);
-        when(mActivity.getContentResolver()).thenReturn(mContentResolver);
-        mPreference = new SwitchPreference(RuntimeEnvironment.application);
-        mController = new VibrateOnTouchPreferenceController(mContext, mSetting, null);
-        when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
-        doReturn(mScreen).when(mSetting).getPreferenceScreen();
-    }
-
-    @Test
-    public void isAvailable_hasHaptic_shouldReturnTrue() {
-        assertThat(mController.isAvailable()).isTrue();
-    }
-
-    @Test
-    public void isAvailable_noHaptic_shouldReturnFalse() {
-        when(mVibrator.hasVibrator()).thenReturn(false);
-
-        assertThat(mController.isAvailable()).isFalse();
-    }
-
-    @Test
-    public void displayPreference_hapticEnabled_shouldCheckedPreference() {
-        System.putInt(mContentResolver, System.HAPTIC_FEEDBACK_ENABLED, 1);
-
-        mController.displayPreference(mScreen);
-
-        assertThat(mPreference.isChecked()).isTrue();
-    }
-
-    @Test
-    public void displayPreference_hapticDisabled_shouldUncheckedPreference() {
-        System.putInt(mContentResolver, System.HAPTIC_FEEDBACK_ENABLED, 0);
-
-        mController.displayPreference(mScreen);
-
-        assertThat(mPreference.isChecked()).isFalse();
-    }
-
-    @Test
-    public void onPreferenceChanged_preferenceChecked_shouldEnabledHaptic() {
-        mController.displayPreference(mScreen);
-
-        mPreference.getOnPreferenceChangeListener().onPreferenceChange(mPreference, true);
-
-        assertThat(System.getInt(mContentResolver, System.HAPTIC_FEEDBACK_ENABLED, 1)).isEqualTo(1);
-    }
-
-    @Test
-    public void onPreferenceChanged_preferenceUnchecked_shouldDisabledHaptic() {
-        mController.displayPreference(mScreen);
-
-        mPreference.getOnPreferenceChangeListener().onPreferenceChange(mPreference, false);
-
-        assertThat(System.getInt(mContentResolver, System.HAPTIC_FEEDBACK_ENABLED, 1)).isEqualTo(0);
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/users/UserSettingsTest.java b/tests/robotests/src/com/android/settings/users/UserSettingsTest.java
index 9d35797..d8f3959 100644
--- a/tests/robotests/src/com/android/settings/users/UserSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/users/UserSettingsTest.java
@@ -59,6 +59,7 @@
 
 import com.android.settings.SettingsActivity;
 import com.android.settings.SubSettings;
+import com.android.settings.testutils.shadow.SettingsShadowResources;
 import com.android.settings.testutils.shadow.ShadowDevicePolicyManager;
 import com.android.settings.testutils.shadow.ShadowUserManager;
 import com.android.settingslib.RestrictedLockUtils;
@@ -85,7 +86,11 @@
 import java.util.List;
 
 @RunWith(RobolectricTestRunner.class)
-@Config(shadows = {ShadowUserManager.class, ShadowDevicePolicyManager.class})
+@Config(shadows = {
+        ShadowUserManager.class,
+        ShadowDevicePolicyManager.class,
+        SettingsShadowResources.class,
+})
 public class UserSettingsTest {
 
     private static final String KEY_USER_GUEST = "user_guest";
@@ -111,6 +116,8 @@
     @Mock
     private RestrictedPreference mAddUserPreference;
     @Mock
+    private RestrictedPreference mAddSupervisedUserPreference;
+    @Mock
     private RestrictedPreference mAddGuestPreference;
     @Mock
     private UserManager mUserManager;
@@ -161,6 +168,7 @@
 
         mFragment.mMePreference = mMePreference;
         mFragment.mAddUser = mAddUserPreference;
+        mFragment.mAddSupervisedUser = mAddSupervisedUserPreference;
         mFragment.mAddGuest = mAddGuestPreference;
         mFragment.mUserListCategory = mock(PreferenceCategory.class);
     }
@@ -169,6 +177,7 @@
     public void tearDown() {
         Settings.Global.putInt(mContext.getContentResolver(),
                 Settings.Global.DEVICE_PROVISIONED, mProvisionedBackupValue);
+        SettingsShadowResources.reset();
     }
 
     @Test
@@ -694,6 +703,36 @@
         verify(mUserManager).getUsers();
     }
 
+    private void setConfigSupervisedUserCreationPackage(String value) {
+        SettingsShadowResources.overrideResource(
+                com.android.internal.R.string.config_supervisedUserCreationPackage,
+                value
+        );
+        mFragment.setConfigSupervisedUserCreationPackage();
+        mUserCapabilities.mCanAddUser = true;
+        mFragment.updateUserList();
+    }
+
+    @Test
+    public void addSupervisedUserOption_resourceIsDefined_shouldBeDisplayed() {
+        try {
+            setConfigSupervisedUserCreationPackage("test");
+            verify(mAddSupervisedUserPreference).setVisible(true);
+        } finally {
+            SettingsShadowResources.reset();
+        }
+    }
+
+    @Test
+    public void addSupervisedUserOption_resourceIsNotDefined_shouldBeHidden() {
+        try {
+            setConfigSupervisedUserCreationPackage("");
+            verify(mAddSupervisedUserPreference).setVisible(false);
+        } finally {
+            SettingsShadowResources.reset();
+        }
+    }
+
     private void givenUsers(UserInfo... userInfo) {
         List<UserInfo> users = Arrays.asList(userInfo);
         doReturn(users).when(mUserManager).getUsers();
diff --git a/tests/uitests/src/com/android/settings/ui/SoundSettingsTest.java b/tests/uitests/src/com/android/settings/ui/SoundSettingsTest.java
index 9789c5f..735992b 100644
--- a/tests/uitests/src/com/android/settings/ui/SoundSettingsTest.java
+++ b/tests/uitests/src/com/android/settings/ui/SoundSettingsTest.java
@@ -153,14 +153,6 @@
                     "Touch sounds", Settings.System.SOUND_EFFECTS_ENABLED));
     }
 
-    @MediumTest
-    public void testOtherSoundsVibrateOnTap() throws Exception {
-        loadOtherSoundsPage();
-        assertTrue("Vibrate on tap not toggled",
-                    mHelper.verifyToggleSetting(SettingsType.SYSTEM, PAGE,
-                    "Vibrate on tap", Settings.System.HAPTIC_FEEDBACK_ENABLED));
-    }
-
     private void loadOtherSoundsPage() throws Exception {
         launchSoundSettings();
         mHelper.scrollVert(false);