Merge "[Settings] Workaround for network and internet crash"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 3fddf39..643740a 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -112,6 +112,7 @@
     <uses-permission android:name="android.permission.ALLOW_PLACE_IN_MULTI_PANE_SETTINGS" />
     <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
     <uses-permission android:name="android.permission.READ_APP_SPECIFIC_LOCALES" />
+    <uses-permission android:name="android.permission.QUERY_ADMIN_POLICY" />
 
     <application
             android:name=".SettingsApplication"
@@ -238,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" />
@@ -259,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">
@@ -549,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">
@@ -844,6 +833,18 @@
         </activity>
 
         <activity
+            android:name=".applications.appinfo.AppLocalePickerActivity"
+            android:label="@string/app_locale_picker_title"
+            android:exported="true" >
+            <intent-filter>
+                <action android:name="android.settings.APP_LOCALE_SETTINGS" />
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
+                android:value="com.android.settings.applications.appinfo.AppLocaleDetails" />
+        </activity>
+
+        <activity
             android:name=".Settings$LanguageAndInputSettingsActivity"
             android:label="@string/language_settings"
             android:exported="true"
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/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/applications/appinfo/AppLocaleDetails.java b/src/com/android/settings/applications/appinfo/AppLocaleDetails.java
index 742ce04..966f02d 100644
--- a/src/com/android/settings/applications/appinfo/AppLocaleDetails.java
+++ b/src/com/android/settings/applications/appinfo/AppLocaleDetails.java
@@ -270,9 +270,14 @@
         /** Gets per app's default locale */
         public static Locale getAppDefaultLocale(Context context, String packageName) {
             LocaleManager localeManager = context.getSystemService(LocaleManager.class);
-            LocaleList localeList = (localeManager == null)
-                    ? new LocaleList() : localeManager.getApplicationLocales(packageName);
-            return localeList.isEmpty() ? null : localeList.get(0);
+            try {
+                LocaleList localeList = (localeManager == null)
+                        ? new LocaleList() : localeManager.getApplicationLocales(packageName);
+                return localeList.isEmpty() ? null : localeList.get(0);
+            } catch (IllegalArgumentException e) {
+                Log.w(TAG, "package name : " + packageName + " is not correct. " + e);
+            }
+            return null;
         }
 
         /** Sets per app's default language to system. */
diff --git a/src/com/android/settings/applications/appinfo/AppLocalePickerActivity.java b/src/com/android/settings/applications/appinfo/AppLocalePickerActivity.java
new file mode 100644
index 0000000..ce833ed
--- /dev/null
+++ b/src/com/android/settings/applications/appinfo/AppLocalePickerActivity.java
@@ -0,0 +1,53 @@
+/*
+ * 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.applications.appinfo;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+
+import androidx.annotation.VisibleForTesting;
+
+import com.android.settings.SettingsActivity;
+import com.android.settings.applications.AppInfoBase;
+
+/** Activity for the entry of {@link #AppLocaleDetails} from outside Settings app. */
+public class AppLocalePickerActivity extends SettingsActivity {
+    private static final String TAG = "AppLocalePickerActivity";
+
+    @Override
+    protected void onCreate(Bundle savedState) {
+        Intent intent = getEntryIntent(getIntent());
+        if (intent == null) {
+            finish();
+            return;
+        }
+        setIntent(intent);
+        super.onCreate(savedState);
+    }
+
+    @VisibleForTesting
+    Intent getEntryIntent(Intent intent) {
+        String callingPackage = getCallingPackage();
+        if (callingPackage == null || callingPackage.isEmpty()) {
+            Log.d(TAG, "No calling package name is found.");
+            return null;
+        }
+        final Bundle fragmentArgs = new Bundle();
+        fragmentArgs.putString(AppInfoBase.ARG_PACKAGE_NAME, callingPackage);
+        return intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS, fragmentArgs);
+    }
+}
diff --git a/src/com/android/settings/core/gateway/SettingsGateway.java b/src/com/android/settings/core/gateway/SettingsGateway.java
index e94fafc..c88fe46 100644
--- a/src/com/android/settings/core/gateway/SettingsGateway.java
+++ b/src/com/android/settings/core/gateway/SettingsGateway.java
@@ -42,6 +42,7 @@
 import com.android.settings.applications.UsageAccessDetails;
 import com.android.settings.applications.appinfo.AlarmsAndRemindersDetails;
 import com.android.settings.applications.appinfo.AppInfoDashboardFragment;
+import com.android.settings.applications.appinfo.AppLocaleDetails;
 import com.android.settings.applications.appinfo.DrawOverlayDetails;
 import com.android.settings.applications.appinfo.ExternalSourcesDetails;
 import com.android.settings.applications.appinfo.ManageExternalStorageDetails;
@@ -331,7 +332,8 @@
             MediaManagementAppsDetails.class.getName(),
             AutoBrightnessSettings.class.getName(),
             OneHandedSettings.class.getName(),
-            MobileNetworkSettings.class.getName()
+            MobileNetworkSettings.class.getName(),
+            AppLocaleDetails.class.getName()
     };
 
     public static final String[] SETTINGS_FOR_RESTRICTED = {
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/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/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);
diff --git a/tests/unit/src/com/android/settings/applications/appinfo/AppLocalePickerActivityTest.java b/tests/unit/src/com/android/settings/applications/appinfo/AppLocalePickerActivityTest.java
new file mode 100644
index 0000000..f6f56d9
--- /dev/null
+++ b/tests/unit/src/com/android/settings/applications/appinfo/AppLocalePickerActivityTest.java
@@ -0,0 +1,87 @@
+/*
+ * 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.applications.appinfo;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Looper;
+
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import com.android.settings.SettingsActivity;
+import com.android.settings.applications.AppInfoBase;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+public class AppLocalePickerActivityTest {
+    private TestAppLocalePickerActivity mActivity;
+
+    @Before
+    @UiThreadTest
+    public void setUp() {
+        if (Looper.myLooper() == null) {
+            Looper.prepare();
+        }
+        mActivity = new TestAppLocalePickerActivity();
+    }
+
+    @After
+    public void cleanUp() {
+        mActivity = null;
+    }
+
+    @Test
+    public void onCreate_getEntryIntent_returnNull() {
+        TestAppLocalePickerActivity.setCallingPackage(null);
+        Intent intent = new Intent();
+
+        assertThat(mActivity.getEntryIntent(intent)).isEqualTo(null);
+    }
+
+    @Test
+    public void onCreate_getEntryIntent_returnIntentWithPackageName() {
+        String callingPackageName = "com.example.android";
+        TestAppLocalePickerActivity.setCallingPackage(callingPackageName);
+        Intent intent = new Intent();
+
+        Intent entryIntent = mActivity.getEntryIntent(intent);
+
+        Bundle outputBundle =
+                entryIntent.getBundleExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS);
+        String packageName = outputBundle.getString(AppInfoBase.ARG_PACKAGE_NAME);
+        assertThat(packageName).isEqualTo(callingPackageName);
+    }
+
+    private static class TestAppLocalePickerActivity extends AppLocalePickerActivity {
+        private static String sCallingPackage;
+        @Override
+        public String getCallingPackage() {
+            return sCallingPackage;
+        }
+
+        public static void setCallingPackage(String packageName) {
+            sCallingPackage = packageName;
+        }
+    }
+}