Merge "Update char limit for "Erase all data?""
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index a94801f..6724ff5 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -116,14 +116,6 @@
         <uses-library android:name="org.apache.http.legacy" />
         <!-- Settings -->
 
-        <!-- TODO(b/118444000): Remove this. -->
-        <activity android:name="SettingsActivity"
-                  android:label="@string/settings_label_launcher"
-                  android:launchMode="singleTask">
-            <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
-                       android:value="true" />
-        </activity>
-
         <activity android:name=".homepage.SettingsHomepageActivity"
                   android:label="@string/settings_label_launcher"
                   android:theme="@style/Theme.Settings.Home"
@@ -1874,7 +1866,8 @@
         <activity android:name=".bluetooth.BluetoothPairingDialog"
                   android:excludeFromRecents="true"
                   android:windowSoftInputMode="stateVisible|adjustResize"
-                  android:theme="@style/Theme.AlertDialog">
+                  android:theme="@style/Theme.AlertDialog"
+                  android:taskAffinity=".bluetooth.BluetoothPairingDialog">
             <intent-filter android:priority="1">
                 <action android:name="android.bluetooth.device.action.PAIRING_REQUEST" />
                 <category android:name="android.intent.category.DEFAULT" />
@@ -2335,6 +2328,18 @@
         </activity>
 
         <activity
+            android:name="Settings$NotificationAssistantSettingsActivity"
+            android:label="@string/notification_assistant_title"
+            android:parentActivityName="Settings">
+            <intent-filter android:priority="1">
+                <action android:name="android.settings.NOTIFICATION_ASSISTANT_SETTINGS" />
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
+                       android:value="com.android.settings.notification.NotificationAssistantPicker" />
+        </activity>
+
+        <activity
             android:name="Settings$VrListenersSettingsActivity"
             android:label="@string/vr_listeners_title"
             android:parentActivityName="Settings">
diff --git a/res/layout/bluetooth_pin_confirm.xml b/res/layout/bluetooth_pin_confirm.xml
index c55c9ff..4891275 100644
--- a/res/layout/bluetooth_pin_confirm.xml
+++ b/res/layout/bluetooth_pin_confirm.xml
@@ -40,8 +40,7 @@
             android:gravity="center_vertical"
             android:text="@string/bluetooth_pairing_key_msg"
             android:visibility="gone"
-            android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
-            android:textColor="@color/bluetooth_dialog_text_color"  />
+            android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1" />
 
         <TextView
             android:id="@+id/pairing_subhead"
@@ -64,7 +63,6 @@
             android:gravity="center_vertical"
             android:text="@string/bluetooth_enter_passkey_msg"
             android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
-            android:textColor="@color/bluetooth_dialog_text_color"
             android:visibility="gone" />
 
         <CheckBox
@@ -73,8 +71,7 @@
             android:layout_height="wrap_content"
             android:layout_marginStart="@dimen/bluetooth_dialog_padding"
             android:layout_marginEnd="@dimen/bluetooth_dialog_padding"
-            android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
-            android:textColor="@color/bluetooth_dialog_text_color"  />
+            android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1" />
 
     </LinearLayout>
 
diff --git a/res/layout/dialog_firmware_version.xml b/res/layout/dialog_firmware_version.xml
deleted file mode 100644
index 1d5f531..0000000
--- a/res/layout/dialog_firmware_version.xml
+++ /dev/null
@@ -1,103 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  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.
-  -->
-
-<ScrollView
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content">
-    <LinearLayout
-        android:orientation="vertical"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:padding="@dimen/sim_content_padding">
-
-        <TextView
-            style="@style/device_info_dialog_label"
-            android:id="@+id/firmware_version_label"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:text="@string/firmware_version"/>
-        <TextView
-            style="@style/device_info_dialog_value"
-            android:id="@+id/firmware_version_value"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"/>
-
-        <TextView
-            style="@style/device_info_dialog_label"
-            android:id="@+id/security_patch_level_label"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:text="@string/security_patch"/>
-        <TextView
-            style="@style/device_info_dialog_value"
-            android:id="@+id/security_patch_level_value"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:background="?android:attr/selectableItemBackground"
-            android:textColor="?android:attr/colorAccent"/>
-
-        <TextView
-            style="@style/device_info_dialog_label"
-            android:id="@+id/module_version_label"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:text="@string/module_version"/>
-        <TextView
-            style="@style/device_info_dialog_value"
-            android:id="@+id/module_version_value"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"/>
-
-        <TextView
-            style="@style/device_info_dialog_label"
-            android:id="@+id/baseband_version_label"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:text="@string/baseband_version"/>
-        <TextView
-            style="@style/device_info_dialog_value"
-            android:id="@+id/baseband_version_value"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"/>
-
-        <TextView
-            style="@style/device_info_dialog_label"
-            android:id="@+id/kernel_version_label"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:text="@string/kernel_version"/>
-        <TextView
-            style="@style/device_info_dialog_value"
-            android:id="@+id/kernel_version_value"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"/>
-
-        <TextView
-            style="@style/device_info_dialog_label"
-            android:id="@+id/build_number_label"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:text="@string/build_number"/>
-        <TextView
-            style="@style/device_info_dialog_value"
-            android:id="@+id/build_number_value"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"/>
-
-    </LinearLayout>
-</ScrollView>
diff --git a/res/layout/dialog_hardware_info.xml b/res/layout/dialog_hardware_info.xml
deleted file mode 100644
index 7ea4783..0000000
--- a/res/layout/dialog_hardware_info.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  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.
-  -->
-
-<ScrollView
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content">
-    <LinearLayout
-        android:orientation="vertical"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:padding="24dp">
-
-        <TextView
-            style="@style/device_info_dialog_label"
-            android:id="@+id/model_label"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:text="@string/model_info" />
-        <TextView
-            style="@style/device_info_dialog_value"
-            android:id="@+id/model_value"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
-
-        <TextView
-            style="@style/device_info_dialog_label"
-            android:id="@+id/serial_number_label"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:text="@string/status_serial_number" />
-        <TextView
-            style="@style/device_info_dialog_value"
-            android:id="@+id/serial_number_value"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
-
-        <TextView
-            style="@style/device_info_dialog_label"
-            android:id="@+id/hardware_rev_label"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:text="@string/hardware_revision" />
-        <TextView
-            style="@style/device_info_dialog_value"
-            android:id="@+id/hardware_rev_value"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
-
-    </LinearLayout>
-</ScrollView>
\ No newline at end of file
diff --git a/res/layout/nfc_payment_option.xml b/res/layout/nfc_payment_option.xml
index be5fe5f..18519ee 100644
--- a/res/layout/nfc_payment_option.xml
+++ b/res/layout/nfc_payment_option.xml
@@ -26,15 +26,8 @@
     android:background="?android:attr/selectableItemBackground">
     <RadioButton xmlns:android="http://schemas.android.com/apk/res/android"
         android:id="@+id/button"
-        android:layout_width="wrap_content"
+        android:layout_width="match_parent"
         android:layout_height="fill_parent"
         android:checkMark="?android:attr/listChoiceIndicatorSingle"
         />
-    <ImageView
-        android:id="@+id/banner"
-        android:layout_width="wrap_content"
-        android:layout_height="64dp"
-        android:scaleType="centerInside"
-        android:clickable="true"
-            />
 </LinearLayout>
diff --git a/res/layout/settings_homepage_container.xml b/res/layout/settings_homepage_container.xml
index 45d0861..78a0278 100644
--- a/res/layout/settings_homepage_container.xml
+++ b/res/layout/settings_homepage_container.xml
@@ -44,7 +44,8 @@
             <FrameLayout
                 android:id="@+id/main_content"
                 android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
+                android:layout_height="wrap_content"
+                android:animateLayoutChanges="true"/>
 
         </LinearLayout>
     </androidx.core.widget.NestedScrollView>
diff --git a/res/layout/settings_main_dashboard.xml b/res/layout/settings_main_dashboard.xml
deleted file mode 100644
index ee84576..0000000
--- a/res/layout/settings_main_dashboard.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-     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.
--->
-
-<!-- TODO(118444000): Remove this -->
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:orientation="vertical">
-
-    <include layout="@layout/search_bar" />
-
-    <FrameLayout
-        android:id="@+id/main_content"
-        android:layout_height="match_parent"
-        android:layout_width="match_parent" />
-</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/wifi_button_preference_widget.xml b/res/layout/wifi_button_preference_widget.xml
index 55078c2..1ecb98c 100644
--- a/res/layout/wifi_button_preference_widget.xml
+++ b/res/layout/wifi_button_preference_widget.xml
@@ -19,6 +19,8 @@
            android:id="@+id/button_icon"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
+           android:minWidth="@dimen/min_tap_target_size"
+           android:minHeight="@dimen/min_tap_target_size"
            android:layout_gravity="center"
            android:background="@null"
            android:visibility="gone"
diff --git a/res/layout/wifi_dialog.xml b/res/layout/wifi_dialog.xml
index 8ee2fba..1ae3bf5 100644
--- a/res/layout/wifi_dialog.xml
+++ b/res/layout/wifi_dialog.xml
@@ -65,9 +65,10 @@
                         android:id="@+id/ssid_scanner_button"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
+                        android:minWidth="@dimen/min_tap_target_size"
+                        android:minHeight="@dimen/min_tap_target_size"
                         android:layout_alignParentEnd="true"
                         android:layout_centerVertical="true"
-                        android:layout_margin="5dp"
                         android:background="@null"
                         android:src="@drawable/ic_scan_24dp"
                         android:contentDescription="@string/wifi_add_network" />
@@ -300,9 +301,10 @@
                         android:id="@+id/password_scanner_button"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
+                        android:minWidth="@dimen/min_tap_target_size"
+                        android:minHeight="@dimen/min_tap_target_size"
                         android:layout_alignParentEnd="true"
                         android:layout_centerVertical="true"
-                        android:layout_margin="5dp"
                         android:background="@null"
                         android:src="@drawable/ic_scan_24dp"
                         android:contentDescription="@string/wifi_add_network" />
diff --git a/res/layout/wifi_network_details_two_buttons_panel.xml b/res/layout/wifi_network_details_two_buttons_panel.xml
index 57f76b5..6c51d11 100644
--- a/res/layout/wifi_network_details_two_buttons_panel.xml
+++ b/res/layout/wifi_network_details_two_buttons_panel.xml
@@ -27,7 +27,6 @@
         android:paddingStart="8dp"
         android:paddingEnd="8dp">
         <Button
-            style="@android:style/@Widget.Material.Button.Colored"
             android:id="@+id/forget_button"
             android:text="@string/forget"
             android:layout_width="0dp"
diff --git a/res/layout/wifi_settings_scanning_required_view.xml b/res/layout/wifi_settings_scanning_required_view.xml
index 8dad9f4..5ede986 100644
--- a/res/layout/wifi_settings_scanning_required_view.xml
+++ b/res/layout/wifi_settings_scanning_required_view.xml
@@ -23,8 +23,8 @@
     <TextView
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginLeft="24dp"
-        android:layout_marginRight="24dp"
+        android:layout_marginStart="24dp"
+        android:layout_marginEnd="24dp"
         android:layout_marginTop="8dp"
         android:text="@string/wifi_settings_scanning_required_summary"
         style="@style/TextAppearance.AppCompat.Subhead"/>
@@ -43,7 +43,7 @@
             android:layout_height="wrap_content"
             android:padding="2dp"
             android:layout_marginTop="4dp"
-            android:layout_marginLeft="24dp"
+            android:layout_marginStart="24dp"
             android:adjustViewBounds="true"/>
 
         <TextView
diff --git a/res/values/colors.xml b/res/values/colors.xml
index a10d1d7..7b55a2b 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -16,8 +16,6 @@
 
 <resources>
 
-    <color name="bluetooth_dialog_text_color">#8a000000</color>
-
     <color name="crypt_keeper_clock_background">#ff9a9a9a</color>
     <color name="crypt_keeper_clock_foreground">#ff666666</color>
     <color name="crypt_keeper_clock_am_pm">#ff9a9a9a</color>
diff --git a/res/values/config.xml b/res/values/config.xml
index c2899ef..beeac0c 100755
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -171,9 +171,6 @@
     <!-- Email address for the homepage contextual cards feedback -->
     <string name="config_contextual_card_feedback_email" translatable="false"></string>
 
-    <!-- Uri that represents extra bluetooth settings -->
-    <string name="config_bluetooth_device_settings_uri" translatable="false">content://com.google.android.gms.nearby.fastpair/settings_slice?addr=<xliff:g id="mac_address">%1$s</xliff:g></string>
-
     <!-- ComponentName to launch a vendor-specific enrollment activity if available -->
     <string name="config_face_enroll" translatable="false"></string>
 
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 00b853c..90b72e1 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -2153,6 +2153,10 @@
     <string name="wifi_dpp_could_not_add_device">Couldn\u2019t add device</string>
     <!-- Title for the fragment to show that device found but naming known [CHAR LIMIT=50]  -->
     <string name="wifi_dpp_device_found">Device found</string>
+    <!-- Hint for Wi-Fi DPP handshake running [CHAR LIMIT=NONE]  -->
+    <string name="wifi_dpp_sharing_wifi_with_this_device">Sharing Wi\u2011Fi with this device\u2026</string>
+    <!-- Hint for Wi-Fi DPP handshake running [CHAR LIMIT=NONE]  -->
+    <string name="wifi_dpp_connecting">Connecting\u2026</string>
      <!-- Label for the try again button [CHAR LIMIT=20]-->
     <string name="retry">Retry</string>
     <!-- Label for the check box to share a network with other users on the same device -->
@@ -2927,8 +2931,6 @@
 
     <!-- About phone screen, status item label  [CHAR LIMIT=40] -->
     <string name="firmware_version">Android version</string>
-    <!-- About phone screen, dialog title for showing device software information such as android version, security patch level, etc  [CHAR LIMIT=60] -->
-    <string name="firmware_title">Android</string>
     <!-- About phone screen, status item label  [CHAR LIMIT=60] -->
     <string name="security_patch">Android security patch level</string>
     <!-- About phone screen, status item label  [CHAR LIMIT=40] -->
@@ -7796,10 +7798,29 @@
         <item quantity="other">%d apps can read notifications</item>
     </plurals>
 
+    <!-- Title for Notification Assistant Picker screen [CHAR LIMIT=30]-->
+    <string name="notification_assistant_title">Notification Assistant</string>
+
+    <!-- Label for no NotificationAssistantService [CHAR_LIMIT=NONE] -->
+    <string name="no_notification_assistant">No assistant</string>
+
     <!-- String to show in the list of notification listeners, when none is installed -->
     <string name="no_notification_listeners">No installed apps have requested notification access.</string>
 
     <!-- Title for a warning message about security implications of enabling a notification
+      assistant, displayed as a dialog message. [CHAR LIMIT=NONE] -->
+    <string name="notification_assistant_security_warning_title">Allow notification access for
+         <xliff:g id="service" example="NotificationAssistant">%1$s</xliff:g>?</string>
+    <!-- Summary for a warning message about security implications of enabling a notification
+          listener, displayed as a dialog message. [CHAR LIMIT=NONE] -->
+    <string name="notification_assistant_security_warning_summary">
+        <xliff:g id="notification_assistant_name" example="Notification Assistant">%1$s</xliff:g> will be able to read all notifications,
+        including personal information such as contact names and the text of messages you receive.
+        It will also be able to modify or dismiss notifications or trigger action buttons they contain.
+        \n\nThis will also give the app the ability to turn Do Not Disturb on or off and change related settings.
+    </string>
+
+    <!-- Title for a warning message about security implications of enabling a notification
           listener, displayed as a dialog message. [CHAR LIMIT=NONE] -->
     <string name="notification_listener_security_warning_title">Allow notification access for
          <xliff:g id="service" example="NotificationReader">%1$s</xliff:g>?</string>
@@ -10673,11 +10694,13 @@
     <string name="manage_app_notification">Manage <xliff:g id="app_name" example="Settings">%1$s</xliff:g> Notifications</string>
     <!-- Title for no suggested app in notification channel slice. [CHAR LIMIT=NONE] -->
     <string name="no_suggested_app">No suggested application</string>
-    <!-- Summary for notification channel slice. [CHAR LIMIT=NONE] -->
-    <plurals name="notification_channel_count_summary">
-        <item quantity="one"><xliff:g id="notification_channel_count">%1$d</xliff:g> notification channel. Tap to manage all.</item>
-        <item quantity="other"><xliff:g id="notification_channel_count">%1$d</xliff:g> notification channels. Tap to manage all.</item>
+    <!-- Summary for the channels count is equal or less than 3 in notification channel slice. [CHAR LIMIT=NONE] -->
+    <plurals name="notification_few_channel_count_summary">
+        <item quantity="one"><xliff:g id="notification_channel_count" example="1">%1$d</xliff:g> notification channel.</item>
+        <item quantity="other"><xliff:g id="notification_channel_count" example="3">%1$d</xliff:g> notification channels.</item>
     </plurals>
+    <!-- Summary for the channels count is more than 3 in notification channel slice. [CHAR LIMIT=NONE] -->
+    <string name="notification_many_channel_count_summary"><xliff:g id="notification_channel_count" example="4">%1$d</xliff:g> notification channels. Tap to manage all.</string>
 
     <!-- Title for the Switch output dialog (settings panel) with media related devices [CHAR LIMIT=50] -->
     <string name="media_output_panel_title">Switch output</string>
diff --git a/res/values/themes.xml b/res/values/themes.xml
index f2c1eae..991e376 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -58,7 +58,7 @@
         <item name="batteryMaybeColor">@color/battery_maybe_color_light</item>
         <item name="batteryBadColor">@color/battery_bad_color_light</item>
 
-        <!-- TODO(118444000): Remove colorPrimary and colorPrimaryVariant -->
+        <!-- For AppBarLayout -->
         <item name="colorPrimary">@*android:color/primary_device_default_settings_light</item>
         <item name="colorPrimaryVariant">@android:color/white</item>
 
diff --git a/res/xml/app_and_notification.xml b/res/xml/app_and_notification.xml
index c15df75..518379a 100644
--- a/res/xml/app_and_notification.xml
+++ b/res/xml/app_and_notification.xml
@@ -23,24 +23,25 @@
     settings:initialExpandedChildrenCount="8">
     <!-- the initial count should include the dynamic tiles -->
 
-    <PreferenceCategory
-        android:key="recent_apps_category"
-        android:title="@string/recent_app_category_title"
-        android:order="-200">
-        <!-- Placeholder for a list of recent apps -->
+    <Preference
+        android:key="all_app_info"
+        android:title="@string/applications_settings"
+        android:order="-999"
+        android:fragment="com.android.settings.applications.manageapplications.ManageApplications"/>
 
-        <!-- See all apps button -->
-        <Preference
-            android:title="@string/applications_settings"
-            android:key="all_app_info"
-            android:fragment="com.android.settings.applications.manageapplications.ManageApplications"
-            android:order="20"/>
-    </PreferenceCategory>
+    <com.android.settingslib.widget.LayoutPreference
+        android:key="recent_open_apps"
+        android:title="@string/recent_app_category_title"
+        android:layout="@layout/app_entities_header"
+        android:selectable="false"
+        android:order="-998"
+        settings:allowDividerBelow="true"
+        settings:controller="com.android.settings.applications.RecentAppsPreferenceController"/>
 
     <!-- Empty category to draw divider -->
     <PreferenceCategory
-        android:key="all_app_info_divider"
-        android:order="-190"/>
+        android:key="recent_apps_divider"
+        android:order="-997"/>
 
     <!-- Notifications (appears before manage_perms), default apps (appears after) -->
     <PreferenceCategory
diff --git a/res/xml/configure_notification_settings.xml b/res/xml/configure_notification_settings.xml
index 803d12b..38fa060 100644
--- a/res/xml/configure_notification_settings.xml
+++ b/res/xml/configure_notification_settings.xml
@@ -19,6 +19,13 @@
                   android:title="@string/configure_notification_settings"
                   android:key="configure_notification_settings">
 
+    <com.android.settingslib.widget.apppreference.AppPreference
+        android:key="notification_assistant"
+        android:title="@string/notification_assistant_title"
+        android:summary="@string/summary_placeholder"
+        settings:fragment="com.android.settings.notification.NotificationAssistantPicker"
+        settings:controller="com.android.settings.notification.NotificationAssistantPreferenceController"/>
+
     <SwitchPreference
         android:key="hide_silent_icons"
         android:title="@string/hide_silent_icons_title"
diff --git a/res/xml/firmware_version.xml b/res/xml/firmware_version.xml
new file mode 100644
index 0000000..2914ef1
--- /dev/null
+++ b/res/xml/firmware_version.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright (C) 2019 The Android Open Source Project
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<PreferenceScreen
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:settings="http://schemas.android.com/apk/res-auto"
+    android:key="firmware_version_screen"
+    android:title="@string/firmware_version"
+    settings:keywords="@string/keywords_android_version">
+
+    <!-- Android version -->
+    <Preference
+        android:key="os_firmware_version"
+        android:title="@string/firmware_version"
+        android:summary="@string/summary_placeholder"
+        settings:enableCopying="true"
+        settings:allowDynamicSummaryInSlice="true"
+        settings:controller="com.android.settings.deviceinfo.firmwareversion.FirmwareVersionDetailPreferenceController"/>
+
+    <!-- Security patch -->
+    <Preference
+        android:key="security_key"
+        android:title="@string/security_patch"
+        settings:enableCopying="true"
+        settings:controller="com.android.settings.deviceinfo.firmwareversion.SecurityPatchLevelPreferenceController"/>
+
+    <!-- Mainline module version -->
+    <Preference
+        android:key="module_version"
+        android:title="@string/module_version"
+        android:summary="@string/summary_placeholder"
+        settings:enableCopying="true"
+        settings:controller="com.android.settings.deviceinfo.firmwareversion.MainlineModuleVersionPreferenceController"/>
+
+    <!-- Baseband -->
+    <Preference
+        android:key="base_band"
+        android:title="@string/baseband_version"
+        android:summary="@string/summary_placeholder"
+        settings:enableCopying="true"
+        settings:controller="com.android.settings.deviceinfo.firmwareversion.BasebandVersionPreferenceController"/>
+
+    <!-- Kernel -->
+    <Preference
+        android:key="kernel_version"
+        android:title="@string/kernel_version"
+        android:summary="@string/summary_placeholder"
+        settings:enableCopying="true"
+        settings:controller="com.android.settings.deviceinfo.firmwareversion.KernelVersionPreferenceController"/>
+
+    <!-- Build -->
+    <Preference
+        android:key="os_build_number"
+        android:title="@string/build_number"
+        android:summary="@string/summary_placeholder"
+        settings:enableCopying="true"
+        settings:controller="com.android.settings.deviceinfo.firmwareversion.SimpleBuildNumberPreferenceController"/>
+
+</PreferenceScreen>
\ No newline at end of file
diff --git a/res/xml/hardware_info.xml b/res/xml/hardware_info.xml
new file mode 100644
index 0000000..2e35101
--- /dev/null
+++ b/res/xml/hardware_info.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright (C) 2019 The Android Open Source Project
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<PreferenceScreen
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:settings="http://schemas.android.com/apk/res-auto"
+    android:key="hardware_info_screen"
+    android:title="@string/hardware_info"
+    settings:keywords="@string/keywords_model_and_hardware">
+
+    <!-- Model -->
+    <Preference
+        android:key="hardware_info_device_model"
+        android:title="@string/model_info"
+        android:summary="@string/summary_placeholder"
+        settings:allowDynamicSummaryInSlice="true"
+        settings:controller="com.android.settings.deviceinfo.hardwareinfo.DeviceModelPreferenceController"
+        settings:enableCopying="true"/>
+
+    <!-- SerialNumber -->
+    <Preference
+        android:key="hardware_info_device_serial"
+        android:title="@string/status_serial_number"
+        android:summary="@string/summary_placeholder"
+        settings:allowDynamicSummaryInSlice="true"
+        settings:controller="com.android.settings.deviceinfo.hardwareinfo.SerialNumberPreferenceController"
+        settings:enableCopying="true"/>
+
+    <!-- Hardware revision -->
+    <Preference
+        android:key="hardware_info_device_revision"
+        android:title="@string/hardware_revision"
+        android:summary="@string/summary_placeholder"
+        settings:allowDynamicSummaryInSlice="true"
+        settings:controller="com.android.settings.deviceinfo.hardwareinfo.HardwareRevisionPreferenceController"
+        settings:enableCopying="true"/>
+
+</PreferenceScreen>
\ No newline at end of file
diff --git a/res/xml/my_device_info.xml b/res/xml/my_device_info.xml
index 6323a14..83bf5c4 100644
--- a/res/xml/my_device_info.xml
+++ b/res/xml/my_device_info.xml
@@ -105,7 +105,8 @@
         settings:keywords="@string/keywords_model_and_hardware"
         android:summary="@string/summary_placeholder"
         settings:allowDynamicSummaryInSlice="true"
-        settings:controller="com.android.settings.deviceinfo.DeviceModelPreferenceController"/>
+        android:fragment="com.android.settings.deviceinfo.hardwareinfo.HardwareInfoFragment"
+        settings:controller="com.android.settings.deviceinfo.HardwareInfoPreferenceController"/>
 
     <!-- IMEI -->
     <Preference
@@ -121,11 +122,10 @@
         android:key="firmware_version"
         android:order="32"
         android:title="@string/firmware_version"
-        settings:keywords="@string/keywords_android_version"
         android:summary="@string/summary_placeholder"
         settings:allowDynamicSummaryInSlice="true"
-        settings:controller=
-            "com.android.settings.deviceinfo.firmwareversion.FirmwareVersionPreferenceController"/>
+        android:fragment="com.android.settings.deviceinfo.firmwareversion.FirmwareVersionSettings"
+        settings:controller="com.android.settings.deviceinfo.firmwareversion.FirmwareVersionPreferenceController"/>
 
     <!--IP address -->
     <Preference
diff --git a/res/xml/notification_assistant_settings.xml b/res/xml/notification_assistant_settings.xml
new file mode 100644
index 0000000..25ae79f
--- /dev/null
+++ b/res/xml/notification_assistant_settings.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2019 The Android Open Source Project
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<PreferenceScreen
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:title="@string/notification_assistant_title" />
\ No newline at end of file
diff --git a/res/xml/privacy_dashboard_settings.xml b/res/xml/privacy_dashboard_settings.xml
index eaca161..48034a84 100644
--- a/res/xml/privacy_dashboard_settings.xml
+++ b/res/xml/privacy_dashboard_settings.xml
@@ -22,9 +22,11 @@
     android:title="@string/privacy_dashboard_title"
     settings:initialExpandedChildrenCount="4">
 
+    <!-- This preference isn't searchable, and user won't see title in this preference.
+         So, we just set empty text for title. -->
     <com.android.settingslib.widget.BarChartPreference
         android:key="permission_bar_chart"
-        android:title="@string/privacy_dashboard_title"
+        android:title="@string/summary_placeholder"
         settings:controller="com.android.settings.privacy.PermissionBarChartPreferenceController"/>
 
     <!-- Accessibility usage -->
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index ae4ae2a..7565dd8 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -110,6 +110,7 @@
     public static class ZenModeEventRuleSettingsActivity extends SettingsActivity { /* empty */ }
     public static class SoundSettingsActivity extends SettingsActivity { /* empty */ }
     public static class ConfigureNotificationSettingsActivity extends SettingsActivity { /* empty */ }
+    public static class NotificationAssistantSettingsActivity extends SettingsActivity{ /* empty */ }
     public static class NotificationAppListActivity extends SettingsActivity { /* empty */ }
     public static class AppNotificationSettingsActivity extends SettingsActivity { /* empty */ }
     public static class ChannelNotificationSettingsActivity extends SettingsActivity { /* empty */ }
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index 8bd81ee..541ca3a 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -18,7 +18,6 @@
 
 import android.app.ActionBar;
 import android.app.ActivityManager;
-import android.app.settings.SettingsEnums;
 import android.content.BroadcastReceiver;
 import android.content.ComponentName;
 import android.content.Context;
@@ -37,7 +36,6 @@
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.Button;
-import android.widget.Toolbar;
 
 import androidx.annotation.Nullable;
 import androidx.annotation.VisibleForTesting;
@@ -165,12 +163,6 @@
 
     private Button mNextButton;
 
-    /**
-     * TODO(b/118444000): Remove this and all related code.
-     */
-    @Deprecated
-    private boolean mIsShowingDashboard;
-
     private ViewGroup mContent;
 
     // Categories
@@ -253,11 +245,7 @@
             setTheme(R.style.Theme_SubSettings);
         }
 
-        mIsShowingDashboard = TextUtils.equals(
-                SettingsActivity.class.getName(), intent.getComponent().getClassName());
-
-        setContentView(mIsShowingDashboard ?
-                R.layout.settings_main_dashboard : R.layout.settings_main_prefs);
+        setContentView(R.layout.settings_main_prefs);
 
         mContent = findViewById(R.id.main_content);
 
@@ -280,21 +268,12 @@
         }
 
         final boolean deviceProvisioned = Utils.isDeviceProvisioned(this);
-        if (mIsShowingDashboard) {
-            findViewById(R.id.search_bar).setVisibility(
-                    deviceProvisioned ? View.VISIBLE : View.INVISIBLE);
-            findViewById(R.id.action_bar).setVisibility(View.GONE);
-            final Toolbar toolbar = findViewById(R.id.search_action_bar);
-            setActionBar(toolbar);
-            FeatureFactory.getFactory(this).getSearchFeatureProvider()
-                    .initSearchToolbar(this, toolbar, SettingsEnums.SETTINGS_HOMEPAGE);
-        }
 
-        ActionBar actionBar = getActionBar();
+        final ActionBar actionBar = getActionBar();
         if (actionBar != null) {
             actionBar.setDisplayHomeAsUpEnabled(deviceProvisioned);
             actionBar.setHomeButtonEnabled(deviceProvisioned);
-            actionBar.setDisplayShowTitleEnabled(!mIsShowingDashboard);
+            actionBar.setDisplayShowTitleEnabled(true);
         }
         mSwitchBar = findViewById(R.id.switch_bar);
         if (mSwitchBar != null) {
diff --git a/src/com/android/settings/applications/AppAndNotificationDashboardFragment.java b/src/com/android/settings/applications/AppAndNotificationDashboardFragment.java
index 94c332f..4848351 100644
--- a/src/com/android/settings/applications/AppAndNotificationDashboardFragment.java
+++ b/src/com/android/settings/applications/AppAndNotificationDashboardFragment.java
@@ -16,14 +16,10 @@
 
 package com.android.settings.applications;
 
-import android.app.Activity;
-import android.app.Application;
 import android.app.settings.SettingsEnums;
 import android.content.Context;
 import android.provider.SearchIndexableResource;
 
-import androidx.fragment.app.Fragment;
-
 import com.android.settings.R;
 import com.android.settings.dashboard.DashboardFragment;
 import com.android.settings.notification.EmergencyBroadcastPreferenceController;
@@ -63,27 +59,20 @@
     @Override
     public void onAttach(Context context) {
         super.onAttach(context);
+
         use(SpecialAppAccessPreferenceController.class).setSession(getSettingsLifecycle());
+        use(RecentAppsPreferenceController.class).setFragment(this /* fragment */);
     }
 
     @Override
     protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
-        final Activity activity = getActivity();
-        final Application app;
-        if (activity != null) {
-            app = activity.getApplication();
-        } else {
-            app = null;
-        }
-        return buildPreferenceControllers(context, app, this);
+        return buildPreferenceControllers(context);
     }
 
-    private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
-            Application app, Fragment host) {
+    private static List<AbstractPreferenceController> buildPreferenceControllers(Context context) {
         final List<AbstractPreferenceController> controllers = new ArrayList<>();
         controllers.add(new EmergencyBroadcastPreferenceController(context,
                 "app_and_notif_cell_broadcast_settings"));
-        controllers.add(new RecentAppsPreferenceController(context, app, host));
         return controllers;
     }
 
@@ -100,7 +89,7 @@
                 @Override
                 public List<AbstractPreferenceController> createPreferenceControllers(
                         Context context) {
-                    return buildPreferenceControllers(context, null, null /* host */);
+                    return buildPreferenceControllers(context);
                 }
             };
 }
diff --git a/src/com/android/settings/applications/RecentAppsPreferenceController.java b/src/com/android/settings/applications/RecentAppsPreferenceController.java
index 6e0ae45..838d758 100644
--- a/src/com/android/settings/applications/RecentAppsPreferenceController.java
+++ b/src/com/android/settings/applications/RecentAppsPreferenceController.java
@@ -27,26 +27,28 @@
 import android.content.pm.PackageManager;
 import android.os.PowerManager;
 import android.os.UserHandle;
-import android.text.TextUtils;
 import android.util.ArrayMap;
 import android.util.ArraySet;
 import android.util.IconDrawableFactory;
 import android.util.Log;
+import android.view.View;
 
 import androidx.annotation.VisibleForTesting;
 import androidx.fragment.app.Fragment;
 import androidx.preference.Preference;
-import androidx.preference.PreferenceCategory;
 import androidx.preference.PreferenceScreen;
 
 import com.android.settings.R;
 import com.android.settings.applications.appinfo.AppInfoDashboardFragment;
-import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settings.applications.manageapplications.ManageApplications;
+import com.android.settings.core.BasePreferenceController;
+import com.android.settings.core.SubSettingLauncher;
 import com.android.settingslib.applications.AppUtils;
 import com.android.settingslib.applications.ApplicationsState;
-import com.android.settingslib.core.AbstractPreferenceController;
 import com.android.settingslib.utils.StringUtil;
-import com.android.settingslib.widget.apppreference.AppPreference;
+import com.android.settingslib.widget.AppEntitiesHeaderController;
+import com.android.settingslib.widget.AppEntityInfo;
+import com.android.settingslib.widget.LayoutPreference;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -58,22 +60,31 @@
 import java.util.Set;
 
 /**
- * This controller displays a list of recently used apps and a "See all" button. If there is
- * no recently used app, "See all" will be displayed as "App info".
+ * This controller displays up to three recently used apps.
+ * If there is no recently used app, we only show up an "App Info" preference.
  */
-public class RecentAppsPreferenceController extends AbstractPreferenceController
-        implements PreferenceControllerMixin, Comparator<UsageStats> {
+public class RecentAppsPreferenceController extends BasePreferenceController
+        implements Comparator<UsageStats> {
+
+    @VisibleForTesting
+    static final String KEY_ALL_APP_INFO = "all_app_info";
+    @VisibleForTesting
+    static final String KEY_DIVIDER = "recent_apps_divider";
 
     private static final String TAG = "RecentAppsCtrl";
-    private static final String KEY_PREF_CATEGORY = "recent_apps_category";
-    @VisibleForTesting
-    static final String KEY_DIVIDER = "all_app_info_divider";
-    @VisibleForTesting
-    static final String KEY_SEE_ALL = "all_app_info";
-    private static final int SHOW_RECENT_APP_COUNT = 5;
     private static final Set<String> SKIP_SYSTEM_PACKAGES = new ArraySet<>();
 
-    private final Fragment mHost;
+    @VisibleForTesting
+    AppEntitiesHeaderController mAppEntitiesController;
+    @VisibleForTesting
+    LayoutPreference mRecentAppsPreference;
+    @VisibleForTesting
+    Preference mAllAppPref;
+    @VisibleForTesting
+    Preference mDivider;
+    @VisibleForTesting
+    boolean mIsFirstLaunch;
+
     private final PackageManager mPm;
     private final UsageStatsManager mUsageStatsManager;
     private final ApplicationsState mApplicationsState;
@@ -81,12 +92,10 @@
     private final IconDrawableFactory mIconDrawableFactory;
     private final PowerManager mPowerManager;
 
+    private Fragment mHost;
     private Calendar mCal;
     private List<UsageStats> mStats;
-
-    private PreferenceCategory mCategory;
-    private Preference mSeeAllPref;
-    private Preference mDivider;
+    private List<UsageStats> mRecentApps;
     private boolean mHasRecentApps;
 
     static {
@@ -100,68 +109,74 @@
         ));
     }
 
-    public RecentAppsPreferenceController(Context context, Application app, Fragment host) {
-        this(context, app == null ? null : ApplicationsState.getInstance(app), host);
-    }
-
-    @VisibleForTesting(otherwise = VisibleForTesting.NONE)
-    RecentAppsPreferenceController(Context context, ApplicationsState appState, Fragment host) {
-        super(context);
-        mIconDrawableFactory = IconDrawableFactory.newInstance(context);
+    public RecentAppsPreferenceController(Context context, String key) {
+        super(context, key);
+        mApplicationsState = ApplicationsState.getInstance(
+                (Application) mContext.getApplicationContext());
         mUserId = UserHandle.myUserId();
-        mPm = context.getPackageManager();
-        mPowerManager = context.getSystemService(PowerManager.class);
+        mPm = mContext.getPackageManager();
+        mIconDrawableFactory = IconDrawableFactory.newInstance(mContext);
+        mPowerManager = mContext.getSystemService(PowerManager.class);
+        mUsageStatsManager = mContext.getSystemService(UsageStatsManager.class);
+        mRecentApps = new ArrayList<>();
+        mIsFirstLaunch = true;
+        reloadData();
+    }
 
-        mHost = host;
-        mUsageStatsManager =
-                (UsageStatsManager) context.getSystemService(Context.USAGE_STATS_SERVICE);
-        mApplicationsState = appState;
+    public void setFragment(Fragment fragment) {
+        mHost = fragment;
     }
 
     @Override
-    public boolean isAvailable() {
-        return true;
-    }
-
-    @Override
-    public String getPreferenceKey() {
-        return KEY_PREF_CATEGORY;
-    }
-
-    @Override
-    public void updateNonIndexableKeys(List<String> keys) {
-        PreferenceControllerMixin.super.updateNonIndexableKeys(keys);
-        // Don't index category name into search. It's not actionable.
-        keys.add(KEY_PREF_CATEGORY);
-        keys.add(KEY_DIVIDER);
+    public int getAvailabilityStatus() {
+        return mRecentApps.isEmpty() ? AVAILABLE_UNSEARCHABLE : AVAILABLE;
     }
 
     @Override
     public void displayPreference(PreferenceScreen screen) {
-        mCategory = screen.findPreference(getPreferenceKey());
-        mSeeAllPref = screen.findPreference(KEY_SEE_ALL);
-        mDivider = screen.findPreference(KEY_DIVIDER);
         super.displayPreference(screen);
-        refreshUi(mCategory.getContext());
+
+        mAllAppPref = screen.findPreference(KEY_ALL_APP_INFO);
+        mDivider = screen.findPreference(KEY_DIVIDER);
+        mRecentAppsPreference = (LayoutPreference) screen.findPreference(getPreferenceKey());
+        final View view = mRecentAppsPreference.findViewById(R.id.app_entities_header);
+        mAppEntitiesController = AppEntitiesHeaderController.newInstance(mContext, view)
+                .setHeaderTitleRes(R.string.recent_app_category_title)
+                .setHeaderDetailsClickListener((View v) -> {
+                    new SubSettingLauncher(mContext)
+                            .setDestination(ManageApplications.class.getName())
+                            .setArguments(null /* arguments */)
+                            .setTitleRes(R.string.application_info_label)
+                            .setSourceMetricsCategory(SettingsEnums.SETTINGS_APP_NOTIF_CATEGORY)
+                            .launch();
+                });
+
+        refreshUi();
     }
 
     @Override
     public void updateState(Preference preference) {
         super.updateState(preference);
-        refreshUi(mCategory.getContext());
+        // In order to improve launch time, we don't load data again at first launch.
+        if (!mIsFirstLaunch) {
+            reloadData();
+            refreshUi();
+        }
         // Show total number of installed apps as See all's summary.
         new InstalledAppCounter(mContext, InstalledAppCounter.IGNORE_INSTALL_REASON,
                 mContext.getPackageManager()) {
             @Override
             protected void onCountComplete(int num) {
                 if (mHasRecentApps) {
-                    mSeeAllPref.setTitle(mContext.getString(R.string.see_all_apps_title, num));
+                    mAppEntitiesController.setHeaderDetails(
+                            mContext.getString(R.string.see_all_apps_title, num));
+                    mAppEntitiesController.apply();
                 } else {
-                    mSeeAllPref.setSummary(mContext.getString(R.string.apps_summary, num));
+                    mAllAppPref.setSummary(mContext.getString(R.string.apps_summary, num));
                 }
             }
         }.execute();
-
+        mIsFirstLaunch = false;
     }
 
     @Override
@@ -171,12 +186,10 @@
     }
 
     @VisibleForTesting
-    void refreshUi(Context prefContext) {
-        reloadData();
-        final List<UsageStats> recentApps = getDisplayableRecentAppList();
-        if (recentApps != null && !recentApps.isEmpty()) {
+    void refreshUi() {
+        if (mRecentApps != null && !mRecentApps.isEmpty()) {
             mHasRecentApps = true;
-            displayRecentApps(prefContext, recentApps);
+            displayRecentApps();
         } else {
             mHasRecentApps = false;
             displayOnlyAppInfo();
@@ -192,80 +205,59 @@
                 : mUsageStatsManager.queryUsageStats(
                         UsageStatsManager.INTERVAL_BEST, mCal.getTimeInMillis(),
                         System.currentTimeMillis());
+
+        updateDisplayableRecentAppList();
     }
 
     private void displayOnlyAppInfo() {
-        mCategory.setTitle(null);
         mDivider.setVisible(false);
-        mSeeAllPref.setTitle(R.string.applications_settings);
-        mSeeAllPref.setIcon(null);
-        int prefCount = mCategory.getPreferenceCount();
-        for (int i = prefCount - 1; i >= 0; i--) {
-            final Preference pref = mCategory.getPreference(i);
-            if (!TextUtils.equals(pref.getKey(), KEY_SEE_ALL)) {
-                mCategory.removePreference(pref);
-            }
-        }
+        mAllAppPref.setTitle(R.string.applications_settings);
+        mAllAppPref.setVisible(true);
+        mRecentAppsPreference.setVisible(false);
     }
 
-    private void displayRecentApps(Context prefContext, List<UsageStats> recentApps) {
-        mCategory.setTitle(R.string.recent_app_category_title);
+    private void displayRecentApps() {
+        int showAppsCount = 0;
+
+        for (UsageStats stat : mRecentApps) {
+            final AppEntityInfo appEntityInfoInfo = createAppEntity(stat);
+            if (appEntityInfoInfo != null) {
+                mAppEntitiesController.setAppEntity(showAppsCount++, appEntityInfoInfo);
+            }
+
+            if (showAppsCount == AppEntitiesHeaderController.MAXIMUM_APPS) {
+                break;
+            }
+        }
+        mAppEntitiesController.apply();
+        mRecentAppsPreference.setVisible(true);
+        mAllAppPref.setVisible(false);
         mDivider.setVisible(true);
-        mSeeAllPref.setSummary(null);
-        mSeeAllPref.setIcon(R.drawable.ic_chevron_right_24dp);
-
-        // Rebind prefs/avoid adding new prefs if possible. Adding/removing prefs causes jank.
-        // Build a cached preference pool
-        final Map<String, Preference> appPreferences = new ArrayMap<>();
-        int prefCount = mCategory.getPreferenceCount();
-        for (int i = 0; i < prefCount; i++) {
-            final Preference pref = mCategory.getPreference(i);
-            final String key = pref.getKey();
-            if (!TextUtils.equals(key, KEY_SEE_ALL)) {
-                appPreferences.put(key, pref);
-            }
-        }
-        final int recentAppsCount = recentApps.size();
-        for (int i = 0; i < recentAppsCount; i++) {
-            final UsageStats stat = recentApps.get(i);
-            // Bind recent apps to existing prefs if possible, or create a new pref.
-            final String pkgName = stat.getPackageName();
-            final ApplicationsState.AppEntry appEntry =
-                    mApplicationsState.getEntry(pkgName, mUserId);
-            if (appEntry == null) {
-                continue;
-            }
-
-            boolean rebindPref = true;
-            Preference pref = appPreferences.remove(pkgName);
-            if (pref == null) {
-                pref = new AppPreference(prefContext);
-                rebindPref = false;
-            }
-            pref.setKey(pkgName);
-            pref.setTitle(appEntry.label);
-            pref.setIcon(mIconDrawableFactory.getBadgedIcon(appEntry.info));
-            pref.setSummary(StringUtil.formatRelativeTime(mContext,
-                    System.currentTimeMillis() - stat.getLastTimeUsed(), false));
-            pref.setOrder(i);
-            pref.setOnPreferenceClickListener(preference -> {
-                AppInfoBase.startAppInfoFragment(AppInfoDashboardFragment.class,
-                        R.string.application_info_label, pkgName, appEntry.info.uid, mHost,
-                        1001 /*RequestCode*/, SettingsEnums.SETTINGS_APP_NOTIF_CATEGORY);
-                return true;
-            });
-            if (!rebindPref) {
-                mCategory.addPreference(pref);
-            }
-        }
-        // Remove unused prefs from pref cache pool
-        for (Preference unusedPrefs : appPreferences.values()) {
-            mCategory.removePreference(unusedPrefs);
-        }
     }
 
-    private List<UsageStats> getDisplayableRecentAppList() {
-        final List<UsageStats> recentApps = new ArrayList<>();
+    private AppEntityInfo createAppEntity(UsageStats stat) {
+        final String pkgName = stat.getPackageName();
+        final ApplicationsState.AppEntry appEntry =
+                mApplicationsState.getEntry(pkgName, mUserId);
+        if (appEntry == null) {
+            return null;
+        }
+
+        return new AppEntityInfo.Builder()
+                .setIcon(mIconDrawableFactory.getBadgedIcon(appEntry.info))
+                .setTitle(appEntry.label)
+                .setSummary(StringUtil.formatRelativeTime(mContext,
+                        System.currentTimeMillis() - stat.getLastTimeUsed(), false))
+                .setOnClickListener(v ->
+                        AppInfoBase.startAppInfoFragment(AppInfoDashboardFragment.class,
+                                R.string.application_info_label, pkgName, appEntry.info.uid,
+                                mHost, 1001 /*RequestCode*/,
+                                SettingsEnums.SETTINGS_APP_NOTIF_CATEGORY))
+                .build();
+    }
+
+    private void updateDisplayableRecentAppList() {
+        mRecentApps.clear();
         final Map<String, UsageStats> map = new ArrayMap<>();
         final int statCount = mStats.size();
         for (int i = 0; i < statCount; i++) {
@@ -291,13 +283,12 @@
             if (appEntry == null) {
                 continue;
             }
-            recentApps.add(stat);
+            mRecentApps.add(stat);
             count++;
-            if (count >= SHOW_RECENT_APP_COUNT) {
+            if (count >= AppEntitiesHeaderController.MAXIMUM_APPS) {
                 break;
             }
         }
-        return recentApps;
     }
 
 
diff --git a/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java b/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java
index 4b8efd4..64c9866 100644
--- a/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java
+++ b/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java
@@ -16,36 +16,72 @@
 
 package com.android.settings.bluetooth;
 
+import android.bluetooth.BluetoothAdapter;
 import android.bluetooth.BluetoothDevice;
 import android.content.Context;
+import android.graphics.Bitmap;
 import android.graphics.PorterDuff;
 import android.graphics.PorterDuffColorFilter;
 import android.graphics.drawable.Drawable;
+import android.net.Uri;
+import android.os.Handler;
+import android.os.Looper;
+import android.provider.MediaStore;
+import android.util.Log;
+import android.view.View;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
 import androidx.annotation.VisibleForTesting;
-import androidx.core.graphics.drawable.IconCompat;
 import androidx.preference.PreferenceScreen;
 
 import com.android.settings.R;
 import com.android.settings.core.BasePreferenceController;
 import com.android.settings.fuelgauge.BatteryMeterView;
 import com.android.settingslib.bluetooth.CachedBluetoothDevice;
+import com.android.settingslib.core.lifecycle.LifecycleObserver;
+import com.android.settingslib.core.lifecycle.events.OnStart;
+import com.android.settingslib.core.lifecycle.events.OnStop;
+import com.android.settingslib.utils.ThreadUtils;
 import com.android.settingslib.widget.LayoutPreference;
 
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * This class adds a header with device name and status (connected/disconnected, etc.).
  */
-public class AdvancedBluetoothDetailsHeaderController extends BasePreferenceController {
+public class AdvancedBluetoothDetailsHeaderController extends BasePreferenceController implements
+        LifecycleObserver, OnStart, OnStop, CachedBluetoothDevice.Callback {
+    private static final String TAG = "AdvancedBtHeaderCtrl";
 
     @VisibleForTesting
     LayoutPreference mLayoutPreference;
+    @VisibleForTesting
+    final Map<String, Bitmap> mIconCache;
     private CachedBluetoothDevice mCachedDevice;
+    @VisibleForTesting
+    BluetoothAdapter mBluetoothAdapter;
+    @VisibleForTesting
+    Handler mHandler = new Handler(Looper.getMainLooper());
+    @VisibleForTesting
+    final BluetoothAdapter.MetadataListener mMetadataListener =
+            new BluetoothAdapter.MetadataListener() {
+                @Override
+                public void onMetadataChanged(BluetoothDevice device, int key, String value) {
+                    super.onMetadataChanged(device, key, value);
+                    Log.i(TAG, String.format("Metadata updated in Device %s: %d = %s.", device, key,
+                            value));
+                    refresh();
+                }
+            };
 
     public AdvancedBluetoothDetailsHeaderController(Context context, String prefKey) {
         super(context, prefKey);
+        mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
+        mIconCache = new HashMap<>();
     }
 
     @Override
@@ -60,9 +96,31 @@
         super.displayPreference(screen);
         mLayoutPreference = screen.findPreference(getPreferenceKey());
         mLayoutPreference.setVisible(isAvailable());
+
         refresh();
     }
 
+    @Override
+    public void onStart() {
+        mCachedDevice.registerCallback(this::onDeviceAttributesChanged);
+        mBluetoothAdapter.registerMetadataListener(mCachedDevice.getDevice(), mMetadataListener,
+                mHandler);
+    }
+
+    @Override
+    public void onStop() {
+        mCachedDevice.unregisterCallback(this::onDeviceAttributesChanged);
+        mBluetoothAdapter.unregisterMetadataListener(mCachedDevice.getDevice());
+
+        // Destroy icon bitmap associated with this header
+        for (Bitmap bitmap : mIconCache.values()) {
+            if (bitmap != null) {
+                bitmap.recycle();
+            }
+        }
+        mIconCache.clear();
+    }
+
     public void init(CachedBluetoothDevice cachedBluetoothDevice) {
         mCachedDevice = cachedBluetoothDevice;
     }
@@ -75,25 +133,33 @@
             final TextView summary = mLayoutPreference.findViewById(R.id.entity_header_summary);
             summary.setText(mCachedDevice.getConnectionSummary());
 
+            if (!mCachedDevice.isConnected()) {
+                updateDisconnectLayout();
+                return;
+            }
+
             updateSubLayout(mLayoutPreference.findViewById(R.id.layout_left),
                     BluetoothDevice.METADATA_UNTHETHERED_LEFT_ICON,
                     BluetoothDevice.METADATA_UNTHETHERED_LEFT_BATTERY,
+                    BluetoothDevice.METADATA_UNTHETHERED_LEFT_CHARGING,
                     R.string.bluetooth_left_name);
 
             updateSubLayout(mLayoutPreference.findViewById(R.id.layout_middle),
                     BluetoothDevice.METADATA_UNTHETHERED_CASE_ICON,
                     BluetoothDevice.METADATA_UNTHETHERED_CASE_BATTERY,
+                    BluetoothDevice.METADATA_UNTHETHERED_CASE_CHARGING,
                     R.string.bluetooth_middle_name);
 
             updateSubLayout(mLayoutPreference.findViewById(R.id.layout_right),
                     BluetoothDevice.METADATA_UNTHETHERED_RIGHT_ICON,
                     BluetoothDevice.METADATA_UNTHETHERED_RIGHT_BATTERY,
+                    BluetoothDevice.METADATA_UNTHETHERED_RIGHT_CHARGING,
                     R.string.bluetooth_right_name);
         }
     }
 
     @VisibleForTesting
-    Drawable createBtBatteryIcon(Context context, int level) {
+    Drawable createBtBatteryIcon(Context context, int level, boolean charging) {
         final BatteryMeterView.BatteryMeterDrawable drawable =
                 new BatteryMeterView.BatteryMeterDrawable(context,
                         context.getColor(R.color.meter_background_color));
@@ -103,12 +169,13 @@
                 com.android.settings.Utils.getColorAttrDefaultColor(context,
                         android.R.attr.colorControlNormal),
                 PorterDuff.Mode.SRC_IN));
+        drawable.setCharging(charging);
 
         return drawable;
     }
 
     private void updateSubLayout(LinearLayout linearLayout, int iconMetaKey, int batteryMetaKey,
-            int titleResId) {
+            int chargeMetaKey, int titleResId) {
         if (linearLayout == null) {
             return;
         }
@@ -116,19 +183,79 @@
         final String iconUri = Utils.getStringMetaData(bluetoothDevice, iconMetaKey);
         if (iconUri != null) {
             final ImageView imageView = linearLayout.findViewById(R.id.header_icon);
-            final IconCompat iconCompat = IconCompat.createWithContentUri(iconUri);
-            imageView.setImageBitmap(iconCompat.getBitmap());
+            updateIcon(imageView, iconUri);
         }
 
         final int batteryLevel = Utils.getIntMetaData(bluetoothDevice, batteryMetaKey);
+        final boolean charging = Utils.getBooleanMetaData(bluetoothDevice, chargeMetaKey);
         if (batteryLevel != Utils.META_INT_ERROR) {
+            linearLayout.setVisibility(View.VISIBLE);
             final ImageView imageView = linearLayout.findViewById(R.id.bt_battery_icon);
-            imageView.setImageDrawable(createBtBatteryIcon(mContext, batteryLevel));
+            imageView.setImageDrawable(createBtBatteryIcon(mContext, batteryLevel, charging));
+            imageView.setVisibility(View.VISIBLE);
             final TextView textView = linearLayout.findViewById(R.id.bt_battery_summary);
             textView.setText(com.android.settings.Utils.formatPercentage(batteryLevel));
+            textView.setVisibility(View.VISIBLE);
+        } else {
+            // Hide it if it doesn't have battery information
+            linearLayout.setVisibility(View.GONE);
         }
 
         final TextView textView = linearLayout.findViewById(R.id.header_title);
         textView.setText(titleResId);
+        textView.setVisibility(View.VISIBLE);
+    }
+
+    private void updateDisconnectLayout() {
+        mLayoutPreference.findViewById(R.id.layout_left).setVisibility(View.GONE);
+        mLayoutPreference.findViewById(R.id.layout_right).setVisibility(View.GONE);
+
+        // Hide title, battery icon and battery summary
+        final LinearLayout linearLayout = mLayoutPreference.findViewById(R.id.layout_middle);
+        linearLayout.setVisibility(View.VISIBLE);
+        linearLayout.findViewById(R.id.header_title).setVisibility(View.GONE);
+        linearLayout.findViewById(R.id.bt_battery_summary).setVisibility(View.GONE);
+        linearLayout.findViewById(R.id.bt_battery_icon).setVisibility(View.GONE);
+
+        // Only show bluetooth icon
+        final BluetoothDevice bluetoothDevice = mCachedDevice.getDevice();
+        final String iconUri = Utils.getStringMetaData(bluetoothDevice,
+                BluetoothDevice.METADATA_MAIN_ICON);
+        if (iconUri != null) {
+            final ImageView imageView = linearLayout.findViewById(R.id.header_icon);
+            updateIcon(imageView, iconUri);
+        }
+    }
+
+    /**
+     * Update icon by {@code iconUri}. If icon exists in cache, use it; otherwise extract it
+     * from uri in background thread and update it in main thread.
+     */
+    @VisibleForTesting
+    void updateIcon(ImageView imageView, String iconUri) {
+        if (mIconCache.containsKey(iconUri)) {
+            imageView.setImageBitmap(mIconCache.get(iconUri));
+            return;
+        }
+
+        ThreadUtils.postOnBackgroundThread(() -> {
+            try {
+                final Bitmap bitmap = MediaStore.Images.Media.getBitmap(
+                        mContext.getContentResolver(), Uri.parse(iconUri));
+                ThreadUtils.postOnMainThread(() -> {
+                    mIconCache.put(iconUri, bitmap);
+                    imageView.setImageBitmap(bitmap);
+                });
+            } catch (IOException e) {
+                Log.e(TAG, "Failed to get bitmap for: " + iconUri);
+            }
+        });
+    }
+
+    @Override
+    public void onDeviceAttributesChanged() {
+        if (mCachedDevice != null) {
+            refresh();
+        }
     }
 }
diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsButtonsController.java b/src/com/android/settings/bluetooth/BluetoothDetailsButtonsController.java
index af15052..a7fae14 100644
--- a/src/com/android/settings/bluetooth/BluetoothDetailsButtonsController.java
+++ b/src/com/android/settings/bluetooth/BluetoothDetailsButtonsController.java
@@ -16,7 +16,6 @@
 
 package com.android.settings.bluetooth;
 
-import android.bluetooth.BluetoothDevice;
 import android.content.Context;
 
 import androidx.preference.PreferenceFragmentCompat;
@@ -44,13 +43,6 @@
         mIsConnected = device.isConnected();
     }
 
-    @Override
-    public boolean isAvailable() {
-        final boolean unthetheredHeadset = Utils.getBooleanMetaData(mCachedDevice.getDevice(),
-                BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET);
-        return !unthetheredHeadset;
-    }
-
     private void onForgetButtonPressed() {
         ForgetDeviceDialogFragment fragment =
                 ForgetDeviceDialogFragment.newInstance(mCachedDevice.getAddress());
diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java b/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java
index 994daa7..fd805b8 100644
--- a/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java
+++ b/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java
@@ -16,6 +16,7 @@
 
 package com.android.settings.bluetooth;
 
+import android.bluetooth.BluetoothDevice;
 import android.content.Context;
 import android.graphics.drawable.Drawable;
 import android.util.Pair;
@@ -51,6 +52,12 @@
     }
 
     @Override
+    public boolean isAvailable() {
+        return !Utils.getBooleanMetaData(mCachedDevice.getDevice(),
+                BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET);
+    }
+
+    @Override
     protected void init(PreferenceScreen screen) {
         final LayoutPreference headerPreference = screen.findPreference(KEY_DEVICE_HEADER);
         mHeaderController = EntityHeaderController.newInstance(mFragment.getActivity(), mFragment,
diff --git a/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragment.java b/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragment.java
index 2fbd061..36cbd5d 100644
--- a/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragment.java
+++ b/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragment.java
@@ -121,7 +121,7 @@
                 FeatureFlags.SLICE_INJECTION);
 
         use(BlockingSlicePrefController.class).setSliceUri(injectionEnabled
-                ? featureProvider.getBluetoothDeviceSettingsUri(mDeviceAddress)
+                ? featureProvider.getBluetoothDeviceSettingsUri(mCachedDevice.getDevice())
                 : null);
     }
 
diff --git a/src/com/android/settings/bluetooth/BluetoothFeatureProvider.java b/src/com/android/settings/bluetooth/BluetoothFeatureProvider.java
index 2bca038..582a26c 100644
--- a/src/com/android/settings/bluetooth/BluetoothFeatureProvider.java
+++ b/src/com/android/settings/bluetooth/BluetoothFeatureProvider.java
@@ -16,6 +16,7 @@
 
 package com.android.settings.bluetooth;
 
+import android.bluetooth.BluetoothDevice;
 import android.net.Uri;
 
 /**
@@ -25,8 +26,8 @@
 
     /**
      * Get the {@link Uri} that represents extra settings for a specific bluetooth device
-     * @param macAddress Bluetooth mac address
+     * @param bluetoothDevice bluetooth device
      * @return {@link Uri} for extra settings
      */
-    Uri getBluetoothDeviceSettingsUri(String macAddress);
+    Uri getBluetoothDeviceSettingsUri(BluetoothDevice bluetoothDevice);
 }
diff --git a/src/com/android/settings/bluetooth/BluetoothFeatureProviderImpl.java b/src/com/android/settings/bluetooth/BluetoothFeatureProviderImpl.java
index dcdc2fd7..e486b68 100644
--- a/src/com/android/settings/bluetooth/BluetoothFeatureProviderImpl.java
+++ b/src/com/android/settings/bluetooth/BluetoothFeatureProviderImpl.java
@@ -16,11 +16,10 @@
 
 package com.android.settings.bluetooth;
 
+import android.bluetooth.BluetoothDevice;
 import android.content.Context;
 import android.net.Uri;
 
-import com.android.settings.R;
-
 /**
  * Impl of {@link BluetoothFeatureProvider}
  */
@@ -33,9 +32,9 @@
     }
 
     @Override
-    public Uri getBluetoothDeviceSettingsUri(String macAddress) {
-        final String uriString = mContext.getString(R.string.config_bluetooth_device_settings_uri,
-                macAddress);
-        return Uri.parse(uriString);
+    public Uri getBluetoothDeviceSettingsUri(BluetoothDevice bluetoothDevice) {
+        final String uriString = bluetoothDevice.getMetadata(
+                BluetoothDevice.METADATA_ENHANCED_SETTINGS_UI_URI);
+        return uriString != null ? Uri.parse(uriString) : null;
     }
 }
diff --git a/src/com/android/settings/core/FeatureFlags.java b/src/com/android/settings/core/FeatureFlags.java
index 78fdfe7..f2ffe22 100644
--- a/src/com/android/settings/core/FeatureFlags.java
+++ b/src/com/android/settings/core/FeatureFlags.java
@@ -21,7 +21,6 @@
  */
 public class FeatureFlags {
     public static final String AUDIO_SWITCHER_SETTINGS = "settings_audio_switcher";
-    public static final String DYNAMIC_HOMEPAGE = "settings_dynamic_homepage";
     public static final String HEARING_AID_SETTINGS = "settings_bluetooth_hearing_aid";
     public static final String MOBILE_NETWORK_V2 = "settings_mobile_network_v2";
     public static final String WIFI_MAC_RANDOMIZATION = "settings_wifi_mac_randomization";
diff --git a/src/com/android/settings/core/gateway/SettingsGateway.java b/src/com/android/settings/core/gateway/SettingsGateway.java
index fb3d0c5..5e32e71 100644
--- a/src/com/android/settings/core/gateway/SettingsGateway.java
+++ b/src/com/android/settings/core/gateway/SettingsGateway.java
@@ -49,9 +49,9 @@
 import com.android.settings.applications.specialaccess.pictureinpicture.PictureInPictureDetails;
 import com.android.settings.applications.specialaccess.pictureinpicture.PictureInPictureSettings;
 import com.android.settings.applications.specialaccess.vrlistener.VrListenerSettings;
-import com.android.settings.backup.UserBackupSettingsActivity;
 import com.android.settings.backup.PrivacySettings;
 import com.android.settings.backup.ToggleBackupSettingFragment;
+import com.android.settings.backup.UserBackupSettingsActivity;
 import com.android.settings.biometrics.face.FaceSettings;
 import com.android.settings.bluetooth.BluetoothDeviceDetailsFragment;
 import com.android.settings.connecteddevice.AdvancedConnectedDeviceDashboardFragment;
@@ -68,6 +68,7 @@
 import com.android.settings.deviceinfo.StorageDashboardFragment;
 import com.android.settings.deviceinfo.StorageSettings;
 import com.android.settings.deviceinfo.aboutphone.MyDeviceInfoFragment;
+import com.android.settings.deviceinfo.firmwareversion.FirmwareVersionSettings;
 import com.android.settings.display.NightDisplaySettings;
 import com.android.settings.dream.DreamSettings;
 import com.android.settings.enterprise.EnterprisePrivacySettings;
@@ -101,6 +102,7 @@
 import com.android.settings.notification.ChannelNotificationSettings;
 import com.android.settings.notification.ConfigureNotificationSettings;
 import com.android.settings.notification.NotificationAccessSettings;
+import com.android.settings.notification.NotificationAssistantPicker;
 import com.android.settings.notification.NotificationStation;
 import com.android.settings.notification.SoundSettings;
 import com.android.settings.notification.ZenAccessSettings;
@@ -165,6 +167,7 @@
             DisplaySettings.class.getName(),
             MyDeviceInfoFragment.class.getName(),
             ManageApplications.class.getName(),
+            FirmwareVersionSettings.class.getName(),
             ManageAssist.class.getName(),
             ProcessStatsUi.class.getName(),
             NotificationStation.class.getName(),
@@ -218,6 +221,7 @@
             AppInfoDashboardFragment.class.getName(),
             BatterySaverSettings.class.getName(),
             AppNotificationSettings.class.getName(),
+            NotificationAssistantPicker.class.getName(),
             ChannelNotificationSettings.class.getName(),
             ChannelGroupNotificationSettings.class.getName(),
             ApnSettings.class.getName(),
diff --git a/src/com/android/settings/development/FileEncryptionPreferenceController.java b/src/com/android/settings/development/FileEncryptionPreferenceController.java
index 8aadfb9..82a58ba 100644
--- a/src/com/android/settings/development/FileEncryptionPreferenceController.java
+++ b/src/com/android/settings/development/FileEncryptionPreferenceController.java
@@ -63,7 +63,8 @@
 
     @Override
     public void updateState(Preference preference) {
-        if (!TextUtils.equals("file", CryptoProperties.type().orElse("none"))) {
+        if (CryptoProperties.type().orElse(CryptoProperties.type_values.NONE) !=
+            CryptoProperties.type_values.FILE) {
             return;
         }
 
diff --git a/src/com/android/settings/deviceinfo/BuildNumberPreferenceController.java b/src/com/android/settings/deviceinfo/BuildNumberPreferenceController.java
index ec0ab36..f13af94 100644
--- a/src/com/android/settings/deviceinfo/BuildNumberPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/BuildNumberPreferenceController.java
@@ -42,7 +42,6 @@
 import com.android.settings.core.InstrumentedPreferenceFragment;
 import com.android.settings.overlay.FeatureFactory;
 import com.android.settings.password.ChooseLockSettingsHelper;
-import com.android.settings.slices.Copyable;
 import com.android.settingslib.RestrictedLockUtils;
 import com.android.settingslib.RestrictedLockUtilsInternal;
 import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
@@ -50,7 +49,7 @@
 import com.android.settingslib.core.lifecycle.events.OnStart;
 import com.android.settingslib.development.DevelopmentSettingsEnabler;
 
-public class BuildNumberPreferenceController extends BasePreferenceController implements Copyable,
+public class BuildNumberPreferenceController extends BasePreferenceController implements
         LifecycleObserver, OnStart {
 
     static final int TAPS_TO_BE_A_DEVELOPER = 7;
@@ -109,6 +108,11 @@
     }
 
     @Override
+    public boolean isCopyableSlice() {
+        return true;
+    }
+
+    @Override
     public void copy() {
         final ClipboardManager clipboard = (ClipboardManager) mContext.getSystemService(
                 CLIPBOARD_SERVICE);
diff --git a/src/com/android/settings/deviceinfo/HardwareInfoDialogFragment.java b/src/com/android/settings/deviceinfo/HardwareInfoDialogFragment.java
deleted file mode 100644
index 34a7143..0000000
--- a/src/com/android/settings/deviceinfo/HardwareInfoDialogFragment.java
+++ /dev/null
@@ -1,91 +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.deviceinfo;
-
-import android.app.Dialog;
-import android.app.settings.SettingsEnums;
-import android.os.Build;
-import android.os.Bundle;
-import android.os.SystemProperties;
-import android.text.TextUtils;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.TextView;
-
-import androidx.annotation.VisibleForTesting;
-import androidx.appcompat.app.AlertDialog;
-
-import com.android.settings.R;
-import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
-
-public class HardwareInfoDialogFragment extends InstrumentedDialogFragment {
-
-    public static final String TAG = "HardwareInfo";
-
-    @Override
-    public int getMetricsCategory() {
-        return SettingsEnums.DIALOG_SETTINGS_HARDWARE_INFO;
-    }
-
-    public static HardwareInfoDialogFragment newInstance() {
-        final HardwareInfoDialogFragment fragment = new HardwareInfoDialogFragment();
-        return fragment;
-    }
-
-    @Override
-    public Dialog onCreateDialog(Bundle savedInstanceState) {
-        final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity())
-                .setTitle(R.string.hardware_info)
-                .setPositiveButton(android.R.string.ok, null);
-        final View content = LayoutInflater.from(builder.getContext())
-                .inflate(R.layout.dialog_hardware_info, null /* parent */);
-        // Model
-        setText(content, R.id.model_label, R.id.model_value,
-                DeviceModelPreferenceController.getDeviceModel());
-
-        // Serial number
-        setText(content, R.id.serial_number_label, R.id.serial_number_value, getSerialNumber());
-
-        // Hardware rev
-        setText(content, R.id.hardware_rev_label, R.id.hardware_rev_value,
-                SystemProperties.get("ro.boot.hardware.revision"));
-
-        return builder.setView(content).create();
-    }
-
-    @VisibleForTesting
-    void setText(View content, int labelViewId, int valueViewId, String value) {
-        if (content == null) {
-            return;
-        }
-        final View labelView = content.findViewById(labelViewId);
-        final TextView valueView = content.findViewById(valueViewId);
-        if (!TextUtils.isEmpty(value)) {
-            labelView.setVisibility(View.VISIBLE);
-            valueView.setVisibility(View.VISIBLE);
-            valueView.setText(value);
-        } else {
-            labelView.setVisibility(View.GONE);
-            valueView.setVisibility(View.GONE);
-        }
-    }
-
-    @VisibleForTesting
-    String getSerialNumber() {
-        return Build.getSerial();
-    }
-}
diff --git a/src/com/android/settings/deviceinfo/DeviceModelPreferenceController.java b/src/com/android/settings/deviceinfo/HardwareInfoPreferenceController.java
similarity index 71%
rename from src/com/android/settings/deviceinfo/DeviceModelPreferenceController.java
rename to src/com/android/settings/deviceinfo/HardwareInfoPreferenceController.java
index 2797153..29f1391 100644
--- a/src/com/android/settings/deviceinfo/DeviceModelPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/HardwareInfoPreferenceController.java
@@ -17,11 +17,8 @@
 
 import android.content.Context;
 import android.os.Build;
-import android.text.TextUtils;
 import android.util.Log;
 
-import androidx.fragment.app.Fragment;
-import androidx.preference.Preference;
 import androidx.preference.PreferenceScreen;
 
 import com.android.settings.R;
@@ -31,21 +28,14 @@
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.FutureTask;
 
-public class DeviceModelPreferenceController extends BasePreferenceController {
-
+public class HardwareInfoPreferenceController extends BasePreferenceController {
 
     private static final String TAG = "DeviceModelPrefCtrl";
 
-    private Fragment mHost;
-
-    public DeviceModelPreferenceController(Context context, String key) {
+    public HardwareInfoPreferenceController(Context context, String key) {
         super(context, key);
     }
 
-    public void setHost(Fragment fragment) {
-        mHost = fragment;
-    }
-
     @Override
     public void displayPreference(PreferenceScreen screen) {
         super.displayPreference(screen);
@@ -54,7 +44,7 @@
     @Override
     public int getAvailabilityStatus() {
         return mContext.getResources().getBoolean(R.bool.config_show_device_model)
-                ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
+                ? AVAILABLE_UNSEARCHABLE : UNSUPPORTED_ON_DEVICE;
     }
 
     @Override
@@ -62,21 +52,6 @@
         return mContext.getResources().getString(R.string.model_summary, getDeviceModel());
     }
 
-    @Override
-    public boolean handlePreferenceTreeClick(Preference preference) {
-        if (!TextUtils.equals(preference.getKey(), getPreferenceKey())) {
-            return false;
-        }
-        final HardwareInfoDialogFragment fragment = HardwareInfoDialogFragment.newInstance();
-        fragment.show(mHost.getFragmentManager(), HardwareInfoDialogFragment.TAG);
-        return true;
-    }
-
-    @Override
-    public boolean isSliceable() {
-        return true;
-    }
-
     public static String getDeviceModel() {
         FutureTask<String> msvSuffixTask = new FutureTask<>(() -> DeviceInfoUtils.getMsvSuffix());
 
diff --git a/src/com/android/settings/deviceinfo/PhoneNumberPreferenceController.java b/src/com/android/settings/deviceinfo/PhoneNumberPreferenceController.java
index 598dfb1..3767860 100644
--- a/src/com/android/settings/deviceinfo/PhoneNumberPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/PhoneNumberPreferenceController.java
@@ -35,14 +35,12 @@
 
 import com.android.settings.R;
 import com.android.settings.core.BasePreferenceController;
-import com.android.settings.slices.Copyable;
 import com.android.settingslib.DeviceInfoUtils;
 
 import java.util.ArrayList;
 import java.util.List;
 
-public class PhoneNumberPreferenceController extends BasePreferenceController implements
-        Copyable {
+public class PhoneNumberPreferenceController extends BasePreferenceController {
 
     private final static String KEY_PHONE_NUMBER = "phone_number";
 
@@ -99,6 +97,11 @@
     }
 
     @Override
+    public boolean isCopyableSlice() {
+        return true;
+    }
+
+    @Override
     public void copy() {
         final ClipboardManager clipboard = (ClipboardManager) mContext.getSystemService(
                 CLIPBOARD_SERVICE);
diff --git a/src/com/android/settings/deviceinfo/aboutphone/MyDeviceInfoFragment.java b/src/com/android/settings/deviceinfo/aboutphone/MyDeviceInfoFragment.java
index 0116c42..e6afb7b 100644
--- a/src/com/android/settings/deviceinfo/aboutphone/MyDeviceInfoFragment.java
+++ b/src/com/android/settings/deviceinfo/aboutphone/MyDeviceInfoFragment.java
@@ -31,7 +31,6 @@
 import com.android.settings.dashboard.DashboardFragment;
 import com.android.settings.deviceinfo.BluetoothAddressPreferenceController;
 import com.android.settings.deviceinfo.BuildNumberPreferenceController;
-import com.android.settings.deviceinfo.DeviceModelPreferenceController;
 import com.android.settings.deviceinfo.DeviceNamePreferenceController;
 import com.android.settings.deviceinfo.FccEquipmentIdPreferenceController;
 import com.android.settings.deviceinfo.FeedbackPreferenceController;
@@ -41,7 +40,6 @@
 import com.android.settings.deviceinfo.SafetyInfoPreferenceController;
 import com.android.settings.deviceinfo.UptimePreferenceController;
 import com.android.settings.deviceinfo.WifiMacAddressPreferenceController;
-import com.android.settings.deviceinfo.firmwareversion.FirmwareVersionPreferenceController;
 import com.android.settings.deviceinfo.imei.ImeiInfoPreferenceController;
 import com.android.settings.deviceinfo.simstatus.SimStatusPreferenceController;
 import com.android.settings.search.BaseSearchIndexProvider;
@@ -77,8 +75,6 @@
     @Override
     public void onAttach(Context context) {
         super.onAttach(context);
-        use(FirmwareVersionPreferenceController.class).setHost(this /* parent */);
-        use(DeviceModelPreferenceController.class).setHost(this /* parent */);
         use(ImeiInfoPreferenceController.class).setHost(this /* parent */);
         use(DeviceNamePreferenceController.class).setHost(this /* parent */);
         mBuildNumberPreferenceController = use(BuildNumberPreferenceController.class);
diff --git a/src/com/android/settings/deviceinfo/firmwareversion/BasebandVersionDialogController.java b/src/com/android/settings/deviceinfo/firmwareversion/BasebandVersionDialogController.java
deleted file mode 100644
index 0e36d85..0000000
--- a/src/com/android/settings/deviceinfo/firmwareversion/BasebandVersionDialogController.java
+++ /dev/null
@@ -1,56 +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.deviceinfo.firmwareversion;
-
-import android.content.Context;
-import android.os.SystemProperties;
-
-import androidx.annotation.VisibleForTesting;
-
-import com.android.settings.R;
-import com.android.settings.Utils;
-
-public class BasebandVersionDialogController {
-
-    @VisibleForTesting
-    static final int BASEBAND_VERSION_LABEL_ID = R.id.baseband_version_label;
-    @VisibleForTesting
-    static final int BASEBAND_VERSION_VALUE_ID = R.id.baseband_version_value;
-    @VisibleForTesting
-    static final String BASEBAND_PROPERTY = "gsm.version.baseband";
-
-    private final FirmwareVersionDialogFragment mDialog;
-
-    public BasebandVersionDialogController(FirmwareVersionDialogFragment dialog) {
-        mDialog = dialog;
-    }
-
-    /**
-     * Updates the baseband version field of the dialog.
-     */
-    public void initialize() {
-        final Context context = mDialog.getContext();
-        if (Utils.isWifiOnly(context)) {
-            mDialog.removeSettingFromScreen(BASEBAND_VERSION_LABEL_ID);
-            mDialog.removeSettingFromScreen(BASEBAND_VERSION_VALUE_ID);
-            return;
-        }
-
-        mDialog.setText(BASEBAND_VERSION_VALUE_ID, SystemProperties.get(BASEBAND_PROPERTY,
-                context.getString(R.string.device_info_default)));
-    }
-}
diff --git a/src/com/android/settings/deviceinfo/firmwareversion/BasebandVersionPreferenceController.java b/src/com/android/settings/deviceinfo/firmwareversion/BasebandVersionPreferenceController.java
new file mode 100644
index 0000000..dd3d560
--- /dev/null
+++ b/src/com/android/settings/deviceinfo/firmwareversion/BasebandVersionPreferenceController.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deviceinfo.firmwareversion;
+
+import android.content.Context;
+import android.os.SystemProperties;
+
+import androidx.annotation.VisibleForTesting;
+
+import com.android.settings.R;
+import com.android.settings.Utils;
+import com.android.settings.core.BasePreferenceController;
+
+public class BasebandVersionPreferenceController extends BasePreferenceController {
+
+    @VisibleForTesting
+    static final String BASEBAND_PROPERTY = "gsm.version.baseband";
+
+    public BasebandVersionPreferenceController(Context context, String preferenceKey) {
+        super(context, preferenceKey);
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return !Utils.isWifiOnly(mContext) ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
+    }
+
+    @Override
+    public CharSequence getSummary() {
+        return SystemProperties.get(BASEBAND_PROPERTY,
+                mContext.getString(R.string.device_info_default));
+    }
+}
diff --git a/src/com/android/settings/deviceinfo/firmwareversion/BuildNumberDialogController.java b/src/com/android/settings/deviceinfo/firmwareversion/BuildNumberDialogController.java
deleted file mode 100644
index ba4eb7a..0000000
--- a/src/com/android/settings/deviceinfo/firmwareversion/BuildNumberDialogController.java
+++ /dev/null
@@ -1,44 +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.deviceinfo.firmwareversion;
-
-import android.os.Build;
-import android.text.BidiFormatter;
-
-import androidx.annotation.VisibleForTesting;
-
-import com.android.settings.R;
-
-public class BuildNumberDialogController {
-
-    @VisibleForTesting
-    static final int BUILD_NUMBER_VALUE_ID = R.id.build_number_value;
-
-    private final FirmwareVersionDialogFragment mDialog;
-
-    public BuildNumberDialogController(FirmwareVersionDialogFragment dialog) {
-        mDialog = dialog;
-    }
-
-    /**
-     * Updates the build number to the dialog.
-     */
-    public void initialize() {
-        mDialog.setText(BUILD_NUMBER_VALUE_ID,
-                BidiFormatter.getInstance().unicodeWrap(Build.DISPLAY));
-    }
-}
diff --git a/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionDialogController.java b/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionDetailPreferenceController.java
similarity index 72%
rename from src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionDialogController.java
rename to src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionDetailPreferenceController.java
index 8c29f7b..9f3d6e5 100644
--- a/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionDialogController.java
+++ b/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionDetailPreferenceController.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,42 +22,60 @@
 import android.os.SystemClock;
 import android.os.UserHandle;
 import android.os.UserManager;
+import android.text.TextUtils;
 import android.util.Log;
-import android.view.View;
 
 import androidx.annotation.VisibleForTesting;
+import androidx.preference.Preference;
 
 import com.android.settings.R;
+import com.android.settings.Utils;
+import com.android.settings.core.BasePreferenceController;
+import com.android.settings.slices.Sliceable;
 import com.android.settingslib.RestrictedLockUtils;
 import com.android.settingslib.RestrictedLockUtilsInternal;
 
-public class FirmwareVersionDialogController implements View.OnClickListener {
+public class FirmwareVersionDetailPreferenceController extends BasePreferenceController {
 
     private static final String TAG = "firmwareDialogCtrl";
     private static final int DELAY_TIMER_MILLIS = 500;
     private static final int ACTIVITY_TRIGGER_COUNT = 3;
 
-    @VisibleForTesting
-    static final int FIRMWARE_VERSION_VALUE_ID = R.id.firmware_version_value;
-    @VisibleForTesting
-    static final int FIRMWARE_VERSION_LABEL_ID = R.id.firmware_version_label;
-
-    private final FirmwareVersionDialogFragment mDialog;
-    private final Context mContext;
     private final UserManager mUserManager;
     private final long[] mHits = new long[ACTIVITY_TRIGGER_COUNT];
 
     private RestrictedLockUtils.EnforcedAdmin mFunDisallowedAdmin;
     private boolean mFunDisallowedBySystem;
 
-    public FirmwareVersionDialogController(FirmwareVersionDialogFragment dialog) {
-        mDialog = dialog;
-        mContext = dialog.getContext();
+    public FirmwareVersionDetailPreferenceController(Context context, String key) {
+        super(context, key);
         mUserManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
+        initializeAdminPermissions();
     }
 
     @Override
-    public void onClick(View v) {
+    public int getAvailabilityStatus() {
+        return AVAILABLE;
+    }
+
+    @Override
+    public boolean isSliceable() {
+        return true;
+    }
+
+    @Override
+    public CharSequence getSummary() {
+        return Build.VERSION.RELEASE;
+    }
+
+    @Override
+    public boolean handlePreferenceTreeClick(Preference preference) {
+        if (!TextUtils.equals(preference.getKey(), getPreferenceKey())) {
+            return false;
+        }
+        if (Utils.isMonkeyRunning()) {
+            return false;
+        }
         arrayCopy();
         mHits[mHits.length - 1] = SystemClock.uptimeMillis();
         if (mHits[0] >= (SystemClock.uptimeMillis() - DELAY_TIMER_MILLIS)) {
@@ -67,7 +85,7 @@
                             mFunDisallowedAdmin);
                 }
                 Log.d(TAG, "Sorry, no fun for you!");
-                return;
+                return true;
             }
 
             final Intent intent = new Intent(Intent.ACTION_MAIN)
@@ -79,21 +97,7 @@
                 Log.e(TAG, "Unable to start activity " + intent.toString());
             }
         }
-    }
-
-    /**
-     * Populates the Android version field in the dialog and registers click listeners.
-     */
-    public void initialize() {
-        initializeAdminPermissions();
-        registerClickListeners();
-
-        mDialog.setText(FIRMWARE_VERSION_VALUE_ID, Build.VERSION.RELEASE);
-    }
-
-    private void registerClickListeners() {
-        mDialog.registerClickListener(FIRMWARE_VERSION_LABEL_ID, this /* listener */);
-        mDialog.registerClickListener(FIRMWARE_VERSION_VALUE_ID, this /* listener */);
+        return true;
     }
 
     /**
@@ -111,4 +115,10 @@
         mFunDisallowedBySystem = RestrictedLockUtilsInternal.hasBaseUserRestriction(
                 mContext, UserManager.DISALLOW_FUN, UserHandle.myUserId());
     }
+
+    @Override
+    public void copy() {
+        Sliceable.setCopyContent(mContext, getSummary(),
+                mContext.getText(R.string.firmware_version));
+    }
 }
diff --git a/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionDialogFragment.java b/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionDialogFragment.java
deleted file mode 100644
index 2093c3e..0000000
--- a/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionDialogFragment.java
+++ /dev/null
@@ -1,95 +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.deviceinfo.firmwareversion;
-
-import android.app.Dialog;
-import android.app.settings.SettingsEnums;
-import android.os.Bundle;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.TextView;
-
-import androidx.appcompat.app.AlertDialog;
-import androidx.fragment.app.Fragment;
-import androidx.fragment.app.FragmentManager;
-
-import com.android.settings.R;
-import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
-
-public class FirmwareVersionDialogFragment extends InstrumentedDialogFragment {
-
-    private static final String TAG = "firmwareVersionDialog";
-
-    private View mRootView;
-
-    public static void show(Fragment host) {
-        final FragmentManager manager = host.getChildFragmentManager();
-        if (manager.findFragmentByTag(TAG) == null) {
-            final FirmwareVersionDialogFragment dialog = new FirmwareVersionDialogFragment();
-            dialog.show(manager, TAG);
-        }
-    }
-
-    @Override
-    public int getMetricsCategory() {
-        return SettingsEnums.DIALOG_FIRMWARE_VERSION;
-    }
-
-    @Override
-    public Dialog onCreateDialog(Bundle savedInstanceState) {
-        final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity())
-                .setTitle(R.string.firmware_title)
-                .setPositiveButton(android.R.string.ok, null /* listener */);
-
-        mRootView = LayoutInflater.from(getActivity()).inflate(
-                R.layout.dialog_firmware_version, null /* parent */);
-
-        initializeControllers();
-
-        return builder.setView(mRootView).create();
-    }
-
-    public void setText(int viewId, CharSequence text) {
-        final TextView view = mRootView.findViewById(viewId);
-        if (view != null) {
-            view.setText(text);
-        }
-    }
-
-    public void removeSettingFromScreen(int viewId) {
-        final View view = mRootView.findViewById(viewId);
-        if (view != null) {
-            view.setVisibility(View.GONE);
-        }
-    }
-
-    public void registerClickListener(int viewId, View.OnClickListener listener) {
-        final View view = mRootView.findViewById(viewId);
-        if (view != null) {
-            view.setOnClickListener(listener);
-        }
-    }
-
-    private void initializeControllers() {
-        new FirmwareVersionDialogController(this).initialize();
-        new SecurityPatchLevelDialogController(this).initialize();
-        new BasebandVersionDialogController(this).initialize();
-        new KernelVersionDialogController(this).initialize();
-        new BuildNumberDialogController(this).initialize();
-        new ModuleVersionDialogController(this).initialize();
-    }
-}
diff --git a/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionPreferenceController.java b/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionPreferenceController.java
index b7b67b7..41d9566 100644
--- a/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionPreferenceController.java
@@ -18,56 +18,22 @@
 
 import android.content.Context;
 import android.os.Build;
-import android.text.TextUtils;
 
-import androidx.fragment.app.Fragment;
-import androidx.preference.Preference;
-
-import com.android.settings.R;
 import com.android.settings.core.BasePreferenceController;
-import com.android.settings.slices.Copyable;
 
-public class FirmwareVersionPreferenceController extends BasePreferenceController implements
-        Copyable {
-
-    private Fragment mFragment;
+public class FirmwareVersionPreferenceController extends BasePreferenceController {
 
     public FirmwareVersionPreferenceController(Context context, String key) {
         super(context, key);
     }
 
-    public void setHost(Fragment fragment) {
-        mFragment = fragment;
-    }
-
     @Override
     public int getAvailabilityStatus() {
-        return AVAILABLE;
+        return AVAILABLE_UNSEARCHABLE;
     }
 
     @Override
     public CharSequence getSummary() {
         return Build.VERSION.RELEASE;
     }
-
-    @Override
-    public boolean handlePreferenceTreeClick(Preference preference) {
-        if (!TextUtils.equals(preference.getKey(), mPreferenceKey)) {
-            return false;
-        }
-
-        FirmwareVersionDialogFragment.show(mFragment);
-        return true;
-    }
-
-    @Override
-    public boolean isSliceable() {
-        return true;
-    }
-
-    @Override
-    public void copy() {
-        Copyable.setCopyContent(mContext, getSummary(),
-                mContext.getText(R.string.firmware_version));
-    }
 }
diff --git a/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionSettings.java b/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionSettings.java
new file mode 100644
index 0000000..90c3b56
--- /dev/null
+++ b/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionSettings.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deviceinfo.firmwareversion;
+
+import android.app.settings.SettingsEnums;
+import android.content.Context;
+import android.provider.SearchIndexableResource;
+
+import com.android.settings.R;
+import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settings.search.Indexable;
+import com.android.settingslib.search.SearchIndexable;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@SearchIndexable
+public class FirmwareVersionSettings extends DashboardFragment {
+
+    @Override
+    protected int getPreferenceScreenResId() {
+        return R.xml.firmware_version;
+    }
+
+    @Override
+    protected String getLogTag() {
+        return "FirmwareVersionSettings";
+    }
+
+    @Override
+    public int getMetricsCategory() {
+        return SettingsEnums.DIALOG_FIRMWARE_VERSION;
+    }
+
+    public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+            new BaseSearchIndexProvider() {
+                @Override
+                public List<SearchIndexableResource> getXmlResourcesToIndex(Context context,
+                        boolean enabled) {
+                    final ArrayList<SearchIndexableResource> result = new ArrayList<>();
+
+                    final SearchIndexableResource sir = new SearchIndexableResource(context);
+                    sir.xmlResId = R.xml.firmware_version;
+                    result.add(sir);
+                    return result;
+                }
+
+            };
+}
diff --git a/src/com/android/settings/deviceinfo/firmwareversion/KernelVersionDialogController.java b/src/com/android/settings/deviceinfo/firmwareversion/KernelVersionDialogController.java
deleted file mode 100644
index 0d816d5..0000000
--- a/src/com/android/settings/deviceinfo/firmwareversion/KernelVersionDialogController.java
+++ /dev/null
@@ -1,42 +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.deviceinfo.firmwareversion;
-
-import androidx.annotation.VisibleForTesting;
-
-import com.android.settings.R;
-import com.android.settingslib.DeviceInfoUtils;
-
-public class KernelVersionDialogController {
-
-    @VisibleForTesting
-    static int KERNEL_VERSION_VALUE_ID = R.id.kernel_version_value;
-
-    private final FirmwareVersionDialogFragment mDialog;
-
-    public KernelVersionDialogController(FirmwareVersionDialogFragment dialog) {
-        mDialog = dialog;
-    }
-
-    /**
-     * Updates kernel version to the dialog.
-     */
-    public void initialize() {
-        mDialog.setText(KERNEL_VERSION_VALUE_ID,
-                DeviceInfoUtils.getFormattedKernelVersion(mDialog.getContext()));
-    }
-}
diff --git a/src/com/android/settings/deviceinfo/firmwareversion/KernelVersionPreferenceController.java b/src/com/android/settings/deviceinfo/firmwareversion/KernelVersionPreferenceController.java
new file mode 100644
index 0000000..0500c893
--- /dev/null
+++ b/src/com/android/settings/deviceinfo/firmwareversion/KernelVersionPreferenceController.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deviceinfo.firmwareversion;
+
+import android.content.Context;
+
+import com.android.settings.core.BasePreferenceController;
+import com.android.settingslib.DeviceInfoUtils;
+
+public class KernelVersionPreferenceController extends BasePreferenceController {
+
+    public KernelVersionPreferenceController(Context context, String preferenceKey) {
+        super(context, preferenceKey);
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return AVAILABLE;
+    }
+
+    @Override
+    public CharSequence getSummary() {
+        return DeviceInfoUtils.getFormattedKernelVersion(mContext);
+    }
+}
diff --git a/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceController.java b/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceController.java
new file mode 100644
index 0000000..e2f4fae
--- /dev/null
+++ b/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceController.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deviceinfo.firmwareversion;
+
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.text.TextUtils;
+import android.util.FeatureFlagUtils;
+import android.util.Log;
+
+import com.android.settings.core.BasePreferenceController;
+import com.android.settings.core.FeatureFlags;
+
+public class MainlineModuleVersionPreferenceController extends BasePreferenceController {
+
+    private static final String TAG = "MainlineModuleControl";
+
+    private final PackageManager mPackageManager;
+
+    private String mModuleVersion;
+
+    public MainlineModuleVersionPreferenceController(Context context, String key) {
+        super(context, key);
+        mPackageManager = mContext.getPackageManager();
+        initModules();
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        if (!FeatureFlagUtils.isEnabled(mContext, FeatureFlags.MAINLINE_MODULE)) {
+            return UNSUPPORTED_ON_DEVICE;
+        }
+        return !TextUtils.isEmpty(mModuleVersion) ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
+    }
+
+    private void initModules() {
+        if (!FeatureFlagUtils.isEnabled(mContext, FeatureFlags.MAINLINE_MODULE)) {
+            return;
+        }
+        final String moduleProvider = mContext.getString(
+                com.android.internal.R.string.config_defaultModuleMetadataProvider);
+        if (!TextUtils.isEmpty(moduleProvider)) {
+            try {
+                mModuleVersion =
+                        mPackageManager.getPackageInfo(moduleProvider, 0 /* flags */).versionName;
+                return;
+            } catch (PackageManager.NameNotFoundException e) {
+                Log.e(TAG, "Failed to get mainline version.", e);
+                mModuleVersion = null;
+            }
+        }
+    }
+
+    @Override
+    public CharSequence getSummary() {
+        return mModuleVersion;
+    }
+}
diff --git a/src/com/android/settings/deviceinfo/firmwareversion/ModuleVersionDialogController.java b/src/com/android/settings/deviceinfo/firmwareversion/ModuleVersionDialogController.java
deleted file mode 100644
index 0dc953d..0000000
--- a/src/com/android/settings/deviceinfo/firmwareversion/ModuleVersionDialogController.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.deviceinfo.firmwareversion;
-
-import android.content.Context;
-import android.content.pm.PackageManager;
-import android.text.TextUtils;
-import android.util.FeatureFlagUtils;
-import android.util.Log;
-
-import com.android.settings.R;
-import com.android.settings.core.FeatureFlags;
-
-import androidx.annotation.VisibleForTesting;
-
-public class ModuleVersionDialogController {
-
-    private static final String TAG = "MainlineModuleControl";
-
-    @VisibleForTesting
-    static final int MODULE_VERSION_LABEL_ID = R.id.module_version_label;
-    @VisibleForTesting
-    static final int MODULE_VERSION_VALUE_ID = R.id.module_version_value;
-
-    private final FirmwareVersionDialogFragment mDialog;
-    private final Context mContext;
-    private final PackageManager mPackageManager;
-
-    public ModuleVersionDialogController(FirmwareVersionDialogFragment dialog) {
-        mDialog = dialog;
-        mContext = mDialog.getContext();
-        mPackageManager = mContext.getPackageManager();
-    }
-
-    /**
-     * Updates the mainline module version field of the dialog.
-     */
-    public void initialize() {
-        if (!FeatureFlagUtils.isEnabled(mContext, FeatureFlags.MAINLINE_MODULE)) {
-            mDialog.removeSettingFromScreen(MODULE_VERSION_LABEL_ID);
-            mDialog.removeSettingFromScreen(MODULE_VERSION_VALUE_ID);
-            return;
-        }
-        final String moduleProvider = mContext.getString(
-            com.android.internal.R.string.config_defaultModuleMetadataProvider);
-        if (!TextUtils.isEmpty(moduleProvider)) {
-            try {
-                mDialog.setText(MODULE_VERSION_VALUE_ID,
-                    mPackageManager.getPackageInfo(moduleProvider, 0 /* flags */).versionName);
-                return;
-            } catch (PackageManager.NameNotFoundException e) {
-                Log.e(TAG, "Failed to get mainline version.", e);
-            }
-        }
-        mDialog.removeSettingFromScreen(MODULE_VERSION_LABEL_ID);
-        mDialog.removeSettingFromScreen(MODULE_VERSION_VALUE_ID);
-    }
-}
diff --git a/src/com/android/settings/deviceinfo/firmwareversion/SecurityPatchLevelDialogController.java b/src/com/android/settings/deviceinfo/firmwareversion/SecurityPatchLevelDialogController.java
deleted file mode 100644
index 9037fe7..0000000
--- a/src/com/android/settings/deviceinfo/firmwareversion/SecurityPatchLevelDialogController.java
+++ /dev/null
@@ -1,87 +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.deviceinfo.firmwareversion;
-
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.net.Uri;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.View;
-
-import androidx.annotation.VisibleForTesting;
-
-import com.android.settings.R;
-import com.android.settingslib.DeviceInfoUtils;
-
-public class SecurityPatchLevelDialogController implements View.OnClickListener {
-
-    private static final String TAG = "SecurityPatchCtrl";
-    private static final Uri INTENT_URI_DATA = Uri.parse(
-            "https://source.android.com/security/bulletin/");
-
-    @VisibleForTesting
-    static final int SECURITY_PATCH_VALUE_ID = R.id.security_patch_level_value;
-    @VisibleForTesting
-    static final int SECURITY_PATCH_LABEL_ID = R.id.security_patch_level_label;
-
-    private final FirmwareVersionDialogFragment mDialog;
-    private final Context mContext;
-    private final PackageManager mPackageManager;
-    private final String mCurrentPatch;
-
-    public SecurityPatchLevelDialogController(FirmwareVersionDialogFragment dialog) {
-        mDialog = dialog;
-        mContext = dialog.getContext();
-        mPackageManager = mContext.getPackageManager();
-        mCurrentPatch = DeviceInfoUtils.getSecurityPatch();
-    }
-
-    @Override
-    public void onClick(View v) {
-        final Intent intent = new Intent();
-        intent.setAction(Intent.ACTION_VIEW);
-        intent.setData(INTENT_URI_DATA);
-        if (mPackageManager.queryIntentActivities(intent, 0).isEmpty()) {
-            // Don't send out the intent to stop crash
-            Log.w(TAG, "Stop click action on " + SECURITY_PATCH_VALUE_ID + ": "
-                    + "queryIntentActivities() returns empty");
-            return;
-        }
-
-        mContext.startActivity(intent);
-    }
-
-    /**
-     * Populates the security patch level field in the dialog and registers click listeners.
-     */
-    public void initialize() {
-        if (TextUtils.isEmpty(mCurrentPatch)) {
-            mDialog.removeSettingFromScreen(SECURITY_PATCH_LABEL_ID);
-            mDialog.removeSettingFromScreen(SECURITY_PATCH_VALUE_ID);
-            return;
-        }
-        registerListeners();
-        mDialog.setText(SECURITY_PATCH_VALUE_ID, mCurrentPatch);
-    }
-
-    private void registerListeners() {
-        mDialog.registerClickListener(SECURITY_PATCH_LABEL_ID, this /* listener */);
-        mDialog.registerClickListener(SECURITY_PATCH_VALUE_ID, this /* listener */);
-    }
-}
diff --git a/src/com/android/settings/deviceinfo/firmwareversion/SecurityPatchLevelPreferenceController.java b/src/com/android/settings/deviceinfo/firmwareversion/SecurityPatchLevelPreferenceController.java
new file mode 100644
index 0000000..1df78a8
--- /dev/null
+++ b/src/com/android/settings/deviceinfo/firmwareversion/SecurityPatchLevelPreferenceController.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deviceinfo.firmwareversion;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.net.Uri;
+import android.text.TextUtils;
+import android.util.Log;
+
+import androidx.preference.Preference;
+
+import com.android.settings.core.BasePreferenceController;
+import com.android.settingslib.DeviceInfoUtils;
+
+public class SecurityPatchLevelPreferenceController extends BasePreferenceController {
+
+    private static final String TAG = "SecurityPatchCtrl";
+    private static final Uri INTENT_URI_DATA = Uri.parse(
+            "https://source.android.com/security/bulletin/");
+
+    private final PackageManager mPackageManager;
+    private final String mCurrentPatch;
+
+    public SecurityPatchLevelPreferenceController(Context context, String key) {
+        super(context, key);
+        mPackageManager = mContext.getPackageManager();
+        mCurrentPatch = DeviceInfoUtils.getSecurityPatch();
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return !TextUtils.isEmpty(mCurrentPatch)
+                ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
+    }
+
+    @Override
+    public CharSequence getSummary() {
+        return mCurrentPatch;
+    }
+
+    @Override
+    public boolean handlePreferenceTreeClick(Preference preference) {
+        if (!TextUtils.equals(preference.getKey(), getPreferenceKey())) {
+            return false;
+        }
+
+        final Intent intent = new Intent();
+        intent.setAction(Intent.ACTION_VIEW);
+        intent.setData(INTENT_URI_DATA);
+        if (mPackageManager.queryIntentActivities(intent, 0).isEmpty()) {
+            // Don't send out the intent to stop crash
+            Log.w(TAG, "queryIntentActivities() returns empty");
+            return true;
+        }
+
+        mContext.startActivity(intent);
+        return true;
+    }
+}
diff --git a/src/com/android/settings/deviceinfo/firmwareversion/SimpleBuildNumberPreferenceController.java b/src/com/android/settings/deviceinfo/firmwareversion/SimpleBuildNumberPreferenceController.java
new file mode 100644
index 0000000..c7d4459
--- /dev/null
+++ b/src/com/android/settings/deviceinfo/firmwareversion/SimpleBuildNumberPreferenceController.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deviceinfo.firmwareversion;
+
+import android.content.Context;
+import android.os.Build;
+import android.text.BidiFormatter;
+
+import com.android.settings.core.BasePreferenceController;
+
+public class SimpleBuildNumberPreferenceController extends BasePreferenceController {
+
+    public SimpleBuildNumberPreferenceController(Context context,
+            String preferenceKey) {
+        super(context, preferenceKey);
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return AVAILABLE;
+    }
+
+    @Override
+    public CharSequence getSummary() {
+        return BidiFormatter.getInstance().unicodeWrap(Build.DISPLAY);
+    }
+}
diff --git a/src/com/android/settings/deviceinfo/hardwareinfo/DeviceModelPreferenceController.java b/src/com/android/settings/deviceinfo/hardwareinfo/DeviceModelPreferenceController.java
new file mode 100644
index 0000000..42c7b01
--- /dev/null
+++ b/src/com/android/settings/deviceinfo/hardwareinfo/DeviceModelPreferenceController.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deviceinfo.hardwareinfo;
+
+import android.content.Context;
+
+import com.android.settings.deviceinfo.HardwareInfoPreferenceController;
+
+public class DeviceModelPreferenceController extends HardwareInfoPreferenceController {
+
+    public DeviceModelPreferenceController(Context context, String key) {
+        super(context, key);
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        final int availability = super.getAvailabilityStatus();
+        if (availability == AVAILABLE_UNSEARCHABLE) {
+            return AVAILABLE;
+        }
+        return availability;
+    }
+
+    @Override
+    public boolean isSliceable() {
+        return true;
+    }
+}
diff --git a/src/com/android/settings/deviceinfo/hardwareinfo/HardwareInfoFragment.java b/src/com/android/settings/deviceinfo/hardwareinfo/HardwareInfoFragment.java
new file mode 100644
index 0000000..40e73ef
--- /dev/null
+++ b/src/com/android/settings/deviceinfo/hardwareinfo/HardwareInfoFragment.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deviceinfo.hardwareinfo;
+
+import android.app.settings.SettingsEnums;
+import android.content.Context;
+import android.provider.SearchIndexableResource;
+
+import com.android.settings.R;
+import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settings.search.Indexable;
+import com.android.settingslib.search.SearchIndexable;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+@SearchIndexable
+public class HardwareInfoFragment extends DashboardFragment {
+
+    public static final String TAG = "HardwareInfo";
+
+    @Override
+    public int getMetricsCategory() {
+        return SettingsEnums.DIALOG_SETTINGS_HARDWARE_INFO;
+    }
+
+    @Override
+    protected int getPreferenceScreenResId() {
+        return R.xml.hardware_info;
+    }
+
+    @Override
+    protected String getLogTag() {
+        return TAG;
+    }
+
+    public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+            new BaseSearchIndexProvider() {
+                @Override
+                public List<SearchIndexableResource> getXmlResourcesToIndex(Context context,
+                        boolean enabled) {
+                    final ArrayList<SearchIndexableResource> result = new ArrayList<>();
+
+                    final SearchIndexableResource sir = new SearchIndexableResource(context);
+                    sir.xmlResId = R.xml.hardware_info;
+                    result.add(sir);
+                    return result;
+                }
+
+                @Override
+                protected boolean isPageSearchEnabled(Context context) {
+                    return context.getResources().getBoolean(R.bool.config_show_device_model);
+                }
+            };
+}
diff --git a/src/com/android/settings/deviceinfo/hardwareinfo/HardwareRevisionPreferenceController.java b/src/com/android/settings/deviceinfo/hardwareinfo/HardwareRevisionPreferenceController.java
new file mode 100644
index 0000000..ec0cdb2
--- /dev/null
+++ b/src/com/android/settings/deviceinfo/hardwareinfo/HardwareRevisionPreferenceController.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deviceinfo.hardwareinfo;
+
+import android.content.Context;
+import android.os.SystemProperties;
+
+import com.android.settings.R;
+import com.android.settings.core.BasePreferenceController;
+
+public class HardwareRevisionPreferenceController extends BasePreferenceController {
+
+    public HardwareRevisionPreferenceController(Context context, String preferenceKey) {
+        super(context, preferenceKey);
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return mContext.getResources().getBoolean(R.bool.config_show_device_model)
+                ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
+    }
+
+    @Override
+    public boolean isSliceable() {
+        return true;
+    }
+
+    @Override
+    public CharSequence getSummary() {
+        return SystemProperties.get("ro.boot.hardware.revision");
+    }
+}
diff --git a/src/com/android/settings/deviceinfo/hardwareinfo/SerialNumberPreferenceController.java b/src/com/android/settings/deviceinfo/hardwareinfo/SerialNumberPreferenceController.java
new file mode 100644
index 0000000..4485c53
--- /dev/null
+++ b/src/com/android/settings/deviceinfo/hardwareinfo/SerialNumberPreferenceController.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deviceinfo.hardwareinfo;
+
+import android.content.Context;
+import android.os.Build;
+
+import com.android.settings.R;
+import com.android.settings.core.BasePreferenceController;
+
+public class SerialNumberPreferenceController extends BasePreferenceController {
+
+    public SerialNumberPreferenceController(Context context, String preferenceKey) {
+        super(context, preferenceKey);
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return mContext.getResources().getBoolean(R.bool.config_show_device_model)
+                ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
+    }
+
+    @Override
+    public boolean isSliceable() {
+        return true;
+    }
+
+    @Override
+    public CharSequence getSummary() {
+        return Build.getSerial();
+    }
+}
diff --git a/src/com/android/settings/deviceinfo/imei/ImeiInfoPreferenceController.java b/src/com/android/settings/deviceinfo/imei/ImeiInfoPreferenceController.java
index 96ff83c..77d975e 100644
--- a/src/com/android/settings/deviceinfo/imei/ImeiInfoPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/imei/ImeiInfoPreferenceController.java
@@ -29,7 +29,7 @@
 
 import com.android.settings.R;
 import com.android.settings.core.BasePreferenceController;
-import com.android.settings.slices.Copyable;
+import com.android.settings.slices.Sliceable;
 import com.android.settingslib.Utils;
 
 import java.util.ArrayList;
@@ -38,7 +38,7 @@
 /**
  * Controller that manages preference for single and multi sim devices.
  */
-public class ImeiInfoPreferenceController extends BasePreferenceController implements Copyable {
+public class ImeiInfoPreferenceController extends BasePreferenceController {
 
     private final boolean mIsMultiSim;
     private final TelephonyManager mTelephonyManager;
@@ -106,8 +106,13 @@
     }
 
     @Override
+    public boolean isCopyableSlice() {
+        return true;
+    }
+
+    @Override
     public void copy() {
-        Copyable.setCopyContent(mContext, getSummary(), mContext.getText(R.string.status_imei));
+        Sliceable.setCopyContent(mContext, getSummary(), mContext.getText(R.string.status_imei));
     }
 
     private void updatePreference(Preference preference, int simSlot) {
diff --git a/src/com/android/settings/fuelgauge/batterytip/StatsManagerConfig.java b/src/com/android/settings/fuelgauge/batterytip/StatsManagerConfig.java
index a0449f2..153aa40 100644
--- a/src/com/android/settings/fuelgauge/batterytip/StatsManagerConfig.java
+++ b/src/com/android/settings/fuelgauge/batterytip/StatsManagerConfig.java
@@ -65,6 +65,11 @@
             AnomalyType.EXCESSIVE_CRASH_RATE,
             AnomalyType.EXCESSIVE_CRASH_LOOPING,
             AnomalyType.NUMBER_OF_OPEN_FILES,
+            AnomalyType.EXCESSIVE_CAMERA_USAGE_IN_BACKGROUND,
+            AnomalyType.EXCESSIVE_CONTACT_ACCESS,
+            AnomalyType.EXCESSIVE_AUDIO_IN_BACKGROUND,
+            AnomalyType.EXCESSIVE_CRASH_ANR_IN_BACKGROUND,
+            AnomalyType.BATTERY_DRAIN_FROM_UNUSED_APP,
     })
     public @interface AnomalyType {
         /**
@@ -218,6 +223,42 @@
          * The application crashed because no more file descriptors were available.
          */
         int NUMBER_OF_OPEN_FILES = 26;
+
+        /**
+         * The application used an excessive amount of CPU while in a
+         * background process state.
+         */
+        int EXCESSIVE_CPU_USAGE_IN_BACKGROUND = 27;
+
+        /**
+         * The application kept the camera open for an excessive amount
+         * of time while in a bckground process state.
+         */
+        int EXCESSIVE_CAMERA_USAGE_IN_BACKGROUND = 28;
+
+        /**
+         * The application has accessed the contacts content provider an
+         * excessive amount.
+         */
+        int EXCESSIVE_CONTACT_ACCESS = 29;
+
+        /**
+         * The application has played too much audio while in a background
+         * process state.
+         */
+        int EXCESSIVE_AUDIO_IN_BACKGROUND = 30;
+
+        /**
+         * The application has crashed or ANRed too many times while in a
+         * background process state.
+         */
+        int EXCESSIVE_CRASH_ANR_IN_BACKGROUND = 31;
+
+        /**
+         * An application which has not been used by the user recently
+         * was detected to cause an excessive amount of battery drain.
+         */
+        int BATTERY_DRAIN_FROM_UNUSED_APP = 32;
     }
 
 }
diff --git a/src/com/android/settings/homepage/SettingsHomepageActivity.java b/src/com/android/settings/homepage/SettingsHomepageActivity.java
index a2e3a9c..9e869a9 100644
--- a/src/com/android/settings/homepage/SettingsHomepageActivity.java
+++ b/src/com/android/settings/homepage/SettingsHomepageActivity.java
@@ -16,11 +16,11 @@
 
 package com.android.settings.homepage;
 
+import android.animation.LayoutTransition;
 import android.app.settings.SettingsEnums;
-import android.content.Intent;
 import android.os.Bundle;
-import android.util.FeatureFlagUtils;
 import android.view.View;
+import android.widget.FrameLayout;
 import android.widget.ImageView;
 import android.widget.Toolbar;
 
@@ -30,9 +30,7 @@
 import androidx.fragment.app.FragmentTransaction;
 
 import com.android.settings.R;
-import com.android.settings.SettingsActivity;
 import com.android.settings.accounts.AvatarViewMixin;
-import com.android.settings.core.FeatureFlags;
 import com.android.settings.core.SettingsBaseActivity;
 import com.android.settings.homepage.contextualcards.ContextualCardsFragment;
 import com.android.settings.overlay.FeatureFactory;
@@ -43,13 +41,6 @@
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
-        if (!FeatureFlagUtils.isEnabled(this, FeatureFlags.DYNAMIC_HOMEPAGE)) {
-            final Intent settings = new Intent(this, SettingsActivity.class);
-            startActivity(settings);
-            finish();
-            return;
-        }
-
         updateWindowProperties();
         setContentView(R.layout.settings_homepage_container);
         setHomepageContainerPaddingTop();
@@ -64,6 +55,8 @@
 
         showFragment(new ContextualCardsFragment(), R.id.contextual_cards_content);
         showFragment(new TopLevelSettings(), R.id.main_content);
+        ((FrameLayout) findViewById(R.id.main_content))
+                .getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING);
     }
 
     private void showFragment(Fragment fragment, int id) {
diff --git a/src/com/android/settings/homepage/contextualcards/ContextualCardLoader.java b/src/com/android/settings/homepage/contextualcards/ContextualCardLoader.java
index b9b2a1c..42e18ed 100644
--- a/src/com/android/settings/homepage/contextualcards/ContextualCardLoader.java
+++ b/src/com/android/settings/homepage/contextualcards/ContextualCardLoader.java
@@ -49,7 +49,7 @@
     @VisibleForTesting
     static final int DEFAULT_CARD_COUNT = 4;
     static final int CARD_CONTENT_LOADER_ID = 1;
-    static final long CARD_CONTENT_LOADER_TIMEOUT_MS = DateUtils.SECOND_IN_MILLIS * 3;
+    static final long CARD_CONTENT_LOADER_TIMEOUT_MS = DateUtils.SECOND_IN_MILLIS;
 
     private static final String TAG = "ContextualCardLoader";
     private static final long ELIGIBILITY_CHECKER_TIMEOUT_MS = 250;
diff --git a/src/com/android/settings/homepage/contextualcards/ContextualCardManager.java b/src/com/android/settings/homepage/contextualcards/ContextualCardManager.java
index 344c248..3b8aacd 100644
--- a/src/com/android/settings/homepage/contextualcards/ContextualCardManager.java
+++ b/src/com/android/settings/homepage/contextualcards/ContextualCardManager.java
@@ -108,7 +108,8 @@
         final CardContentLoaderCallbacks cardContentLoaderCallbacks =
                 new CardContentLoaderCallbacks(mContext);
         cardContentLoaderCallbacks.setListener(this);
-        LoaderManager.getInstance(fragment).restartLoader(CARD_CONTENT_LOADER_ID, null /* bundle */,
+        // Use the cached data when navigating back to the first page and upon screen rotation.
+        LoaderManager.getInstance(fragment).initLoader(CARD_CONTENT_LOADER_ID, null /* bundle */,
                 cardContentLoaderCallbacks);
     }
 
@@ -192,7 +193,7 @@
         Log.d(TAG, "Total loading time = " + loadTime);
         final List<ContextualCard> cardsToKeep = getCardsToKeep(cards);
 
-        //navigate back to the homepage or after card dismissal
+        //navigate back to the homepage, screen rotate or after card dismissal
         if (!mIsFirstLaunch) {
             onContextualCardUpdated(cardsToKeep.stream()
                     .collect(groupingBy(ContextualCard::getCardType)));
diff --git a/src/com/android/settings/homepage/contextualcards/deviceinfo/DeviceInfoSlice.java b/src/com/android/settings/homepage/contextualcards/deviceinfo/DeviceInfoSlice.java
index e278baa..48a9aa5 100644
--- a/src/com/android/settings/homepage/contextualcards/deviceinfo/DeviceInfoSlice.java
+++ b/src/com/android/settings/homepage/contextualcards/deviceinfo/DeviceInfoSlice.java
@@ -36,7 +36,7 @@
 import com.android.settings.R;
 import com.android.settings.SubSettings;
 import com.android.settings.Utils;
-import com.android.settings.deviceinfo.DeviceModelPreferenceController;
+import com.android.settings.deviceinfo.HardwareInfoPreferenceController;
 import com.android.settings.deviceinfo.aboutphone.MyDeviceInfoFragment;
 import com.android.settings.slices.CustomSliceRegistry;
 import com.android.settings.slices.CustomSliceable;
@@ -107,7 +107,7 @@
     }
 
     private CharSequence getDeviceModel() {
-        return DeviceModelPreferenceController.getDeviceModel();
+        return HardwareInfoPreferenceController.getDeviceModel();
     }
 
     @VisibleForTesting
diff --git a/src/com/android/settings/homepage/contextualcards/slices/BatteryFixSlice.java b/src/com/android/settings/homepage/contextualcards/slices/BatteryFixSlice.java
index 5b5d474..9b912a8 100644
--- a/src/com/android/settings/homepage/contextualcards/slices/BatteryFixSlice.java
+++ b/src/com/android/settings/homepage/contextualcards/slices/BatteryFixSlice.java
@@ -80,7 +80,7 @@
     public Slice getSlice() {
         final ListBuilder sliceBuilder =
                 new ListBuilder(mContext, BATTERY_FIX_SLICE_URI, ListBuilder.INFINITY)
-                        .setAccentColor(-1);
+                        .setAccentColor(COLOR_NOT_TINTED);
 
         // TipType.SUMMARY is battery good
         if (UNIMPORTANT_BATTERY_TIPS.contains(readBatteryTipAvailabilityCache(mContext))) {
diff --git a/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSlice.java b/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSlice.java
index c2c2ece..ae8b80a 100644
--- a/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSlice.java
+++ b/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSlice.java
@@ -142,7 +142,8 @@
     @Override
     public Slice getSlice() {
         final ListBuilder listBuilder =
-                new ListBuilder(mContext, getUri(), ListBuilder.INFINITY).setAccentColor(-1);
+                new ListBuilder(mContext, getUri(), ListBuilder.INFINITY)
+                        .setAccentColor(COLOR_NOT_TINTED);
         /**
          * Get package which is satisfied with:
          * 1. Recently installed.
@@ -415,9 +416,13 @@
     private CharSequence getSubTitle(String packageName, int uid) {
         final int channelCount = mNotificationBackend.getChannelCount(packageName, uid);
 
+        if (channelCount > DEFAULT_EXPANDED_ROW_COUNT) {
+            return mContext.getString(
+                    R.string.notification_many_channel_count_summary, channelCount);
+        }
+
         return mContext.getResources().getQuantityString(
-                R.plurals.notification_channel_count_summary,
-                channelCount, channelCount);
+                R.plurals.notification_few_channel_count_summary, channelCount, channelCount);
     }
 
     private Intent getAppAndNotificationPageIntent() {
diff --git a/src/com/android/settings/network/telephony/DataUsagePreferenceController.java b/src/com/android/settings/network/telephony/DataUsagePreferenceController.java
index 7028a3e..f9e0a97 100644
--- a/src/com/android/settings/network/telephony/DataUsagePreferenceController.java
+++ b/src/com/android/settings/network/telephony/DataUsagePreferenceController.java
@@ -63,7 +63,16 @@
     @Override
     public void updateState(Preference preference) {
         super.updateState(preference);
-        final boolean enabled = mSubId != SubscriptionManager.INVALID_SUBSCRIPTION_ID;
+        if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+            preference.setEnabled(false);
+            return;
+        }
+        long usageLevel = mDataUsageInfo.usageLevel;
+        if (usageLevel <= 0L) {
+            final DataUsageController controller = new DataUsageController(mContext);
+            usageLevel = controller.getHistoricalUsageLevel(mTemplate);
+        }
+        final boolean enabled = usageLevel > 0L;
         preference.setEnabled(enabled);
 
         if (enabled) {
diff --git a/src/com/android/settings/nfc/NfcPaymentPreferenceController.java b/src/com/android/settings/nfc/NfcPaymentPreferenceController.java
index 5215243..9d3673d 100644
--- a/src/com/android/settings/nfc/NfcPaymentPreferenceController.java
+++ b/src/com/android/settings/nfc/NfcPaymentPreferenceController.java
@@ -183,7 +183,7 @@
         }
 
         public void updateApps(PaymentAppInfo[] appInfos) {
-            // Clone app infos, only add those with a banner
+            // Clone app infos, only add an application label
             this.appInfos = appInfos;
             notifyDataSetChanged();
         }
@@ -211,16 +211,11 @@
                 convertView = mLayoutInflater.inflate(
                         R.layout.nfc_payment_option, parent, false);
                 holder = new ViewHolder();
-                holder.imageView = convertView.findViewById(R.id.banner);
                 holder.radioButton = convertView.findViewById(R.id.button);
                 convertView.setTag(holder);
             } else {
                 holder = (ViewHolder) convertView.getTag();
             }
-            holder.imageView.setImageDrawable(appInfo.banner);
-            holder.imageView.setTag(appInfo);
-            holder.imageView.setContentDescription(appInfo.label);
-            holder.imageView.setOnClickListener(this);
 
             // Prevent checked callback getting called on recycled views
             holder.radioButton.setOnCheckedChangeListener(null);
@@ -228,11 +223,11 @@
             holder.radioButton.setContentDescription(appInfo.label);
             holder.radioButton.setOnCheckedChangeListener(this);
             holder.radioButton.setTag(appInfo);
+            holder.radioButton.setText(appInfo.label);
             return convertView;
         }
 
         private class ViewHolder {
-            public ImageView imageView;
             public RadioButton radioButton;
         }
 
@@ -258,4 +253,4 @@
             }
         }
     }
-}
\ No newline at end of file
+}
diff --git a/src/com/android/settings/nfc/PaymentBackend.java b/src/com/android/settings/nfc/PaymentBackend.java
index 67ea6bd..a87855e 100644
--- a/src/com/android/settings/nfc/PaymentBackend.java
+++ b/src/com/android/settings/nfc/PaymentBackend.java
@@ -46,7 +46,6 @@
     public static class PaymentAppInfo {
         public CharSequence label;
         CharSequence description;
-        Drawable banner;
         boolean isDefault;
         public ComponentName componentName;
         public ComponentName settingsComponent;
@@ -111,7 +110,6 @@
                 appInfo.settingsComponent = null;
             }
             appInfo.description = service.getDescription();
-            appInfo.banner = service.loadBanner(pm);
             appInfos.add(appInfo);
         }
         mAppInfos = appInfos;
@@ -141,19 +139,6 @@
         }
     }
 
-    Drawable loadDrawableForPackage(String pkgName, int drawableResId) {
-        PackageManager pm = mContext.getPackageManager();
-        try {
-            Resources res = pm.getResourcesForApplication(pkgName);
-            Drawable banner = res.getDrawable(drawableResId);
-            return banner;
-        } catch (Resources.NotFoundException e) {
-            return null;
-        } catch (PackageManager.NameNotFoundException e) {
-            return null;
-        }
-    }
-
     boolean isForegroundMode() {
         try {
             return Settings.Secure.getInt(mContext.getContentResolver(),
@@ -222,4 +207,4 @@
             mHandler.obtainMessage().sendToTarget();
         }
     }
-}
\ No newline at end of file
+}
diff --git a/src/com/android/settings/notification/ConfigureNotificationSettings.java b/src/com/android/settings/notification/ConfigureNotificationSettings.java
index 1b860e3..73f6e06 100644
--- a/src/com/android/settings/notification/ConfigureNotificationSettings.java
+++ b/src/com/android/settings/notification/ConfigureNotificationSettings.java
@@ -58,6 +58,8 @@
     static final String KEY_LOCKSCREEN_WORK_PROFILE = "lock_screen_notifications_profile";
     @VisibleForTesting
     static final String KEY_SWIPE_DOWN = "gesture_swipe_down_fingerprint_notifications";
+    @VisibleForTesting
+    static final String KEY_NOTIFICATION_ASSISTANT = "notification_assistant";
 
     private static final String KEY_NOTI_DEFAULT_RINGTONE = "notification_default_ringtone";
 
diff --git a/src/com/android/settings/notification/NotificationAssistantPicker.java b/src/com/android/settings/notification/NotificationAssistantPicker.java
new file mode 100644
index 0000000..7720e6f
--- /dev/null
+++ b/src/com/android/settings/notification/NotificationAssistantPicker.java
@@ -0,0 +1,162 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.notification;
+
+import android.app.settings.SettingsEnums;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.pm.PackageItemInfo;
+import android.content.pm.ServiceInfo;
+import android.graphics.drawable.Drawable;
+import android.provider.SearchIndexableResource;
+import android.provider.Settings;
+import android.service.notification.NotificationAssistantService;
+import android.text.TextUtils;
+
+import com.android.internal.annotations.VisibleForTesting;
+import com.android.settings.R;
+import com.android.settings.applications.defaultapps.DefaultAppPickerFragment;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settings.search.Indexable;
+import com.android.settingslib.applications.DefaultAppInfo;
+import com.android.settingslib.applications.ServiceListing;
+import com.android.settingslib.widget.CandidateInfo;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class NotificationAssistantPicker extends DefaultAppPickerFragment implements
+        ServiceListing.Callback {
+
+    private static final String TAG = "NotiAssistantPicker";
+
+    @VisibleForTesting
+    protected NotificationBackend mNotificationBackend;
+    private List<CandidateInfo> mCandidateInfos = new ArrayList<>();
+    @VisibleForTesting
+    protected Context mContext;
+    private ServiceListing mServiceListing;
+
+    @Override
+    public void onAttach(Context context) {
+        super.onAttach(context);
+        mContext = context;
+        mNotificationBackend = new NotificationBackend();
+        mServiceListing = new ServiceListing.Builder(context)
+                .setTag(TAG)
+                .setSetting(Settings.Secure.ENABLED_NOTIFICATION_ASSISTANT)
+                .setIntentAction(NotificationAssistantService.SERVICE_INTERFACE)
+                .setPermission(android.Manifest.permission.BIND_NOTIFICATION_ASSISTANT_SERVICE)
+                .setNoun("notification assistant")
+                .build();
+        mServiceListing.addCallback(this);
+        mServiceListing.reload();
+    }
+
+    @Override
+    public void onDetach() {
+        super.onDetach();
+        mServiceListing.removeCallback(this);
+    }
+
+    @Override
+    protected int getPreferenceScreenResId() {
+        return R.xml.notification_assistant_settings;
+    }
+
+    @Override
+    protected List<? extends CandidateInfo> getCandidates() {
+        return mCandidateInfos;
+    }
+
+    @Override
+    protected String getDefaultKey() {
+        ComponentName cn = mNotificationBackend.getAllowedNotificationAssistant();
+        return (cn != null) ? cn.flattenToString() : "";
+    }
+
+    @Override
+    protected boolean setDefaultKey(String key) {
+        return mNotificationBackend.setNotificationAssistantGranted(
+                ComponentName.unflattenFromString(key));
+    }
+
+    @Override
+    public int getMetricsCategory() {
+        return SettingsEnums.DEFAULT_NOTIFICATION_ASSISTANT;
+    }
+
+    @Override
+    protected CharSequence getConfirmationMessage(CandidateInfo info) {
+        if (TextUtils.isEmpty(info.getKey())) {
+            return null;
+        }
+        return mContext.getString(R.string.notification_assistant_security_warning_summary,
+                info.loadLabel());
+    }
+
+    @Override
+    public void onServicesReloaded(List<ServiceInfo> services) {
+        List<CandidateInfo> list = new ArrayList<>();
+        services.sort(new PackageItemInfo.DisplayNameComparator(mPm));
+        for (ServiceInfo service : services) {
+            final ComponentName cn = new ComponentName(service.packageName, service.name);
+            list.add(new DefaultAppInfo(mContext, mPm, mUserId, cn));
+        }
+        list.add(new CandidateNone(mContext));
+        mCandidateInfos = list;
+    }
+
+    public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+            new BaseSearchIndexProvider() {
+                @Override
+                public List<SearchIndexableResource> getXmlResourcesToIndex(Context context,
+                        boolean enabled) {
+                    final List<SearchIndexableResource> result = new ArrayList<>();
+
+                    final SearchIndexableResource sir = new SearchIndexableResource(context);
+                    sir.xmlResId = R.xml.notification_assistant_settings;
+                    result.add(sir);
+                    return result;
+                }
+            };
+
+    public static class CandidateNone extends CandidateInfo {
+
+        public Context mContext;
+
+        public CandidateNone(Context context) {
+            super(true);
+            mContext = context;
+        }
+
+        @Override
+        public CharSequence loadLabel() {
+            return mContext.getString(R.string.no_notification_assistant);
+        }
+
+        @Override
+        public Drawable loadIcon() {
+            return null;
+        }
+
+        @Override
+        public String getKey() {
+            return "";
+        }
+    }
+}
diff --git a/src/com/android/settings/notification/NotificationAssistantPreferenceController.java b/src/com/android/settings/notification/NotificationAssistantPreferenceController.java
new file mode 100644
index 0000000..5c591b8
--- /dev/null
+++ b/src/com/android/settings/notification/NotificationAssistantPreferenceController.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.notification;
+
+import android.content.Context;
+
+import com.android.settings.core.BasePreferenceController;
+
+public class NotificationAssistantPreferenceController extends BasePreferenceController {
+
+    public NotificationAssistantPreferenceController(Context context, String preferenceKey) {
+        super(context, preferenceKey);
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return BasePreferenceController.AVAILABLE;
+    }
+}
diff --git a/src/com/android/settings/notification/NotificationBackend.java b/src/com/android/settings/notification/NotificationBackend.java
index dbba616..ba07438 100644
--- a/src/com/android/settings/notification/NotificationBackend.java
+++ b/src/com/android/settings/notification/NotificationBackend.java
@@ -23,6 +23,7 @@
 import android.app.NotificationChannelGroup;
 import android.app.usage.IUsageStatsManager;
 import android.app.usage.UsageEvents;
+import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.ApplicationInfo;
@@ -410,6 +411,29 @@
         }
     }
 
+    public ComponentName getAllowedNotificationAssistant() {
+        try {
+            return sINM.getAllowedNotificationAssistant();
+        } catch (Exception e) {
+            Log.w(TAG, "Error calling NoMan", e);
+            return null;
+        }
+    }
+
+    public boolean setNotificationAssistantGranted(ComponentName cn) {
+        try {
+            sINM.setNotificationAssistantAccessGranted(cn, true);
+            if (cn == null) {
+                return sINM.getAllowedNotificationAssistant() == null;
+            } else {
+                return cn.equals(sINM.getAllowedNotificationAssistant());
+            }
+        } catch (Exception e) {
+            Log.w(TAG, "Error calling NoMan", e);
+            return false;
+        }
+    }
+
     /**
      * NotificationsSentState contains how often an app sends notifications and how recently it sent
      * one.
diff --git a/src/com/android/settings/notification/ZenAutomaticRuleSwitchPreferenceController.java b/src/com/android/settings/notification/ZenAutomaticRuleSwitchPreferenceController.java
index 807d944..b9ed734 100644
--- a/src/com/android/settings/notification/ZenAutomaticRuleSwitchPreferenceController.java
+++ b/src/com/android/settings/notification/ZenAutomaticRuleSwitchPreferenceController.java
@@ -63,6 +63,11 @@
             mSwitchBar.setSwitchBarText(R.string.zen_mode_use_automatic_rule,
                     R.string.zen_mode_use_automatic_rule);
             try {
+                pref.setOnPreferenceClickListener(preference -> {
+                    mRule.setEnabled(!mRule.isEnabled());
+                    mBackend.updateZenRule(mId, mRule);
+                    return true;
+                });
                 mSwitchBar.addOnSwitchChangeListener(this);
             } catch (IllegalStateException e) {
                 // an exception is thrown if you try to add the listener twice
@@ -71,7 +76,6 @@
         }
     }
 
-
     public void onResume(AutomaticZenRule rule, String id) {
         mRule = rule;
         mId = id;
diff --git a/src/com/android/settings/password/ChooseLockGeneric.java b/src/com/android/settings/password/ChooseLockGeneric.java
index cae7d33..cf62112 100644
--- a/src/com/android/settings/password/ChooseLockGeneric.java
+++ b/src/com/android/settings/password/ChooseLockGeneric.java
@@ -238,8 +238,8 @@
                     UserManager.get(getActivity()),
                     getArguments(),
                     getActivity().getIntent().getExtras()).getIdentifier();
-            mController =
-                    new ChooseLockGenericController(getContext(), mUserId, mRequestedMinComplexity);
+            mController = new ChooseLockGenericController(
+                    getContext(), mUserId, mRequestedMinComplexity, mLockPatternUtils);
             if (ACTION_SET_NEW_PASSWORD.equals(chooseLockAction)
                     && UserManager.get(getActivity()).isManagedProfile(mUserId)
                     && mLockPatternUtils.isSeparateProfileChallengeEnabled(mUserId)) {
diff --git a/src/com/android/settings/password/ChooseLockGenericController.java b/src/com/android/settings/password/ChooseLockGenericController.java
index 91ca957..62a0063 100644
--- a/src/com/android/settings/password/ChooseLockGenericController.java
+++ b/src/com/android/settings/password/ChooseLockGenericController.java
@@ -27,6 +27,7 @@
 import androidx.annotation.NonNull;
 import androidx.annotation.VisibleForTesting;
 
+import com.android.internal.widget.LockPatternUtils;
 import com.android.settings.R;
 
 import java.util.ArrayList;
@@ -43,12 +44,14 @@
     @PasswordComplexity private final int mRequestedMinComplexity;
     private ManagedLockPasswordProvider mManagedPasswordProvider;
     private DevicePolicyManager mDpm;
+    private final LockPatternUtils mLockPatternUtils;
 
     public ChooseLockGenericController(Context context, int userId) {
         this(
                 context,
                 userId,
-                PASSWORD_COMPLEXITY_NONE);
+                PASSWORD_COMPLEXITY_NONE,
+                new LockPatternUtils(context));
     }
 
     /**
@@ -56,13 +59,14 @@
      *                               when determining the available screen lock types
      */
     public ChooseLockGenericController(Context context, int userId,
-            @PasswordComplexity int requestedMinComplexity) {
+            @PasswordComplexity int requestedMinComplexity, LockPatternUtils lockPatternUtils) {
         this(
                 context,
                 userId,
                 requestedMinComplexity,
                 context.getSystemService(DevicePolicyManager.class),
-                ManagedLockPasswordProvider.get(context, userId));
+                ManagedLockPasswordProvider.get(context, userId),
+                lockPatternUtils);
     }
 
     @VisibleForTesting
@@ -71,12 +75,14 @@
             int userId,
             @PasswordComplexity int requestedMinComplexity,
             DevicePolicyManager dpm,
-            ManagedLockPasswordProvider managedLockPasswordProvider) {
+            ManagedLockPasswordProvider managedLockPasswordProvider,
+            LockPatternUtils lockPatternUtils) {
         mContext = context;
         mUserId = userId;
         mRequestedMinComplexity = requestedMinComplexity;
         mManagedPasswordProvider = managedLockPasswordProvider;
         mDpm = dpm;
+        mLockPatternUtils = lockPatternUtils;
     }
 
     /**
@@ -105,6 +111,12 @@
                     && !managedProfile; // Swipe doesn't make sense for profiles.
             case MANAGED:
                 return mManagedPasswordProvider.isManagedPasswordChoosable();
+            case PIN:
+            case PATTERN:
+            case PASSWORD:
+                // Hide the secure lock screen options if the device doesn't support the secure lock
+                // screen feature.
+                return mLockPatternUtils.hasSecureLockScreen();
         }
         return true;
     }
diff --git a/src/com/android/settings/slices/Copyable.java b/src/com/android/settings/slices/Copyable.java
deleted file mode 100644
index a480063..0000000
--- a/src/com/android/settings/slices/Copyable.java
+++ /dev/null
@@ -1,51 +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.slices;
-
-import static android.content.Context.CLIPBOARD_SERVICE;
-
-import android.content.ClipData;
-import android.content.ClipboardManager;
-import android.content.Context;
-import android.widget.Toast;
-
-import com.android.settings.R;
-
-/**
- * Provide the copy ability for preference controller to copy the data to the clipboard.
- */
-public interface Copyable {
-    /**
-     * Copy the key slice information to the clipboard.
-     * It is highly recommended to show the toast to notify users when implemented this function.
-     */
-    void copy();
-
-    /**
-     * Set the copy content to the clipboard and show the toast.
-     */
-    static void setCopyContent(Context context, CharSequence copyContent,
-            CharSequence messageTitle) {
-        final ClipboardManager clipboard = (ClipboardManager) context.getSystemService(
-                CLIPBOARD_SERVICE);
-        final ClipData clip = ClipData.newPlainText("text", copyContent);
-        clipboard.setPrimaryClip(clip);
-
-        final String toast = context.getString(R.string.copyable_slice_toast, messageTitle);
-        Toast.makeText(context, toast, Toast.LENGTH_SHORT).show();
-    }
-}
diff --git a/src/com/android/settings/slices/CustomSliceable.java b/src/com/android/settings/slices/CustomSliceable.java
index d32e266..b48f22a 100644
--- a/src/com/android/settings/slices/CustomSliceable.java
+++ b/src/com/android/settings/slices/CustomSliceable.java
@@ -55,6 +55,11 @@
 public interface CustomSliceable extends Sliceable {
 
     /**
+     * The color representing not to be tinted for the slice.
+     */
+    int COLOR_NOT_TINTED = -1;
+
+    /**
      * @return an complete instance of the {@link Slice}.
      */
     Slice getSlice();
diff --git a/src/com/android/settings/slices/SliceBroadcastReceiver.java b/src/com/android/settings/slices/SliceBroadcastReceiver.java
index 061cf18..2a9b491 100644
--- a/src/com/android/settings/slices/SliceBroadcastReceiver.java
+++ b/src/com/android/settings/slices/SliceBroadcastReceiver.java
@@ -184,7 +184,7 @@
 
         final BasePreferenceController controller = getPreferenceController(context, key);
 
-        if (!(controller instanceof Copyable)) {
+        if (!(controller instanceof Sliceable)) {
             throw new IllegalArgumentException(
                     "Copyable action passed for a non-copyable key:" + key);
         }
@@ -197,7 +197,7 @@
             return;
         }
 
-        ((Copyable) controller).copy();
+        ((Sliceable) controller).copy();
     }
 
     /**
diff --git a/src/com/android/settings/slices/SliceBuilderUtils.java b/src/com/android/settings/slices/SliceBuilderUtils.java
index 8f85431..c3869a6 100644
--- a/src/com/android/settings/slices/SliceBuilderUtils.java
+++ b/src/com/android/settings/slices/SliceBuilderUtils.java
@@ -93,7 +93,7 @@
             return buildUnavailableSlice(context, sliceData);
         }
 
-        if (controller instanceof Copyable) {
+        if (controller.isCopyableSlice()) {
             return buildCopyableSlice(context, sliceData, controller);
         }
 
diff --git a/src/com/android/settings/slices/Sliceable.java b/src/com/android/settings/slices/Sliceable.java
index ddec2e1..b00ab82 100644
--- a/src/com/android/settings/slices/Sliceable.java
+++ b/src/com/android/settings/slices/Sliceable.java
@@ -16,7 +16,15 @@
 
 package com.android.settings.slices;
 
+import static android.content.Context.CLIPBOARD_SERVICE;
+
+import android.content.ClipData;
+import android.content.ClipboardManager;
+import android.content.Context;
 import android.content.IntentFilter;
+import android.widget.Toast;
+
+import com.android.settings.R;
 
 /**
  * A collection of API making a PreferenceController "sliceable"
@@ -55,4 +63,32 @@
     default boolean hasAsyncUpdate() {
         return false;
     }
+
+    /**
+     * Copy the key slice information to the clipboard.
+     * It is highly recommended to show the toast to notify users when implemented this function.
+     */
+    default void copy() {
+    }
+
+    /**
+     * Whether or not it's a copyable slice.
+     */
+    default boolean isCopyableSlice() {
+        return false;
+    }
+
+    /**
+     * Set the copy content to the clipboard and show the toast.
+     */
+    static void setCopyContent(Context context, CharSequence copyContent,
+            CharSequence messageTitle) {
+        final ClipboardManager clipboard = (ClipboardManager) context.getSystemService(
+                CLIPBOARD_SERVICE);
+        final ClipData clip = ClipData.newPlainText("text", copyContent);
+        clipboard.setPrimaryClip(clip);
+
+        final String toast = context.getString(R.string.copyable_slice_toast, messageTitle);
+        Toast.makeText(context, toast, Toast.LENGTH_SHORT).show();
+    }
 }
diff --git a/src/com/android/settings/users/UserCapabilities.java b/src/com/android/settings/users/UserCapabilities.java
index 473c9c5..459a880 100644
--- a/src/com/android/settings/users/UserCapabilities.java
+++ b/src/com/android/settings/users/UserCapabilities.java
@@ -118,6 +118,8 @@
                 ", mDisallowAddUser=" + mDisallowAddUser +
                 ", mEnforcedAdmin=" + mEnforcedAdmin +
                 ", mDisallowSwitchUser=" + mDisallowSwitchUser +
+                ", mDisallowAddUserSetByAdmin=" + mDisallowAddUserSetByAdmin +
+                ", mUserSwitcherEnabled=" + mUserSwitcherEnabled +
                 '}';
     }
 }
diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index 21552ce..5a83f34 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -271,18 +271,7 @@
             mMePreference.setSummary(R.string.user_admin);
         }
         mAddUser = (RestrictedPreference) findPreference(KEY_ADD_USER);
-        mAddUser.useAdminDisabledSummary(false);
-        // Determine if add user/profile button should be visible
-        if (mUserCaps.mCanAddUser && Utils.isDeviceProvisioned(activity)) {
-            mAddUser.setVisible(true);
-            mAddUser.setOnPreferenceClickListener(this);
-            // change label to only mention user, if restricted profiles are not supported
-            if (!mUserCaps.mCanAddRestrictedProfile) {
-                mAddUser.setTitle(R.string.user_add_user_menu);
-            }
-        } else {
-            mAddUser.setVisible(false);
-        }
+        mAddUser.setOnPreferenceClickListener(this);
 
         activity.registerReceiverAsUser(
                 mUserChangeReceiver, UserHandle.ALL, USER_REMOVED_INTENT_FILTER, null, mHandler);
@@ -968,9 +957,10 @@
                 mAddUserWhenLockedPreferenceController.getPreferenceKey());
         mAddUserWhenLockedPreferenceController.updateState(addUserOnLockScreen);
         mMultiUserFooterPreferenceController.updateState(null /* preference */);
-        mAddUser.setVisible(mUserCaps.mCanAddUser && Utils.isDeviceProvisioned(context)
-                && mUserCaps.mUserSwitcherEnabled);
         mUserListCategory.setVisible(mUserCaps.mUserSwitcherEnabled);
+
+        updateAddUser(context);
+
         if (!mUserCaps.mUserSwitcherEnabled) {
             return;
         }
@@ -980,10 +970,13 @@
             mUserListCategory.addPreference(userPreference);
         }
 
-        // Append Add user to the end of the list
-        if ((mUserCaps.mCanAddUser || mUserCaps.mDisallowAddUserSetByAdmin) &&
-                Utils.isDeviceProvisioned(context)) {
-            boolean moreUsers = mUserManager.canAddMoreUsers();
+    }
+
+    private void updateAddUser(Context context) {
+        if ((mUserCaps.mCanAddUser || mUserCaps.mDisallowAddUserSetByAdmin)
+                && Utils.isDeviceProvisioned(context) && mUserCaps.mUserSwitcherEnabled) {
+            mAddUser.setVisible(true);
+            final boolean moreUsers = mUserManager.canAddMoreUsers();
             mAddUser.setEnabled(moreUsers && !mAddingUser && mUserManager.canSwitchUsers());
             if (!moreUsers) {
                 mAddUser.setSummary(getString(R.string.user_add_max_count, getMaxRealUsers()));
@@ -994,6 +987,8 @@
                 mAddUser.setDisabledByAdmin(
                         mUserCaps.mDisallowAddUser ? mUserCaps.mEnforcedAdmin : null);
             }
+        } else {
+            mAddUser.setVisible(false);
         }
     }
 
diff --git a/src/com/android/settings/wifi/AddNetworkFragment.java b/src/com/android/settings/wifi/AddNetworkFragment.java
index 1a64e2f..81b6c85 100644
--- a/src/com/android/settings/wifi/AddNetworkFragment.java
+++ b/src/com/android/settings/wifi/AddNetworkFragment.java
@@ -19,12 +19,14 @@
 import android.app.Activity;
 import android.app.settings.SettingsEnums;
 import android.content.Intent;
+import android.net.wifi.WifiConfiguration;
 import android.os.Bundle;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.Button;
 import android.widget.ImageButton;
+import android.widget.TextView;
 
 import androidx.annotation.VisibleForTesting;
 
@@ -40,7 +42,10 @@
     final static int SUBMIT_BUTTON_ID = android.R.id.button1;
     @VisibleForTesting
     final static int CANCEL_BUTTON_ID = android.R.id.button2;
-    final static int SCANNER_BUTTON_ID = R.id.ssid_scanner_button;
+    final static int SSID_SCANNER_BUTTON_ID = R.id.ssid_scanner_button;
+    final static int PASSWORD_SCANNER_BUTTON_ID = R.id.password_scanner_button;
+
+    private static final int REQUEST_CODE_WIFI_DPP_ENROLLEE_QR_CODE_SCANNER = 0;
 
     private WifiConfigController mUIController;
     private Button mSubmitBtn;
@@ -61,13 +66,19 @@
             Bundle savedInstanceState) {
         final View rootView = inflater.inflate(R.layout.wifi_add_network_view, container, false);
 
-        rootView.findViewById(android.R.id.button3).setVisibility(View.GONE);
+        final Button neutral = rootView.findViewById(android.R.id.button3);
+        if (neutral != null) {
+            neutral.setVisibility(View.GONE);
+        }
+
         mSubmitBtn = rootView.findViewById(SUBMIT_BUTTON_ID);
         mCancelBtn = rootView.findViewById(CANCEL_BUTTON_ID);
-        final ImageButton scannerButton = rootView.findViewById(SCANNER_BUTTON_ID);
+        final ImageButton ssidScannerButton = rootView.findViewById(SSID_SCANNER_BUTTON_ID);
+        final ImageButton passwordScannerButton = rootView.findViewById(PASSWORD_SCANNER_BUTTON_ID);
         mSubmitBtn.setOnClickListener(this);
         mCancelBtn.setOnClickListener(this);
-        scannerButton.setOnClickListener(this);
+        ssidScannerButton.setOnClickListener(this);
+        passwordScannerButton.setOnClickListener(this);
         mUIController = new WifiConfigController(this, rootView, null, getMode());
 
         return rootView;
@@ -81,6 +92,8 @@
 
     @Override
     public void onClick(View view) {
+        String ssid = null;
+
         switch (view.getId()) {
             case SUBMIT_BUTTON_ID:
                 handleSubmitAction();
@@ -88,15 +101,34 @@
             case CANCEL_BUTTON_ID:
                 handleCancelAction();
                 break;
-            case SCANNER_BUTTON_ID:
+            case SSID_SCANNER_BUTTON_ID:
+                final TextView ssidEditText = getView().findViewById(R.id.ssid);
+                ssid = ssidEditText.getText().toString();
+                // No break and flows to case PASSWORD_SCANNER_BUTTON_ID
+            case PASSWORD_SCANNER_BUTTON_ID:
                 // Launch QR code scanner to join a network.
-                getContext().startActivity(
-                        WifiDppUtils.getEnrolleeQrCodeScannerIntent(/* ssid */ null));
+                startActivityForResult(WifiDppUtils.getEnrolleeQrCodeScannerIntent(ssid),
+                        REQUEST_CODE_WIFI_DPP_ENROLLEE_QR_CODE_SCANNER);
                 break;
         }
     }
 
     @Override
+    public void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+
+        if (requestCode == REQUEST_CODE_WIFI_DPP_ENROLLEE_QR_CODE_SCANNER) {
+            if (resultCode != Activity.RESULT_OK) {
+                return;
+            }
+
+            final WifiConfiguration config = data.getParcelableExtra(
+                    WifiDialogActivity.KEY_WIFI_CONFIGURATION);
+            successfullyFinish(config);
+        }
+    }
+
+    @Override
     public int getMode() {
         return WifiConfigUiBase.MODE_CONNECT;
     }
@@ -154,9 +186,13 @@
 
     @VisibleForTesting
     void handleSubmitAction() {
+        successfullyFinish(mUIController.getConfig());
+    }
+
+    private void successfullyFinish(WifiConfiguration config) {
         final Intent intent = new Intent();
         final Activity activity = getActivity();
-        intent.putExtra(WIFI_CONFIG_KEY, mUIController.getConfig());
+        intent.putExtra(WIFI_CONFIG_KEY, config);
         activity.setResult(Activity.RESULT_OK, intent);
         activity.finish();
     }
diff --git a/src/com/android/settings/wifi/WifiDialog.java b/src/com/android/settings/wifi/WifiDialog.java
index 7d5f3b3..fbea824 100644
--- a/src/com/android/settings/wifi/WifiDialog.java
+++ b/src/com/android/settings/wifi/WifiDialog.java
@@ -18,15 +18,16 @@
 
 import android.content.Context;
 import android.content.DialogInterface;
+import android.content.Intent;
 import android.os.Bundle;
 import android.view.View;
 import android.widget.Button;
 import android.widget.ImageButton;
+import android.widget.TextView;
 
 import androidx.appcompat.app.AlertDialog;
 
 import com.android.settings.R;
-import com.android.settings.wifi.dpp.WifiDppUtils;
 import com.android.settingslib.RestrictedLockUtils;
 import com.android.settingslib.RestrictedLockUtilsInternal;
 import com.android.settingslib.wifi.AccessPoint;
@@ -40,6 +41,9 @@
 
         default void onSubmit(WifiDialog dialog) {
         }
+
+        default void onScan(WifiDialog dialog, String ssid) {
+        }
     }
 
     private static final int BUTTON_SUBMIT = DialogInterface.BUTTON_POSITIVE;
@@ -80,18 +84,6 @@
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         mView = getLayoutInflater().inflate(R.layout.wifi_dialog, /* root */ null);
-        final ImageButton scannerButton = mView.findViewById(R.id.password_scanner_button);
-        if (scannerButton != null) {
-            scannerButton.setOnClickListener((View v) -> {
-                String ssid = null;
-                if (mAccessPoint != null) {
-                    ssid = mAccessPoint.getSsidStr();
-                }
-                // Launch QR code scanner to join a network.
-                getContext().startActivity(
-                        WifiDppUtils.getEnrolleeQrCodeScannerIntent(ssid));
-            });
-        }
         setView(mView);
         mController = new WifiConfigController(this, mView, mAccessPoint, mMode);
         super.onCreate(savedInstanceState);
@@ -109,6 +101,35 @@
         }
     }
 
+    @Override
+    protected void onStart() {
+        View.OnClickListener onClickScannerButtonListener = v -> {
+            if (mListener == null) {
+                return;
+            }
+
+            String ssid = null;
+            if (mAccessPoint == null) {
+                final TextView ssidEditText = findViewById(R.id.ssid);
+                ssid = ssidEditText.getText().toString();
+            } else {
+                ssid = mAccessPoint.getSsidStr();
+            }
+            mListener.onScan(/* WifiDialog */ this, ssid);
+        };
+
+        final ImageButton ssidScannerButton = findViewById(R.id.ssid_scanner_button);
+        ssidScannerButton.setOnClickListener(onClickScannerButtonListener);
+
+        final ImageButton passwordScannerButton = findViewById(R.id.password_scanner_button);
+        passwordScannerButton.setOnClickListener(onClickScannerButtonListener);
+
+        if (mHideSubmitButton) {
+            ssidScannerButton.setVisibility(View.GONE);
+            passwordScannerButton.setVisibility(View.GONE);
+        }
+    }
+
     public void onRestoreInstanceState(Bundle savedInstanceState) {
         super.onRestoreInstanceState(savedInstanceState);
         mController.updatePassword();
diff --git a/src/com/android/settings/wifi/WifiDialogActivity.java b/src/com/android/settings/wifi/WifiDialogActivity.java
index c32bcf3..35de66e 100644
--- a/src/com/android/settings/wifi/WifiDialogActivity.java
+++ b/src/com/android/settings/wifi/WifiDialogActivity.java
@@ -29,6 +29,7 @@
 import androidx.annotation.VisibleForTesting;
 
 import com.android.settings.SetupWizardUtils;
+import com.android.settings.wifi.dpp.WifiDppUtils;
 import com.android.settingslib.wifi.AccessPoint;
 
 import com.google.android.setupcompat.util.WizardManagerHelper;
@@ -49,10 +50,13 @@
     @VisibleForTesting
     static final String KEY_CONNECT_FOR_CALLER = "connect_for_caller";
 
-    private static final String KEY_WIFI_CONFIGURATION = "wifi_configuration";
+    public static final String KEY_WIFI_CONFIGURATION = "wifi_configuration";
+
     private static final int RESULT_CONNECTED = RESULT_FIRST_USER;
     private static final int RESULT_FORGET = RESULT_FIRST_USER + 1;
 
+    private static final int REQUEST_CODE_WIFI_DPP_ENROLLEE_QR_CODE_SCANNER = 0;
+
     private WifiDialog mDialog;
 
     @Override
@@ -162,4 +166,25 @@
         mDialog = null;
         finish();
     }
+
+    @Override
+    public void onScan(WifiDialog dialog, String ssid) {
+        // Launch QR code scanner to join a network.
+        startActivityForResult(WifiDppUtils.getEnrolleeQrCodeScannerIntent(ssid),
+                REQUEST_CODE_WIFI_DPP_ENROLLEE_QR_CODE_SCANNER);
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+
+        if (requestCode == REQUEST_CODE_WIFI_DPP_ENROLLEE_QR_CODE_SCANNER) {
+            if (resultCode != RESULT_OK) {
+                return;
+            }
+
+            setResult(RESULT_CONNECTED, data);
+            finish();
+        }
+    }
 }
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index 4ca9f86..27c495e 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -117,6 +117,8 @@
     private static final String PREF_KEY_SAVED_NETWORKS = "saved_networks";
     private static final String PREF_KEY_STATUS_MESSAGE = "wifi_status_message";
 
+    private static final int REQUEST_CODE_WIFI_DPP_ENROLLEE_QR_CODE_SCANNER = 0;
+
     private static boolean isVerboseLoggingEnabled() {
         return WifiTracker.sVerboseLogging || Log.isLoggable(TAG, Log.VERBOSE);
     }
@@ -427,10 +429,17 @@
     public void onActivityResult(int requestCode, int resultCode, Intent data) {
         super.onActivityResult(requestCode, resultCode, data);
 
-        // Only handle request comes from AddNetworkFragment
         if (requestCode == ADD_NETWORK_REQUEST) {
             handleAddNetworkRequest(resultCode, data);
             return;
+        } else if (requestCode == REQUEST_CODE_WIFI_DPP_ENROLLEE_QR_CODE_SCANNER) {
+            if (resultCode == Activity.RESULT_OK) {
+                if (mDialog != null) {
+                    mDialog.dismiss();
+                }
+                mWifiTracker.resumeScanning();
+            }
+            return;
         }
 
         final boolean formerlyRestricted = mIsRestricted;
@@ -1065,6 +1074,13 @@
         }
     }
 
+    @Override
+    public void onScan(WifiDialog dialog, String ssid) {
+        // Launch QR code scanner to join a network.
+        startActivityForResult(WifiDppUtils.getEnrolleeQrCodeScannerIntent(ssid),
+                REQUEST_CODE_WIFI_DPP_ENROLLEE_QR_CODE_SCANNER);
+    }
+
     /* package */ void submit(WifiConfigController configController) {
 
         final WifiConfiguration config = configController.getConfig();
diff --git a/src/com/android/settings/wifi/calling/WifiCallingSettingsForSub.java b/src/com/android/settings/wifi/calling/WifiCallingSettingsForSub.java
index fda62fe..79112c7 100644
--- a/src/com/android/settings/wifi/calling/WifiCallingSettingsForSub.java
+++ b/src/com/android/settings/wifi/calling/WifiCallingSettingsForSub.java
@@ -177,7 +177,7 @@
 
         mEmptyView = getView().findViewById(android.R.id.empty);
         setEmptyView(mEmptyView);
-        final Resources res = SubscriptionManager.getResourcesForSubId(getActivity(), mSubId);
+        final Resources res = SubscriptionManager.getResourcesForSubId(getContext(), mSubId);
         String emptyViewText = res.getString(R.string.wifi_calling_off_explanation,
                 res.getString(R.string.wifi_calling_off_explanation_2));
         mEmptyView.setText(emptyViewText);
diff --git a/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java b/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
index 671624e..53b1530 100644
--- a/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
+++ b/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
@@ -371,9 +371,6 @@
 
         // Update whether the forget button should be displayed.
         mButtonsPref.setButton1Visible(canForgetNetwork());
-
-        // TODO(b/124700405): Check if showing share button is fine to added for saved network
-        mButtonsPref.setButton3Visible(false);
     }
 
     private void updateLiveNetworkInfo() {
diff --git a/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java b/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java
index 97b2ebe..9e731ba 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java
@@ -172,6 +172,9 @@
             mLatestStatusCode = code;
         }
 
+        if (isGoingInitiator()) {
+            mSummary.setText(R.string.wifi_dpp_sharing_wifi_with_this_device);
+        }
         mProgressBar.setVisibility(isGoingInitiator() ? View.VISIBLE : View.INVISIBLE);
         mButtonRight.setVisibility(isGoingInitiator() ? View.INVISIBLE : View.VISIBLE);
     }
@@ -255,7 +258,7 @@
             mTitle.setText(information);
         }
 
-        mSummary.setText(getString(R.string.wifi_dpp_add_device_to_wifi, getSsid()));
+        updateSummary();
         mWifiApPictureView = view.findViewById(R.id.wifi_ap_picture_view);
 
         mChooseDifferentNetwork = view.findViewById(R.id.choose_different_network);
@@ -273,6 +276,7 @@
             mProgressBar.setVisibility(View.VISIBLE);
             mButtonRight.setVisibility(View.INVISIBLE);
             startWifiDppConfiguratorInitiator();
+            updateSummary();
         });
 
         if (savedInstanceState != null) {
@@ -342,4 +346,12 @@
 
         return model.isGoingInitiator();
     }
+
+    private void updateSummary() {
+        if (isGoingInitiator()) {
+            mSummary.setText(R.string.wifi_dpp_sharing_wifi_with_this_device);
+        } else {
+            mSummary.setText(getString(R.string.wifi_dpp_add_device_to_wifi, getSsid()));
+        }
+    }
 }
diff --git a/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java b/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
index e664a05..a19069b 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
@@ -31,7 +31,6 @@
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
-import android.provider.Settings;
 import android.text.TextUtils;
 import android.util.Log;
 import android.util.Size;
@@ -48,6 +47,7 @@
 import androidx.lifecycle.ViewModelProviders;
 
 import com.android.settings.R;
+import com.android.settings.wifi.WifiDialogActivity;
 import com.android.settings.wifi.qrcode.QrCamera;
 import com.android.settings.wifi.qrcode.QrDecorateView;
 
@@ -77,6 +77,7 @@
     // Key for Bundle usage
     private static final String KEY_IS_CONFIGURATOR_MODE = "key_is_configurator_mode";
     private static final String KEY_LATEST_ERROR_CODE = "key_latest_error_code";
+    private static final String KEY_WIFI_CONFIGURATION = "key_wifi_configuration";
 
     private ProgressBar mProgressBar;
     private QrCamera mCamera;
@@ -93,6 +94,9 @@
     /** QR code data scanned by camera */
     private WifiQrCode mWifiQrCode;
 
+    /** The WifiConfiguration connecting for enrollee usage */
+    private WifiConfiguration mWifiConfiguration;
+
     private int mLatestStatusCode = WifiDppUtils.EASY_CONNECT_EVENT_FAILURE_NONE;
 
     @Override
@@ -102,6 +106,7 @@
         if (savedInstanceState != null) {
             mIsConfiguratorMode = savedInstanceState.getBoolean(KEY_IS_CONFIGURATOR_MODE);
             mLatestStatusCode = savedInstanceState.getInt(KEY_LATEST_ERROR_CODE);
+            mWifiConfiguration = savedInstanceState.getParcelable(KEY_WIFI_CONFIGURATION);
         }
 
         final WifiDppInitiatorViewModel model =
@@ -224,13 +229,7 @@
         } else {
             mTitle.setText(R.string.wifi_dpp_scan_qr_code);
 
-            String description;
-            if (TextUtils.isEmpty(mSsid)) {
-                description = getString(R.string.wifi_dpp_scan_qr_code_join_unknown_network, mSsid);
-            } else {
-                description = getString(R.string.wifi_dpp_scan_qr_code_join_network, mSsid);
-            }
-            mSummary.setText(description);
+            updateEnrolleeSummary();
         }
 
         mErrorMessage = view.findViewById(R.id.error_message);
@@ -410,6 +409,7 @@
                     if (!mIsConfiguratorMode) {
                         mProgressBar.setVisibility(View.VISIBLE);
                         startWifiDppEnrolleeInitiator((WifiQrCode)msg.obj);
+                        updateEnrolleeSummary();
                     }
                     break;
 
@@ -417,6 +417,7 @@
                     mErrorMessage.setVisibility(View.INVISIBLE);
 
                     final WifiNetworkConfig wifiNetworkConfig = (WifiNetworkConfig)msg.obj;
+                    mWifiConfiguration = wifiNetworkConfig.getWifiConfigurationOrNull();
                     wifiNetworkConfig.connect(getContext(),
                             /* listener */ WifiDppQrCodeScannerFragment.this);
                     break;
@@ -431,6 +432,7 @@
     public void onSaveInstanceState(Bundle outState) {
         outState.putBoolean(KEY_IS_CONFIGURATOR_MODE, mIsConfiguratorMode);
         outState.putInt(KEY_LATEST_ERROR_CODE, mLatestStatusCode);
+        outState.putParcelable(KEY_WIFI_CONFIGURATION, mWifiConfiguration);
 
         super.onSaveInstanceState(outState);
     }
@@ -446,6 +448,7 @@
             for (WifiConfiguration wifiConfig : wifiConfigs) {
                 if (wifiConfig.networkId == newNetworkId) {
                     mLatestStatusCode = WifiDppUtils.EASY_CONNECT_EVENT_SUCCESS;
+                    mWifiConfiguration = wifiConfig;
                     wifiManager.connect(wifiConfig, WifiDppQrCodeScannerFragment.this);
                     return;
                 }
@@ -453,6 +456,7 @@
 
             Log.e(TAG, "Invalid networkId " + newNetworkId);
             mLatestStatusCode = EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_GENERIC;
+            updateEnrolleeSummary();
             mProgressBar.setVisibility(View.INVISIBLE);
             showErrorMessage(getString(R.string.wifi_dpp_check_connection_try_again));
             restartCamera();
@@ -520,6 +524,7 @@
             }
 
             mLatestStatusCode = code;
+            updateEnrolleeSummary();
             mProgressBar.setVisibility(View.INVISIBLE);
             restartCamera();
         }
@@ -539,9 +544,11 @@
 
     @Override
     public void onSuccess() {
-        startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
+        final Intent resultIntent = new Intent();
+        resultIntent.putExtra(WifiDialogActivity.KEY_WIFI_CONFIGURATION, mWifiConfiguration);
+
         final Activity hostActivity = getActivity();
-        hostActivity.setResult(Activity.RESULT_OK);
+        hostActivity.setResult(Activity.RESULT_OK, resultIntent);
         hostActivity.finish();
     }
 
@@ -578,4 +585,18 @@
 
         mCamera.start(surfaceTexture);
     }
+
+    private void updateEnrolleeSummary() {
+        if (isGoingInitiator()) {
+            mSummary.setText(R.string.wifi_dpp_connecting);
+        } else {
+            String description;
+            if (TextUtils.isEmpty(mSsid)) {
+                description = getString(R.string.wifi_dpp_scan_qr_code_join_unknown_network, mSsid);
+            } else {
+                description = getString(R.string.wifi_dpp_scan_qr_code_join_network, mSsid);
+            }
+            mSummary.setText(description);
+        }
+    }
 }
diff --git a/src/com/android/settings/wifi/dpp/WifiDppUtils.java b/src/com/android/settings/wifi/dpp/WifiDppUtils.java
index 24cd1d7..6c991cf 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppUtils.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppUtils.java
@@ -95,6 +95,11 @@
     /**
      * Returns an intent to launch QR code scanner for Wi-Fi DPP enrollee.
      *
+     * After enrollee success, the callee activity will return connecting WifiConfiguration by
+     * putExtra {@code WifiDialogActivity.KEY_WIFI_CONFIGURATION} for
+     * {@code Activity#setResult(int resultCode, Intent data)}. The calling object should check
+     * if it's available before using it.
+     *
      * @param ssid The data corresponding to {@code WifiConfiguration} SSID
      * @return Intent for launching QR code scanner
      */
diff --git a/src/com/android/settings/wifi/dpp/WifiNetworkConfig.java b/src/com/android/settings/wifi/dpp/WifiNetworkConfig.java
index 979e602..6135cba 100644
--- a/src/com/android/settings/wifi/dpp/WifiNetworkConfig.java
+++ b/src/com/android/settings/wifi/dpp/WifiNetworkConfig.java
@@ -228,7 +228,7 @@
     /**
      * This is a simplified method from {@code WifiConfigController.getConfig()}
      */
-    private WifiConfiguration getWifiConfigurationOrNull() {
+    WifiConfiguration getWifiConfigurationOrNull() {
         if (!isValidConfig(this)) {
             return null;
         }
diff --git a/src/com/android/settings/wifi/slice/ContextualWifiSlice.java b/src/com/android/settings/wifi/slice/ContextualWifiSlice.java
index 5761ae5..fa8c267 100644
--- a/src/com/android/settings/wifi/slice/ContextualWifiSlice.java
+++ b/src/com/android/settings/wifi/slice/ContextualWifiSlice.java
@@ -16,26 +16,17 @@
 
 package com.android.settings.wifi.slice;
 
-import android.annotation.ColorInt;
 import android.content.Context;
-import android.graphics.PorterDuff;
-import android.graphics.PorterDuffColorFilter;
-import android.graphics.drawable.Drawable;
-import android.net.NetworkInfo.State;
 import android.net.Uri;
 import android.net.wifi.WifiSsid;
 import android.text.TextUtils;
 import android.util.Log;
 
 import androidx.annotation.VisibleForTesting;
-import androidx.core.graphics.drawable.IconCompat;
 import androidx.slice.Slice;
 
-import com.android.settings.R;
-import com.android.settings.Utils;
 import com.android.settings.slices.CustomSliceRegistry;
 import com.android.settings.slices.CustomSliceable;
-import com.android.settingslib.wifi.AccessPoint;
 
 /**
  * {@link CustomSliceable} for Wi-Fi, used by contextual homepage.
@@ -65,36 +56,6 @@
         // keep showing this card to keep UI stable, even if wifi connects to a network later.
         mPreviouslyDisplayed = true;
 
-        // Reload theme for switching dark mode on/off
-        mContext.getTheme().applyStyle(R.style.Theme_Settings_Home, true /* force */);
-
         return super.getSlice();
     }
-
-    @Override
-    protected IconCompat getAccessPointLevelIcon(AccessPoint accessPoint) {
-        final Drawable d = mContext.getDrawable(
-                com.android.settingslib.Utils.getWifiIconResource(accessPoint.getLevel()));
-
-        @ColorInt int color;
-        if (accessPoint.isActive()) {
-            final State state = accessPoint.getNetworkInfo().getState();
-            if (state == State.CONNECTED) {
-                color = Utils.getColorAccentDefaultColor(mContext);
-            } else { // connecting
-                color = Utils.getDisabled(mContext, Utils.getColorAttrDefaultColor(mContext,
-                        android.R.attr.colorControlNormal));
-            }
-        } else {
-            color = Utils.getColorAttrDefaultColor(mContext, android.R.attr.colorControlNormal);
-        }
-
-        d.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN));
-        return Utils.createIconWithDrawable(d);
-    }
-
-    @Override
-    protected int getSliceAccentColor() {
-        return -1;
-    }
 }
diff --git a/src/com/android/settings/wifi/slice/WifiSlice.java b/src/com/android/settings/wifi/slice/WifiSlice.java
index b4b94e1..679ab8b 100644
--- a/src/com/android/settings/wifi/slice/WifiSlice.java
+++ b/src/com/android/settings/wifi/slice/WifiSlice.java
@@ -26,12 +26,21 @@
 import android.app.settings.SettingsEnums;
 import android.content.Context;
 import android.content.Intent;
+import android.graphics.Color;
+import android.graphics.PorterDuff;
+import android.graphics.PorterDuffColorFilter;
+import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.Drawable;
+import android.net.NetworkInfo;
 import android.net.Uri;
 import android.net.wifi.WifiInfo;
 import android.net.wifi.WifiManager;
 import android.net.wifi.WifiSsid;
 import android.os.Bundle;
+import android.text.Spannable;
+import android.text.SpannableString;
 import android.text.TextUtils;
+import android.text.style.ForegroundColorSpan;
 
 import androidx.annotation.VisibleForTesting;
 import androidx.core.graphics.drawable.IconCompat;
@@ -79,13 +88,15 @@
 
     @Override
     public Slice getSlice() {
+        // Reload theme for switching dark mode on/off
+        mContext.getTheme().applyStyle(R.style.Theme_Settings_Home, true /* force */);
+
         final boolean isWifiEnabled = isWifiEnabled();
 
         final IconCompat icon = IconCompat.createWithResource(mContext,
                 R.drawable.ic_settings_wireless);
         final String title = mContext.getString(R.string.wifi_settings);
         final CharSequence summary = getSummary();
-        @ColorInt final int color = getSliceAccentColor();
         final PendingIntent toggleAction = getBroadcastIntent(mContext);
         final PendingIntent primaryAction = getPrimaryAction();
         final SliceAction primarySliceAction = SliceAction.createDeeplink(primaryAction, icon,
@@ -94,7 +105,7 @@
                 null /* actionTitle */, isWifiEnabled);
 
         final ListBuilder listBuilder = new ListBuilder(mContext, getUri(), ListBuilder.INFINITY)
-                .setAccentColor(color)
+                .setAccentColor(COLOR_NOT_TINTED)
                 .addRow(new ListBuilder.RowBuilder()
                         .setTitle(title)
                         .setSubtitle(summary)
@@ -118,8 +129,7 @@
             if (i < apCount) {
                 listBuilder.addRow(getAccessPointRow(results.get(i)));
             } else if (needLoadingRow) {
-                listBuilder.addRow(new ListBuilder.RowBuilder()
-                        .setTitle(mContext.getText(R.string.wifi_empty_list_wifi_on)));
+                listBuilder.addRow(getLoadingRow());
                 needLoadingRow = false;
             } else {
                 listBuilder.addRow(new ListBuilder.RowBuilder()
@@ -130,11 +140,11 @@
     }
 
     private ListBuilder.RowBuilder getAccessPointRow(AccessPoint accessPoint) {
-        final CharSequence title = accessPoint.getConfigName();
+        final CharSequence title = getAccessPointName(accessPoint);
         final IconCompat levelIcon = getAccessPointLevelIcon(accessPoint);
         final ListBuilder.RowBuilder rowBuilder = new ListBuilder.RowBuilder()
                 .setTitleItem(levelIcon, ListBuilder.ICON_IMAGE)
-                .setTitle(title)
+                .setSubtitle(title)
                 .setPrimaryAction(SliceAction.create(
                         getAccessPointAction(accessPoint), levelIcon, ListBuilder.ICON_IMAGE,
                         title));
@@ -146,14 +156,35 @@
         return rowBuilder;
     }
 
-    protected IconCompat getAccessPointLevelIcon(AccessPoint accessPoint) {
-        return IconCompat.createWithResource(mContext,
-                com.android.settingslib.Utils.getWifiIconResource(accessPoint.getLevel()));
+    private CharSequence getAccessPointName(AccessPoint accessPoint) {
+        final CharSequence name = accessPoint.getConfigName();
+        final Spannable span = new SpannableString(name);
+        @ColorInt final int color = Utils.getColorAttrDefaultColor(mContext,
+                android.R.attr.textColorPrimary);
+        span.setSpan(new ForegroundColorSpan(color), 0, name.length(),
+                Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+        return span;
     }
 
-    @ColorInt
-    protected int getSliceAccentColor() {
-        return Utils.getColorAccentDefaultColor(mContext);
+    private IconCompat getAccessPointLevelIcon(AccessPoint accessPoint) {
+        final Drawable d = mContext.getDrawable(
+                com.android.settingslib.Utils.getWifiIconResource(accessPoint.getLevel()));
+
+        @ColorInt int color;
+        if (accessPoint.isActive()) {
+            final NetworkInfo.State state = accessPoint.getNetworkInfo().getState();
+            if (state == NetworkInfo.State.CONNECTED) {
+                color = Utils.getColorAccentDefaultColor(mContext);
+            } else { // connecting
+                color = Utils.getDisabled(mContext, Utils.getColorAttrDefaultColor(mContext,
+                        android.R.attr.colorControlNormal));
+            }
+        } else {
+            color = Utils.getColorAttrDefaultColor(mContext, android.R.attr.colorControlNormal);
+        }
+
+        d.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN));
+        return Utils.createIconWithDrawable(d);
     }
 
     private IconCompat getEndIcon(AccessPoint accessPoint) {
@@ -190,6 +221,18 @@
                 intent, 0 /* flags */);
     }
 
+    private ListBuilder.RowBuilder getLoadingRow() {
+        final CharSequence title = mContext.getText(R.string.wifi_empty_list_wifi_on);
+
+        // for aligning to the Wi-Fi AP's name
+        final IconCompat emptyIcon = Utils.createIconWithDrawable(
+                new ColorDrawable(Color.TRANSPARENT));
+
+        return new ListBuilder.RowBuilder()
+                .setTitleItem(emptyIcon, ListBuilder.ICON_IMAGE)
+                .setSubtitle(title);
+    }
+
     /**
      * Update the current wifi status to the boolean value keyed by
      * {@link android.app.slice.Slice#EXTRA_TOGGLE_STATE} on {@param intent}.
diff --git a/tests/robotests/src/com/android/settings/applications/RecentAppsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/RecentAppsPreferenceControllerTest.java
index 3fd4369..e2a1657 100644
--- a/tests/robotests/src/com/android/settings/applications/RecentAppsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/RecentAppsPreferenceControllerTest.java
@@ -16,14 +16,15 @@
 
 package com.android.settings.applications;
 
+import static com.android.settings.core.BasePreferenceController.AVAILABLE;
+import static com.android.settings.core.BasePreferenceController.AVAILABLE_UNSEARCHABLE;
+
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.ArgumentMatchers.anyLong;
-import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.ArgumentMatchers.argThat;
-import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
@@ -32,7 +33,6 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import android.app.Application;
 import android.app.usage.UsageStats;
 import android.app.usage.UsageStatsManager;
 import android.content.Context;
@@ -44,27 +44,29 @@
 import android.os.PowerManager;
 import android.os.UserHandle;
 import android.os.UserManager;
-import android.text.TextUtils;
+import android.view.LayoutInflater;
+import android.view.View;
 
+import androidx.fragment.app.Fragment;
 import androidx.preference.Preference;
-import androidx.preference.PreferenceCategory;
 import androidx.preference.PreferenceScreen;
 
 import com.android.settings.R;
 import com.android.settingslib.applications.AppUtils;
 import com.android.settingslib.applications.ApplicationsState;
 import com.android.settingslib.applications.instantapps.InstantAppDataProvider;
+import com.android.settingslib.widget.AppEntitiesHeaderController;
+import com.android.settingslib.widget.AppEntityInfo;
+import com.android.settingslib.widget.LayoutPreference;
 
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.mockito.ArgumentCaptor;
 import org.mockito.ArgumentMatcher;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
-import org.robolectric.annotation.Config;
 import org.robolectric.util.ReflectionHelpers;
 
 import java.util.ArrayList;
@@ -76,12 +78,6 @@
     @Mock
     private PreferenceScreen mScreen;
     @Mock
-    private PreferenceCategory mCategory;
-    @Mock
-    private Preference mSeeAllPref;
-    @Mock
-    private PreferenceCategory mDivider;
-    @Mock
     private UsageStatsManager mUsageStatsManager;
     @Mock
     private UserManager mUserManager;
@@ -95,73 +91,155 @@
     private ApplicationInfo mApplicationInfo;
     @Mock
     private PowerManager mPowerManager;
+    @Mock
+    private Fragment mFragment;
 
-    private Context mContext;
+    private LayoutPreference mRecentAppsPreference;
     private RecentAppsPreferenceController mController;
 
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
-        mContext = spy(RuntimeEnvironment.application);
-        when(mContext.getApplicationContext()).thenReturn(mContext);
+        final Context context = spy(RuntimeEnvironment.application);
+        when(context.getApplicationContext()).thenReturn(context);
         ReflectionHelpers.setStaticField(ApplicationsState.class, "sInstance", mAppState);
-        doReturn(mUsageStatsManager).when(mContext).getSystemService(Context.USAGE_STATS_SERVICE);
-        doReturn(mUserManager).when(mContext).getSystemService(Context.USER_SERVICE);
-        doReturn(mPackageManager).when(mContext).getPackageManager();
-        doReturn(mPowerManager).when(mContext).getSystemService(PowerManager.class);
-        when(mUserManager.getProfileIdsWithDisabled(anyInt())).thenReturn(new int[] {});
+        doReturn(mUsageStatsManager).when(context).getSystemService(Context.USAGE_STATS_SERVICE);
+        doReturn(mUserManager).when(context).getSystemService(Context.USER_SERVICE);
+        doReturn(mPackageManager).when(context).getPackageManager();
+        doReturn(mPowerManager).when(context).getSystemService(PowerManager.class);
+        when(mUserManager.getProfileIdsWithDisabled(anyInt())).thenReturn(new int[]{});
 
-        mController = new RecentAppsPreferenceController(mContext, mAppState, null);
-        when(mScreen.findPreference(anyString())).thenReturn(mCategory);
+        final View appEntitiesHeaderView = LayoutInflater.from(context).inflate(
+                R.layout.app_entities_header, null /* root */);
+        final Preference seeAllPreference = new Preference(context);
+        final Preference dividerPreference = new Preference(context);
+        mRecentAppsPreference = spy(new LayoutPreference(context, appEntitiesHeaderView));
 
-        when(mScreen.findPreference(RecentAppsPreferenceController.KEY_SEE_ALL))
-                .thenReturn(mSeeAllPref);
+        mController = spy(new RecentAppsPreferenceController(context, "test_key"));
+        mController.setFragment(mFragment);
+        mController.mAppEntitiesController = mock(AppEntitiesHeaderController.class);
+        mController.mRecentAppsPreference = mRecentAppsPreference;
+        mController.mAllAppPref = seeAllPreference;
+        mController.mDivider = dividerPreference;
+
+        when(mScreen.findPreference(RecentAppsPreferenceController.KEY_ALL_APP_INFO))
+                .thenReturn(seeAllPreference);
         when(mScreen.findPreference(RecentAppsPreferenceController.KEY_DIVIDER))
-                .thenReturn(mDivider);
-        when(mCategory.getContext()).thenReturn(mContext);
+                .thenReturn(dividerPreference);
+        when(mScreen.findPreference("test_key")).thenReturn(mRecentAppsPreference);
+        when(mRecentAppsPreference.findViewById(R.id.app_entities_header)).thenReturn(
+                appEntitiesHeaderView);
     }
 
     @Test
-    public void isAlwaysAvailable() {
-        assertThat(mController.isAvailable()).isTrue();
+    public void getAvailabilityStatus_hasRecentApps_shouldReturnAvailable() {
+        final List<UsageStats> stats = new ArrayList<>();
+        final UsageStats stat1 = new UsageStats();
+        stat1.mLastTimeUsed = System.currentTimeMillis();
+        stat1.mPackageName = "pkg.class";
+        stats.add(stat1);
+        // stat1 is valid app.
+        when(mAppState.getEntry(stat1.mPackageName, UserHandle.myUserId()))
+                .thenReturn(mAppEntry);
+        when(mPackageManager.resolveActivity(any(Intent.class), anyInt()))
+                .thenReturn(new ResolveInfo());
+        when(mUsageStatsManager.queryUsageStats(anyInt(), anyLong(), anyLong()))
+                .thenReturn(stats);
+        mAppEntry.info = mApplicationInfo;
+        mController.reloadData();
+
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
     }
 
     @Test
-    public void doNotIndexCategory() {
-        final List<String> nonIndexable = new ArrayList<>();
-
-        mController.updateNonIndexableKeys(nonIndexable);
-
-        assertThat(nonIndexable).containsAllOf(mController.getPreferenceKey(),
-                RecentAppsPreferenceController.KEY_DIVIDER);
+    public void getAvailabilityStatus_noRecentApps_shouldReturnAvailableUnsearchable() {
+        // No data
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE_UNSEARCHABLE);
     }
 
     @Test
-    public void onDisplayAndUpdateState_shouldRefreshUi() {
-        mController = spy(new RecentAppsPreferenceController(mContext, (Application) null, null));
-
-        doNothing().when(mController).refreshUi(mContext);
-
-        mController.displayPreference(mScreen);
-        mController.updateState(mCategory);
-
-        verify(mController, times(2)).refreshUi(mContext);
-    }
-
-    @Test
-    @Config(qualifiers = "mcc999")
-    public void display_shouldNotShowRecents_showAppInfoPreference() {
+    public void displayPreference_shouldNotReloadData() {
         mController.displayPreference(mScreen);
 
-        verify(mCategory, never()).addPreference(any(Preference.class));
-        verify(mCategory).setTitle(null);
-        verify(mSeeAllPref).setTitle(R.string.applications_settings);
-        verify(mSeeAllPref).setIcon(null);
-        verify(mDivider).setVisible(false);
+        verify(mController, never()).reloadData();
     }
 
     @Test
-    public void display_showRecents() {
+    public void displayPreference_shouldRefreshUi() {
+        mController.displayPreference(mScreen);
+
+        verify(mController).refreshUi();
+    }
+
+    @Test
+    public void displayPreference_shouldSetupAppEntitiesHeaderController() {
+        mController.displayPreference(mScreen);
+
+        assertThat(mController.mAppEntitiesController).isNotNull();
+    }
+
+    @Test
+    public void updateState_firstLaunch_shouldNotReloadData() {
+        mController.mIsFirstLaunch = true;
+
+        mController.updateState(mRecentAppsPreference);
+
+        verify(mController, never()).reloadData();
+    }
+
+    @Test
+    public void updateState_afterFirstLaunch_shouldReloadDataAndRefreshUi() {
+        mController.mIsFirstLaunch = false;
+
+        mController.updateState(mRecentAppsPreference);
+
+        verify(mController).reloadData();
+        verify(mController).refreshUi();
+    }
+
+    @Test
+    public void updateState_threeValidRecentOpenAppsSet_setAppEntityThreeTime() {
+        final List<UsageStats> stats = new ArrayList<>();
+        final UsageStats stat1 = new UsageStats();
+        final UsageStats stat2 = new UsageStats();
+        final UsageStats stat3 = new UsageStats();
+        stat1.mLastTimeUsed = System.currentTimeMillis();
+        stat1.mPackageName = "pkg.class";
+        stats.add(stat1);
+
+        stat2.mLastTimeUsed = System.currentTimeMillis();
+        stat2.mPackageName = "pkg.class2";
+        stats.add(stat2);
+
+        stat3.mLastTimeUsed = System.currentTimeMillis();
+        stat3.mPackageName = "pkg.class3";
+        stats.add(stat3);
+
+        // stat1, stat2 are valid apps. stat3 is invalid.
+        when(mAppState.getEntry(stat1.mPackageName, UserHandle.myUserId()))
+                .thenReturn(mAppEntry);
+        when(mAppState.getEntry(stat2.mPackageName, UserHandle.myUserId()))
+                .thenReturn(mAppEntry);
+        when(mAppState.getEntry(stat3.mPackageName, UserHandle.myUserId()))
+                .thenReturn(mAppEntry);
+        when(mPackageManager.resolveActivity(any(Intent.class), anyInt()))
+                .thenReturn(new ResolveInfo());
+        when(mUsageStatsManager.queryUsageStats(anyInt(), anyLong(), anyLong()))
+                .thenReturn(stats);
+        mAppEntry.info = mApplicationInfo;
+        mController.mIsFirstLaunch = false;
+
+        mController.updateState(mRecentAppsPreference);
+
+        verify(mController.mAppEntitiesController, times(3))
+                .setAppEntity(anyInt(), any(AppEntityInfo.class));
+        assertThat(mController.mRecentAppsPreference.isVisible()).isTrue();
+        assertThat(mController.mDivider.isVisible()).isTrue();
+        assertThat(mController.mAllAppPref.isVisible()).isFalse();
+    }
+
+    @Test
+    public void updateState_oneValidRecentOpenAppSet_setAppEntityOneTime() {
         final List<UsageStats> stats = new ArrayList<>();
         final UsageStats stat1 = new UsageStats();
         final UsageStats stat2 = new UsageStats();
@@ -175,7 +253,7 @@
         stats.add(stat2);
 
         stat3.mLastTimeUsed = System.currentTimeMillis();
-        stat3.mPackageName = "pkg.class2";
+        stat3.mPackageName = "pkg.class3";
         stats.add(stat3);
 
         // stat1, stat2 are valid apps. stat3 is invalid.
@@ -190,21 +268,21 @@
         when(mUsageStatsManager.queryUsageStats(anyInt(), anyLong(), anyLong()))
                 .thenReturn(stats);
         mAppEntry.info = mApplicationInfo;
+        mController.mIsFirstLaunch = false;
 
-        mController.displayPreference(mScreen);
+        mController.updateState(mRecentAppsPreference);
 
-        verify(mCategory).setTitle(R.string.recent_app_category_title);
         // Only add stat1. stat2 is skipped because of the package name, stat3 skipped because
         // it's invalid app.
-        verify(mCategory, times(1)).addPreference(any(Preference.class));
-
-        verify(mSeeAllPref).setSummary(null);
-        verify(mSeeAllPref).setIcon(R.drawable.ic_chevron_right_24dp);
-        verify(mDivider).setVisible(true);
+        verify(mController.mAppEntitiesController, times(1))
+                .setAppEntity(anyInt(), any(AppEntityInfo.class));
+        assertThat(mController.mRecentAppsPreference.isVisible()).isTrue();
+        assertThat(mController.mDivider.isVisible()).isTrue();
+        assertThat(mController.mAllAppPref.isVisible()).isFalse();
     }
 
     @Test
-    public void display_powerSaverMode_showNoRecents() {
+    public void updateState_powerSaverModeOn_headerIsNotVisible() {
         when(mPowerManager.isPowerSaveMode()).thenReturn(true);
 
         final List<UsageStats> stats = new ArrayList<>();
@@ -222,18 +300,17 @@
         when(mUsageStatsManager.queryUsageStats(anyInt(), anyLong(), anyLong()))
                 .thenReturn(stats);
         mAppEntry.info = mApplicationInfo;
+        mController.mIsFirstLaunch = false;
 
-        mController.displayPreference(mScreen);
+        mController.updateState(mRecentAppsPreference);
 
-        verify(mCategory, never()).addPreference(any(Preference.class));
-        verify(mCategory).setTitle(null);
-        verify(mSeeAllPref).setTitle(R.string.applications_settings);
-        verify(mSeeAllPref).setIcon(null);
-        verify(mDivider).setVisible(false);
+        assertThat(mController.mRecentAppsPreference.isVisible()).isFalse();
+        assertThat(mController.mDivider.isVisible()).isFalse();
+        assertThat(mController.mAllAppPref.isVisible()).isTrue();
     }
 
     @Test
-    public void display_showRecentsWithInstantApp() {
+    public void updateState_instantAppSet_shouldSetAppEntityForInstantApp() {
         // Regular app.
         final List<UsageStats> stats = new ArrayList<>();
         final UsageStats stat1 = new UsageStats();
@@ -258,25 +335,22 @@
         // Only the regular app stat1 should have its intent resolve.
         when(mPackageManager.resolveActivity(argThat(intentMatcher(stat1.mPackageName)), anyInt()))
                 .thenReturn(new ResolveInfo());
-
         when(mUsageStatsManager.queryUsageStats(anyInt(), anyLong(), anyLong()))
                 .thenReturn(stats);
 
         // Make sure stat2 is considered an instant app.
         ReflectionHelpers.setStaticField(AppUtils.class, "sInstantAppDataProvider",
                 (InstantAppDataProvider) (ApplicationInfo info) -> info == stat2Entry.info);
+        mController.mIsFirstLaunch = false;
 
-        mController.displayPreference(mScreen);
+        mController.updateState(mRecentAppsPreference);
 
-        ArgumentCaptor<Preference> prefCaptor = ArgumentCaptor.forClass(Preference.class);
-        verify(mCategory, times(2)).addPreference(prefCaptor.capture());
-        List<Preference> prefs = prefCaptor.getAllValues();
-        assertThat(prefs.get(1).getKey()).isEqualTo(stat1.mPackageName);
-        assertThat(prefs.get(0).getKey()).isEqualTo(stat2.mPackageName);
+        verify(mController.mAppEntitiesController, times(2))
+                .setAppEntity(anyInt(), any(AppEntityInfo.class));
     }
 
     @Test
-    public void display_showRecentsWithNullAppEntryOrInfo() {
+    public void updateState_withNullAppEntryOrInfo_shouldNotCrash() {
         final List<UsageStats> stats = new ArrayList<>();
         final UsageStats stat1 = new UsageStats();
         final UsageStats stat2 = new UsageStats();
@@ -299,63 +373,11 @@
                 .thenReturn(stats);
 
         // We should not crash here.
-        mController.displayPreference(mScreen);
+        mController.updateState(mRecentAppsPreference);
     }
 
     @Test
-    public void display_hasRecentButNoneDisplayable_showAppInfo() {
-        final List<UsageStats> stats = new ArrayList<>();
-        final UsageStats stat1 = new UsageStats();
-        final UsageStats stat2 = new UsageStats();
-        stat1.mLastTimeUsed = System.currentTimeMillis();
-        stat1.mPackageName = "com.android.phone";
-        stats.add(stat1);
-
-        stat2.mLastTimeUsed = System.currentTimeMillis();
-        stat2.mPackageName = "com.android.settings";
-        stats.add(stat2);
-
-        // stat1, stat2 are not displayable
-        when(mAppState.getEntry(stat1.mPackageName, UserHandle.myUserId()))
-                .thenReturn(mock(ApplicationsState.AppEntry.class));
-        when(mAppState.getEntry(stat2.mPackageName, UserHandle.myUserId()))
-                .thenReturn(mock(ApplicationsState.AppEntry.class));
-        when(mPackageManager.resolveActivity(any(Intent.class), anyInt()))
-                .thenReturn(new ResolveInfo());
-        when(mUsageStatsManager.queryUsageStats(anyInt(), anyLong(), anyLong()))
-                .thenReturn(stats);
-
-        mController.displayPreference(mScreen);
-
-        verify(mCategory, never()).addPreference(any(Preference.class));
-        verify(mCategory).setTitle(null);
-        verify(mSeeAllPref).setTitle(R.string.applications_settings);
-        verify(mSeeAllPref).setIcon(null);
-    }
-
-    @Test
-    public void display_showRecents_formatSummary() {
-        final UsageStats stat1 = new UsageStats();
-        stat1.mLastTimeUsed = System.currentTimeMillis();
-        stat1.mPackageName = "pkg.class";
-        final List<UsageStats> stats = new ArrayList<>();
-        stats.add(stat1);
-
-        when(mAppState.getEntry(stat1.mPackageName, UserHandle.myUserId()))
-                .thenReturn(mAppEntry);
-        when(mPackageManager.resolveActivity(any(Intent.class), anyInt()))
-                .thenReturn(new ResolveInfo());
-        when(mUsageStatsManager.queryUsageStats(anyInt(), anyLong(), anyLong()))
-                .thenReturn(stats);
-        mAppEntry.info = mApplicationInfo;
-
-        mController.displayPreference(mScreen);
-
-        verify(mCategory).addPreference(argThat(summaryMatches("0 minutes ago")));
-    }
-
-    @Test
-    public void displayPreference_shouldNotShowHiddenSystemModule() {
+    public void updateState_hiddenSystemModuleSet_shouldNotShowHiddenSystemModule() {
         final List<UsageStats> stats = new ArrayList<>();
         // Regular app.
         final UsageStats stat1 = new UsageStats();
@@ -389,24 +411,18 @@
         final List<ModuleInfo> modules = new ArrayList<>();
         modules.add(moduleInfo2);
         when(mPackageManager.getInstalledModules(anyInt() /* flags */))
-            .thenReturn(modules);
+                .thenReturn(modules);
 
         when(mPackageManager.resolveActivity(any(Intent.class), anyInt()))
-            .thenReturn(new ResolveInfo());
+                .thenReturn(new ResolveInfo());
         when(mUsageStatsManager.queryUsageStats(anyInt(), anyLong(), anyLong()))
-            .thenReturn(stats);
+                .thenReturn(stats);
+        mController.mIsFirstLaunch = false;
 
-        mController.displayPreference(mScreen);
+        mController.updateState(mRecentAppsPreference);
 
         // Only add stat1. stat2 is skipped because it is hidden module.
-        final ArgumentCaptor<Preference> prefCaptor = ArgumentCaptor.forClass(Preference.class);
-        verify(mCategory).addPreference(prefCaptor.capture());
-        final Preference pref = prefCaptor.getValue();
-        assertThat(pref.getKey()).isEqualTo(stat1.mPackageName);
-    }
-
-    private static ArgumentMatcher<Preference> summaryMatches(String expected) {
-        return preference -> TextUtils.equals(expected, preference.getSummary());
+        verify(mController.mAppEntitiesController).setAppEntity(anyInt(), any(AppEntityInfo.class));
     }
 
     // Used for matching an intent with a specific package name.
diff --git a/tests/robotests/src/com/android/settings/applications/appinfo/DefaultEmergencyShortcutPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/appinfo/DefaultEmergencyShortcutPreferenceControllerTest.java
index 8f12f98..9f2ee44 100644
--- a/tests/robotests/src/com/android/settings/applications/appinfo/DefaultEmergencyShortcutPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/appinfo/DefaultEmergencyShortcutPreferenceControllerTest.java
@@ -23,6 +23,7 @@
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
 
+import android.app.role.RoleManager;
 import android.content.Context;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
@@ -38,12 +39,15 @@
 import org.robolectric.RuntimeEnvironment;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 @RunWith(RobolectricTestRunner.class)
 public class DefaultEmergencyShortcutPreferenceControllerTest {
 
     @Mock
+    private RoleManager mRoleManager;
+    @Mock
     private PackageManager mPackageManager;
 
     private Context mContext;
@@ -54,6 +58,7 @@
         MockitoAnnotations.initMocks(this);
         mContext = spy(RuntimeEnvironment.application);
         when(mContext.getPackageManager()).thenReturn(mPackageManager);
+        when(mContext.getSystemService(RoleManager.class)).thenReturn(mRoleManager);
         mController = new DefaultEmergencyShortcutPreferenceController(mContext, "Package1");
     }
 
@@ -80,8 +85,8 @@
 
     @Test
     public void isDefaultApp_isDefaultEmergency_shouldReturnTrue() {
-        Settings.Secure.putString(mContext.getContentResolver(),
-                Settings.Secure.EMERGENCY_ASSISTANCE_APPLICATION, "Package1");
+        when(mRoleManager.getRoleHolders(RoleManager.ROLE_EMERGENCY))
+                .thenReturn(Collections.singletonList("Package1"));
 
         assertThat(mController.isDefaultApp()).isTrue();
     }
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultBrowserPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultBrowserPreferenceControllerTest.java
index 1aa9f9d..5197eb3 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultBrowserPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultBrowserPreferenceControllerTest.java
@@ -84,11 +84,9 @@
 
     @Test
     public void isAvailable_hasBrowser_shouldReturnTrue() {
-        final ResolveInfo info = new ResolveInfo();
-        info.activityInfo = new ActivityInfo();
-        info.handleAllWebDataURI = true;
         when(mPackageManager.queryIntentActivitiesAsUser(any(Intent.class), anyInt(), anyInt()))
-            .thenReturn(Collections.singletonList(info));
+            .thenReturn(Collections.singletonList(createResolveInfo("com.test.pkg")));
+
         assertThat(mController.isAvailable()).isTrue();
     }
 
diff --git a/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java
index a74610e..139ef41 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java
@@ -18,12 +18,17 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
+import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
+import android.bluetooth.BluetoothAdapter;
 import android.bluetooth.BluetoothDevice;
 import android.content.Context;
+import android.graphics.Bitmap;
 import android.graphics.drawable.Drawable;
 import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
@@ -49,13 +54,20 @@
     private static final int BATTERY_LEVEL_MAIN = 30;
     private static final int BATTERY_LEVEL_LEFT = 25;
     private static final int BATTERY_LEVEL_RIGHT = 45;
+    private static final String ICON_URI = "content://test.provider/icon.png";
 
     private Context mContext;
 
     @Mock
     private BluetoothDevice mBluetoothDevice;
     @Mock
+    private Bitmap mBitmap;
+    @Mock
+    private ImageView mImageView;
+    @Mock
     private CachedBluetoothDevice mCachedDevice;
+    @Mock
+    private BluetoothAdapter mBluetoothAdapter;
     private AdvancedBluetoothDetailsHeaderController mController;
     private LayoutPreference mLayoutPreference;
 
@@ -69,21 +81,24 @@
         mLayoutPreference = new LayoutPreference(mContext,
                 LayoutInflater.from(mContext).inflate(R.layout.advanced_bt_entity_header, null));
         mController.mLayoutPreference = mLayoutPreference;
+        mController.mBluetoothAdapter = mBluetoothAdapter;
         when(mCachedDevice.getDevice()).thenReturn(mBluetoothDevice);
     }
 
     @Test
     public void createBatteryIcon_hasCorrectInfo() {
-        final Drawable drawable = mController.createBtBatteryIcon(mContext, BATTERY_LEVEL_MAIN);
+        final Drawable drawable = mController.createBtBatteryIcon(mContext, BATTERY_LEVEL_MAIN,
+                true /* charging */);
         assertThat(drawable).isInstanceOf(BatteryMeterView.BatteryMeterDrawable.class);
 
         final BatteryMeterView.BatteryMeterDrawable iconDrawable =
                 (BatteryMeterView.BatteryMeterDrawable) drawable;
         assertThat(iconDrawable.getBatteryLevel()).isEqualTo(BATTERY_LEVEL_MAIN);
+        assertThat(iconDrawable.getCharging()).isTrue();
     }
 
     @Test
-    public void refresh_updateCorrectInfo() {
+    public void refresh_connected_updateCorrectInfo() {
         when(mBluetoothDevice.getMetadata(
                 BluetoothDevice.METADATA_UNTHETHERED_LEFT_BATTERY)).thenReturn(
                 String.valueOf(BATTERY_LEVEL_LEFT));
@@ -93,6 +108,7 @@
         when(mBluetoothDevice.getMetadata(
                 BluetoothDevice.METADATA_UNTHETHERED_CASE_BATTERY)).thenReturn(
                 String.valueOf(BATTERY_LEVEL_MAIN));
+        when(mCachedDevice.isConnected()).thenReturn(true);
         mController.refresh();
 
         assertBatteryLevel(mLayoutPreference.findViewById(R.id.layout_left), BATTERY_LEVEL_LEFT);
@@ -101,6 +117,26 @@
     }
 
     @Test
+    public void refresh_disconnected_updateCorrectInfo() {
+        when(mCachedDevice.isConnected()).thenReturn(false);
+
+        mController.refresh();
+
+        final LinearLayout layout = mLayoutPreference.findViewById(R.id.layout_middle);
+
+        assertThat(mLayoutPreference.findViewById(R.id.layout_left).getVisibility()).isEqualTo(
+                View.GONE);
+        assertThat(mLayoutPreference.findViewById(R.id.layout_right).getVisibility()).isEqualTo(
+                View.GONE);
+        assertThat(layout.getVisibility()).isEqualTo(View.VISIBLE);
+        assertThat(layout.findViewById(R.id.header_title).getVisibility()).isEqualTo(View.GONE);
+        assertThat(layout.findViewById(R.id.bt_battery_summary).getVisibility()).isEqualTo(
+                View.GONE);
+        assertThat(layout.findViewById(R.id.bt_battery_icon).getVisibility()).isEqualTo(View.GONE);
+        assertThat(layout.findViewById(R.id.header_icon).getVisibility()).isEqualTo(View.VISIBLE);
+    }
+
+    @Test
     public void getAvailabilityStatus_unthetheredHeadset_returnAvailable() {
         when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET))
                 .thenReturn("true");
@@ -118,6 +154,30 @@
                 BasePreferenceController.CONDITIONALLY_UNAVAILABLE);
     }
 
+    @Test
+    public void updateIcon_existInCache_setImageBitmap() {
+        mController.mIconCache.put(ICON_URI, mBitmap);
+
+        mController.updateIcon(mImageView, ICON_URI);
+
+        verify(mImageView).setImageBitmap(mBitmap);
+    }
+
+    @Test
+    public void onStart_registerCallback() {
+        mController.onStart();
+
+        verify(mBluetoothAdapter).registerMetadataListener(mBluetoothDevice,
+                mController.mMetadataListener, mController.mHandler);
+    }
+
+    @Test
+    public void onStop_unregisterCallback() {
+        mController.onStop();
+
+        verify(mBluetoothAdapter).unregisterMetadataListener(mBluetoothDevice);
+    }
+
     private void assertBatteryLevel(LinearLayout linearLayout, int batteryLevel) {
         final TextView textView = linearLayout.findViewById(R.id.bt_battery_summary);
         assertThat(textView.getText().toString()).isEqualTo(
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsHeaderControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsHeaderControllerTest.java
index 930d9cb..cf119ea 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsHeaderControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsHeaderControllerTest.java
@@ -19,18 +19,12 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.inOrder;
-import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
+import android.bluetooth.BluetoothDevice;
 import android.graphics.drawable.Drawable;
-import android.view.View;
-
-import androidx.fragment.app.Fragment;
-import androidx.fragment.app.FragmentManager;
-import androidx.fragment.app.FragmentTransaction;
 
 import com.android.settings.R;
 import com.android.settings.testutils.FakeFeatureFactory;
@@ -62,6 +56,8 @@
     private LocalBluetoothManager mBluetoothManager;
     @Mock
     private CachedBluetoothDeviceManager mCachedDeviceManager;
+    @Mock
+    private BluetoothDevice mBluetoothDevice;
 
     @Override
     public void setUp() {
@@ -77,6 +73,7 @@
         mPreference.setKey(mController.getPreferenceKey());
         mScreen.addPreference(mPreference);
         setupDevice(mDeviceConfig);
+        when(mCachedDevice.getDevice()).thenReturn(mBluetoothDevice);
     }
 
     @After
@@ -124,4 +121,12 @@
         inOrder.verify(mHeaderController)
             .setSummary(mContext.getString(R.string.bluetooth_connecting));
     }
+
+    @Test
+    public void isAvailable_unthetheredHeadset_returnFalse() {
+        when(mBluetoothDevice.getMetadata(
+                BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET)).thenReturn("true");
+
+        assertThat(mController.isAvailable()).isFalse();
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothFeatureProviderImplTest.java
index 887f58c..a921215 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothFeatureProviderImplTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothFeatureProviderImplTest.java
@@ -17,30 +17,40 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
+import static org.mockito.Mockito.when;
+
+import android.bluetooth.BluetoothDevice;
 import android.net.Uri;
 
 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 BluetoothFeatureProviderImplTest {
-    private static final String PARAMETER_KEY = "addr";
-    private static final String MAC_ADDRESS = "04:52:C7:0B:D8:3C";
+    private static final String SETTINGS_URI = "content://test.provider/settings_uri";
     private BluetoothFeatureProvider mBluetoothFeatureProvider;
 
+    @Mock
+    private BluetoothDevice mBluetoothDevice;
+
     @Before
     public void setUp() {
+        MockitoAnnotations.initMocks(this);
+
         mBluetoothFeatureProvider = new BluetoothFeatureProviderImpl(
                 RuntimeEnvironment.application);
     }
 
     @Test
     public void getBluetoothDeviceSettingsUri_containCorrectMacAddress() {
-        final Uri uri = mBluetoothFeatureProvider.getBluetoothDeviceSettingsUri(MAC_ADDRESS);
-        assertThat(uri.getQueryParameterNames()).containsExactly(PARAMETER_KEY);
-        assertThat(uri.getQueryParameter(PARAMETER_KEY)).isEqualTo(MAC_ADDRESS);
+        when(mBluetoothDevice.getMetadata(
+                BluetoothDevice.METADATA_ENHANCED_SETTINGS_UI_URI)).thenReturn(SETTINGS_URI);
+        final Uri uri = mBluetoothFeatureProvider.getBluetoothDeviceSettingsUri(mBluetoothDevice);
+        assertThat(uri.toString()).isEqualTo(SETTINGS_URI);
     }
 }
diff --git a/tests/robotests/src/com/android/settings/development/FileEncryptionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/FileEncryptionPreferenceControllerTest.java
index 61e650f..0784a61 100644
--- a/tests/robotests/src/com/android/settings/development/FileEncryptionPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/FileEncryptionPreferenceControllerTest.java
@@ -92,7 +92,7 @@
         ReflectionHelpers.setField(mController, "mStorageManager", mStorageManager);
         when(mStorageManager.isConvertibleToFBE()).thenReturn(true);
         mController.displayPreference(mPreferenceScreen);
-        CryptoProperties.type("foobar");
+        CryptoProperties.type(CryptoProperties.type_values.NONE);
 
         mController.updateState(mPreference);
 
@@ -106,7 +106,7 @@
         ReflectionHelpers.setField(mController, "mStorageManager", mStorageManager);
         when(mStorageManager.isConvertibleToFBE()).thenReturn(true);
         mController.displayPreference(mPreferenceScreen);
-        CryptoProperties.type("file");
+        CryptoProperties.type(CryptoProperties.type_values.FILE);
 
         mController.updateState(mPreference);
 
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/HardwareInfoDialogFragmentTest.java b/tests/robotests/src/com/android/settings/deviceinfo/HardwareInfoDialogFragmentTest.java
deleted file mode 100644
index 29d9a7c..0000000
--- a/tests/robotests/src/com/android/settings/deviceinfo/HardwareInfoDialogFragmentTest.java
+++ /dev/null
@@ -1,66 +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.deviceinfo;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-
-import android.os.SystemProperties;
-import android.view.View;
-
-import androidx.fragment.app.FragmentActivity;
-
-import com.android.settings.R;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.Robolectric;
-import org.robolectric.RobolectricTestRunner;
-
-@RunWith(RobolectricTestRunner.class)
-public class HardwareInfoDialogFragmentTest {
-
-    private FragmentActivity mActivity;
-
-    @Before
-    public void setUp() {
-        mActivity = Robolectric.setupActivity(FragmentActivity.class);
-    }
-
-    @Test
-    public void display_shouldShowHardwareRevision() {
-        final String TEST_HARDWARE_REV = "123";
-        SystemProperties.set("ro.boot.hardware.revision", TEST_HARDWARE_REV);
-
-        final HardwareInfoDialogFragment fragment = spy(HardwareInfoDialogFragment.newInstance());
-        doReturn("").when(fragment).getSerialNumber();
-        fragment.show(mActivity.getSupportFragmentManager(), HardwareInfoDialogFragment.TAG);
-
-        verify(fragment).setText(
-                any(View.class), eq(R.id.model_label), eq(R.id.model_value),
-                anyString());
-
-        verify(fragment).setText(
-                any(View.class), eq(R.id.hardware_rev_label), eq(R.id.hardware_rev_value),
-                anyString());
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/BasebandVersionDialogControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/BasebandVersionPreferenceControllerTest.java
similarity index 60%
rename from tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/BasebandVersionDialogControllerTest.java
rename to tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/BasebandVersionPreferenceControllerTest.java
index 0f56164..5f4848f 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/BasebandVersionDialogControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/BasebandVersionPreferenceControllerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,15 +16,12 @@
 
 package com.android.settings.deviceinfo.firmwareversion;
 
-import static com.android.settings.deviceinfo.firmwareversion.BasebandVersionDialogController
-        .BASEBAND_PROPERTY;
-import static com.android.settings.deviceinfo.firmwareversion.BasebandVersionDialogController
-        .BASEBAND_VERSION_LABEL_ID;
-import static com.android.settings.deviceinfo.firmwareversion.BasebandVersionDialogController
-        .BASEBAND_VERSION_VALUE_ID;
+import static com.android.settings.core.BasePreferenceController.AVAILABLE;
+import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
+import static com.android.settings.deviceinfo.firmwareversion.BasebandVersionPreferenceController.BASEBAND_PROPERTY;
 
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
+import static com.google.common.truth.Truth.assertThat;
+
 import static org.robolectric.shadow.api.Shadow.extract;
 
 import android.content.Context;
@@ -36,7 +33,6 @@
 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;
@@ -44,44 +40,35 @@
 
 @RunWith(RobolectricTestRunner.class)
 @Config(shadows = ShadowConnectivityManager.class)
-public class BasebandVersionDialogControllerTest {
-
-    @Mock
-    private FirmwareVersionDialogFragment mDialog;
+public class BasebandVersionPreferenceControllerTest {
 
     private Context mContext;
-    private BasebandVersionDialogController mController;
+    private BasebandVersionPreferenceController mController;
 
     @Before
     public void setup() {
         MockitoAnnotations.initMocks(this);
         mContext = RuntimeEnvironment.application;
-        when(mDialog.getContext()).thenReturn(mContext);
-        mController = new BasebandVersionDialogController(mDialog);
+        mController = new BasebandVersionPreferenceController(mContext, "key");
     }
 
     @Test
-    public void initialize_wifiOnly_shouldRemoveSettingFromDialog() {
-        ShadowConnectivityManager connectivityManager =
+    public void getAvailability_wifiOnly_unavailable() {
+        final ShadowConnectivityManager connectivityManager =
                 extract(mContext.getSystemService(ConnectivityManager.class));
         connectivityManager.setNetworkSupported(ConnectivityManager.TYPE_MOBILE, false);
 
-        mController.initialize();
-
-        verify(mDialog).removeSettingFromScreen(BASEBAND_VERSION_LABEL_ID);
-        verify(mDialog).removeSettingFromScreen(BASEBAND_VERSION_VALUE_ID);
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
     }
 
     @Test
-    public void initialize_hasMobile_shouldSetDialogTextToBasebandVersion() {
+    public void getAvailability_hasMobile_available() {
         final String text = "test";
         SystemProperties.set(BASEBAND_PROPERTY, text);
         ShadowConnectivityManager connectivityManager =
                 extract(mContext.getSystemService(ConnectivityManager.class));
         connectivityManager.setNetworkSupported(ConnectivityManager.TYPE_MOBILE, true);
 
-        mController.initialize();
-
-        verify(mDialog).setText(BASEBAND_VERSION_VALUE_ID, text);
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
     }
 }
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/BuildNumberDialogControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/BuildNumberDialogControllerTest.java
deleted file mode 100644
index a1e8813..0000000
--- a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/BuildNumberDialogControllerTest.java
+++ /dev/null
@@ -1,55 +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.deviceinfo.firmwareversion;
-
-import static com.android.settings.deviceinfo.firmwareversion.BuildNumberDialogController
-        .BUILD_NUMBER_VALUE_ID;
-
-import static org.mockito.Mockito.verify;
-
-import android.os.Build;
-import android.text.BidiFormatter;
-
-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;
-
-@RunWith(RobolectricTestRunner.class)
-public class BuildNumberDialogControllerTest {
-
-    @Mock
-    private FirmwareVersionDialogFragment mDialog;
-
-    private BuildNumberDialogController mController;
-
-    @Before
-    public void setup() {
-        MockitoAnnotations.initMocks(this);
-        mController = new BuildNumberDialogController(mDialog);
-    }
-
-    @Test
-    public void initialize_shouldUpdateBuildNumberToDialog() {
-        mController.initialize();
-
-        verify(mDialog)
-            .setText(BUILD_NUMBER_VALUE_ID, BidiFormatter.getInstance().unicodeWrap(Build.DISPLAY));
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionDialogControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionDetailPreferenceControllerTest.java
similarity index 64%
rename from tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionDialogControllerTest.java
rename to tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionDetailPreferenceControllerTest.java
index 0c57941..adfff25 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionDialogControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionDetailPreferenceControllerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,13 +16,9 @@
 
 package com.android.settings.deviceinfo.firmwareversion;
 
-import static com.android.settings.deviceinfo.firmwareversion.FirmwareVersionDialogController
-        .FIRMWARE_VERSION_LABEL_ID;
-import static com.android.settings.deviceinfo.firmwareversion.FirmwareVersionDialogController
-        .FIRMWARE_VERSION_VALUE_ID;
+import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.spy;
@@ -32,7 +28,8 @@
 import android.content.Context;
 import android.os.Build;
 import android.os.UserManager;
-import android.view.View;
+
+import androidx.preference.Preference;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -44,36 +41,30 @@
 import org.robolectric.util.ReflectionHelpers;
 
 @RunWith(RobolectricTestRunner.class)
-public class FirmwareVersionDialogControllerTest {
+public class FirmwareVersionDetailPreferenceControllerTest {
 
     @Mock
     private UserManager mUserManager;
-    @Mock
-    private FirmwareVersionDialogFragment mDialog;
-    @Mock
-    private View mView;
 
+    private Preference mPreference;
     private Context mContext;
-    private FirmwareVersionDialogController mController;
+    private FirmwareVersionDetailPreferenceController mController;
 
     @Before
     public void setup() {
         MockitoAnnotations.initMocks(this);
         mContext = spy(RuntimeEnvironment.application);
-        when(mDialog.getContext()).thenReturn(mContext);
-        mController = spy(new FirmwareVersionDialogController(mDialog));
+        mController = spy(new TestController(mContext, "key"));
+
         ReflectionHelpers.setField(mController, "mUserManager", mUserManager);
-        doNothing().when(mController).arrayCopy();
-        doNothing().when(mController).initializeAdminPermissions();
+
+        mPreference = new Preference(mContext);
+        mPreference.setKey(mController.getPreferenceKey());
     }
 
     @Test
-    public void initialize_shouldRegisterListenersAndSetBuildVersion() {
-        mController.initialize();
-
-        verify(mDialog).registerClickListener(eq(FIRMWARE_VERSION_VALUE_ID), any());
-        verify(mDialog).registerClickListener(eq(FIRMWARE_VERSION_LABEL_ID), any());
-        verify(mDialog).setText(FIRMWARE_VERSION_VALUE_ID, Build.VERSION.RELEASE);
+    public void getSummary_shouldGetBuildVersion() {
+        assertThat(mController.getSummary()).isEqualTo(Build.VERSION.RELEASE);
     }
 
     @Test
@@ -82,7 +73,7 @@
         hits[0] = Long.MAX_VALUE;
         when(mUserManager.hasUserRestriction(UserManager.DISALLOW_FUN)).thenReturn(true);
 
-        mController.onClick(mView);
+        mController.handlePreferenceTreeClick(mPreference);
 
         verify(mContext, never()).startActivity(any());
     }
@@ -93,8 +84,19 @@
         hits[0] = Long.MAX_VALUE;
         when(mUserManager.hasUserRestriction(UserManager.DISALLOW_FUN)).thenReturn(false);
 
-        mController.onClick(mView);
+        mController.handlePreferenceTreeClick(mPreference);
 
         verify(mContext).startActivity(any());
     }
+
+    private static class TestController extends FirmwareVersionDetailPreferenceController {
+
+        public TestController(Context context, String key) {
+            super(context, key);
+        }
+
+        @Override
+        void initializeAdminPermissions() {
+        }
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionPreferenceControllerTest.java
index 0c74525..77ae4e2 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionPreferenceControllerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,42 +16,29 @@
 
 package com.android.settings.deviceinfo.firmwareversion;
 
-import static android.content.Context.CLIPBOARD_SERVICE;
-
 import static com.google.common.truth.Truth.assertThat;
 
-import android.content.ClipboardManager;
 import android.content.Context;
 import android.os.Build;
 
-import androidx.fragment.app.Fragment;
 import androidx.preference.Preference;
 import androidx.preference.PreferenceManager;
 import androidx.preference.PreferenceScreen;
 
 import com.android.settings.core.BasePreferenceController;
 
-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.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
-import org.robolectric.annotation.Config;
-import org.robolectric.annotation.Implementation;
-import org.robolectric.annotation.Implements;
-import org.robolectric.annotation.Resetter;
 
 @RunWith(RobolectricTestRunner.class)
 public class FirmwareVersionPreferenceControllerTest {
 
     private static final String KEY = "firmware_version";
 
-    @Mock
-    private Fragment mFragment;
-
     private Preference mPreference;
     private PreferenceScreen mScreen;
     private FirmwareVersionPreferenceController mController;
@@ -62,22 +49,16 @@
         final Context context = RuntimeEnvironment.application;
         final PreferenceManager preferenceManager = new PreferenceManager(context);
         mController = new FirmwareVersionPreferenceController(context, KEY);
-        mController.setHost(mFragment);
         mPreference = new Preference(context);
         mPreference.setKey(KEY);
         mScreen = preferenceManager.createPreferenceScreen(context);
         mScreen.addPreference(mPreference);
     }
 
-    @After
-    public void tearDown() {
-        ShadowFirmwareVersionDialogFragment.reset();
-    }
-
     @Test
     public void firmwareVersion_shouldAlwaysBeShown() {
-        assertThat(mController.getAvailabilityStatus()).isEqualTo(
-                BasePreferenceController.AVAILABLE);
+        assertThat(mController.getAvailabilityStatus())
+                .isEqualTo(BasePreferenceController.AVAILABLE_UNSEARCHABLE);
     }
 
     @Test
@@ -86,55 +67,4 @@
 
         assertThat(mPreference.getSummary()).isEqualTo(Build.VERSION.RELEASE);
     }
-
-    @Test
-    @Config(shadows = ShadowFirmwareVersionDialogFragment.class)
-    public void handlePreferenceTreeClick_samePreferenceKey_shouldStartDialogFragment() {
-        final boolean result = mController.handlePreferenceTreeClick(mPreference);
-
-        assertThat(ShadowFirmwareVersionDialogFragment.isShowing).isTrue();
-        assertThat(result).isTrue();
-    }
-
-    @Test
-    public void handlePreferenceTreeClick_unknownPreferenceKey_shouldDoNothingAndReturnFalse() {
-        mPreference.setKey("foobar");
-
-        final boolean result = mController.handlePreferenceTreeClick(mPreference);
-
-        assertThat(ShadowFirmwareVersionDialogFragment.isShowing).isFalse();
-        assertThat(result).isFalse();
-    }
-
-    @Test
-    public void isSliceable_shouldBeTrue() {
-        assertThat(mController.isSliceable()).isTrue();
-    }
-
-    @Test
-    public void copy_shouldCopyVersionNumberToClipboard() {
-        mController.copy();
-
-        final Context context = RuntimeEnvironment.application;
-        final ClipboardManager clipboard = (ClipboardManager) context.getSystemService(
-                CLIPBOARD_SERVICE);
-        final CharSequence data = clipboard.getPrimaryClip().getItemAt(0).getText();
-        assertThat(data.toString()).isEqualTo(Build.VERSION.RELEASE);
-    }
-
-    @Implements(FirmwareVersionDialogFragment.class)
-    public static class ShadowFirmwareVersionDialogFragment {
-
-        private static boolean isShowing = false;
-
-        @Implementation
-        public static void show(Fragment fragemnt) {
-            isShowing = true;
-        }
-
-        @Resetter
-        public static void reset() {
-            isShowing = false;
-        }
-    }
 }
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/KernelVersionDialogControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/KernelVersionDialogControllerTest.java
deleted file mode 100644
index 52af280..0000000
--- a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/KernelVersionDialogControllerTest.java
+++ /dev/null
@@ -1,61 +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.deviceinfo.firmwareversion;
-
-import static com.android.settings.deviceinfo.firmwareversion.KernelVersionDialogController
-        .KERNEL_VERSION_VALUE_ID;
-
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.content.Context;
-
-import com.android.settingslib.DeviceInfoUtils;
-
-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 KernelVersionDialogControllerTest {
-
-    @Mock
-    private FirmwareVersionDialogFragment mDialog;
-
-    private Context mContext;
-    private KernelVersionDialogController mController;
-
-    @Before
-    public void setup() {
-        MockitoAnnotations.initMocks(this);
-        mContext = RuntimeEnvironment.application;
-        when(mDialog.getContext()).thenReturn(mContext);
-        mController = new KernelVersionDialogController(mDialog);
-    }
-
-    @Test
-    public void initialize_shouldUpdateKernelVersionToDialog() {
-        mController.initialize();
-
-        verify(mDialog)
-            .setText(KERNEL_VERSION_VALUE_ID, DeviceInfoUtils.getFormattedKernelVersion(mContext));
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/KernelVersionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/KernelVersionPreferenceControllerTest.java
new file mode 100644
index 0000000..9ee0bb3
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/KernelVersionPreferenceControllerTest.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deviceinfo.firmwareversion;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+
+import com.android.settingslib.DeviceInfoUtils;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public class KernelVersionPreferenceControllerTest {
+
+
+    private Context mContext;
+    private KernelVersionPreferenceController mController;
+
+    @Before
+    public void setup() {
+        MockitoAnnotations.initMocks(this);
+        mContext = RuntimeEnvironment.application;
+        mController = new KernelVersionPreferenceController(mContext, "key");
+    }
+
+    @Test
+    public void getSummary_shouldGetKernalVersion() {
+        assertThat(mController.getSummary()).isEqualTo(
+                DeviceInfoUtils.getFormattedKernelVersion(mContext));
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceControllerTest.java
new file mode 100644
index 0000000..2761b2f
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceControllerTest.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deviceinfo.firmwareversion;
+
+import static com.android.settings.core.BasePreferenceController.AVAILABLE;
+import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Matchers.anyInt;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.util.FeatureFlagUtils;
+
+import com.android.settings.core.FeatureFlags;
+
+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 MainlineModuleVersionPreferenceControllerTest {
+
+    @Mock
+    private PackageManager mPackageManager;
+
+    private Context mContext;
+
+    @Before
+    public void setup() {
+        MockitoAnnotations.initMocks(this);
+        mContext = spy(RuntimeEnvironment.application);
+        when(mContext.getPackageManager()).thenReturn(mPackageManager);
+
+        FeatureFlagUtils.setEnabled(mContext, FeatureFlags.MAINLINE_MODULE, true);
+    }
+
+    @Test
+    public void getAvailabilityStatus_featureDisabled_unavailable() {
+        FeatureFlagUtils.setEnabled(mContext, FeatureFlags.MAINLINE_MODULE, false);
+
+        final MainlineModuleVersionPreferenceController controller =
+                new MainlineModuleVersionPreferenceController(mContext, "key");
+
+        assertThat(controller.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
+    }
+
+    @Test
+    public void getAvailabilityStatus_noMainlineModuleProvider_unavailable() {
+        when(mContext.getString(
+                com.android.internal.R.string.config_defaultModuleMetadataProvider)).thenReturn(
+                null);
+
+        final MainlineModuleVersionPreferenceController controller =
+                new MainlineModuleVersionPreferenceController(mContext, "key");
+
+        assertThat(controller.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
+    }
+
+    @Test
+    public void getAvailabilityStatus_noMainlineModulePackageInfo_unavailable() throws Exception {
+
+        final String provider = "test.provider";
+        when(mContext.getString(
+                com.android.internal.R.string.config_defaultModuleMetadataProvider))
+                .thenReturn(provider);
+        when(mPackageManager.getPackageInfo(eq(provider), anyInt()))
+                .thenThrow(new PackageManager.NameNotFoundException());
+
+        final MainlineModuleVersionPreferenceController controller =
+                new MainlineModuleVersionPreferenceController(mContext, "key");
+
+        assertThat(controller.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
+    }
+
+    @Test
+    public void getAvailabilityStatus_hasMainlineModulePackageInfo_available() throws Exception {
+        final String provider = "test.provider";
+        final String version = "test version 123";
+        final PackageInfo info = new PackageInfo();
+        info.versionName = version;
+        when(mContext.getString(
+                com.android.internal.R.string.config_defaultModuleMetadataProvider))
+                .thenReturn(provider);
+        when(mPackageManager.getPackageInfo(eq(provider), anyInt())).thenReturn(info);
+
+        final MainlineModuleVersionPreferenceController controller =
+                new MainlineModuleVersionPreferenceController(mContext, "key");
+
+        assertThat(controller.getAvailabilityStatus()).isEqualTo(AVAILABLE);
+    }
+
+}
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/ModuleVersionDialogControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/ModuleVersionDialogControllerTest.java
deleted file mode 100644
index b84ea99..0000000
--- a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/ModuleVersionDialogControllerTest.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.deviceinfo.firmwareversion;
-
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.content.Context;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
-import android.util.FeatureFlagUtils;
-
-import com.android.settings.core.FeatureFlags;
-
-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 ModuleVersionDialogControllerTest {
-
-    @Mock
-    private FirmwareVersionDialogFragment mDialog;
-    @Mock
-    private PackageManager mPackageManager;
-
-    private Context mContext;
-    private ModuleVersionDialogController mController;
-
-    @Before
-    public void setup() {
-        MockitoAnnotations.initMocks(this);
-        mContext = spy(RuntimeEnvironment.application);
-        when(mDialog.getContext()).thenReturn(mContext);
-        when(mContext.getPackageManager()).thenReturn(mPackageManager);
-        mController = new ModuleVersionDialogController(mDialog);
-        FeatureFlagUtils.setEnabled(mContext, FeatureFlags.MAINLINE_MODULE, true);
-    }
-
-    @Test
-    public void initialize_featureDisabled_shouldRemoveSettingFromDialog() {
-        FeatureFlagUtils.setEnabled(mContext, FeatureFlags.MAINLINE_MODULE, false);
-
-        mController.initialize();
-
-        verify(mDialog).removeSettingFromScreen(mController.MODULE_VERSION_LABEL_ID);
-        verify(mDialog).removeSettingFromScreen(mController.MODULE_VERSION_VALUE_ID);
-    }
-
-    @Test
-    public void initialize_noMainlineModuleProvider_shouldRemoveSettingFromDialog() {
-        when(mContext.getString(
-            com.android.internal.R.string.config_defaultModuleMetadataProvider)).thenReturn(null);
-
-        mController.initialize();
-
-        verify(mDialog).removeSettingFromScreen(mController.MODULE_VERSION_LABEL_ID);
-        verify(mDialog).removeSettingFromScreen(mController.MODULE_VERSION_VALUE_ID);
-    }
-
-    @Test
-    public void initialize_noMainlineModulePackageInfo_shouldRemoveSettingFromDialog()
-            throws PackageManager.NameNotFoundException {
-        final String provider = "test.provider";
-        when(mContext.getString(
-            com.android.internal.R.string.config_defaultModuleMetadataProvider))
-            .thenReturn(provider);
-        when(mPackageManager.getPackageInfo(eq(provider), anyInt()))
-            .thenThrow(new PackageManager.NameNotFoundException());
-
-        mController.initialize();
-
-        verify(mDialog).removeSettingFromScreen(mController.MODULE_VERSION_LABEL_ID);
-        verify(mDialog).removeSettingFromScreen(mController.MODULE_VERSION_VALUE_ID);
-    }
-
-    @Test
-    public void initialize_hasMainlineModulePackageInfo_shouldshouldSetDialogTextToMainlineVersion()
-            throws PackageManager.NameNotFoundException {
-        final String provider = "test.provider";
-        final String version = "test version 123";
-        final PackageInfo info = new PackageInfo();
-        info.versionName = version;
-        when(mContext.getString(
-            com.android.internal.R.string.config_defaultModuleMetadataProvider))
-            .thenReturn(provider);
-        when(mPackageManager.getPackageInfo(eq(provider), anyInt())).thenReturn(info);
-
-        mController.initialize();
-
-        verify(mDialog).setText(mController.MODULE_VERSION_VALUE_ID, version);
-    }
-
-}
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/SecurityPatchLevelDialogControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/SecurityPatchLevelPreferenceControllerTest.java
similarity index 62%
rename from tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/SecurityPatchLevelDialogControllerTest.java
rename to tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/SecurityPatchLevelPreferenceControllerTest.java
index 8c334cc..ccc91e6 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/SecurityPatchLevelDialogControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/SecurityPatchLevelPreferenceControllerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,14 +16,13 @@
 
 package com.android.settings.deviceinfo.firmwareversion;
 
-import static com.android.settings.deviceinfo.firmwareversion.SecurityPatchLevelDialogController
-        .SECURITY_PATCH_LABEL_ID;
-import static com.android.settings.deviceinfo.firmwareversion.SecurityPatchLevelDialogController
-        .SECURITY_PATCH_VALUE_ID;
+import static com.android.settings.core.BasePreferenceController.AVAILABLE;
+import static com.android.settings.core.BasePreferenceController.CONDITIONALLY_UNAVAILABLE;
+
+import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
@@ -33,7 +32,8 @@
 import android.content.Context;
 import android.content.pm.PackageManager;
 import android.os.Build;
-import android.view.View;
+
+import androidx.preference.Preference;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -47,55 +47,47 @@
 import java.util.Collections;
 
 @RunWith(RobolectricTestRunner.class)
-public class SecurityPatchLevelDialogControllerTest {
+public class SecurityPatchLevelPreferenceControllerTest {
 
     @Mock
     private PackageManager mPackageManager;
-    @Mock
-    private FirmwareVersionDialogFragment mDialog;
-    @Mock
-    private View mView;
 
     private Context mContext;
-    private SecurityPatchLevelDialogController mController;
+    private SecurityPatchLevelPreferenceController mController;
 
     @Before
     public void setup() {
         MockitoAnnotations.initMocks(this);
         mContext = spy(Robolectric.setupActivity(Activity.class));
-        when(mDialog.getContext()).thenReturn(mContext);
     }
 
     @Test
-    public void initialize_noPatchInfo_shouldRemoveSettingFromDialog() {
+    public void getAvailabilityStatus_noPatchInfo_unavailable() {
         ReflectionHelpers.setStaticField(Build.VERSION.class, "SECURITY_PATCH", "");
-        mController = new SecurityPatchLevelDialogController(mDialog);
+        mController = new SecurityPatchLevelPreferenceController(mContext, "key");
 
-        mController.initialize();
-
-        verify(mDialog).removeSettingFromScreen(SECURITY_PATCH_VALUE_ID);
-        verify(mDialog).removeSettingFromScreen(SECURITY_PATCH_LABEL_ID);
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(CONDITIONALLY_UNAVAILABLE);
     }
 
     @Test
-    public void initialize_patchInfoAvailable_shouldRegisterListeners() {
+    public void getAvailabilityStatus_hasPatchInfo_available() {
         ReflectionHelpers.setStaticField(Build.VERSION.class, "SECURITY_PATCH", "foobar");
-        mController = new SecurityPatchLevelDialogController(mDialog);
+        mController = new SecurityPatchLevelPreferenceController(mContext, "key");
 
-        mController.initialize();
-
-        verify(mDialog).registerClickListener(eq(SECURITY_PATCH_LABEL_ID), any());
-        verify(mDialog).registerClickListener(eq(SECURITY_PATCH_VALUE_ID), any());
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
     }
 
     @Test
     public void onClick_noActivityIntent_shouldDoNothing() {
         when(mPackageManager.queryIntentActivities(any(), anyInt()))
                 .thenReturn(Collections.emptyList());
-        mController = new SecurityPatchLevelDialogController(mDialog);
+        mController = new SecurityPatchLevelPreferenceController(mContext, "key");
         ReflectionHelpers.setField(mController, "mPackageManager", mPackageManager);
 
-        mController.onClick(mView);
+        final Preference pref = new Preference(mContext);
+        pref.setKey(mController.getPreferenceKey());
+
+        mController.handlePreferenceTreeClick(pref);
 
         verify(mContext, never()).startActivity(any());
     }
@@ -104,10 +96,14 @@
     public void onClick_activityIntentFound_shouldStartActivity() {
         when(mPackageManager.queryIntentActivities(any(), anyInt()))
                 .thenReturn(Collections.singletonList(null));
-        mController = new SecurityPatchLevelDialogController(mDialog);
+
+        mController = new SecurityPatchLevelPreferenceController(mContext, "key");
         ReflectionHelpers.setField(mController, "mPackageManager", mPackageManager);
 
-        mController.onClick(mView);
+        final Preference pref = new Preference(mContext);
+        pref.setKey(mController.getPreferenceKey());
+
+        mController.handlePreferenceTreeClick(pref);
 
         verify(mContext).startActivity(any());
     }
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/hardwareinfo/DeviceModelPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/hardwareinfo/DeviceModelPreferenceControllerTest.java
new file mode 100644
index 0000000..1204c44
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/deviceinfo/hardwareinfo/DeviceModelPreferenceControllerTest.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deviceinfo.hardwareinfo;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+
+import com.android.settings.core.BasePreferenceController;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
+
+@RunWith(RobolectricTestRunner.class)
+public class DeviceModelPreferenceControllerTest {
+
+    private Context mContext;
+    private DeviceModelPreferenceController mController;
+
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mContext = RuntimeEnvironment.application;
+        mController = new DeviceModelPreferenceController(mContext, "test_key");
+    }
+
+    @Test
+    public void getAvailabilityStatus_configAllowed_available() {
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(
+                BasePreferenceController.AVAILABLE);
+    }
+
+    @Test
+    @Config(qualifiers = "mcc999")
+    public void getAvailabilityStatus_configDisallowed_unavailable() {
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(
+                BasePreferenceController.UNSUPPORTED_ON_DEVICE);
+    }
+
+    @Test
+    public void isAlwaysSliceable() {
+        assertThat(mController.isSliceable()).isTrue();
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/DeviceModelPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/hardwareinfo/HardwareInfoPreferenceControllerTest.java
similarity index 64%
rename from tests/robotests/src/com/android/settings/deviceinfo/DeviceModelPreferenceControllerTest.java
rename to tests/robotests/src/com/android/settings/deviceinfo/hardwareinfo/HardwareInfoPreferenceControllerTest.java
index 6418cf8..413c492 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/DeviceModelPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/hardwareinfo/HardwareInfoPreferenceControllerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -13,56 +13,44 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.android.settings.deviceinfo;
+package com.android.settings.deviceinfo.hardwareinfo;
 
 import static com.google.common.truth.Truth.assertThat;
 
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
 import android.content.Context;
 import android.os.Build;
 
-import androidx.fragment.app.Fragment;
-import androidx.fragment.app.FragmentManager;
-import androidx.fragment.app.FragmentTransaction;
 import androidx.preference.Preference;
 import androidx.preference.PreferenceManager;
 import androidx.preference.PreferenceScreen;
 
 import com.android.settings.R;
 import com.android.settings.core.BasePreferenceController;
+import com.android.settings.deviceinfo.HardwareInfoPreferenceController;
 
 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;
 import org.robolectric.annotation.Config;
 
 @RunWith(RobolectricTestRunner.class)
-public class DeviceModelPreferenceControllerTest {
+public class HardwareInfoPreferenceControllerTest {
 
     private final String KEY = "device_model";
 
-    @Mock
-    private Fragment mFragment;
     private Preference mPreference;
     private PreferenceScreen mPreferenceScreen;
     private Context mContext;
-    private DeviceModelPreferenceController mController;
+    private HardwareInfoPreferenceController mController;
 
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
         mContext = RuntimeEnvironment.application;
-        mController = new DeviceModelPreferenceController(mContext, KEY);
-        mController.setHost(mFragment);
+        mController = new HardwareInfoPreferenceController(mContext, KEY);
         mPreference = new Preference(mContext);
         mPreference.setKey(KEY);
         final PreferenceManager preferenceManager = new PreferenceManager(mContext);
@@ -73,7 +61,7 @@
     @Test
     public void isAvailable_returnTrueIfVisible() {
         assertThat(mController.getAvailabilityStatus()).isEqualTo(
-                BasePreferenceController.AVAILABLE);
+                BasePreferenceController.AVAILABLE_UNSEARCHABLE);
     }
 
     @Test
@@ -90,22 +78,6 @@
         assertThat(containBuildModel(mPreference.getSummary())).isTrue();
     }
 
-    @Test
-    public void clickPreference_shouldLaunchHardwareInfoDialog() {
-        FragmentManager fragmentManager = mock(FragmentManager.class);
-        when(mFragment.getFragmentManager()).thenReturn(fragmentManager);
-        when(fragmentManager.beginTransaction()).thenReturn(mock(FragmentTransaction.class));
-
-        assertThat(mController.handlePreferenceTreeClick(mPreference)).isTrue();
-        verify(fragmentManager.beginTransaction())
-                .add(any(HardwareInfoDialogFragment.class), eq(HardwareInfoDialogFragment.TAG));
-    }
-
-    @Test
-    public void isSliceable_shouldBeTrue() {
-        assertThat(mController.isSliceable()).isTrue();
-    }
-
     private boolean containBuildModel(CharSequence result) {
         final String oracle = mContext.getResources().getString(R.string.model_summary,
                 Build.MODEL);
diff --git a/tests/robotests/src/com/android/settings/homepage/SettingsHomepageActivityTest.java b/tests/robotests/src/com/android/settings/homepage/SettingsHomepageActivityTest.java
index b100460..50a798f 100644
--- a/tests/robotests/src/com/android/settings/homepage/SettingsHomepageActivityTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/SettingsHomepageActivityTest.java
@@ -18,36 +18,20 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
-import android.util.FeatureFlagUtils;
 import android.view.View;
+import android.widget.FrameLayout;
 
 import com.android.settings.R;
-import com.android.settings.SettingsActivity;
-import com.android.settings.core.FeatureFlags;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.robolectric.Robolectric;
 import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.Shadows;
-import org.robolectric.shadows.ShadowActivity;
 
 @RunWith(RobolectricTestRunner.class)
 public class SettingsHomepageActivityTest {
 
     @Test
-    public void launch_featureFlagOff_shouldRedirectToSettingsActivity() {
-        FeatureFlagUtils.setEnabled(RuntimeEnvironment.application, FeatureFlags.DYNAMIC_HOMEPAGE,
-                false);
-
-        final ShadowActivity shadowActivity = Shadows.shadowOf(
-                Robolectric.setupActivity(SettingsHomepageActivity.class));
-        assertThat(shadowActivity.getNextStartedActivity().getComponent().getClassName())
-                .isEqualTo(SettingsActivity.class.getName());
-    }
-
-    @Test
     public void setHomepageContainerPaddingTop_shouldBeSetPaddingTop() {
         final SettingsHomepageActivity activity = Robolectric.buildActivity(
                 SettingsHomepageActivity.class).create().get();
@@ -65,4 +49,13 @@
         assertThat(actualPaddingTop).isEqualTo(
                 statusBarHeight + searchBarHeight + searchBarMargin * 2);
     }
+
+    @Test
+    public void launch_shouldHaveAnimationForIaFragment() {
+        final SettingsHomepageActivity activity = Robolectric.buildActivity(
+                SettingsHomepageActivity.class).create().get();
+        final FrameLayout frameLayout = activity.findViewById(R.id.main_content);
+
+        assertThat(frameLayout.getLayoutTransition()).isNotNull();
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSliceTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSliceTest.java
index 7ec1316..a744e68 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSliceTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSliceTest.java
@@ -229,6 +229,50 @@
         assertThat(rows).isEqualTo(NotificationChannelSlice.DEFAULT_EXPANDED_ROW_COUNT + 1);
     }
 
+    @Test
+    @Config(shadows = ShadowRestrictedLockUtilsInternal.class)
+    public void getSlice_channelCountIsLessThanDefaultRows_subTitleShouldNotHaveTapToManagerAll() {
+        addMockPackageToPackageManager(true /* isRecentlyInstalled */,
+                ApplicationInfo.FLAG_INSTALLED);
+        mockNotificationBackend(CHANNEL_COUNT - 1, NOTIFICATION_COUNT, false /* banned */);
+
+        final Slice slice = mNotificationChannelSlice.getSlice();
+
+        final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
+        assertThat(metadata.getSubtitle()).isEqualTo(mContext.getResources().getQuantityString(
+                R.plurals.notification_few_channel_count_summary, CHANNEL_COUNT - 1,
+                CHANNEL_COUNT - 1));
+    }
+
+    @Test
+    @Config(shadows = ShadowRestrictedLockUtilsInternal.class)
+    public void getSlice_channelCountIsEqualToDefaultRows_subTitleShouldNotHaveTapToManagerAll() {
+        addMockPackageToPackageManager(true /* isRecentlyInstalled */,
+                ApplicationInfo.FLAG_INSTALLED);
+        mockNotificationBackend(CHANNEL_COUNT, NOTIFICATION_COUNT, false /* banned */);
+
+        final Slice slice = mNotificationChannelSlice.getSlice();
+
+        final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
+        assertThat(metadata.getSubtitle()).isEqualTo(mContext.getResources().getQuantityString(
+                R.plurals.notification_few_channel_count_summary, CHANNEL_COUNT, CHANNEL_COUNT));
+    }
+
+    @Test
+    @Config(shadows = ShadowRestrictedLockUtilsInternal.class)
+    public void getSlice_channelCountIsMoreThanDefaultRows_subTitleShouldHaveTapToManagerAll() {
+        addMockPackageToPackageManager(true /* isRecentlyInstalled */,
+                ApplicationInfo.FLAG_INSTALLED);
+        mockNotificationBackend(CHANNEL_COUNT + 1, NOTIFICATION_COUNT, false /* banned */);
+
+        final Slice slice = mNotificationChannelSlice.getSlice();
+
+        final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
+        assertThat(metadata.getSubtitle()).isEqualTo(
+                mContext.getString(R.string.notification_many_channel_count_summary,
+                        CHANNEL_COUNT + 1));
+    }
+
     private void addMockPackageToPackageManager(boolean isRecentlyInstalled, int flags) {
         final ApplicationInfo applicationInfo = new ApplicationInfo();
         applicationInfo.name = APP_LABEL;
diff --git a/tests/robotests/src/com/android/settings/network/telephony/DataUsagePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/telephony/DataUsagePreferenceControllerTest.java
index f77a94f..348f8b4 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/DataUsagePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/DataUsagePreferenceControllerTest.java
@@ -18,11 +18,17 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
+import static org.mockito.Matchers.anyInt;
+import static org.mockito.Matchers.anyLong;
+import static org.mockito.Matchers.anyString;
 import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 import android.app.Activity;
+import android.app.usage.NetworkStats;
 import android.app.usage.NetworkStatsManager;
 import android.content.Context;
 import android.content.Intent;
@@ -33,6 +39,7 @@
 import androidx.preference.SwitchPreference;
 
 import com.android.settings.core.BasePreferenceController;
+import com.android.settingslib.net.DataUsageController;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -42,6 +49,7 @@
 import org.mockito.MockitoAnnotations;
 import org.robolectric.Robolectric;
 import org.robolectric.RobolectricTestRunner;
+import org.robolectric.util.ReflectionHelpers;
 
 @RunWith(RobolectricTestRunner.class)
 public class DataUsagePreferenceControllerTest {
@@ -104,4 +112,18 @@
 
         assertThat(mPreference.isEnabled()).isFalse();
     }
+
+    @Test
+    public void updateState_noUsageData_shouldDisablePreference() throws Exception {
+        final NetworkStatsManager networkStatsManager = mock(NetworkStatsManager.class);
+        when(networkStatsManager.querySummaryForDevice(anyInt() /* networkType */,
+            anyString() /* subscriberId */, anyLong() /* startTime */, anyLong() /* endTime */))
+            .thenReturn(mock(NetworkStats.Bucket.class));
+        ReflectionHelpers.setField(
+            mController, "mDataUsageInfo", new DataUsageController.DataUsageInfo());
+
+        mController.updateState(mPreference);
+
+        assertThat(mPreference.isEnabled()).isFalse();
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/notification/NotificationAssistantPickerTest.java b/tests/robotests/src/com/android/settings/notification/NotificationAssistantPickerTest.java
new file mode 100644
index 0000000..6b6ed02
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/notification/NotificationAssistantPickerTest.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.notification;
+
+import static org.junit.Assert.fail;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.RETURNS_SMART_NULLS;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.content.pm.ServiceInfo;
+
+import com.android.settingslib.widget.CandidateInfo;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.mockito.invocation.InvocationOnMock;
+import org.robolectric.RobolectricTestRunner;
+
+@RunWith(RobolectricTestRunner.class)
+public class NotificationAssistantPickerTest {
+
+    private NotificationAssistantPicker mFragment;
+    @Mock
+    private Context mContext;
+    @Mock
+    private PackageManager mPackageManager;
+    @Mock
+    private NotificationBackend mNotificationBackend;
+    private static final String TEST_PKG = "test.package";
+    private static final String TEST_SRV = "test.component";
+    private static final String TEST_CMP = TEST_PKG + "/" + TEST_SRV;
+    private static final String TEST_NAME = "Test name";
+    private static final ComponentName TEST_COMPONENT = ComponentName.unflattenFromString(TEST_CMP);
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mFragment = new TestNotificationAssistantPicker(mContext, mPackageManager,
+                mNotificationBackend);
+    }
+
+    @Test
+    public void getCurrentAssistant() {
+        when(mNotificationBackend.getAllowedNotificationAssistant()).thenReturn(TEST_COMPONENT);
+        String key = mFragment.getDefaultKey();
+        assertEquals(key, TEST_CMP);
+    }
+
+    @Test
+    public void getCurrentAssistant_None() {
+        when(mNotificationBackend.getAllowedNotificationAssistant()).thenReturn(null);
+        String key = mFragment.getDefaultKey();
+        assertEquals(key, "");
+    }
+
+    @Test
+    public void setAssistant() {
+        mFragment.setDefaultKey(TEST_CMP);
+        verify(mNotificationBackend).setNotificationAssistantGranted(TEST_COMPONENT);
+    }
+
+    @Test
+    public void setAssistant_None() {
+        mFragment.setDefaultKey("");
+        verify(mNotificationBackend).setNotificationAssistantGranted(null);
+    }
+
+    @Test
+    public void candidateListHasNoneAtEnd() {
+        List<ServiceInfo> list = new ArrayList<>();
+        ServiceInfo serviceInfo = mock(ServiceInfo.class, RETURNS_SMART_NULLS);
+        serviceInfo.packageName = TEST_PKG;
+        serviceInfo.name = TEST_SRV;
+        list.add(serviceInfo);
+        mFragment.onServicesReloaded(list);
+        List<? extends CandidateInfo> candidates = mFragment.getCandidates();
+        assertTrue(candidates.size() > 0);
+        assertEquals(candidates.get(candidates.size() - 1).getKey(), "");
+    }
+
+    @Test
+    public void candidateListHasCorrectCandidate() {
+        List<ServiceInfo> list = new ArrayList<>();
+        ServiceInfo serviceInfo = mock(ServiceInfo.class, RETURNS_SMART_NULLS);
+        serviceInfo.packageName = TEST_PKG;
+        serviceInfo.name = TEST_SRV;
+        list.add(serviceInfo);
+        mFragment.onServicesReloaded(list);
+        List<? extends CandidateInfo> candidates = mFragment.getCandidates();
+        boolean found = false;
+        for (CandidateInfo c : candidates) {
+            if (TEST_CMP.equals(c.getKey())) {
+                found = true;
+                break;
+            }
+        }
+        if (!found) fail();
+    }
+
+    @Test
+    public void noDialogOnNoAssistantSelected() {
+        when(mContext.getString(anyInt(), anyString())).thenAnswer(
+                (InvocationOnMock invocation) -> {
+                        return invocation.getArgument(1);
+                });
+        assertNull(mFragment.getConfirmationMessage(
+                new NotificationAssistantPicker.CandidateNone(mContext)));
+    }
+
+    @Test
+    public void dialogTextHasAssistantName() {
+        CandidateInfo c = mock(CandidateInfo.class);
+        when(mContext.getString(anyInt(), anyString())).thenAnswer(
+                (InvocationOnMock invocation) -> {
+                    return invocation.getArgument(1);
+                });
+        when(c.loadLabel()).thenReturn(TEST_NAME);
+        when(c.getKey()).thenReturn(TEST_CMP);
+        CharSequence text = mFragment.getConfirmationMessage(c);
+        assertNotNull(text);
+        assertTrue(text.toString().contains(TEST_NAME));
+    }
+
+
+    private static class TestNotificationAssistantPicker extends NotificationAssistantPicker {
+        TestNotificationAssistantPicker(Context context, PackageManager packageManager,
+                NotificationBackend notificationBackend) {
+            mContext = context;
+            mPm = packageManager;
+            mNotificationBackend = notificationBackend;
+        }
+    }
+
+}
diff --git a/tests/robotests/src/com/android/settings/password/ChooseLockGenericControllerTest.java b/tests/robotests/src/com/android/settings/password/ChooseLockGenericControllerTest.java
index 2b7bdeb..4adc01b 100644
--- a/tests/robotests/src/com/android/settings/password/ChooseLockGenericControllerTest.java
+++ b/tests/robotests/src/com/android/settings/password/ChooseLockGenericControllerTest.java
@@ -34,6 +34,7 @@
 import android.app.admin.DevicePolicyManager.PasswordComplexity;
 import android.content.ComponentName;
 
+import com.android.internal.widget.LockPatternUtils;
 import com.android.settings.R;
 import com.android.settings.testutils.shadow.SettingsShadowResources;
 
@@ -61,10 +62,14 @@
     @Mock
     private DevicePolicyManager mDevicePolicyManager;
 
+    @Mock
+    private LockPatternUtils mLockPatternUtils;
+
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
 
+        when(mLockPatternUtils.hasSecureLockScreen()).thenReturn(true);
         mController = createController(PASSWORD_COMPLEXITY_NONE);
         SettingsShadowResources.overrideResource(R.bool.config_hide_none_security_option, false);
         SettingsShadowResources.overrideResource(R.bool.config_hide_swipe_security_option, false);
@@ -266,6 +271,7 @@
                 0 /* userId */,
                 minPasswordComplexity,
                 mDevicePolicyManager,
-                mManagedLockPasswordProvider);
+                mManagedLockPasswordProvider,
+                mLockPatternUtils);
     }
 }
diff --git a/tests/robotests/src/com/android/settings/password/ChooseLockTypeDialogFragmentTest.java b/tests/robotests/src/com/android/settings/password/ChooseLockTypeDialogFragmentTest.java
index 195c82d..9e8644f 100644
--- a/tests/robotests/src/com/android/settings/password/ChooseLockTypeDialogFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/password/ChooseLockTypeDialogFragmentTest.java
@@ -33,6 +33,7 @@
 import com.android.settings.R;
 import com.android.settings.password.ChooseLockTypeDialogFragment.OnLockTypeSelectedListener;
 import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
+import com.android.settings.testutils.shadow.ShadowLockPatternUtils;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -43,7 +44,7 @@
 import org.robolectric.shadows.androidx.fragment.FragmentController;
 
 @RunWith(RobolectricTestRunner.class)
-@Config(shadows = ShadowAlertDialogCompat.class)
+@Config(shadows = {ShadowAlertDialogCompat.class, ShadowLockPatternUtils.class})
 public class ChooseLockTypeDialogFragmentTest {
 
     private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/password/SetupChooseLockPasswordTest.java b/tests/robotests/src/com/android/settings/password/SetupChooseLockPasswordTest.java
index e0c6ded..aeb16e6 100644
--- a/tests/robotests/src/com/android/settings/password/SetupChooseLockPasswordTest.java
+++ b/tests/robotests/src/com/android/settings/password/SetupChooseLockPasswordTest.java
@@ -34,6 +34,7 @@
 import com.android.settings.password.SetupChooseLockPassword.SetupChooseLockPasswordFragment;
 import com.android.settings.testutils.shadow.SettingsShadowResources;
 import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
+import com.android.settings.testutils.shadow.ShadowLockPatternUtils;
 import com.android.settings.testutils.shadow.ShadowUtils;
 import com.android.settings.widget.ScrollToParentEditText;
 
@@ -57,7 +58,13 @@
 import java.util.List;
 
 @RunWith(RobolectricTestRunner.class)
-@Config(shadows = {SettingsShadowResources.class, ShadowUtils.class, ShadowAlertDialogCompat.class})
+@Config(
+        shadows = {
+                SettingsShadowResources.class,
+                ShadowLockPatternUtils.class,
+                ShadowUtils.class,
+                ShadowAlertDialogCompat.class
+        })
 public class SetupChooseLockPasswordTest {
 
     @Before
diff --git a/tests/robotests/src/com/android/settings/password/SetupChooseLockPatternTest.java b/tests/robotests/src/com/android/settings/password/SetupChooseLockPatternTest.java
index 430c535..4852546 100644
--- a/tests/robotests/src/com/android/settings/password/SetupChooseLockPatternTest.java
+++ b/tests/robotests/src/com/android/settings/password/SetupChooseLockPatternTest.java
@@ -38,6 +38,7 @@
 import com.android.settings.password.ChooseLockPattern.ChooseLockPatternFragment;
 import com.android.settings.password.ChooseLockPattern.IntentBuilder;
 import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
+import com.android.settings.testutils.shadow.ShadowLockPatternUtils;
 import com.android.settings.testutils.shadow.ShadowUtils;
 
 import com.google.android.setupcompat.PartnerCustomizationLayout;
@@ -57,7 +58,7 @@
 import java.util.Arrays;
 
 @RunWith(RobolectricTestRunner.class)
-@Config(shadows = {ShadowUtils.class, ShadowAlertDialogCompat.class})
+@Config(shadows = {ShadowUtils.class, ShadowAlertDialogCompat.class, ShadowLockPatternUtils.class})
 public class SetupChooseLockPatternTest {
 
     private SetupChooseLockPattern mActivity;
diff --git a/tests/robotests/src/com/android/settings/testutils/FakeCopyableController.java b/tests/robotests/src/com/android/settings/testutils/FakeCopyableController.java
index 31e955c..e51a249 100644
--- a/tests/robotests/src/com/android/settings/testutils/FakeCopyableController.java
+++ b/tests/robotests/src/com/android/settings/testutils/FakeCopyableController.java
@@ -19,9 +19,8 @@
 import android.content.Context;
 
 import com.android.settings.core.BasePreferenceController;
-import com.android.settings.slices.Copyable;
 
-public class FakeCopyableController extends BasePreferenceController implements Copyable {
+public class FakeCopyableController extends BasePreferenceController {
 
     public FakeCopyableController(Context context, String preferenceKey) {
         super(context, preferenceKey);
@@ -38,6 +37,7 @@
     }
 
     @Override
-    public void copy() {
+    public boolean isCopyableSlice() {
+        return true;
     }
 }
diff --git a/tests/robotests/src/com/android/settings/testutils/SliceTester.java b/tests/robotests/src/com/android/settings/testutils/SliceTester.java
index 17edb6e..d84d42c 100644
--- a/tests/robotests/src/com/android/settings/testutils/SliceTester.java
+++ b/tests/robotests/src/com/android/settings/testutils/SliceTester.java
@@ -238,22 +238,38 @@
      * @param title Title for asserting.
      */
     public static void assertAnySliceItemContainsTitle(List<SliceItem> sliceItems, String title) {
-        boolean hasTitle = false;
+        assertThat(hasText(sliceItems, title, HINT_TITLE)).isTrue();
+    }
+
+    /**
+     * Assert any slice item contains subtitle.
+     *
+     * @param sliceItems All slice items of a Slice.
+     * @param subtitle Subtitle for asserting.
+     */
+    public static void assertAnySliceItemContainsSubtitle(List<SliceItem> sliceItems,
+            String subtitle) {
+        // Subtitle has no hints
+        assertThat(hasText(sliceItems, subtitle, null /* hints */)).isTrue();
+    }
+
+    private static boolean hasText(List<SliceItem> sliceItems, String text, String hints) {
+        boolean hasText = false;
         for (SliceItem item : sliceItems) {
-            List<SliceItem> titleItems = SliceQuery.findAll(item, FORMAT_TEXT, HINT_TITLE,
+            List<SliceItem> textItems = SliceQuery.findAll(item, FORMAT_TEXT, hints,
                     null /* non-hints */);
-            if (titleItems == null) {
+            if (textItems == null) {
                 continue;
             }
 
-            for (SliceItem subTitleItem : titleItems) {
-                if (TextUtils.equals(subTitleItem.getText(), title)) {
-                    hasTitle = true;
+            for (SliceItem textItem : textItems) {
+                if (TextUtils.equals(textItem.getText(), text)) {
+                    hasText = true;
                     break;
                 }
             }
         }
-        assertThat(hasTitle).isTrue();
+        return hasText;
     }
 
     private static void assertKeywords(SliceMetadata metadata, SliceData data) {
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowLockPatternUtils.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowLockPatternUtils.java
index 7ce098d..f287085 100644
--- a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowLockPatternUtils.java
+++ b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowLockPatternUtils.java
@@ -32,6 +32,11 @@
     private static boolean sDeviceEncryptionEnabled;
 
     @Implementation
+    protected boolean hasSecureLockScreen() {
+        return true;
+    }
+
+    @Implementation
     protected boolean isSecure(int id) {
         return true;
     }
diff --git a/tests/robotests/src/com/android/settings/users/UserSettingsTest.java b/tests/robotests/src/com/android/settings/users/UserSettingsTest.java
index b682388..1a98238 100644
--- a/tests/robotests/src/com/android/settings/users/UserSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/users/UserSettingsTest.java
@@ -57,7 +57,6 @@
 
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.AdditionalMatchers;
@@ -101,15 +100,23 @@
         MockitoAnnotations.initMocks(this);
         mActivity = spy(ActivityController.of(new FragmentActivity()).get());
         mContext = spy(RuntimeEnvironment.application);
+        mUserCapabilities = UserCapabilities.create(mContext);
+
         mFragment = spy(new UserSettings());
         ReflectionHelpers.setField(mFragment, "mAddUserWhenLockedPreferenceController",
                 mock(AddUserWhenLockedPreferenceController.class));
         ReflectionHelpers.setField(mFragment, "mMultiUserFooterPreferenceController",
                 mock(MultiUserFooterPreferenceController.class));
-        mUserCapabilities = UserCapabilities.create(mContext);
+        ReflectionHelpers.setField(mFragment, "mUserManager", mUserManager);
+        ReflectionHelpers.setField(mFragment, "mUserCaps", mUserCapabilities);
+        ReflectionHelpers.setField(mFragment, "mDefaultIconDrawable", mDefaultIconDrawable);
+        ReflectionHelpers.setField(mFragment, "mAddingUser", false);
+        mFragment.mMePreference = mMePreference;
+
         when((Object) mActivity.getSystemService(UserManager.class)).thenReturn(mUserManager);
         doReturn(mActivity).when(mFragment).getActivity();
         doReturn(mContext).when(mFragment).getContext();
+        doReturn(mMockPreferenceManager).when(mFragment).getPreferenceManager();
         doReturn(mUserManager).when(mContext).getSystemService(UserManager.class);
         mProvisioned = Settings.Global.getInt(mContext.getContentResolver(),
             Settings.Global.DEVICE_PROVISIONED, 0);
@@ -157,10 +164,6 @@
         mUserCapabilities.mDisallowSwitchUser = false;
         mUserCapabilities.mUserSwitcherEnabled = true;
 
-        ReflectionHelpers.setField(mFragment, "mUserManager", mUserManager);
-        ReflectionHelpers.setField(mFragment, "mUserCaps", mUserCapabilities);
-        ReflectionHelpers.setField(mFragment, "mDefaultIconDrawable", mDefaultIconDrawable);
-        mFragment.mMePreference = mMePreference;
         mFragment.mUserListCategory = userListCategory;
         mFragment.mAddUser = addUser;
 
@@ -186,11 +189,6 @@
         mUserCapabilities.mDisallowAddUser = false;
         mUserCapabilities.mUserSwitcherEnabled = true;
 
-        ReflectionHelpers.setField(mFragment, "mUserManager", mUserManager);
-        ReflectionHelpers.setField(mFragment, "mUserCaps", mUserCapabilities);
-        ReflectionHelpers.setField(mFragment, "mDefaultIconDrawable", mDefaultIconDrawable);
-        ReflectionHelpers.setField(mFragment, "mAddingUser", false);
-        mFragment.mMePreference = mMePreference;
         mFragment.mUserListCategory = userListCategory;
         mFragment.mAddUser = addUser;
 
@@ -206,7 +204,6 @@
     }
 
     @Test
-    @Ignore
     public void updateUserList_cannotAddUserButCanSwitchUser_shouldNotShowAddUser() {
         Settings.Global.putInt(mContext.getContentResolver(),
             Settings.Global.DEVICE_PROVISIONED, 1);
@@ -216,11 +213,6 @@
         mUserCapabilities.mDisallowAddUser = true;
         mUserCapabilities.mUserSwitcherEnabled = true;
 
-        ReflectionHelpers.setField(mFragment, "mUserManager", mUserManager);
-        ReflectionHelpers.setField(mFragment, "mUserCaps", mUserCapabilities);
-        ReflectionHelpers.setField(mFragment, "mDefaultIconDrawable", mDefaultIconDrawable);
-        ReflectionHelpers.setField(mFragment, "mAddingUser", false);
-        mFragment.mMePreference = mMePreference;
         mFragment.mUserListCategory = mock(PreferenceCategory.class);
         mFragment.mAddUser = addUser;
 
@@ -251,9 +243,6 @@
         doReturn(true).when(mUserManager).canSwitchUsers();
         mUserCapabilities.mIsAdmin = false;
 
-        ReflectionHelpers.setField(mFragment, "mUserCaps", mUserCapabilities);
-        ReflectionHelpers.setField(mFragment, "mUserManager", mUserManager);
-
         Menu menu = mock(Menu.class);
         MenuItem menuItem = mock(MenuItem.class);
         final String title = "title";
@@ -279,9 +268,6 @@
         doReturn(true).when(mUserManager).canSwitchUsers();
         mUserCapabilities.mIsAdmin = false;
 
-        ReflectionHelpers.setField(mFragment, "mUserCaps", mUserCapabilities);
-        ReflectionHelpers.setField(mFragment, "mUserManager", mock(UserManager.class));
-
         Menu menu = mock(Menu.class);
         MenuItem menuItem = mock(MenuItem.class);
         final String title = "title";
@@ -301,7 +287,6 @@
     }
 
     @Test
-    @Ignore
     public void updateUserList_canAddUserAndSwitchUser_shouldShowAddUser() {
         Settings.Global.putInt(mContext.getContentResolver(),
             Settings.Global.DEVICE_PROVISIONED, 1);
@@ -311,13 +296,8 @@
         mUserCapabilities.mDisallowAddUser = false;
         mUserCapabilities.mUserSwitcherEnabled = true;
 
-        ReflectionHelpers.setField(mFragment, "mUserManager", mUserManager);
-        ReflectionHelpers.setField(mFragment, "mUserCaps", mUserCapabilities);
-        ReflectionHelpers.setField(mFragment, "mDefaultIconDrawable", mDefaultIconDrawable);
-        ReflectionHelpers.setField(mFragment, "mAddingUser", false);
-        mFragment.mMePreference = mMePreference;
-        mFragment.mUserListCategory = mock(PreferenceCategory.class);
         mFragment.mAddUser = addUser;
+        mFragment.mUserListCategory = mock(PreferenceCategory.class);
 
         doReturn(mock(PreferenceScreen.class)).when(mFragment).getPreferenceScreen();
         doReturn("Test summary").when(mFragment).getString(anyInt(), anyInt());
@@ -326,4 +306,26 @@
 
         verify(addUser).setVisible(true);
     }
+
+    @Test
+    public void updateUserList_addUserDisallowedByAdmin_shouldShowAddUserDisabled() {
+        Settings.Global.putInt(mContext.getContentResolver(),
+                Settings.Global.DEVICE_PROVISIONED, 1);
+        final RestrictedPreference addUser = mock(RestrictedPreference.class);
+
+        mUserCapabilities.mCanAddUser = false;
+        mUserCapabilities.mDisallowAddUser = true;
+        mUserCapabilities.mDisallowAddUserSetByAdmin = true;
+        mUserCapabilities.mUserSwitcherEnabled = true;
+
+        mFragment.mUserListCategory = mock(PreferenceCategory.class);
+        mFragment.mAddUser = addUser;
+
+        doReturn(mock(PreferenceScreen.class)).when(mFragment).getPreferenceScreen();
+
+        mFragment.updateUserList();
+
+        verify(addUser).setVisible(true);
+        assertThat(addUser.isEnabled()).isFalse();
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingSettingsForSubTest.java b/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingSettingsForSubTest.java
index 98795a7..c8b3920 100644
--- a/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingSettingsForSubTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingSettingsForSubTest.java
@@ -18,7 +18,6 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
-import static org.junit.Assert.assertNotNull;
 import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.anyInt;
 import static org.mockito.Mockito.doNothing;
@@ -32,7 +31,6 @@
 import android.content.Context;
 import android.content.Intent;
 import android.os.Bundle;
-import android.preference.PreferenceManager;
 import android.telephony.TelephonyManager;
 import android.telephony.ims.ProvisioningManager;
 import android.view.View;
@@ -46,7 +44,6 @@
 import com.android.ims.ImsManager;
 import com.android.settings.R;
 import com.android.settings.SettingsActivity;
-import com.android.settings.testutils.FakeFeatureFactory;
 import com.android.settings.widget.SwitchBar;
 import com.android.settings.widget.ToggleSwitch;
 
diff --git a/tests/robotests/src/com/android/settings/wifi/slice/WifiSliceTest.java b/tests/robotests/src/com/android/settings/wifi/slice/WifiSliceTest.java
index dd99e55..6af8f80 100644
--- a/tests/robotests/src/com/android/settings/wifi/slice/WifiSliceTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/slice/WifiSliceTest.java
@@ -118,7 +118,7 @@
         // All AP rows + title row
         assertThat(rows).isEqualTo(DEFAULT_EXPANDED_ROW_COUNT + 1);
         // Has scanning text
-        SliceTester.assertAnySliceItemContainsTitle(sliceItems,
+        SliceTester.assertAnySliceItemContainsSubtitle(sliceItems,
                 mContext.getString(R.string.wifi_empty_list_wifi_on));
     }
 
diff --git a/tests/unit/src/com/android/settings/DisplaySettingsTest.java b/tests/unit/src/com/android/settings/DisplaySettingsTest.java
deleted file mode 100644
index cc9cd81..0000000
--- a/tests/unit/src/com/android/settings/DisplaySettingsTest.java
+++ /dev/null
@@ -1,59 +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;
-
-import static androidx.test.espresso.Espresso.onView;
-import static androidx.test.espresso.action.ViewActions.click;
-import static androidx.test.espresso.matcher.ViewMatchers.withText;
-
-import android.app.Instrumentation;
-import android.content.Context;
-import android.content.Intent;
-import android.support.test.uiautomator.UiDevice;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.filters.SmallTest;
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(AndroidJUnit4.class)
-@SmallTest
-public class DisplaySettingsTest {
-
-    private Instrumentation mInstrumentation;
-    private Context mContext;
-    private UiDevice mDevice;
-
-    @Before
-    public void setUp() {
-        mInstrumentation = InstrumentationRegistry.getInstrumentation();
-        mContext = mInstrumentation.getTargetContext();
-        mDevice = UiDevice.getInstance(mInstrumentation);
-    }
-
-    @Test
-    public void launchBrightnessLevel_shouldNotCrash() {
-        mInstrumentation.startActivitySync(
-                new Intent(mContext, DisplaySettings.class));
-        onView(withText(mContext.getString(R.string.brightness))).perform(click());
-        // should not crash
-        mDevice.pressBack(); // dismiss the brightness dialog
-    }
-}
diff --git a/tests/unit/src/com/android/settings/EncryptionInterstitialTest.java b/tests/unit/src/com/android/settings/EncryptionInterstitialTest.java
deleted file mode 100644
index 503a78c..0000000
--- a/tests/unit/src/com/android/settings/EncryptionInterstitialTest.java
+++ /dev/null
@@ -1,110 +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;
-
-import static androidx.test.espresso.Espresso.onView;
-import static androidx.test.espresso.action.ViewActions.click;
-import static androidx.test.espresso.matcher.ViewMatchers.withId;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import android.app.Activity;
-import android.app.Instrumentation;
-import android.app.Instrumentation.ActivityMonitor;
-import android.app.Instrumentation.ActivityResult;
-import android.content.Context;
-import android.content.Intent;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.filters.MediumTest;
-import androidx.test.runner.AndroidJUnit4;
-
-import com.google.android.setupcompat.PartnerCustomizationLayout;
-import com.google.android.setupcompat.template.FooterBarMixin;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(AndroidJUnit4.class)
-@MediumTest
-public class EncryptionInterstitialTest {
-
-    private Instrumentation mInstrumentation;
-    private Context mContext;
-    private TestActivityMonitor mActivityMonitor;
-
-    @Before
-    public void setUp() {
-        mInstrumentation = InstrumentationRegistry.getInstrumentation();
-        mContext = mInstrumentation.getTargetContext();
-        mActivityMonitor = new TestActivityMonitor();
-        mInstrumentation.addMonitor(mActivityMonitor);
-    }
-
-    @After
-    public void tearDown() {
-        mInstrumentation.removeMonitor(mActivityMonitor);
-    }
-
-    @Test
-    public void clickYes_shouldRequirePassword() {
-        final Activity activity = mInstrumentation.startActivitySync(
-                new Intent(mContext, EncryptionInterstitial.class)
-                        .putExtra("extra_unlock_method_intent", new Intent("test.unlock.intent")));
-        final PartnerCustomizationLayout layout = activity.findViewById(R.id.setup_wizard_layout);
-        layout.getMixin(FooterBarMixin.class).getPrimaryButtonView().performClick();
-
-        mActivityMonitor.waitForActivityWithTimeout(1000);
-        assertEquals(1, mActivityMonitor.getHits());
-
-        assertTrue(mActivityMonitor.mMatchedIntent.getBooleanExtra(
-                EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, false));
-    }
-
-    @Test
-    public void clickNo_shouldNotRequirePassword() {
-        final Activity activity = mInstrumentation.startActivitySync(
-                new Intent(mContext, EncryptionInterstitial.class)
-                        .putExtra("extra_unlock_method_intent", new Intent("test.unlock.intent")));
-        final PartnerCustomizationLayout layout = activity.findViewById(R.id.setup_wizard_layout);
-        layout.getMixin(FooterBarMixin.class).getSecondaryButtonView().performClick();
-
-        mActivityMonitor.waitForActivityWithTimeout(1000);
-        assertEquals(1, mActivityMonitor.getHits());
-
-        assertFalse(mActivityMonitor.mMatchedIntent.getBooleanExtra(
-                EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, true));
-    }
-
-    private static class TestActivityMonitor extends ActivityMonitor {
-
-        Intent mMatchedIntent = null;
-
-        @Override
-        public ActivityResult onStartActivity(Intent intent) {
-            if ("test.unlock.intent".equals(intent.getAction())) {
-                mMatchedIntent = intent;
-                return new ActivityResult(Activity.RESULT_OK, null);
-            }
-            return null;
-        }
-    }
-}
diff --git a/tests/unit/src/com/android/settings/ManagedAccessSettingsLowRamTest.java b/tests/unit/src/com/android/settings/ManagedAccessSettingsLowRamTest.java
deleted file mode 100644
index 426b8a4..0000000
--- a/tests/unit/src/com/android/settings/ManagedAccessSettingsLowRamTest.java
+++ /dev/null
@@ -1,126 +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;
-
-import static androidx.test.espresso.Espresso.onView;
-import static androidx.test.espresso.action.ViewActions.click;
-import static androidx.test.espresso.assertion.ViewAssertions.doesNotExist;
-import static androidx.test.espresso.assertion.ViewAssertions.matches;
-import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static androidx.test.espresso.matcher.ViewMatchers.withText;
-
-import android.app.ActivityManager;
-import android.app.Instrumentation;
-import android.content.Context;
-import android.content.Intent;
-import android.provider.Settings;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.filters.SmallTest;
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(AndroidJUnit4.class)
-@SmallTest
-public class ManagedAccessSettingsLowRamTest {
-
-    private Instrumentation mInstrumentation;
-    private Context mTargetContext;
-
-    @Before
-    public void setUp() {
-        mInstrumentation = InstrumentationRegistry.getInstrumentation();
-        mTargetContext = mInstrumentation.getTargetContext();
-    }
-
-    @Test
-    public void testManagedAccessOptionsVisibility() throws Exception {
-        mInstrumentation.startActivitySync(new Intent(mTargetContext,
-                com.android.settings.Settings.AppAndNotificationDashboardActivity.class));
-        onView(withText(mTargetContext.getString(R.string.expand_button_title))).perform(click());
-        onView(withText(mTargetContext.getString(R.string.special_access))).perform(click());
-
-        String[] managedServiceLabels = new String[] {"Do Not Disturb access",
-                "VR helper services", "Notification access", "Picture-in-picture"};
-        for (String label : managedServiceLabels) {
-            if (ActivityManager.isLowRamDeviceStatic()) {
-                onView(withText(label)).check(doesNotExist());
-            } else {
-                onView(withText(label)).check(matches(isDisplayed()));
-            }
-        }
-    }
-
-    @Test
-    public void launchNotificationSetting_onlyWorksIfNotLowRam() {
-        final Intent intent = new Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS);
-
-        mInstrumentation.startActivitySync(intent);
-
-        final String label = "This feature is not available on this device";
-        if (ActivityManager.isLowRamDeviceStatic()) {
-            onView(withText(label)).check(matches(isDisplayed()));
-        } else {
-            onView(withText(label)).check(doesNotExist());
-        }
-    }
-
-    @Test
-    public void launchDndSetting_onlyWorksIfNotLowRam() {
-        final Intent intent = new Intent(Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS);
-
-        mInstrumentation.startActivitySync(intent);
-
-        final String label = "This feature is not available on this device";
-        if (ActivityManager.isLowRamDeviceStatic()) {
-            onView(withText(label)).check(matches(isDisplayed()));
-        } else {
-            onView(withText(label)).check(doesNotExist());
-        }
-    }
-
-    @Test
-    public void launchVrSetting_onlyWorksIfNotLowRam() {
-        final Intent intent = new Intent(Settings.ACTION_VR_LISTENER_SETTINGS);
-
-        mInstrumentation.startActivitySync(intent);
-
-        final String label = "This feature is not available on this device";
-        if (ActivityManager.isLowRamDeviceStatic()) {
-            onView(withText(label)).check(matches(isDisplayed()));
-        } else {
-            onView(withText(label)).check(doesNotExist());
-        }
-    }
-
-    @Test
-    public void launchPictureInPictureSetting_onlyWorksIfNotLowRam() {
-        final Intent intent = new Intent(Settings.ACTION_PICTURE_IN_PICTURE_SETTINGS);
-
-        mInstrumentation.startActivitySync(intent);
-
-        final String label = "This feature is not available on this device";
-        if (ActivityManager.isLowRamDeviceStatic()) {
-            onView(withText(label)).check(matches(isDisplayed()));
-        } else {
-            onView(withText(label)).check(doesNotExist());
-        }
-    }
-}
diff --git a/tests/unit/src/com/android/settings/RegulatoryInfoDisplayActivityTest.java b/tests/unit/src/com/android/settings/RegulatoryInfoDisplayActivityTest.java
index 48f9f5d..1701ddf 100644
--- a/tests/unit/src/com/android/settings/RegulatoryInfoDisplayActivityTest.java
+++ b/tests/unit/src/com/android/settings/RegulatoryInfoDisplayActivityTest.java
@@ -16,12 +16,6 @@
 
 package com.android.settings;
 
-import static androidx.test.espresso.Espresso.onView;
-import static androidx.test.espresso.assertion.ViewAssertions.matches;
-import static androidx.test.espresso.matcher.RootMatchers.isDialog;
-import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static androidx.test.espresso.matcher.ViewMatchers.withId;
-
 import static junit.framework.Assert.fail;
 
 import android.app.Instrumentation;
@@ -29,8 +23,6 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.ResolveInfo;
-import android.graphics.Bitmap;
-import android.util.Log;
 
 import androidx.test.InstrumentationRegistry;
 import androidx.test.filters.SmallTest;
@@ -40,10 +32,6 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
 @RunWith(AndroidJUnit4.class)
 @SmallTest
 public class RegulatoryInfoDisplayActivityTest {
@@ -82,73 +70,4 @@
             return;
         }
     }
-
-    @Test
-    public void launchRegulatoryInfo_shouldNotCrash() {
-        final Context context = mInstrumentation.getTargetContext();
-        final boolean hasRegulatoryInfo = context.getResources()
-                .getBoolean(R.bool.config_show_regulatory_info);
-
-        if (!hasRegulatoryInfo) {
-            return;
-        }
-        // Launch intent
-        mInstrumentation.startActivitySync(mRegulatoryInfoIntent);
-
-        onView(withId(R.id.regulatoryInfo))
-                .inRoot(isDialog())
-                .check(matches(isDisplayed()));
-    }
-
-    @Test
-    public void launchRegulatoryInfo_withInfoImage_shouldDisplay() throws IOException {
-        // TODO: Remove "setenforce 0" when selinux rules is updated to give read permission for
-        // regulatory info.
-        mUiAutomation.executeShellCommand("setenforce 0");
-
-        final boolean tempFileCreated = ensureRegulatoryInfoImageExists();
-        try {
-            final Context context = mInstrumentation.getTargetContext();
-            final boolean hasRegulatoryInfo = context.getResources()
-                    .getBoolean(R.bool.config_show_regulatory_info);
-
-            if (!hasRegulatoryInfo) {
-                return;
-            }
-            // Launch intent
-            mInstrumentation.startActivitySync(mRegulatoryInfoIntent);
-
-            onView(withId(R.id.regulatoryInfo))
-                    .inRoot(isDialog())
-                    .check(matches(isDisplayed()));
-        } finally {
-            if (tempFileCreated) {
-                final String filename =
-                        RegulatoryInfoDisplayActivity.getRegulatoryInfoImageFileName();
-                new File(filename).delete();
-                Log.d(TAG, "Deleting temp file " + filename);
-            }
-        }
-    }
-
-    /**
-     * Ensures regulatory label image exists on disk.
-     *
-     * @return true if a test image is created.
-     */
-    private boolean ensureRegulatoryInfoImageExists() throws IOException {
-        final String filename = RegulatoryInfoDisplayActivity.getRegulatoryInfoImageFileName();
-        if (new File(filename).exists()) {
-            return false;
-        }
-        Log.d(TAG, "Creating temp file " + filename);
-        final Bitmap bitmap = Bitmap.createBitmap(400 /* width */, 400 /* height */,
-                Bitmap.Config.ARGB_8888);
-        final FileOutputStream out = new FileOutputStream(filename);
-        bitmap.compress(Bitmap.CompressFormat.PNG, 100 /* quality */, out);
-        out.close();
-        return true;
-    }
-
-
 }
diff --git a/tests/unit/src/com/android/settings/SettingsHookTests.java b/tests/unit/src/com/android/settings/SettingsHookTests.java
deleted file mode 100644
index ee0bbb6..0000000
--- a/tests/unit/src/com/android/settings/SettingsHookTests.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (C) 2010 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;
-
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
-import android.test.ActivityInstrumentationTestCase2;
-
-import java.util.List;
-
-/**
- * Tests for the Settings operator/manufacturer hook.
- *
- * Running all tests:
- *
- *   make SettingsTests
- *   adb push SettingsTests.apk /system/app/SettingsTests.apk
- *   adb shell am instrument \
- *    -w com.android.settings.tests/android.test.InstrumentationTestRunner
- */
-public class SettingsHookTests extends ActivityInstrumentationTestCase2<Settings> {
-
-    private static final String PACKAGE_NAME = "com.android.settings.tests.unit";
-
-    private static final String KEY_SETTINGS_ROOT = "parent";
-    private static final String KEY_SETTINGS_OPERATOR = "operator_settings";
-    private static final String KEY_SETTINGS_MANUFACTURER = "manufacturer_settings";
-
-    private static final String INTENT_OPERATOR_HOOK = "com.android.settings.OPERATOR_APPLICATION_SETTING";
-    private static final String INTENT_MANUFACTURER_HOOK = "com.android.settings.MANUFACTURER_APPLICATION_SETTING";
-
-    private Settings mSettings;
-
-    public SettingsHookTests() {
-        super("com.android.settings", Settings.class);
-    }
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        mSettings = getActivity();
-    }
-
-    /**
-     * Test that the operator/manufacturer settings hook test application is
-     * available and that it's installed in the device's system image.
-     */
-    public void testSettingsHookTestAppAvailable() throws Exception {
-        Context context = mSettings.getApplicationContext();
-        PackageManager pm = context.getPackageManager();
-        ApplicationInfo applicationInfo = pm.getApplicationInfo(PACKAGE_NAME, 0);
-        assertTrue((applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0);
-    }
-
-    /**
-     * Test that the operator test activity has registered an intent-filter for
-     * an action named 'android.settings.OPERATOR_APPLICATION_SETTING'.
-     */
-    public void testOperatorIntentFilter() {
-        boolean result = false;
-        Context context = mSettings.getApplicationContext();
-        PackageManager pm = context.getPackageManager();
-        Intent intent = new Intent(INTENT_OPERATOR_HOOK);
-        List<ResolveInfo> list = pm.queryIntentActivities(intent, 0);
-        for (ResolveInfo resolveInfo : list) {
-            if (resolveInfo.activityInfo.packageName.equals(PACKAGE_NAME)) {
-                result = true;
-            }
-        }
-        assertTrue("Intent-filter not found", result);
-    }
-
-    /**
-     * Test that the manufacturer test activity has registered an intent-filter
-     * for an action named 'android.settings.MANUFACTURER_APPLICATION_SETTING'.
-     */
-    public void testManufacturerIntentFilter() {
-        boolean result = false;
-        Context context = mSettings.getApplicationContext();
-        PackageManager pm = context.getPackageManager();
-        Intent intent = new Intent(INTENT_MANUFACTURER_HOOK);
-        List<ResolveInfo> list = pm.queryIntentActivities(intent, 0);
-        for (ResolveInfo resolveInfo : list) {
-            if (resolveInfo.activityInfo.packageName.equals(PACKAGE_NAME)) {
-                result = true;
-            }
-        }
-        assertTrue("Intent-filter not found", result);
-    }
-
-    /**
-     * Test that the operator preference is available in the Settings
-     * application.
-     */
-    public void testOperatorPreferenceAvailable() {
-// TODO: fix this test case to work with fragments
-//        PreferenceGroup root = (PreferenceGroup)mSettings.findPreference(KEY_SETTINGS_ROOT);
-//        Preference operatorPreference = root.findPreference(KEY_SETTINGS_OPERATOR);
-//        assertNotNull(operatorPreference);
-    }
-
-    /**
-     * Test that the manufacturer preference is available in the Settings
-     * application.
-     */
-    public void testManufacturerPreferenceAvailable() {
-// TODO: fix this test case to work with fragments
-//        PreferenceGroup root = (PreferenceGroup)mSettings.findPreference(KEY_SETTINGS_ROOT);
-//        Preference manufacturerHook = root.findPreference(KEY_SETTINGS_MANUFACTURER);
-//        assertNotNull(manufacturerHook);
-    }
-
-}
diff --git a/tests/unit/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragmentTest.java b/tests/unit/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragmentTest.java
index f8d06a8..0c27379 100644
--- a/tests/unit/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragmentTest.java
+++ b/tests/unit/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragmentTest.java
@@ -30,6 +30,7 @@
 
 import android.app.Instrumentation;
 import android.os.Bundle;
+
 import android.provider.Settings;
 import android.widget.CompoundButton;
 
@@ -64,14 +65,6 @@
     }
 
     @Test
-    public void lockScreenPreference_defaultBeforeDialogShown_isOff() {
-        setDialogShown(false);
-        setOnLockscreen(null);
-        startFragment();
-        assertLockscreenSwitchIsCheckedIs(false);
-    }
-
-    @Test
     public void lockScreenPreference_setOnBeforeDialogShown_isOn() {
         setDialogShown(false);
         setOnLockscreen(true);
@@ -87,14 +80,6 @@
         assertLockscreenSwitchIsCheckedIs(true);
     }
 
-    @Test
-    public void lockScreenPreference_setOffAfterDialogShown_isOn() {
-        setDialogShown(true);
-        setOnLockscreen(false);
-        startFragment();
-        assertLockscreenSwitchIsCheckedIs(false);
-    }
-
     private void startFragment() {
         mInstrumentation.runOnMainSync(() -> {
             new SubSettingLauncher(mActivity)
diff --git a/tests/unit/src/com/android/settings/applications/DefaultAppSettingsTest.java b/tests/unit/src/com/android/settings/applications/DefaultAppSettingsTest.java
deleted file mode 100644
index 1dd899e..0000000
--- a/tests/unit/src/com/android/settings/applications/DefaultAppSettingsTest.java
+++ /dev/null
@@ -1,79 +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.applications;
-
-import android.content.Context;
-import android.content.Intent;
-import android.support.test.uiautomator.UiDevice;
-import android.support.test.uiautomator.UiObject;
-import android.support.test.uiautomator.UiSelector;
-import android.test.InstrumentationTestCase;
-import android.widget.TextView;
-
-import androidx.test.filters.SmallTest;
-
-import com.android.settings.R;
-
-import org.junit.Test;
-
-/**
- * Test for Advanced App preferences.
- */
-@SmallTest
-public class DefaultAppSettingsTest extends InstrumentationTestCase {
-
-    private UiDevice mDevice;
-    private Context mTargetContext;
-    private String mTargetPackage;
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        mDevice = UiDevice.getInstance(getInstrumentation());
-        mTargetContext = getInstrumentation().getTargetContext();
-        mTargetPackage = mTargetContext.getPackageName();
-    }
-
-    @Test
-    public void testSelectDefaultHome_shouldLaunchHomePicker() throws Exception {
-        launchDefaultApps();
-        final String titleHomeApp = mTargetContext.getResources().getString(R.string.home_app);
-        mDevice.findObject(new UiSelector().text(titleHomeApp)).click();
-        final UiObject actionBar = mDevice.findObject(new UiSelector().resourceId(
-            "com.android.settings:id/action_bar"));
-        final UiObject title = actionBar.getChild(
-            new UiSelector().className(TextView.class.getName()));
-        assertEquals(titleHomeApp, title.getText());
-    }
-
-    private void launchDefaultApps() throws Exception  {
-        final Intent settingsIntent = new Intent(Intent.ACTION_MAIN)
-            .addCategory(Intent.CATEGORY_LAUNCHER)
-            .setPackage(mTargetPackage)
-            .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        getInstrumentation().getContext().startActivity(settingsIntent);
-        final String titleApps = mTargetContext.getResources().getString(
-            R.string.app_and_notification_dashboard_title);
-        mDevice.findObject(new UiSelector().text(titleApps)).click();
-        final String titleAdvance = mTargetContext.getResources().getString(
-                R.string.advanced_section_header);
-        mDevice.findObject(new UiSelector().text(titleAdvance)).click();
-        final String titleDefaultApps = mTargetContext.getResources().getString(
-            R.string.app_default_dashboard_title);
-        mDevice.findObject(new UiSelector().text(titleDefaultApps)).click();
-    }
-
-}
diff --git a/tests/unit/src/com/android/settings/applications/ManageApplicationsLaunchTest.java b/tests/unit/src/com/android/settings/applications/ManageApplicationsLaunchTest.java
deleted file mode 100644
index c98a43d..0000000
--- a/tests/unit/src/com/android/settings/applications/ManageApplicationsLaunchTest.java
+++ /dev/null
@@ -1,58 +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.applications;
-
-import static androidx.test.espresso.Espresso.onView;
-import static androidx.test.espresso.assertion.ViewAssertions.matches;
-import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static androidx.test.espresso.matcher.ViewMatchers.withText;
-
-import static org.hamcrest.Matchers.allOf;
-
-import android.app.Instrumentation;
-import android.content.Intent;
-import android.provider.Settings;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.filters.SmallTest;
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@SmallTest
-@RunWith(AndroidJUnit4.class)
-public class ManageApplicationsLaunchTest {
-
-    private Instrumentation mInstrumentation;
-
-    @Before
-    public void setUp() {
-        mInstrumentation = InstrumentationRegistry.getInstrumentation();
-    }
-
-    @Test
-    public void launchAppsSettings_shouldShowAppList() throws Exception {
-        final Intent appsSettingsIntent = new
-                Intent(Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS);
-
-        mInstrumentation.startActivitySync(appsSettingsIntent);
-
-        onView(allOf(withText("Calculator"))).check(matches(isDisplayed()));
-    }
-}
diff --git a/tests/unit/src/com/android/settings/applications/SpecialAppAccessSettingsTest.java b/tests/unit/src/com/android/settings/applications/SpecialAppAccessSettingsTest.java
deleted file mode 100644
index 4738d59..0000000
--- a/tests/unit/src/com/android/settings/applications/SpecialAppAccessSettingsTest.java
+++ /dev/null
@@ -1,97 +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.applications;
-
-import android.content.Context;
-import android.content.Intent;
-import android.support.test.uiautomator.UiDevice;
-import android.support.test.uiautomator.UiObject;
-import android.support.test.uiautomator.UiObjectNotFoundException;
-import android.support.test.uiautomator.UiScrollable;
-import android.support.test.uiautomator.UiSelector;
-import android.test.InstrumentationTestCase;
-import android.widget.TextView;
-
-import androidx.test.filters.SmallTest;
-
-import com.android.settings.R;
-
-import org.junit.Test;
-
-/**
- * Test for Special App Access preferences.
- */
-@SmallTest
-public class SpecialAppAccessSettingsTest extends InstrumentationTestCase {
-
-    private UiDevice mDevice;
-    private Context mTargetContext;
-    private String mTargetPackage;
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        mDevice = UiDevice.getInstance(getInstrumentation());
-        mTargetContext = getInstrumentation().getTargetContext();
-        mTargetPackage = mTargetContext.getPackageName();
-    }
-
-    @Test
-    public void testSelectPictureInPicture_shouldNotCrash() throws Exception {
-        launchSpecialApps();
-        final String titlePictureInPictureApp =
-                mTargetContext.getResources().getString(R.string.picture_in_picture_title);
-
-        // select Picture-in-Picture
-        mDevice.findObject(new UiSelector().text(titlePictureInPictureApp)).click();
-
-        // Picture-in-picture settings page should launch and no crash
-        final UiObject actionBar = mDevice.findObject(new UiSelector().resourceId(
-            "com.android.settings:id/action_bar"));
-        final UiObject title = actionBar.getChild(
-            new UiSelector().className(TextView.class.getName()));
-        assertEquals(titlePictureInPictureApp, title.getText());
-    }
-
-    private void launchSpecialApps() throws Exception  {
-        final Intent settingsIntent = new Intent(Intent.ACTION_MAIN)
-            .addCategory(Intent.CATEGORY_LAUNCHER)
-            .setPackage(mTargetPackage)
-            .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        getInstrumentation().getContext().startActivity(settingsIntent);
-        final String titleApps = mTargetContext.getResources().getString(
-            R.string.app_and_notification_dashboard_title);
-        mDevice.findObject(new UiSelector().text(titleApps)).click();
-        final String titleAdvance = mTargetContext.getResources().getString(
-                R.string.advanced_section_header);
-        mDevice.findObject(new UiSelector().text(titleAdvance)).click();
-        final String titleSpecialApps = mTargetContext.getResources().getString(
-            R.string.special_access);
-
-        try {
-            // scollbar may or may not be present, depending on how many recents app are there. If
-            // the page is scrollable, scroll to the bottom to show the special app access settings.
-            final UiScrollable settings = new UiScrollable(
-                    new UiSelector().packageName(mTargetContext.getPackageName()).scrollable(true));
-            settings.scrollTextIntoView(titleSpecialApps);
-        } catch (UiObjectNotFoundException e) {
-            // ignore
-        }
-
-        mDevice.findObject(new UiSelector().text(titleSpecialApps)).click();
-    }
-
-}
diff --git a/tests/unit/src/com/android/settings/backup/BackupIntentTest.java b/tests/unit/src/com/android/settings/backup/BackupIntentTest.java
index 0115c56..54e7451 100644
--- a/tests/unit/src/com/android/settings/backup/BackupIntentTest.java
+++ b/tests/unit/src/com/android/settings/backup/BackupIntentTest.java
@@ -39,7 +39,7 @@
 public class BackupIntentTest {
     private static final String INTENT_PRIVACY_SETTINGS = "android.settings.PRIVACY_SETTINGS";
     private static final String BACKUP_SETTINGS_ACTIVITY =
-            "com.android.settings.backup.UserBackupSettingsActivity";
+            "com.android.settings.Settings$PrivacyDashboardActivity";
 
     private Context mContext;
 
diff --git a/tests/unit/src/com/android/settings/bluetooth/BluetoothDeviceDetailsRotationTest.java b/tests/unit/src/com/android/settings/bluetooth/BluetoothDeviceDetailsRotationTest.java
deleted file mode 100644
index aec6dd2..0000000
--- a/tests/unit/src/com/android/settings/bluetooth/BluetoothDeviceDetailsRotationTest.java
+++ /dev/null
@@ -1,106 +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.bluetooth;
-
-import static org.mockito.Mockito.when;
-
-import android.app.Instrumentation;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.RemoteException;
-import android.support.test.uiautomator.UiDevice;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.filters.SmallTest;
-import androidx.test.runner.AndroidJUnit4;
-
-import com.android.settings.SettingsActivity;
-import com.android.settings.core.SubSettingLauncher;
-import com.android.settingslib.bluetooth.CachedBluetoothDevice;
-import com.android.settingslib.bluetooth.LocalBluetoothManager;
-import com.android.settingslib.core.instrumentation.Instrumentable;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Answers;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-@RunWith(AndroidJUnit4.class)
-@SmallTest
-public class BluetoothDeviceDetailsRotationTest {
-    private Context mContext;
-    private UiDevice mUiDevice;
-    private Instrumentation mInstrumentation;
-
-    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
-    private CachedBluetoothDevice mCachedDevice;
-
-    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
-    private LocalBluetoothManager mBluetoothManager;
-
-    private String mDeviceAddress;
-
-    @Before
-    public void setUp() throws Exception {
-        MockitoAnnotations.initMocks(this);
-        mContext = InstrumentationRegistry.getTargetContext();
-        mUiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
-        mInstrumentation = InstrumentationRegistry.getInstrumentation();
-
-        mDeviceAddress = "AA:BB:CC:DD:EE:FF";
-        when(mCachedDevice.getAddress()).thenReturn(mDeviceAddress);
-        when(mCachedDevice.getName()).thenReturn("Mock Device");
-
-        BluetoothDeviceDetailsFragment.sTestDataFactory =
-                new BluetoothDeviceDetailsFragment.TestDataFactory() {
-                    @Override
-                    public CachedBluetoothDevice getDevice(String deviceAddress) {
-                        return mCachedDevice;
-                    }
-
-                    @Override
-                    public LocalBluetoothManager getManager(Context context) {
-                        return mBluetoothManager;
-                    }
-                };
-    }
-
-    @Test
-    public void rotation() {
-        Intent intent = new Intent("android.settings.BLUETOOTH_SETTINGS");
-        SettingsActivity activity = (SettingsActivity) mInstrumentation.startActivitySync(intent);
-        Bundle args = new Bundle(1);
-        args.putString(BluetoothDeviceDetailsFragment.KEY_DEVICE_ADDRESS, mDeviceAddress);
-        new SubSettingLauncher(activity)
-                .setDestination(BluetoothDeviceDetailsFragment.class.getName())
-                .setTitleText("test")
-                .setArguments(args)
-                .setSourceMetricsCategory(Instrumentable.METRICS_CATEGORY_UNKNOWN)
-                .launch();
-        try {
-            mUiDevice.setOrientationLeft();
-            mUiDevice.setOrientationNatural();
-            mUiDevice.setOrientationRight();
-            mUiDevice.setOrientationNatural();
-        } catch (RemoteException e) {
-            throw new RuntimeException(e);
-        }
-    }
-}
\ No newline at end of file
diff --git a/tests/unit/src/com/android/settings/bluetooth/DevicePickerActivityTest.java b/tests/unit/src/com/android/settings/bluetooth/DevicePickerActivityTest.java
deleted file mode 100644
index e531e0a..0000000
--- a/tests/unit/src/com/android/settings/bluetooth/DevicePickerActivityTest.java
+++ /dev/null
@@ -1,47 +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.bluetooth;
-
-import android.app.Instrumentation;
-import android.content.Intent;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.filters.SmallTest;
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(AndroidJUnit4.class)
-@SmallTest
-public class DevicePickerActivityTest {
-
-    private Instrumentation mInstrumentation;
-
-    @Before
-    public void setUp() throws Exception {
-        mInstrumentation = InstrumentationRegistry.getInstrumentation();
-    }
-
-    @Test
-    public void startActivityNoCrash() {
-        mInstrumentation.startActivitySync(
-                new Intent("android.bluetooth.devicepicker.action.LAUNCH"));
-        // No crash
-    }
-}
diff --git a/tests/unit/src/com/android/settings/connecteddevice/ConnectedDeviceActivityTest.java b/tests/unit/src/com/android/settings/connecteddevice/ConnectedDeviceActivityTest.java
deleted file mode 100644
index 2957c4c..0000000
--- a/tests/unit/src/com/android/settings/connecteddevice/ConnectedDeviceActivityTest.java
+++ /dev/null
@@ -1,68 +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.connecteddevice;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.app.Instrumentation;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
-import android.text.TextUtils;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.filters.SmallTest;
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.util.List;
-
-@RunWith(AndroidJUnit4.class)
-@SmallTest
-public class ConnectedDeviceActivityTest {
-    private static final String INTENT_ACTION = "android.intent.action.MAIN";
-    private static final String CONNECTED_DEVICE_TITLE = "Connected devices";
-
-    private Instrumentation mInstrumentation;
-
-    @Before
-    public void setUp() throws Exception {
-        mInstrumentation = InstrumentationRegistry.getInstrumentation();
-    }
-
-    @Test
-    public void queryConnectedDeviceActivity_onlyOneResponse() {
-        final PackageManager packageManager = mInstrumentation.getContext().getPackageManager();
-        final Intent intent = new Intent(INTENT_ACTION);
-
-        int count = 0;
-        final List<ResolveInfo> resolveInfoList = packageManager.queryIntentActivities(intent,
-                PackageManager.GET_META_DATA);
-        for (ResolveInfo info : resolveInfoList) {
-            if (TextUtils.equals(info.activityInfo.loadLabel(packageManager).toString(),
-                    CONNECTED_DEVICE_TITLE)) {
-                count++;
-            }
-        }
-
-        assertThat(count).isEqualTo(1);
-    }
-
-}
diff --git a/tests/unit/src/com/android/settings/dashboard/PreferenceThemeTest.java b/tests/unit/src/com/android/settings/dashboard/PreferenceThemeTest.java
index 18a5e70..0ae5597 100644
--- a/tests/unit/src/com/android/settings/dashboard/PreferenceThemeTest.java
+++ b/tests/unit/src/com/android/settings/dashboard/PreferenceThemeTest.java
@@ -18,13 +18,9 @@
 
 import static androidx.test.espresso.Espresso.onView;
 import static androidx.test.espresso.assertion.ViewAssertions.doesNotExist;
-import static androidx.test.espresso.assertion.ViewAssertions.matches;
-import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
 import static androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility;
 import static androidx.test.espresso.matcher.ViewMatchers.withId;
 
-import static com.android.settings.dashboard.FirstIdViewMatcher.withFirstId;
-
 import static org.hamcrest.Matchers.allOf;
 
 import android.app.Instrumentation;
@@ -58,12 +54,6 @@
     }
 
     @Test
-    public void startPhoneStatus_preferenceIconSpaceReserved() throws InterruptedException {
-        launchPhoneStatus();
-        onView(withFirstId(R.id.icon_frame)).check(matches(isDisplayed()));
-    }
-
-    @Test
     public void startSetupWizardLockScreen_preferenceIconSpaceNotReserved() {
         launchSetupWizardLockScreen();
         // Icons should not be shown, and the frame should not occupy extra space.
@@ -72,14 +62,6 @@
         onView(withId(R.id.icon_container)).check(doesNotExist());
     }
 
-    private void launchPhoneStatus() {
-        final Intent settingsIntent = new Intent("android.settings.DEVICE_INFO_SETTINGS")
-                .addCategory(Intent.CATEGORY_DEFAULT)
-                .setPackage(mTargetPackage)
-                .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        InstrumentationRegistry.getInstrumentation().startActivitySync(settingsIntent);
-    }
-
     private void launchSetupWizardLockScreen() {
         final Intent settingsIntent = new Intent("com.android.settings.SETUP_LOCK_SCREEN")
                 .addCategory(Intent.CATEGORY_DEFAULT)
diff --git a/tests/unit/src/com/android/settings/datausage/MobileDataUsageActivityTest.java b/tests/unit/src/com/android/settings/datausage/MobileDataUsageActivityTest.java
deleted file mode 100644
index 066d199..0000000
--- a/tests/unit/src/com/android/settings/datausage/MobileDataUsageActivityTest.java
+++ /dev/null
@@ -1,64 +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;
-
-import static junit.framework.Assert.assertEquals;
-
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.net.NetworkTemplate;
-import android.telephony.SubscriptionManager;
-import android.telephony.TelephonyManager;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.filters.SmallTest;
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(AndroidJUnit4.class)
-@SmallTest
-public class MobileDataUsageActivityTest {
-    private static final String TAG = "MobileDataUsageTest";
-    @Test
-    public void test_mobileDataUsageIntent() {
-        final Context context = InstrumentationRegistry.getTargetContext();
-        final PackageManager packageManager = context.getPackageManager();
-        final int subId = SubscriptionManager.getDefaultSubscriptionId();
-        final NetworkTemplate template = getNetworkTemplate(context, subId);
-
-        Intent intent = new Intent(android.provider.Settings.ACTION_MOBILE_DATA_USAGE);
-        intent.putExtra(android.provider.Settings.EXTRA_NETWORK_TEMPLATE, template);
-        intent.putExtra(android.provider.Settings.EXTRA_SUB_ID, subId);
-
-        assertEquals(packageManager.queryIntentActivities(intent, 0).size(), 1);
-
-        context.startActivity(intent);
-        // Should exit gracefully without crashing.
-    }
-
-    private NetworkTemplate getNetworkTemplate(Context context, int subId) {
-        TelephonyManager tm = (TelephonyManager) context
-                .getSystemService(Context.TELEPHONY_SERVICE);
-        NetworkTemplate mobileAll = NetworkTemplate.buildTemplateMobileAll(
-                tm.getSubscriberId(subId));
-        return NetworkTemplate.normalize(mobileAll,
-                tm.getMergedSubscriberIds());
-    }
-}
diff --git a/tests/unit/src/com/android/settings/datetime/timezone/model/TimeZoneDataTest.java b/tests/unit/src/com/android/settings/datetime/timezone/model/TimeZoneDataTest.java
index 2659529..a04c08d 100644
--- a/tests/unit/src/com/android/settings/datetime/timezone/model/TimeZoneDataTest.java
+++ b/tests/unit/src/com/android/settings/datetime/timezone/model/TimeZoneDataTest.java
@@ -56,9 +56,6 @@
         */
         assertThat(mTimeZoneData.lookupCountryCodesForZoneId("Europe/Simferopol").isEmpty())
                 .isTrue();
-        // Metlakatla has the same time as Anchorage after 2015
-        assertThat(mTimeZoneData.lookupCountryCodesForZoneId("America/Metlakatla").isEmpty())
-                .isTrue();
         assertThat(mTimeZoneData.lookupCountryCodesForZoneId("Europe/London").isEmpty())
                 .isFalse();
         assertThat(mTimeZoneData.lookupCountryCodesForZoneId("America/Los_Angeles").isEmpty())
diff --git a/tests/unit/src/com/android/settings/deviceinfo/StorageDashboardFragmentTest.java b/tests/unit/src/com/android/settings/deviceinfo/StorageDashboardFragmentTest.java
deleted file mode 100644
index a0053be..0000000
--- a/tests/unit/src/com/android/settings/deviceinfo/StorageDashboardFragmentTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.android.settings.deviceinfo;
-
-import static androidx.test.espresso.Espresso.onView;
-import static androidx.test.espresso.action.ViewActions.click;
-import static androidx.test.espresso.intent.Intents.intended;
-import static androidx.test.espresso.intent.matcher.IntentMatchers.hasExtra;
-import static androidx.test.espresso.matcher.ViewMatchers.withText;
-
-import static org.hamcrest.Matchers.containsString;
-import static org.hamcrest.Matchers.equalTo;
-
-import androidx.test.espresso.intent.rule.IntentsTestRule;
-import androidx.test.filters.SmallTest;
-
-import com.android.settings.R;
-import com.android.settings.Settings.StorageDashboardActivity;
-import com.android.settings.deletionhelper.AutomaticStorageManagerSettings;
-
-import org.junit.Rule;
-import org.junit.Test;
-
-@SmallTest
-public class StorageDashboardFragmentTest {
-
-    public static final String EXTRA_KEY = ":settings:show_fragment";
-
-    @Rule
-    public IntentsTestRule<StorageDashboardActivity> mActivityRule =
-            new IntentsTestRule<>(StorageDashboardActivity.class, true, true);
-
-    @Test
-    public void testStorageManagePreference_canClickTextView() throws InterruptedException {
-        // Click on the actual textbox instead of just somewhere in the preference
-        onView(withText(R.string.automatic_storage_manager_preference_title)).perform(click());
-
-        // Check that it worked by seeing if we switched screens
-        intended(hasExtra(equalTo(EXTRA_KEY),
-                containsString(AutomaticStorageManagerSettings.class.getName())));
-
-    }
-}
diff --git a/tests/unit/src/com/android/settings/dream/DreamSettingsLaunchTest.java b/tests/unit/src/com/android/settings/dream/DreamSettingsLaunchTest.java
deleted file mode 100644
index 6a2abd5..0000000
--- a/tests/unit/src/com/android/settings/dream/DreamSettingsLaunchTest.java
+++ /dev/null
@@ -1,41 +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.dream;
-
-import android.content.Context;
-import android.content.Intent;
-import android.provider.Settings;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.filters.SmallTest;
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(AndroidJUnit4.class)
-@SmallTest
-public class DreamSettingsLaunchTest {
-
-    @Test
-    public void launchFromIntent_doesNotCrash() {
-        final Context context = InstrumentationRegistry.getTargetContext();
-        Intent intent = new Intent(Settings.ACTION_DREAM_SETTINGS);
-
-        context.startActivity(intent);
-    }
-}
diff --git a/tests/unit/src/com/android/settings/tests/DrawOverlayDetailsTest.java b/tests/unit/src/com/android/settings/tests/DrawOverlayDetailsTest.java
deleted file mode 100644
index d450bf0..0000000
--- a/tests/unit/src/com/android/settings/tests/DrawOverlayDetailsTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2016 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.tests;
-
-import static androidx.test.espresso.Espresso.onView;
-import static androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
-import static androidx.test.espresso.action.ViewActions.click;
-import static androidx.test.espresso.assertion.ViewAssertions.matches;
-import static androidx.test.espresso.matcher.ViewMatchers.isEnabled;
-import static androidx.test.espresso.matcher.ViewMatchers.withText;
-
-import static org.hamcrest.core.IsNot.not;
-
-import android.app.Instrumentation;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.support.test.uiautomator.UiDevice;
-import android.support.test.uiautomator.UiScrollable;
-import android.support.test.uiautomator.UiSelector;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.filters.SmallTest;
-import androidx.test.runner.AndroidJUnit4;
-
-import com.android.settings.R;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(AndroidJUnit4.class)
-@SmallTest
-public class DrawOverlayDetailsTest {
-    private final static String PACKAGE_SYSTEM_UI = "com.android.systemui";
-
-    @Test
-    public void testSystemUiDrawOverlayDetails_Disabled() throws Exception{
-        Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
-        instrumentation.startActivitySync(new Intent(android.provider.Settings
-                .ACTION_MANAGE_OVERLAY_PERMISSION));
-
-        final Context targetContext = instrumentation.getTargetContext();
-
-        final PackageManager packageManager = targetContext.getPackageManager();
-        final String appName = (String) packageManager.getApplicationLabel(packageManager
-                .getApplicationInfo(PACKAGE_SYSTEM_UI, PackageManager.GET_META_DATA));
-
-        final UiDevice device = UiDevice.getInstance(instrumentation);
-        device.waitForIdle();
-
-        openActionBarOverflowOrOptionsMenu(targetContext);
-        onView(withText(targetContext.getString(R.string.menu_show_system))).perform(click());
-        device.waitForIdle();
-
-        final UiScrollable settings = new UiScrollable(
-                new UiSelector().packageName(targetContext.getPackageName()).scrollable(true));
-        settings.scrollTextIntoView(appName);
-        onView(withText(appName)).perform(click());
-        onView(withText(targetContext.getString(R.string.permit_draw_overlay))).check(matches
-                (not(isEnabled())));
-    }
-
-}
diff --git a/tests/unit/src/com/android/settings/tests/KeepOnScreenTest.java b/tests/unit/src/com/android/settings/tests/KeepOnScreenTest.java
deleted file mode 100644
index b930ffb..0000000
--- a/tests/unit/src/com/android/settings/tests/KeepOnScreenTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2016 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.tests;
-
-import static androidx.test.espresso.Espresso.onView;
-import static androidx.test.espresso.action.ViewActions.click;
-import static androidx.test.espresso.matcher.ViewMatchers.withText;
-
-import static junit.framework.Assert.assertEquals;
-
-import android.app.Instrumentation;
-import android.content.Context;
-import android.content.Intent;
-import android.os.BatteryManager;
-import android.provider.Settings;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.filters.SmallTest;
-import androidx.test.runner.AndroidJUnit4;
-
-import com.android.settings.R;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(AndroidJUnit4.class)
-@SmallTest
-public class KeepOnScreenTest {
-    private static int EXPECTED_FLAG = BatteryManager.BATTERY_PLUGGED_AC
-            | BatteryManager.BATTERY_PLUGGED_USB | BatteryManager.BATTERY_PLUGGED_WIRELESS;
-
-    @Test
-    public void testStayAwake_turnOn_StayAwakeWhileWirelessCharging() throws Exception{
-        Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
-        instrumentation.startActivitySync(new Intent(android.provider.Settings
-                .ACTION_APPLICATION_DEVELOPMENT_SETTINGS));
-
-        final Context targetContext = instrumentation.getTargetContext();
-        final int prevFlag = Settings.Global.getInt(targetContext.getContentResolver(), Settings
-                .Global.STAY_ON_WHILE_PLUGGED_IN);
-
-        // Turn on "Stay Awake" if needed
-        if (prevFlag == 0) {
-            onView(withText(R.string.keep_screen_on)).perform(click());
-        }
-
-        final int currentFlag = Settings.Global.getInt(targetContext.getContentResolver(), Settings
-                .Global.STAY_ON_WHILE_PLUGGED_IN);
-
-        assertEquals(EXPECTED_FLAG, currentFlag);
-
-        // Since this app doesn't have permission(and shouldn't have) to change global setting, we
-        // can only tearDown in this way
-        if (prevFlag != currentFlag) {
-            onView(withText(R.string.keep_screen_on)).perform(click());
-        }
-    }
-}
diff --git a/tests/unit/src/com/android/settings/tests/PrivateVolumeSettingsTest.java b/tests/unit/src/com/android/settings/tests/PrivateVolumeSettingsTest.java
deleted file mode 100644
index 2760a07..0000000
--- a/tests/unit/src/com/android/settings/tests/PrivateVolumeSettingsTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2016 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.tests;
-
-import static androidx.test.espresso.Espresso.onView;
-import static androidx.test.espresso.assertion.ViewAssertions.doesNotExist;
-import static androidx.test.espresso.matcher.ViewMatchers.withText;
-
-import android.app.Instrumentation;
-import android.content.Intent;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.filters.SmallTest;
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(AndroidJUnit4.class)
-@SmallTest
-public class PrivateVolumeSettingsTest {
-    @Test
-    public void test_ManageStorageNotShown() {
-        Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
-        instrumentation.startActivitySync(
-                new Intent(android.provider.Settings.ACTION_INTERNAL_STORAGE_SETTINGS));
-        onView(withText(com.android.settings.R.string.storage_menu_manage)).check(doesNotExist());
-    }
-}
\ No newline at end of file
diff --git a/tests/unit/src/com/android/settings/tests/SettingsRestoreAfterCloseTest.java b/tests/unit/src/com/android/settings/tests/SettingsRestoreAfterCloseTest.java
deleted file mode 100644
index 3c6caf7..0000000
--- a/tests/unit/src/com/android/settings/tests/SettingsRestoreAfterCloseTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2016 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.tests;
-
-import android.app.ActivityManager;
-import android.content.Context;
-import android.content.Intent;
-import android.provider.Settings;
-import android.support.test.uiautomator.By;
-import android.support.test.uiautomator.UiDevice;
-import android.support.test.uiautomator.Until;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.filters.SmallTest;
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(AndroidJUnit4.class)
-@SmallTest
-public class SettingsRestoreAfterCloseTest {
-    private static final String PACKAGE_SETTINGS = "com.android.settings";
-    private static final int TIME_OUT = 2000;
-
-    private boolean mAlwaysFinish;
-
-    @Before
-    public void setUp() throws Exception {
-        // To make sure when we press home button, the activity will be destroyed by OS
-        Context context = InstrumentationRegistry.getContext();
-        mAlwaysFinish = Settings.Global.getInt(
-                context.getContentResolver(), Settings.Global
-                .ALWAYS_FINISH_ACTIVITIES, 0)
-                != 0;
-
-        ActivityManager.getService().setAlwaysFinish(true);
-    }
-
-    @After
-    public void tearDown() throws Exception {
-        ActivityManager.getService().setAlwaysFinish(mAlwaysFinish);
-    }
-
-    @Test
-    public void testRtlStability_AppCloseAndReOpen_shouldNotCrash() throws Exception {
-
-        final UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation
-                ());
-        uiDevice.pressHome();
-
-        // Open the settings app
-        startSettingsMainActivity(uiDevice);
-
-        // Press home button
-        uiDevice.pressHome();
-        final String launcherPackage = uiDevice.getLauncherPackageName();
-        uiDevice.wait(Until.hasObject(By.pkg(launcherPackage).depth(0)), TIME_OUT);
-
-        // Open the settings again
-        startSettingsMainActivity(uiDevice);
-    }
-
-    private void startSettingsMainActivity(UiDevice uiDevice) {
-        Context context = InstrumentationRegistry.getContext();
-        context.startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS));
-        uiDevice.wait(Until.hasObject(By.pkg(PACKAGE_SETTINGS).depth(0)), TIME_OUT);
-    }
-}
diff --git a/tests/unit/src/com/android/settings/users/UserSettingsTest.java b/tests/unit/src/com/android/settings/users/UserSettingsTest.java
deleted file mode 100644
index 93f62f3..0000000
--- a/tests/unit/src/com/android/settings/users/UserSettingsTest.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright (C) 2016 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 static com.google.common.truth.Truth.assertThat;
-
-import android.content.Context;
-import android.content.Intent;
-import android.support.test.uiautomator.UiDevice;
-import android.support.test.uiautomator.UiObject;
-import android.support.test.uiautomator.UiObjectNotFoundException;
-import android.support.test.uiautomator.UiScrollable;
-import android.support.test.uiautomator.UiSelector;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.filters.SmallTest;
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(AndroidJUnit4.class)
-@SmallTest
-public class UserSettingsTest {
-
-    private static final String SYSTEM = "System";
-    private static final String ADVANCED = "Advanced";
-    private static final String USERS = "Multiple users";
-    private static final String EMERGNENCY_INFO = "Emergency information";
-    private static final String ADD_USERS_WHEN_LOCKED = "Add users";
-    private static final String SWITCH_USER_BUTTON = "com.android.systemui:id/multi_user_switch";
-    private static final String SETTINGS_BUTTON = "com.android.systemui:id/settings_button";
-    private static final String PRIMARY_USER = "Owner";
-    private static final String GUEST_USER = "Guest";
-    private static final String ADD_GUEST = "Add guest";
-    private static final String CONTINUE = "Yes, continue";
-
-    private UiDevice mDevice;
-    private Context mContext;
-    private String mTargetPackage;
-
-    @Before
-    public void setUp() {
-        mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
-        mContext = InstrumentationRegistry.getTargetContext();
-        mTargetPackage = mContext.getPackageName();
-    }
-
-    @Test
-    public void testEmergencyInfoNotExists() throws Exception {
-        launchUserSettings();
-        UiObject emergencyInfoPreference =
-            mDevice.findObject(new UiSelector().text(EMERGNENCY_INFO));
-
-        assertThat(emergencyInfoPreference.exists()).isFalse();
-    }
-
-    @Test
-    public void testAddUsersWhenLockedNotExists() throws Exception {
-        launchUserSettings();
-        UiObject addUsersPreference =
-            mDevice.findObject(new UiSelector().text(ADD_USERS_WHEN_LOCKED));
-        assertThat(addUsersPreference.exists()).isFalse();
-    }
-
-    @Test
-    public void testUsersExistsOnSecondaryUser() throws Exception {
-        // switch to guest user
-        switchToOrCreateGuest();
-        // launch settings (launch from intent doesn't work, hence launch from quick settings)
-        mDevice.openQuickSettings();
-        mDevice.findObject(new UiSelector().resourceId(SETTINGS_BUTTON)).click();
-        // launch system settings and expand whole screen
-        final UiScrollable settings = new UiScrollable(
-            new UiSelector().packageName(mTargetPackage).scrollable(true));
-        final String titleSystem = SYSTEM;
-        settings.scrollTextIntoView(titleSystem);
-        mDevice.findObject(new UiSelector().text(titleSystem)).click();
-        mDevice.findObject(new UiSelector().text(ADVANCED)).click();
-
-        final boolean hasUsersSettings = mDevice.findObject(new UiSelector().text(USERS)).exists();
-
-        // switch back to primary user
-        mDevice.openQuickSettings();
-        mDevice.findObject(new UiSelector().resourceId(SWITCH_USER_BUTTON)).click();
-        mDevice.findObject(new UiSelector().text(PRIMARY_USER)).click();
-
-        assertThat(hasUsersSettings).isTrue();
-    }
-
-    private void launchSettings() {
-        Intent settingsIntent = new Intent(Intent.ACTION_MAIN)
-                .addCategory(Intent.CATEGORY_LAUNCHER)
-                .setPackage(mTargetPackage)
-                .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        mContext.startActivity(settingsIntent);
-    }
-
-    private void launchUserSettings() throws Exception  {
-        launchSettings();
-        final UiScrollable settings = new UiScrollable(
-                new UiSelector().packageName(mTargetPackage).scrollable(true));
-        final String titleSystem = SYSTEM;
-        settings.scrollTextIntoView(titleSystem);
-        mDevice.findObject(new UiSelector().text(titleSystem)).click();
-        mDevice.findObject(new UiSelector().text(ADVANCED)).click();
-        mDevice.findObject(new UiSelector().text(USERS)).click();
-    }
-
-    private void switchToOrCreateGuest() throws UiObjectNotFoundException {
-        mDevice.openQuickSettings();
-        mDevice.findObject(new UiSelector().resourceId(SWITCH_USER_BUTTON)).click();
-        // if no existing guest user, select "Add guest", otherwise select "Guest"
-        final UiObject addGuest = mDevice.findObject(new UiSelector().text(ADD_GUEST));
-        if (addGuest.exists()) {
-            addGuest.click();
-            mDevice.waitForIdle();
-            mDevice.pressBack();
-        } else {
-            mDevice.findObject(new UiSelector().text(GUEST_USER)).click();
-            mDevice.waitForIdle();
-            mDevice.findObject(new UiSelector().text(CONTINUE)).click();
-            mDevice.waitForIdle();
-        }
-    }
-}
diff --git a/tests/unit/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java b/tests/unit/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java
index cb586e4..2de6611 100644
--- a/tests/unit/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java
+++ b/tests/unit/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java
@@ -56,7 +56,8 @@
         mTetherActivityIntent = new Intent()
                 .setClassName(mInstrumentation.getTargetContext().getPackageName(),
                         Settings.TetherSettingsActivity.class.getName())
-                .setPackage(mInstrumentation.getTargetContext().getPackageName());
+                .setPackage(mInstrumentation.getTargetContext().getPackageName())
+                .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
     }
 
     @After
@@ -69,7 +70,6 @@
         launchWifiTetherActivity();
         onView(withText("Hotspot name")).check(matches(isDisplayed()));
         onView(withText("Hotspot password")).check(matches(isDisplayed()));
-        onView(withText("AP Band")).check(matches(isDisplayed()));
     }
 
     private void launchWifiTetherActivity() {