Merge "Use correct uid when querying usage data for specific user."
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 8362fd6..dccd1d0 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -57,6 +57,7 @@
     <uses-permission android:name="android.permission.READ_SYNC_STATS" />
     <uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
     <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
+    <uses-permission android:name="android.permission.READ_DEVICE_CONFIG" />
     <uses-permission android:name="android.permission.STATUS_BAR" />
     <uses-permission android:name="android.permission.MANAGE_USB" />
     <uses-permission android:name="android.permission.MANAGE_DEBUGGING" />
@@ -1825,7 +1826,7 @@
         <activity
             android:name="Settings$PrintSettingsActivity"
             android:label="@string/print_settings"
-            android:icon="@*android:drawable/ic_settings_print"
+            android:icon="@drawable/ic_settings_print"
             android:parentActivityName="Settings">
             <intent-filter android:priority="1">
                 <action android:name="android.settings.ACTION_PRINT_SETTINGS" />
@@ -2591,6 +2592,12 @@
             </intent-filter>
         </activity>
 
+        <activity
+            android:name=".wifi.slice.ConnectToWifiHandler"
+            android:theme="@android:style/Theme.NoDisplay"
+            android:excludeFromRecents="true"
+            android:exported="false" />
+
         <activity android:name=".sim.SimDialogActivity"
                 android:theme="@style/Theme.AlertDialog"
                 android:label="@string/sim_settings_title"
@@ -2776,13 +2783,17 @@
                 android:value="com.android.settings.webview.WebViewAppPicker" />
         </activity-alias>
 
-        <activity android:name=".backup.BackupSettingsActivity"
+        <provider
+            android:name=".backup.BackupSettingsContentProvider"
+            android:authorities="com.android.settings.backup.BackupSettingsContentProvider"
+	    android:exported="true">
+        </provider>
+
+        <activity android:name=".backup.UserBackupSettingsActivity"
                   android:label="@string/privacy_settings_title"
-                  android:icon="@drawable/ic_settings_backup"
-                  android:parentActivityName="Settings">
+                  android:icon="@drawable/ic_settings_backup">
             <intent-filter android:priority="1">
                 <action android:name="android.settings.PRIVACY_SETTINGS" />
-                <action android:name="android.settings.BACKUP_AND_RESET_SETTINGS" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
             <intent-filter>
@@ -2790,10 +2801,16 @@
                 <category android:name="android.intent.category.DEFAULT" />
                 <category android:name="android.intent.category.VOICE_LAUNCH" />
             </intent-filter>
-            <meta-data android:name="com.android.settings.summary"
-                       android:resource="@string/summary_empty"/>
-            <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
-                       android:value="true" />
+            <!-- Mark the activity as a dynamic setting -->
+            <intent-filter>
+                <action android:name="com.android.settings.action.IA_SETTINGS" />
+            </intent-filter>
+            <!-- Tell Settings app which category it belongs to -->
+            <meta-data android:name="com.android.settings.category"
+                       android:value="com.android.settings.category.ia.system" />
+            <meta-data android:name="com.android.settings.summary_uri"
+		       android:value="content://com.android.settings.backup.BackupSettingsContentProvider/summary" />
+            <meta-data android:name="com.android.settings.order" android:value="-60"/>
         </activity>
 
         <activity
diff --git a/proguard.flags b/proguard.flags
index b66a786..d509dba 100644
--- a/proguard.flags
+++ b/proguard.flags
@@ -9,7 +9,7 @@
 -keep public class com.android.settings.** extends androidx.fragment.app.Fragment
 
 # Keep all preference controllers needed by slice and DashboardFragment.
--keep class * extends com.android.settings.core.BasePreferenceController {
+-keep class !com.google.android.settings.aware.*, * extends com.android.settings.core.BasePreferenceController {
     *;
 }
 
diff --git a/protos/contextual_card_list.proto b/protos/contextual_card_list.proto
index 5645c87..37383ba 100644
--- a/protos/contextual_card_list.proto
+++ b/protos/contextual_card_list.proto
@@ -18,7 +18,7 @@
     SUGGESTION = 1;
     POSSIBLE = 2;
     IMPORTANT = 3;
-    EXCLUSIVE = 4;
+    EXCLUSIVE = 4 [deprecated = true];
     DEFERRED_SETUP = 5;
   }
 
diff --git a/res/drawable/ic_devices_check_circle_green.xml b/res/drawable/ic_devices_check_circle_green.xml
new file mode 100644
index 0000000..71c683b
--- /dev/null
+++ b/res/drawable/ic_devices_check_circle_green.xml
@@ -0,0 +1,30 @@
+<!--
+    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.
+-->
+<layer-list
+    xmlns:android="http://schemas.android.com/apk/res/android">
+    <item
+        android:drawable="@drawable/ic_devices_other_opaque_black"
+        android:width="@dimen/wifi_dpp_fragment_icon_width_height"
+        android:height="@dimen/wifi_dpp_fragment_icon_width_height"
+        android:gravity="center"/>
+
+    <item
+        android:drawable="@drawable/ic_check_circle_green"
+        android:top="28dp"
+        android:left="44dp"
+        android:gravity="center"/>
+
+</layer-list>
diff --git a/res/drawable/ic_menu_add_white.xml b/res/drawable/ic_menu_add_white.xml
deleted file mode 100644
index 25a8ff0..0000000
--- a/res/drawable/ic_menu_add_white.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-     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.
--->
-
-<vector
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:width="24dp"
-    android:height="24dp"
-    android:viewportWidth="24.0"
-    android:viewportHeight="24.0"
-    android:tint="?android:attr/colorControlNormal">
-    <path
-        android:fillColor="#FFFFFFFF"
-        android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
-</vector>
diff --git a/res/drawable/ic_settings_print.xml b/res/drawable/ic_settings_print.xml
new file mode 100644
index 0000000..dc92de0
--- /dev/null
+++ b/res/drawable/ic_settings_print.xml
@@ -0,0 +1,22 @@
+<?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.
+  -->
+
+<!-- Pass through drawable to framework ic_settings_print. This is necessary because this drawable
+     is used in AndroidManifest.xml and aapt cannot find drawable reference from outside of Settings
+      apk. -->
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+        android:src="@*android:drawable/ic_settings_print"/>
\ No newline at end of file
diff --git a/res/layout/dialog_mobile_network_rename.xml b/res/layout/dialog_mobile_network_rename.xml
new file mode 100644
index 0000000..d67f0dc
--- /dev/null
+++ b/res/layout/dialog_mobile_network_rename.xml
@@ -0,0 +1,64 @@
+<?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.
+-->
+<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">
+
+        <EditText
+            android:id="@+id/edittext"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:inputType="text"
+            android:maxLength="50"
+            android:singleLine="true">
+            <requestFocus/>
+        </EditText>
+
+        <TextView
+            style="@style/device_info_dialog_label"
+            android:id="@+id/operator_name_label"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="@string/status_operator"/>
+        <TextView
+            style="@style/device_info_dialog_value"
+            android:id="@+id/operator_name_value"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="@string/device_info_not_available"/>
+
+        <TextView
+            style="@style/device_info_dialog_label"
+            android:id="@+id/number_label"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="@string/status_number_sim_status"/>
+        <TextView
+            style="@style/device_info_dialog_value"
+            android:id="@+id/number_value"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="@string/device_info_not_available"/>
+
+    </LinearLayout>
+</ScrollView>
diff --git a/res/layout/homepage_condition_footer.xml b/res/layout/homepage_condition_footer.xml
index 0ff7ac6..56687fe 100644
--- a/res/layout/homepage_condition_footer.xml
+++ b/res/layout/homepage_condition_footer.xml
@@ -15,26 +15,20 @@
   limitations under the License.
   -->
 
-<androidx.cardview.widget.CardView
+<LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    style="@style/ContextualCardStyle">
+    android:layout_height="@dimen/homepage_condition_footer_height"
+    android:contentDescription="@string/homepage_condition_footer_content_description"
+    android:gravity="end"
+    android:orientation="horizontal"
+    android:paddingTop="@dimen/homepage_condition_footer_padding_top"
+    android:paddingEnd="@dimen/homepage_condition_footer_padding_end">
 
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="@dimen/homepage_condition_footer_height"
-        android:contentDescription="@string/homepage_condition_footer_content_description"
-        android:gravity="end"
-        android:orientation="horizontal"
-        android:paddingTop="@dimen/homepage_condition_footer_padding_top"
-        android:paddingEnd="@dimen/homepage_condition_footer_padding_end">
+    <ImageView
+        android:id="@+id/collapse_button"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:src="@drawable/ic_expand_less"/>
 
-        <ImageView
-            android:id="@+id/collapse_button"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:src="@drawable/ic_expand_less" />
-
-    </LinearLayout>
-</androidx.cardview.widget.CardView>
\ No newline at end of file
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/manage_applications_apps.xml b/res/layout/manage_applications_apps.xml
index c2f58c3..021a61e 100644
--- a/res/layout/manage_applications_apps.xml
+++ b/res/layout/manage_applications_apps.xml
@@ -28,9 +28,9 @@
         settings:layout_behavior="com.android.settings.widget.FloatingAppBarScrollingViewBehavior">
 
         <FrameLayout
+            android:id="@+id/content_container"
             android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:paddingTop="@dimen/app_bar_height">
+            android:layout_height="match_parent">
 
             <LinearLayout
                 android:id="@+id/list_container"
diff --git a/res/layout/preference_widget_add.xml b/res/layout/preference_widget_add.xml
new file mode 100644
index 0000000..6e33a4d
--- /dev/null
+++ b/res/layout/preference_widget_add.xml
@@ -0,0 +1,30 @@
+<?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.
+  -->
+
+<ImageView
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/add_preference_widget"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:layout_gravity="center"
+    android:paddingStart="?android:attr/listPreferredItemPaddingEnd"
+    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+    android:background="?android:attr/selectableItemBackground"
+    android:scaleType="center"
+    android:src="@drawable/ic_add_24dp"
+    android:contentDescription="@string/add" />
+
diff --git a/res/layout/radio_info.xml b/res/layout/radio_info.xml
index 100521e..fc8cc26 100644
--- a/res/layout/radio_info.xml
+++ b/res/layout/radio_info.xml
@@ -182,6 +182,14 @@
                 android:layout_height="wrap_content"
                 android:text="@string/cbrs_data_switch_string" />
 
+        <!-- Switch between SSSS(single sim single standby) and DSDS(dual sim dual standby). -->
+        <Switch android:id="@+id/dsds_switch"
+                android:textSize="14sp"
+                android:layout_marginTop="8dip"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="@string/dsds_switch_string" />
+
         <!-- Horizontal Rule -->
         <View
             android:layout_width="fill_parent"
diff --git a/res/layout/settings_homepage_container.xml b/res/layout/settings_homepage_container.xml
index 1e5bdce..45d0861 100644
--- a/res/layout/settings_homepage_container.xml
+++ b/res/layout/settings_homepage_container.xml
@@ -28,12 +28,11 @@
         app:layout_behavior="com.android.settings.widget.FloatingAppBarScrollingViewBehavior">
 
         <LinearLayout
+            android:id="@+id/homepage_container"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:orientation="vertical"
-            android:descendantFocusability="blocksDescendants"
-            android:paddingTop="104dp">
-            <!-- height of status bar(24dp) + height of action bar(48dp) + top/bottom margins(16dp) -->
+            android:descendantFocusability="blocksDescendants">
 
             <FrameLayout
                 android:id="@+id/contextual_cards_content"
diff --git a/res/layout/wifi_dpp_fragment_header.xml b/res/layout/wifi_dpp_fragment_header.xml
index 20bcd7d..e8e71d1 100644
--- a/res/layout/wifi_dpp_fragment_header.xml
+++ b/res/layout/wifi_dpp_fragment_header.xml
@@ -28,8 +28,16 @@
 
     <ImageView
         android:id="@android:id/icon"
-        android:layout_width="48dp"
-        android:layout_height="48dp"
+        android:layout_width="@dimen/wifi_dpp_fragment_icon_width_height"
+        android:layout_height="@dimen/wifi_dpp_fragment_icon_width_height"
+        android:scaleType="fitCenter"/>
+
+    <!-- Special header icon only for ic_devices_check_circle_green -->
+    <ImageView
+        android:id="@+id/devices_check_circle_green_icon"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:src="@drawable/ic_devices_check_circle_green"
         android:scaleType="fitCenter"/>
 
     <TextView
diff --git a/res/menu/vpn.xml b/res/menu/vpn.xml
index 7b35c70..a3b8090 100644
--- a/res/menu/vpn.xml
+++ b/res/menu/vpn.xml
@@ -18,6 +18,6 @@
     <item
         android:id="@+id/vpn_create"
         android:title="@string/vpn_create"
-        android:icon="@drawable/ic_menu_add_white"
+        android:icon="@drawable/ic_menu_add"
         android:showAsAction="always" />
 </menu>
diff --git a/res/values/config.xml b/res/values/config.xml
index e6856ac..0e46200 100755
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -41,10 +41,6 @@
     <!-- Whether to show Camera laser sensor switch in Developer Options -->
     <bool name="config_show_camera_laser_sensor">false</bool>
 
-    <!-- Whether to show Connected MAC Randomization in Developer Options
-         as not all devices can support dynamic MAC address change.  -->
-    <bool name="config_wifi_support_connected_mac_randomization">false</bool>
-
     <!-- Fully-qualified class name for the implementation of the FeatureFactory to be instantiated. -->
     <string name="config_featureFactory" translatable="false">com.android.settings.overlay.FeatureFactoryImpl</string>
 
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index dd06c37..0a35188 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -385,6 +385,9 @@
     <dimen name="qrcode_size">264dp</dimen>
     <dimen name="qrcode_preview_size">360dp</dimen>
 
+    <!-- Wi-Fi DPP fragment icon size -->
+    <dimen name="wifi_dpp_fragment_icon_width_height">48dp</dimen>
+
     <!-- Height for slice preference, which contains 6 items at most -->
     <dimen name="slice_preference_group_height">360dp</dimen>
 </resources>
diff --git a/res/values/ids.xml b/res/values/ids.xml
index 66af163..ba14e85 100644
--- a/res/values/ids.xml
+++ b/res/values/ids.xml
@@ -31,4 +31,7 @@
     <item type="id" name="action_drag_move_top" />
     <item type="id" name="action_drag_move_bottom" />
     <item type="id" name="action_drag_remove" />
+
+    <!-- For a menu item allowing users to edit a SIM display name -->
+    <item type="id" name="edit_sim_name" />
 </resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1a92f7b..1b1a7f3 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -66,6 +66,21 @@
     <!-- Cbrs enable disable flag. Only shown in diagnostic screen, so precise translation is not needed -->
     <string name="cbrs_data_switch_string">Cbrs Data</string>
 
+    <!-- Dsds enable/disable flag. Only shown in diagnostic screen, so precise translation is not needed, [CHAR LIMIT=none] -->
+    <string name="dsds_switch_string">Enable DSDS</string>
+
+    <!-- UI debug setting: Enable/Disable DSDS [CHAR LIMIT=none] -->
+    <string name="dsds_dialog_title">Restart Device?</string>
+
+    <!-- UI debug setting: Enable/Disable DSDS [CHAR LIMIT=none] -->
+    <string name="dsds_dialog_message">You need to restart your device to change this setting.</string>
+
+    <!-- UI debug setting: Enable/Disable DSDS [CHAR LIMIT=none] -->
+    <string name="dsds_dialog_confirm">Restart</string>
+
+    <!-- UI debug setting: Enable/Disable DSDS [CHAR LIMIT=none] -->
+    <string name="dsds_dialog_cancel">Cancel</string>
+
     <!-- Title for controlling on/off for Mobile phone's radio power. Only shown in diagnostic screen, so precise translation is not needed. -->
     <string name="radio_info_radio_power">Mobile Radio Power</string>
 
@@ -658,6 +673,8 @@
     <string name="apply">Apply</string>
     <!-- Button label for generic share action [CHAR LIMIT=20] -->
     <string name="share">Share</string>
+    <!-- Button label for generic add action [CHAR LIMIT=20] -->
+    <string name="add">Add</string>
 
     <!-- Title of the Settings activity shown within the application itself. -->
     <string name="settings_label">Settings</string>
@@ -803,9 +820,9 @@
     <string name="lockdown_settings_summary">Display power button option that turns off Smart Lock, fingerprint unlocking, and notifications on the lock screen</string>
 
     <!-- Text shown for the title of the extend unlock mode option for trust agents [CHAR LIMIT=40] -->
-    <string name="trust_agents_extend_unlock_title">SmartLock only extends unlock</string>
+    <string name="trust_agents_extend_unlock_title">Trust agents only extend unlock</string>
     <!-- Text shown for the description of the extend unlock mode option [CHAR LIMIT=NONE] -->
-    <string name="trust_agents_extend_unlock_summary">If enabled, SmartLock will keep your device unlocked for longer, but can no longer unlock a locked device.</string>
+    <string name="trust_agents_extend_unlock_summary">If enabled, trust agents will keep your device unlocked for longer, but can no longer unlock a locked device.</string>
 
     <!-- Text shown for the title of the lock when trust lost option [CHAR LIMIT=40] -->
     <string name="trust_lost_locks_screen_title">Lock screen when trust is lost</string>
@@ -1869,6 +1886,11 @@
     <!-- Dialog content for NFC disclaimer: telling user NFC can exchange data when device is nearby other devices (for example: payment terminals, badge reader etc). [CHAR_LIMIT=NONE]-->
     <string name="nfc_disclaimer_content">NFC exchanges data between this device and other nearby devices or targets, such as payment terminals, access readers, and interactive ads or tags.</string>
 
+    <!-- Used in the settings screen to secure NFC [CHAR LIMIT=NONE] -->
+    <string name="nfc_secure_settings_title">Secure NFC</string>
+    <!-- Description of Secure NFC in the 1st level settings screen. [CHAR LIMIT=NONE] -->
+    <string name="nfc_secure_toggle_summary" product="default">Allow NFC Payment and Transit use only when screen is unlocked</string>
+
     <!-- Used to enter the Android Beam sharing preferences screen. This phrase is a trademark. [CHAR LIMIT=32] -->
     <string name="android_beam_settings_title">Android Beam</string>
     <!-- Used to describe the on state of the Android Beam feature [CHAR LIMIT=NONE] -->
@@ -1876,7 +1898,7 @@
     <!-- Used to describe the off state of the Android Beam feature [CHAR LIMIT=NONE] -->
     <string name="android_beam_off_summary">Off</string>
     <!-- Used to describe the enabled state of the Android Beam feature when NFC, which it relies on, is turned off [CHAR LIMIT=NONE] -->
-    <string name="android_beam_disabled_summary">Unavailable because NFC is turned off</string>
+    <string name="nfc_disabled_summary">Unavailable because NFC is turned off</string>
     <!-- Used in the Android Beam sharing preferences screen. This phrase is a trademark. [CHAR LIMIT=32] -->
     <string name="android_beam_label">Android Beam</string>
     <!-- Explanation of the Android Beam feature in the Android Beam settings panel. The use of "beam" here is as a verb and not considered trademarked. [CHAR LIMIT=NONE] -->
@@ -4749,13 +4771,13 @@
     <!-- Summary for the accessibility preference for hearing aid when not connected. [CHAR LIMIT=50] -->
     <string name="accessibility_hearingaid_not_connected_summary">No hearing aids connected</string>
     <!-- Summary for the accessibility preference for hearing aid when adding new devices. [CHAR LIMIT=50] -->
-    <string name="accessibility_hearingaid_adding_summary">Add hearing aid</string>
+    <string name="accessibility_hearingaid_adding_summary">Add hearing aids</string>
     <!-- Message to ask the user that if they want to pair the hearing aid, then they should find and tap the hearing aid device from the list on the next screen. [CHAR LIMIT=NONE] -->
     <string name="accessibility_hearingaid_pair_instructions_first_message">To pair your hearing aids, find and tap your device on the next screen.</string>
     <!-- Message to ask the user to make sure that their hearing aid devices are in pairing mode. [CHAR LIMIT=NONE] -->
     <string name="accessibility_hearingaid_pair_instructions_second_message">Make sure your hearing aids are in pairing mode.</string>
     <!-- Summary for the accessibility preference for hearing aid when there is an active device. [CHAR LIMIT=50] -->
-    <string name="accessibility_hearingaid_active_device_summary"><xliff:g id="device_name">%1$s</xliff:g> currently active</string>
+    <string name="accessibility_hearingaid_active_device_summary"><xliff:g id="device_name">%1$s</xliff:g> active</string>
     <!-- Summary for the accessibility preference for hearing aid when there are saved devices. [CHAR LIMIT=50] -->
     <plurals name="show_number_hearingaid_count">
         <item quantity="one"><xliff:g id="number_device_count">%1$d</xliff:g> saved hearing aid</item>
@@ -7034,7 +7056,9 @@
     <string name="keywords_sim_status">network, mobile network state, service state, signal strength, mobile network type, roaming, iccid</string>
     <string name="keywords_model_and_hardware">serial number, hardware version</string>
     <string name="keywords_android_version">android security patch level, baseband version, kernel version</string>
-    <!--Search keywords for financial apps sms access settings -->
+    <!-- Search keywords for dark mode settings [CHAR LIMIT=NONE] -->
+    <string name="keywords_dark_ui_mode">theme, light, dark, mode</string>
+    <!-- Search keywords for financial apps sms access settings [CHAR LIMIT=NONE] -->
     <string name="keywords_financial_apps_sms_access">financial app, sms, permission</string>
 
     <!-- Search keyword for Device Theme Settings [CHAR LIMIT=NONE] -->
@@ -7400,12 +7424,6 @@
     <!--  Do not disturb: Label for button that will turn off zen mode. [CHAR LIMIT=30] -->
     <string name="zen_mode_button_turn_off">Turn off now</string>
 
-    <!-- Setting title for controlling how caption text display in real time [CHAR LIMIT=40]-->
-    <string name="live_captions_title">Live Caption</string>
-
-    <!-- Setting summary for controlling how caption text display in real time [CHAR LIMIT=NONE]-->
-    <string name="live_captions_summary">Auto-convert on-device audio to captions</string>
-
     <!-- [CHAR LIMIT=110] Zen mode settings footer: Footer showing end time of DND -->
     <string name="zen_mode_settings_dnd_manual_end_time">Do Not Disturb is on until <xliff:g id="formatted_time" example="7:00 AM">%s</xliff:g></string>
 
@@ -7590,6 +7608,12 @@
     <!-- Configure Notifications: Work profile section header [CHAR LIMIT=30] -->
     <string name="profile_section_header">Work notifications</string>
 
+    <!-- Configure Notifications: setting title [CHAR LIMIT=80] -->
+    <string name="hide_silent_icons_title">Hide silent notification status icons</string>
+
+    <!-- Configure Notifications: setting summary [CHAR LIMIT=NONE] -->
+    <string name="hide_silent_icons_summary">Hide icons for silent notifications in the status bar</string>
+
     <!-- Configure Notifications: Title for the notification badging option. [CHAR LIMIT=30 BACKUP_MESSAGE_ID=5125022693565388760] -->
     <string name="notification_badging_title">Allow notification dots</string>
 
@@ -9583,8 +9607,8 @@
         <item quantity="other"><xliff:g id="count" example="10">%d</xliff:g> apps can use unrestricted data</item>
     </plurals>
 
-    <!-- Title for the More preference item in Special app access settings [CHAR LIMIT=30] -->
-    <string name="special_access_more">More</string>
+    <!-- Title for the See more preference item in Special app access settings [CHAR LIMIT=30] -->
+    <string name="special_access_more">See more</string>
 
     <!-- Developer option to convert to file encryption - final warning -->
     <string name="confirm_convert_to_fbe_warning">Really wipe user data and convert to file encryption?</string>
@@ -9768,11 +9792,6 @@
     <!-- Summary text for ambient display (device) [CHAR LIMIT=NONE]-->
     <string name="ambient_display_pickup_summary" product="device">To check time, notifications, and other info, pick up your device.</string>
 
-    <!-- Preference and settings suggestion title text for gesture that shows the lock screen [CHAR LIMIT=60]-->
-    <string name="ambient_display_wake_lock_screen_title">Wake lock screen gesture</string>
-    <!-- Summary text for ambient display [CHAR LIMIT=NONE]-->
-    <string name="ambient_display_wake_lock_screen_summary" product="default"></string>
-
     <!-- Preference and settings suggestion title text for ambient display tap (phone) [CHAR LIMIT=60]-->
     <string name="ambient_display_tap_screen_title" product="default">Tap to check phone</string>
     <!-- Preference and settings suggestion title text for ambient display tap (tablet) [CHAR LIMIT=60]-->
@@ -10251,11 +10270,11 @@
     <!--  Summary for battery Suggestion. [CHAR LIMIT=55] -->
     <string name="battery_suggestion_summary"></string>
 
-    <!-- Title for prevent ringing gesture screen -->
+    <!-- Title for prevent ringing gesture screen [CHAR LIMIT=60]-->
     <string name="gesture_prevent_ringing_screen_title">Prevent ringing</string>
-    <!-- Title for prevent ringing setting -->
+    <!-- Title for prevent ringing setting [CHAR LIMIT=60]-->
     <string name="gesture_prevent_ringing_title">Press Power &amp; Volume Up together to</string>
-    <!-- Title for prevent ringing setting -->
+    <!-- Title for prevent ringing setting [CHAR LIMIT=60]-->
     <string name="gesture_prevent_ringing_sound_title">Shortcut to prevent ringing</string>
     <!-- Option for prevent ringing setting -->
     <string name="prevent_ringing_option_vibrate">Vibrate</string>
@@ -10439,6 +10458,14 @@
     <!-- Summary for an item in the page listing multiple mobile service subscriptions, indicating
          that service is inactive and is tied to an eSIM profile [CHAR LIMIT=40] -->
     <string name="mobile_network_inactive_esim">Inactive eSIM</string>
+    <!-- Title of a dialog that lets a user modify the display name used for a mobile network
+         subscription in various places in the Settings app. The default name is typically just the
+          carrier name, but especially in multi-SIM configurations users may want to use a different
+           name. [CHAR LIMIT=40] -->
+    <string name="mobile_network_sim_name">SIM name</string>
+    <!-- Label on the confirmation button of a dialog that lets a user set the display name of a
+         mobile network subscription [CHAR LIMIT=20] -->
+    <string name="mobile_network_sim_name_rename">Rename</string>
 
     <!-- Title for preferred network type [CHAR LIMIT=NONE] -->
     <string name="preferred_network_mode_title">Preferred network type</string>
@@ -10546,7 +10573,7 @@
     <!-- Title for the top level Privacy Settings [CHAR LIMIT=30]-->
     <string name="privacy_dashboard_title">Privacy</string>
     <!-- Summary for the top level Privacy Settings [CHAR LIMIT=NONE]-->
-    <string name="privacy_dashboard_summary">Permissions, activity controls, data shown on screen</string>
+    <string name="privacy_dashboard_summary">Permissions, web activity, personal data</string>
 
     <!-- Label for button in contextual card for users to remove the card [CHAR LIMIT=30] -->
     <string name="contextual_card_dismiss_remove">Remove</string>
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index b3e1704..cc07ce1 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -124,12 +124,6 @@
             android:key="audio_and_captions_category"
             android:title="@string/audio_and_captions_category_title">
 
-        <Preference
-            android:key="live_caption"
-            android:title="@string/live_captions_title"
-            android:summary="@string/live_captions_summary"
-            settings:controller="com.android.settings.accessibility.LiveCaptionPreferenceController"/>
-
         <SwitchPreference
                 android:key="toggle_master_mono"
                 android:title="@string/accessibility_toggle_master_mono_title"
diff --git a/res/xml/configure_notification_settings.xml b/res/xml/configure_notification_settings.xml
index e4d948b..ca82609 100644
--- a/res/xml/configure_notification_settings.xml
+++ b/res/xml/configure_notification_settings.xml
@@ -26,6 +26,12 @@
         android:summary="@string/summary_placeholder"
         settings:searchable="false"/>
 
+    <SwitchPreference
+        android:key="hide_silent_icons"
+        android:title="@string/hide_silent_icons_title"
+        android:summary="@string/hide_silent_icons_summary"
+        settings:controller="com.android.settings.notification.SilentStatusBarPreferenceController" />
+
     <!-- Notification badging -->
     <SwitchPreference
         android:key="notification_badging"
diff --git a/res/xml/connected_devices_advanced.xml b/res/xml/connected_devices_advanced.xml
index 28e9fdc..ab8967d 100644
--- a/res/xml/connected_devices_advanced.xml
+++ b/res/xml/connected_devices_advanced.xml
@@ -44,6 +44,14 @@
         android:icon="@drawable/ic_android"
         android:order="-6"/>
 
+    <SwitchPreference
+        android:key="nfc_secure_settings"
+        android:title="@string/nfc_secure_settings_title"
+        settings:controller="com.android.settings.nfc.SecureNfcPreferenceController"
+        android:icon="@drawable/ic_nfc"
+        android:summary="@string/nfc_secure_toggle_summary"
+        android:order="-7"/>
+
     <com.android.settingslib.RestrictedPreference
         android:key="connected_device_printing"
         android:title="@string/print_settings"
diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml
index 9b43723..b9e809c 100644
--- a/res/xml/development_settings.xml
+++ b/res/xml/development_settings.xml
@@ -114,6 +114,17 @@
             android:key="quick_settings_tiles"
             android:title="@string/quick_settings_developer_tiles"
             android:fragment="com.android.settings.development.qstile.DevelopmentTileConfigFragment" />
+
+    <!-- Configure trust agent behavior -->
+    <SwitchPreference
+        android:key="security_setting_trust_agents_extend_unlock"
+        android:title="@string/trust_agents_extend_unlock_title"
+        android:summary="@string/trust_agents_extend_unlock_summary" />
+
+    <SwitchPreference
+        android:key="security_setting_trust_lost_locks_screen"
+        android:title="@string/trust_lost_locks_screen_title"
+        android:summary="@string/trust_lost_locks_screen_summary" />
     </PreferenceCategory>
 
     <PreferenceCategory
@@ -222,11 +233,6 @@
             android:summary="@string/wifi_verbose_logging_summary" />
 
         <SwitchPreference
-            android:key="wifi_connected_mac_randomization"
-            android:title="@string/wifi_connected_mac_randomization"
-            android:summary="@string/wifi_connected_mac_randomization_summary" />
-
-        <SwitchPreference
             android:key="mobile_data_always_on"
             android:title="@string/mobile_data_always_on"
             android:summary="@string/mobile_data_always_on_summary" />
diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml
index b110b46..0f4c1d3 100644
--- a/res/xml/display_settings.xml
+++ b/res/xml/display_settings.xml
@@ -141,6 +141,7 @@
         android:dialogTitle="@string/dark_ui_mode_title"
         android:entries="@array/dark_ui_mode_entries"
         android:entryValues="@array/dark_ui_mode_values"
+        settings:keywords="@string/keywords_dark_ui_mode"
         settings:controller="com.android.settings.display.DarkUIPreferenceController" />
 
     <ListPreference
diff --git a/res/xml/gestures.xml b/res/xml/gestures.xml
index 4b17bd9..b1250ec 100644
--- a/res/xml/gestures.xml
+++ b/res/xml/gestures.xml
@@ -34,12 +34,6 @@
         settings:controller="com.android.settings.gestures.WakeScreenGesturePreferenceController" />
 
     <Preference
-        android:key="gesture_wake_lock_screen_summary"
-        android:title="@string/ambient_display_wake_lock_screen_title"
-        android:fragment="com.android.settings.gestures.WakeLockScreenGestureSettings"
-        settings:controller="com.android.settings.gestures.WakeLockScreenGesturePreferenceController" />
-
-    <Preference
         android:key="gesture_swipe_down_fingerprint_input_summary"
         android:title="@string/fingerprint_swipe_for_notifications_title"
         android:fragment="com.android.settings.gestures.SwipeToNotificationSettings"
diff --git a/res/xml/location_settings.xml b/res/xml/location_settings.xml
index 72ea312..29d4048 100644
--- a/res/xml/location_settings.xml
+++ b/res/xml/location_settings.xml
@@ -28,7 +28,7 @@
 
         <PreferenceCategory
             android:key="location_advanced_settings"
-            settings:initialExpandedChildrenCount="0">
+            settings:initialExpandedChildrenCount="2">
 
             <!-- This preference category gets removed if new_recent_location_ui is disabled -->
             <Preference
diff --git a/res/xml/mobile_network_list.xml b/res/xml/mobile_network_list.xml
index 81704e5..5bffa2f 100644
--- a/res/xml/mobile_network_list.xml
+++ b/res/xml/mobile_network_list.xml
@@ -23,6 +23,8 @@
         android:key="add_more"
         android:title="@string/mobile_network_list_add_more"
         android:icon="@drawable/ic_menu_add"
-        android:order="100" />
+        android:order="100" >
+        <intent android:action="android.telephony.euicc.action.PROVISION_EMBEDDED_SUBSCRIPTION" />
+    </Preference>
 
 </PreferenceScreen>
diff --git a/res/xml/network_and_internet_v2.xml b/res/xml/network_and_internet_v2.xml
index 83499d7..fd29c41 100644
--- a/res/xml/network_and_internet_v2.xml
+++ b/res/xml/network_and_internet_v2.xml
@@ -39,7 +39,7 @@
             android:targetClass="Settings$WifiSettingsActivity" />
     </com.android.settings.widget.MasterSwitchPreference>
 
-    <com.android.settingslib.RestrictedPreference
+    <com.android.settings.widget.AddPreference
         android:key="mobile_network_list"
         android:title="@string/network_settings_title"
         android:summary="@string/summary_placeholder"
diff --git a/res/xml/screen_lock_settings.xml b/res/xml/screen_lock_settings.xml
index 29c8de9..dd4ac34 100644
--- a/res/xml/screen_lock_settings.xml
+++ b/res/xml/screen_lock_settings.xml
@@ -40,17 +40,4 @@
         android:key="power_button_instantly_locks"
         android:title="@string/lockpattern_settings_enable_power_button_instantly_locks" />
 
-    <!-- Temporarily available to evaluate extend unlock mode for SmartLock -->
-    <SwitchPreference
-        android:key="security_setting_trust_agents_extend_unlock"
-        android:title="@string/trust_agents_extend_unlock_title"
-        android:summary="@string/trust_agents_extend_unlock_summary"
-        settings:controller="com.android.settings.security.trustagent.TrustAgentsExtendUnlockPreferenceController" />
-
-    <SwitchPreference
-        android:key="security_setting_trust_lost_locks_screen"
-        android:title="@string/trust_lost_locks_screen_title"
-        android:summary="@string/trust_lost_locks_screen_summary"
-        settings:controller="com.android.settings.security.trustagent.TrustLostLocksScreenPreferenceController" />
-
 </PreferenceScreen>
diff --git a/res/xml/system_dashboard_fragment.xml b/res/xml/system_dashboard_fragment.xml
index 1ca86ab..6a753f2 100644
--- a/res/xml/system_dashboard_fragment.xml
+++ b/res/xml/system_dashboard_fragment.xml
@@ -29,17 +29,6 @@
         android:fragment="com.android.settings.gestures.GestureSettings"
         settings:controller="com.android.settings.gestures.GesturesSettingPreferenceController"/>
 
-    <!-- Backup -->
-    <Preference
-        android:key="backup_settings"
-        android:title="@string/privacy_settings_title"
-        android:summary="@string/summary_placeholder"
-        android:icon="@drawable/ic_settings_backup"
-        android:order="-60"
-        settings:controller="com.android.settings.backup.BackupSettingsActivityPreferenceController">
-        <intent android:action="android.settings.BACKUP_AND_RESET_SETTINGS" />
-    </Preference>
-
     <Preference
         android:key="reset_dashboard"
         android:title="@string/reset_dashboard_title"
diff --git a/res/xml/wake_lock_screen_gesture_settings.xml b/res/xml/wake_lock_screen_gesture_settings.xml
deleted file mode 100644
index 5491bb1..0000000
--- a/res/xml/wake_lock_screen_gesture_settings.xml
+++ /dev/null
@@ -1,37 +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.
-  -->
-
-<PreferenceScreen
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    android:key="gesture_wake_lock_screen_screen"
-    android:title="@string/ambient_display_wake_lock_screen_title">
-
-    <com.android.settings.widget.VideoPreference
-        android:key="gesture_wake_lock_screen_video"
-        app:animation="@raw/gesture_ambient_wake_lock_screen"
-        app:preview="@drawable/gesture_ambient_wake_lock_screen" />
-
-    <SwitchPreference
-        android:key="gesture_wake_lock_screen"
-        android:title="@string/ambient_display_wake_lock_screen_title"
-        android:summary="@string/ambient_display_wake_lock_screen_summary"
-        app:keywords="@string/keywords_gesture"
-        app:controller="com.android.settings.gestures.WakeLockScreenGesturePreferenceController"
-        app:allowDividerAbove="true" />
-
-</PreferenceScreen>
\ No newline at end of file
diff --git a/src/com/android/settings/RadioInfo.java b/src/com/android/settings/RadioInfo.java
index 251bfbc..db6bd9b 100644
--- a/src/com/android/settings/RadioInfo.java
+++ b/src/com/android/settings/RadioInfo.java
@@ -23,6 +23,7 @@
 import android.app.QueuedWork;
 import android.content.ComponentName;
 import android.content.Context;
+import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
@@ -40,6 +41,7 @@
 import android.os.Handler;
 import android.os.Message;
 import android.provider.Settings;
+import android.provider.Telephony;
 import android.telephony.CarrierConfigManager;
 import android.telephony.CellIdentityCdma;
 import android.telephony.CellIdentityGsm;
@@ -81,11 +83,13 @@
 import android.widget.TextView;
 
 import androidx.appcompat.app.AlertDialog;
+import androidx.appcompat.app.AlertDialog.Builder;
 
 import com.android.ims.ImsConfig;
 import com.android.ims.ImsException;
 import com.android.ims.ImsManager;
 import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.PhoneConfigurationManager;
 import com.android.internal.telephony.PhoneFactory;
 
 import java.io.IOException;
@@ -93,6 +97,7 @@
 import java.net.URL;
 import java.util.List;
 
+// TODO(b/123598192) consider to move this activity to telephony package.
 public class RadioInfo extends Activity {
     private static final String TAG = "RadioInfo";
 
@@ -214,6 +219,7 @@
     private Switch imsWfcProvisionedSwitch;
     private Switch eabProvisionedSwitch;
     private Switch cbrsDataSwitch;
+    private Switch dsdsSwitch;
     private Spinner preferredNetworkType;
     private Spinner cellInfoRefreshRateSpinner;
 
@@ -454,6 +460,23 @@
         cbrsDataSwitch = (Switch) findViewById(R.id.cbrs_data_switch);
         cbrsDataSwitch.setVisibility(isCbrsSupported() ? View.VISIBLE : View.GONE);
 
+        dsdsSwitch = findViewById(R.id.dsds_switch);
+        if (isDsdsSupported()) {
+            dsdsSwitch.setVisibility(View.VISIBLE);
+            dsdsSwitch.setOnClickListener(v -> {
+                if (mTelephonyManager.isRebootRequiredForModemConfigChange()) {
+                    // Undo the click action until user clicks the confirm dialog.
+                    dsdsSwitch.toggle();
+                    showDsdsChangeDialog();
+                } else {
+                    performDsdsSwitch();
+                }
+            });
+            dsdsSwitch.setChecked(isDsdsEnabled());
+        } else {
+            dsdsSwitch.setVisibility(View.GONE);
+        }
+
         radioPowerOnSwitch = (Switch) findViewById(R.id.radio_power);
 
         mDownlinkKbps = (TextView) findViewById(R.id.dl_kbps);
@@ -1525,5 +1548,38 @@
         }
     };
 
+    private void showDsdsChangeDialog() {
+        final AlertDialog confirmDialog = new Builder(RadioInfo.this)
+                .setTitle(R.string.dsds_dialog_title)
+                .setMessage(R.string.dsds_dialog_message)
+                .setPositiveButton(R.string.dsds_dialog_confirm, mOnDsdsDialogConfirmedListener)
+                .setNegativeButton(R.string.dsds_dialog_cancel, mOnDsdsDialogConfirmedListener)
+                .create();
+        confirmDialog.show();
+    }
 
+    private static boolean isDsdsSupported() {
+        return PhoneConfigurationManager.getInstance().getStaticPhoneCapability()
+                .logicalModemList.size() >= 2
+                && !TelephonyManager.getDefault().isMultisimCarrierRestricted();
+    }
+
+    private static boolean isDsdsEnabled() {
+        return TelephonyManager.getDefault().getPhoneCount() > 1;
+    }
+
+    private void performDsdsSwitch() {
+        mTelephonyManager.switchMultiSimConfig(dsdsSwitch.isChecked() ? 2 : 1);
+    }
+
+    DialogInterface.OnClickListener mOnDsdsDialogConfirmedListener =
+            new DialogInterface.OnClickListener() {
+        @Override
+        public void onClick(DialogInterface dialog, int which) {
+            if (which == DialogInterface.BUTTON_POSITIVE) {
+                dsdsSwitch.toggle();
+                performDsdsSwitch();
+            }
+        }
+    };
 }
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index 25ad73d..8bd81ee 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -18,6 +18,7 @@
 
 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;
@@ -51,7 +52,6 @@
 import com.android.internal.util.ArrayUtils;
 import com.android.settings.Settings.WifiSettingsActivity;
 import com.android.settings.applications.manageapplications.ManageApplications;
-import com.android.settings.backup.BackupSettingsActivity;
 import com.android.settings.core.OnActivityResultListener;
 import com.android.settings.core.SettingsBaseActivity;
 import com.android.settings.core.SubSettingLauncher;
@@ -287,7 +287,7 @@
             final Toolbar toolbar = findViewById(R.id.search_action_bar);
             setActionBar(toolbar);
             FeatureFactory.getFactory(this).getSearchFeatureProvider()
-                    .initSearchToolbar(this, toolbar);
+                    .initSearchToolbar(this, toolbar, SettingsEnums.SETTINGS_HOMEPAGE);
         }
 
         ActionBar actionBar = getActionBar();
@@ -651,11 +651,6 @@
                 showDev, isAdmin)
                 || somethingChanged;
 
-        // Enable/disable backup settings depending on whether the user is admin.
-        somethingChanged = setTileEnabled(changedList, new ComponentName(packageName,
-                BackupSettingsActivity.class.getName()), true, isAdmin)
-                || somethingChanged;
-
         somethingChanged = setTileEnabled(changedList, new ComponentName(packageName,
                         Settings.WifiDisplaySettingsActivity.class.getName()),
                 WifiDisplaySettings.isAvailable(this), isAdmin)
diff --git a/src/com/android/settings/SettingsInitialize.java b/src/com/android/settings/SettingsInitialize.java
index 784617a..5157033 100644
--- a/src/com/android/settings/SettingsInitialize.java
+++ b/src/com/android/settings/SettingsInitialize.java
@@ -21,6 +21,8 @@
 import static android.content.pm.PackageManager.GET_RESOLVED_FILTER;
 import static android.content.pm.PackageManager.MATCH_DISABLED_COMPONENTS;
 
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
 import android.content.BroadcastReceiver;
 import android.content.ComponentName;
 import android.content.Context;
@@ -51,14 +53,13 @@
     private static final String TAG = "Settings";
     private static final String PRIMARY_PROFILE_SETTING =
             "com.android.settings.PRIMARY_PROFILE_CONTROLLED";
-    private static final String SETTINGS_PACKAGE = "com.android.settings";
     private static final String WEBVIEW_IMPLEMENTATION_ACTIVITY = ".WebViewImplementation";
 
     @Override
     public void onReceive(Context context, Intent broadcast) {
         final UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
         UserInfo userInfo = um.getUserInfo(UserHandle.myUserId());
-        final PackageManager pm  = context.getPackageManager();
+        final PackageManager pm = context.getPackageManager();
         managedProfileSetup(context, pm, broadcast, userInfo);
         webviewSettingSetup(context, pm, userInfo);
         refreshExistingShortcuts(context);
@@ -91,7 +92,7 @@
                         PRIMARY_PROFILE_SETTING);
                 if (shouldForward) {
                     pm.addCrossProfileIntentFilter(info.filter, userInfo.id,
-                        userInfo.profileGroupId, PackageManager.SKIP_CURRENT_PROFILE);
+                            userInfo.profileGroupId, PackageManager.SKIP_CURRENT_PROFILE);
                 }
             }
         }
@@ -113,7 +114,8 @@
             return;
         }
         ComponentName settingsComponentName =
-            new ComponentName(SETTINGS_PACKAGE, SETTINGS_PACKAGE + WEBVIEW_IMPLEMENTATION_ACTIVITY);
+                new ComponentName(SETTINGS_PACKAGE_NAME,
+                        SETTINGS_PACKAGE_NAME + WEBVIEW_IMPLEMENTATION_ACTIVITY);
         pm.setComponentEnabledSetting(settingsComponentName,
                 userInfo.isAdmin() ?
                         PackageManager.COMPONENT_ENABLED_STATE_ENABLED :
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 79caefe..93a785f 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -111,16 +111,7 @@
      */
     public static final int UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY = 1;
 
-    /**
-     * Color spectrum to use to indicate badness.  0 is completely transparent (no data),
-     * 1 is most bad (red), the last value is least bad (green).
-     */
-    public static final int[] BADNESS_COLORS = new int[] {
-            0x00000000, 0xffc43828, 0xffe54918, 0xfff47b00,
-            0xfffabf2c, 0xff679e37, 0xff0a7f42
-    };
-
-    private static final String SETTINGS_PACKAGE_NAME = "com.android.settings";
+    public static final String SETTINGS_PACKAGE_NAME = "com.android.settings";
 
     public static final String OS_PKG = "os";
 
diff --git a/src/com/android/settings/accessibility/AccessibilitySettings.java b/src/com/android/settings/accessibility/AccessibilitySettings.java
index 5852757..ee0cb7d 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettings.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettings.java
@@ -92,7 +92,7 @@
     private static final String CATEGORY_EXPERIMENTAL = "experimental_category";
     private static final String CATEGORY_DOWNLOADED_SERVICES = "user_installed_services_category";
 
-    private static final String[] CATEGORIES = new String[]{
+    private static final String[] CATEGORIES = new String[] {
             CATEGORY_SCREEN_READER, CATEGORY_AUDIO_AND_CAPTIONS, CATEGORY_DISPLAY,
             CATEGORY_INTERACTION_CONTROL, CATEGORY_EXPERIMENTAL, CATEGORY_DOWNLOADED_SERVICES
     };
@@ -133,8 +133,7 @@
             "accessibility_content_timeout_preference_fragment";
     private static final String ACCESSIBILITY_CONTROL_TIMEOUT_PREFERENCE =
             "accessibility_control_timeout_preference_fragment";
-    private static final String LIVE_CAPTION_PREFERENCE_KEY =
-            "live_caption";
+
 
     // Extras passed to sub-fragments.
     static final String EXTRA_PREFERENCE_KEY = "preference_key";
@@ -234,11 +233,9 @@
     private Preference mDisplayDaltonizerPreferenceScreen;
     private Preference mHearingAidPreference;
     private Preference mVibrationPreferenceScreen;
-    private Preference mLiveCaptionPreference;
     private SwitchPreference mToggleInversionPreference;
     private ColorInversionPreferenceController mInversionPreferenceController;
     private AccessibilityHearingAidPreferenceController mHearingAidPreferenceController;
-    private LiveCaptionPreferenceController mLiveCaptionPreferenceController;
 
     private int mLongPressTimeoutDefault;
 
@@ -297,9 +294,6 @@
                 (context, HEARING_AID_PREFERENCE);
         mHearingAidPreferenceController.setFragmentManager(getFragmentManager());
         getLifecycle().addObserver(mHearingAidPreferenceController);
-
-        mLiveCaptionPreferenceController = new LiveCaptionPreferenceController(context,
-                LIVE_CAPTION_PREFERENCE_KEY);
     }
 
     @Override
@@ -488,10 +482,6 @@
         // Captioning.
         mCaptioningPreferenceScreen = findPreference(CAPTIONING_PREFERENCE_SCREEN);
 
-        // Live caption
-        mLiveCaptionPreference = findPreference(LIVE_CAPTION_PREFERENCE_KEY);
-        mLiveCaptionPreferenceController.displayPreference(getPreferenceScreen());
-
         // Display magnification.
         mDisplayMagnificationPreferenceScreen = findPreference(
                 DISPLAY_MAGNIFICATION_PREFERENCE_SCREEN);
@@ -727,8 +717,6 @@
 
         mHearingAidPreferenceController.updateState(mHearingAidPreference);
 
-        mLiveCaptionPreferenceController.updateState(mLiveCaptionPreference);
-
         updateFeatureSummary(Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED,
                 mCaptioningPreferenceScreen);
         updateFeatureSummary(Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED,
@@ -749,6 +737,7 @@
     }
 
     void updateAccessibilityTimeoutSummary(ContentResolver resolver, Preference pref) {
+
         String[] timeoutSummarys = getResources().getStringArray(
                 R.array.accessibility_timeout_summaries);
         int[] timeoutValues = getResources().getIntArray(
@@ -817,7 +806,7 @@
         pref.setSummary(entries[index]);
     }
 
-    @VisibleForTesting
+    @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
     void updateVibrationSummary(Preference pref) {
         final Context context = getContext();
         final Vibrator vibrator = context.getSystemService(Vibrator.class);
diff --git a/src/com/android/settings/accessibility/LiveCaptionPreferenceController.java b/src/com/android/settings/accessibility/LiveCaptionPreferenceController.java
deleted file mode 100644
index 94ee1c0..0000000
--- a/src/com/android/settings/accessibility/LiveCaptionPreferenceController.java
+++ /dev/null
@@ -1,58 +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.accessibility;
-
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
-
-import androidx.annotation.VisibleForTesting;
-import androidx.preference.Preference;
-
-import com.android.settings.core.BasePreferenceController;
-
-import java.util.List;
-
-public class LiveCaptionPreferenceController extends BasePreferenceController {
-
-    @VisibleForTesting
-    static final Intent LIVE_CAPTION_INTENT = new Intent(
-            "com.android.settings.action.live_caption");
-
-    private final PackageManager mPackageManager;
-
-    public LiveCaptionPreferenceController(Context context, String preferenceKey) {
-        super(context, preferenceKey);
-        mPackageManager = context.getPackageManager();
-    }
-
-    @Override
-    public int getAvailabilityStatus() {
-        final List<ResolveInfo> resolved =
-                mPackageManager.queryIntentActivities(LIVE_CAPTION_INTENT, 0 /* flags */);
-        return resolved != null && !resolved.isEmpty()
-                ? AVAILABLE
-                : UNSUPPORTED_ON_DEVICE;
-    }
-
-    @Override
-    public void updateState(Preference preference) {
-        super.updateState(preference);
-        preference.setIntent(LIVE_CAPTION_INTENT);
-    }
-}
diff --git a/src/com/android/settings/accounts/AccountDetailDashboardFragment.java b/src/com/android/settings/accounts/AccountDetailDashboardFragment.java
index 4b61238..ad6ecaf 100644
--- a/src/com/android/settings/accounts/AccountDetailDashboardFragment.java
+++ b/src/com/android/settings/accounts/AccountDetailDashboardFragment.java
@@ -15,11 +15,14 @@
  */
 package com.android.settings.accounts;
 
+import static android.content.Intent.EXTRA_USER;
+
 import android.accounts.Account;
 import android.accounts.AccountManager;
 import android.app.Activity;
 import android.app.settings.SettingsEnums;
 import android.content.Context;
+import android.content.Intent;
 import android.os.Bundle;
 import android.os.UserHandle;
 import android.os.UserManager;
@@ -56,6 +59,8 @@
     String mAccountType;
     private AccountSyncPreferenceController mAccountSynController;
     private RemoveAccountPreferenceController mRemoveAccountController;
+    @VisibleForTesting
+    UserHandle mUserHandle;
 
     @Override
     public void onCreate(Bundle icicle) {
@@ -63,7 +68,7 @@
         getPreferenceManager().setPreferenceComparisonCallback(null);
         Bundle args = getArguments();
         final Activity activity = getActivity();
-        UserHandle userHandle = Utils.getSecureTargetUser(activity.getActivityToken(),
+        mUserHandle = Utils.getSecureTargetUser(activity.getActivityToken(),
                 (UserManager) getSystemService(Context.USER_SERVICE), args,
                 activity.getIntent().getExtras());
         if (args != null) {
@@ -77,8 +82,8 @@
                 mAccountType = args.getString(KEY_ACCOUNT_TYPE);
             }
         }
-        mAccountSynController.init(mAccount, userHandle);
-        mRemoveAccountController.init(mAccount, userHandle);
+        mAccountSynController.init(mAccount, mUserHandle);
+        mRemoveAccountController.init(mAccount, mUserHandle);
     }
 
     @Override
@@ -154,7 +159,9 @@
         }
         final boolean display = mAccountType.equals(metadata.getString(METADATA_IA_ACCOUNT));
         if (display) {
-            tile.getIntent().putExtra(EXTRA_ACCOUNT_NAME, mAccount.name);
+            final Intent intent = tile.getIntent();
+            intent.putExtra(EXTRA_ACCOUNT_NAME, mAccount.name);
+            intent.putExtra(EXTRA_USER, mUserHandle);
         }
         return display;
     }
diff --git a/src/com/android/settings/accounts/AvatarViewMixin.java b/src/com/android/settings/accounts/AvatarViewMixin.java
index 43531b3..3ce8c0a 100644
--- a/src/com/android/settings/accounts/AvatarViewMixin.java
+++ b/src/com/android/settings/accounts/AvatarViewMixin.java
@@ -17,6 +17,7 @@
 package com.android.settings.accounts;
 
 import android.accounts.Account;
+import android.app.settings.SettingsEnums;
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.Intent;
@@ -38,6 +39,7 @@
 import com.android.settings.R;
 import com.android.settings.homepage.SettingsHomepageActivity;
 import com.android.settings.overlay.FeatureFactory;
+import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
 import com.android.settingslib.utils.ThreadUtils;
 
 import java.net.URISyntaxException;
@@ -91,6 +93,12 @@
                 return;
             }
 
+            final MetricsFeatureProvider metricsFeatureProvider = FeatureFactory.getFactory(
+                    mContext).getMetricsFeatureProvider();
+            metricsFeatureProvider.action(SettingsEnums.PAGE_UNKNOWN,
+                    SettingsEnums.CLICK_ACCOUNT_AVATAR, SettingsEnums.SETTINGS_HOMEPAGE,
+                    null /* key */, Integer.MIN_VALUE /* value */);
+
             // Here may have two different UI while start the activity.
             // It will display adding account UI when device has no any account.
             // It will display account information page when intent added the specified account.
diff --git a/src/com/android/settings/applications/RecentAppsPreferenceController.java b/src/com/android/settings/applications/RecentAppsPreferenceController.java
index c7d310e..364aeff 100644
--- a/src/com/android/settings/applications/RecentAppsPreferenceController.java
+++ b/src/com/android/settings/applications/RecentAppsPreferenceController.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.applications;
 
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
 import android.app.Application;
 import android.app.settings.SettingsEnums;
 import android.app.usage.UsageStats;
@@ -91,7 +93,7 @@
         SKIP_SYSTEM_PACKAGES.addAll(Arrays.asList(
                 "android",
                 "com.android.phone",
-                "com.android.settings",
+                SETTINGS_PACKAGE_NAME,
                 "com.android.systemui",
                 "com.android.providers.calendar",
                 "com.android.providers.media"
diff --git a/src/com/android/settings/applications/appinfo/DefaultPhoneShortcutPreferenceController.java b/src/com/android/settings/applications/appinfo/DefaultPhoneShortcutPreferenceController.java
index c968d55..c19c367 100644
--- a/src/com/android/settings/applications/appinfo/DefaultPhoneShortcutPreferenceController.java
+++ b/src/com/android/settings/applications/appinfo/DefaultPhoneShortcutPreferenceController.java
@@ -14,27 +14,15 @@
 
 package com.android.settings.applications.appinfo;
 
+import android.app.role.RoleManager;
 import android.content.Context;
 
-import com.android.settings.applications.defaultapps.DefaultPhonePreferenceController;
-
 public class DefaultPhoneShortcutPreferenceController
         extends DefaultAppShortcutPreferenceControllerBase {
 
     private static final String KEY = "default_phone_app";
 
     public DefaultPhoneShortcutPreferenceController(Context context, String packageName) {
-        super(context, KEY, packageName);
+        super(context, KEY, RoleManager.ROLE_DIALER, packageName);
     }
-
-    @Override
-    protected boolean hasAppCapability() {
-        return DefaultPhonePreferenceController.hasPhonePreference(mPackageName, mContext);
-    }
-
-    @Override
-    protected boolean isDefaultApp() {
-        return DefaultPhonePreferenceController.isPhoneDefault(mPackageName, mContext);
-    }
-
 }
diff --git a/src/com/android/settings/applications/manageapplications/ManageApplications.java b/src/com/android/settings/applications/manageapplications/ManageApplications.java
index 126cf6d..816b44a 100644
--- a/src/com/android/settings/applications/manageapplications/ManageApplications.java
+++ b/src/com/android/settings/applications/manageapplications/ManageApplications.java
@@ -185,7 +185,6 @@
     private ApplicationsAdapter mApplications;
 
     private View mLoadingContainer;
-
     private View mListContainer;
     private RecyclerView mRecyclerView;
     private SearchView mSearchView;
@@ -216,10 +215,15 @@
             LIST_TYPE_MAIN,
             LIST_TYPE_STORAGE));
 
+    @VisibleForTesting
+    View mSpinnerHeader;
+    @VisibleForTesting
+    FilterSpinnerAdapter mFilterAdapter;
+    @VisibleForTesting
+    View mContentContainer;
+
     private View mRootView;
-    private View mSpinnerHeader;
     private Spinner mFilterSpinner;
-    private FilterSpinnerAdapter mFilterAdapter;
     private IUsageStatsManager mUsageStatsManager;
     private UserManager mUserManager;
     private NotificationBackend mNotificationBackend;
@@ -326,6 +330,7 @@
             Bundle savedInstanceState) {
         mRootView = inflater.inflate(R.layout.manage_applications_apps, null);
         mLoadingContainer = mRootView.findViewById(R.id.loading_container);
+        mContentContainer = mRootView.findViewById(R.id.content_container);
         mListContainer = mRootView.findViewById(R.id.list_container);
         if (mListContainer != null) {
             // Create adapter and list view here
@@ -794,8 +799,7 @@
             }
             mFilterOptions.add(filter);
             Collections.sort(mFilterOptions);
-            mManageApplications.mSpinnerHeader.setVisibility(
-                    mFilterOptions.size() > 1 ? View.VISIBLE : View.GONE);
+            updateFilterView(mFilterOptions.size() > 1);
             notifyDataSetChanged();
             if (mFilterOptions.size() == 1) {
                 if (DEBUG) {
@@ -826,14 +830,13 @@
                         filter.getTitle()));
             }
             Collections.sort(mFilterOptions);
-            mManageApplications.mSpinnerHeader.setVisibility(
-                    mFilterOptions.size() > 1 ? View.VISIBLE : View.GONE);
+            updateFilterView(mFilterOptions.size() > 1);
             notifyDataSetChanged();
             if (mManageApplications.mFilter == filter) {
                 if (mFilterOptions.size() > 0) {
                     if (DEBUG) {
                         Log.d(TAG, "Auto selecting filter " + mFilterOptions.get(0)
-                            + mContext.getText(mFilterOptions.get(0).getTitle()));
+                                + mContext.getText(mFilterOptions.get(0).getTitle()));
                     }
                     mManageApplications.mFilterSpinner.setSelection(0);
                     mManageApplications.onItemSelected(null, null, 0, 0);
@@ -850,6 +853,26 @@
         public CharSequence getItem(int position) {
             return mContext.getText(mFilterOptions.get(position).getTitle());
         }
+
+        @VisibleForTesting
+        void updateFilterView(boolean hasFilter) {
+            // If we need to add a floating filter in this screen, we should have an extra top
+            // padding for putting floating filter view. Otherwise, the content of list will be
+            // overlapped by floating filter.
+            if (hasFilter) {
+                mManageApplications.mSpinnerHeader.setVisibility(View.VISIBLE);
+                mManageApplications.mContentContainer.setPadding(0 /* left */,
+                        mContext.getResources().getDimensionPixelSize(
+                                R.dimen.app_bar_height) /* top */,
+                        0 /* right */,
+                        0 /* bottom */);
+            } else {
+                mManageApplications.mSpinnerHeader.setVisibility(View.GONE);
+                mManageApplications.mContentContainer.setPadding(0 /* left */, 0 /* top */,
+                        0 /* right */,
+                        0 /* bottom */);
+            }
+        }
     }
 
     static class ApplicationsAdapter extends RecyclerView.Adapter<ApplicationViewHolder>
diff --git a/src/com/android/settings/backup/BackupSettingsActivityPreferenceController.java b/src/com/android/settings/backup/BackupSettingsActivityPreferenceController.java
deleted file mode 100644
index 1af80d9..0000000
--- a/src/com/android/settings/backup/BackupSettingsActivityPreferenceController.java
+++ /dev/null
@@ -1,54 +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.backup;
-
-import android.app.backup.BackupManager;
-import android.content.Context;
-import android.os.UserManager;
-
-import com.android.settings.R;
-import com.android.settings.core.BasePreferenceController;
-
-public class BackupSettingsActivityPreferenceController extends BasePreferenceController {
-    private static final String TAG = "BackupSettingActivityPC";
-
-
-    private final UserManager mUm;
-    private final BackupManager mBackupManager;
-
-    public BackupSettingsActivityPreferenceController(Context context, String key) {
-        super(context, key);
-        mUm = (UserManager) context.getSystemService(Context.USER_SERVICE);
-        mBackupManager = new BackupManager(context);
-    }
-
-    @Override
-    public int getAvailabilityStatus() {
-        return mUm.isAdminUser()
-                ? AVAILABLE_UNSEARCHABLE
-                : UNSUPPORTED_ON_DEVICE;
-    }
-
-    @Override
-    public CharSequence getSummary() {
-        final boolean backupEnabled = mBackupManager.isBackupEnabled();
-
-        return backupEnabled
-                ? mContext.getText(R.string.backup_summary_state_on)
-                : mContext.getText(R.string.backup_summary_state_off);
-    }
-}
\ No newline at end of file
diff --git a/src/com/android/settings/backup/BackupSettingsContentProvider.java b/src/com/android/settings/backup/BackupSettingsContentProvider.java
new file mode 100644
index 0000000..5c888ab
--- /dev/null
+++ b/src/com/android/settings/backup/BackupSettingsContentProvider.java
@@ -0,0 +1,78 @@
+/*
+ * 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.backup;
+
+import android.content.ContentProvider;
+import android.content.ContentValues;
+import android.content.UriMatcher;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.Bundle;
+
+import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_SUMMARY;
+
+/** Provider stores and manages user interaction feedback for homepage contextual cards. */
+public class BackupSettingsContentProvider extends ContentProvider {
+    private static final String AUTHORITY =
+        "com.android.settings.backup.BackupSettingsContentProvider";
+    private static final String SUMMARY = "summary";
+    private static final UriMatcher URI_MATCHER = new UriMatcher(UriMatcher.NO_MATCH);
+    static {
+        URI_MATCHER.addURI(AUTHORITY, SUMMARY, 1);
+    }
+
+    @Override
+    public Bundle call(String method, String uri, Bundle extras) {
+        if (!SUMMARY.equals(method)) {
+            return null;
+        }
+        Bundle bundle = new Bundle();
+        bundle.putString(META_DATA_PREFERENCE_SUMMARY,
+            new BackupSettingsHelper(getContext()).getSummary());
+        return bundle;
+    }
+
+    @Override
+    public boolean onCreate() {
+        return true;
+    }
+
+    @Override
+    public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public String getType(Uri uri) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Uri insert(Uri uri, ContentValues values) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int delete(Uri uri, String selection, String[] selectionArgs) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
+        throw new UnsupportedOperationException();
+    }
+}
diff --git a/src/com/android/settings/backup/BackupSettingsFragment.java b/src/com/android/settings/backup/BackupSettingsFragment.java
index 57c8d00..f08c8e7 100644
--- a/src/com/android/settings/backup/BackupSettingsFragment.java
+++ b/src/com/android/settings/backup/BackupSettingsFragment.java
@@ -68,7 +68,7 @@
         return controllers;
     }
 
-    // The intention is to index {@link BackupSettingsActivity} instead of the fragments,
+    // The intention is to index {@link UserBackupSettingsActivity} instead of the fragments,
     // therefore leaving this index provider empty.
     public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
             new BaseSearchIndexProvider() {
diff --git a/src/com/android/settings/backup/BackupSettingsHelper.java b/src/com/android/settings/backup/BackupSettingsHelper.java
index b35d6b2..fa77154 100644
--- a/src/com/android/settings/backup/BackupSettingsHelper.java
+++ b/src/com/android/settings/backup/BackupSettingsHelper.java
@@ -24,6 +24,7 @@
 import android.os.RemoteException;
 import android.os.ServiceManager;
 import android.os.UserHandle;
+import android.os.UserManager;
 import android.util.Log;
 
 import androidx.annotation.VisibleForTesting;
@@ -34,7 +35,7 @@
 import java.net.URISyntaxException;
 
 /**
- * Helper class for {@link BackupSettingsActivity} that interacts with {@link IBackupManager}.
+ * Helper class for {@link UserBackupSettingsActivity} that interacts with {@link IBackupManager}.
  */
 public class BackupSettingsHelper {
     private static final String TAG = "BackupSettingsHelper";
@@ -49,6 +50,24 @@
     }
 
     /**
+     * If there is only one profile, show whether the backup is on or off.
+     * Otherwise, show nothing.
+     */
+    String getSummary() {
+        UserManager userManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
+        if (userManager.getUserProfiles().size() == 1) {
+            try {
+                int resId = mBackupManager.isBackupEnabled() ? R.string.backup_summary_state_on
+                    : R.string.backup_summary_state_off;
+                return mContext.getText(resId).toString();
+            } catch (RemoteException e) {
+                Log.e(TAG, "Error getting isBackupEnabled", e);
+            }
+        }
+        return null;
+    }
+
+    /**
      * Returns an intent to launch backup settings from backup transport if the intent was provided
      * by the transport. Otherwise returns the intent to launch the default backup settings screen.
      *
diff --git a/src/com/android/settings/backup/BackupSettingsActivity.java b/src/com/android/settings/backup/UserBackupSettingsActivity.java
similarity index 84%
rename from src/com/android/settings/backup/BackupSettingsActivity.java
rename to src/com/android/settings/backup/UserBackupSettingsActivity.java
index 615dbf3..4a0b80c 100644
--- a/src/com/android/settings/backup/BackupSettingsActivity.java
+++ b/src/com/android/settings/backup/UserBackupSettingsActivity.java
@@ -20,7 +20,6 @@
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.os.Bundle;
-import android.os.UserHandle;
 import android.util.Log;
 
 import androidx.annotation.VisibleForTesting;
@@ -40,9 +39,14 @@
 /**
  * The activity used to launch the configured Backup activity or the preference screen
  * if the manufacturer provided their backup settings.
+ * Pre-Q, BackupSettingsActivity was disabled for non-system users. Therefore, for phones which
+ * upgrade to Q, BackupSettingsActivity is disabled for those users. However, we cannot simply
+ * enable it in Q since component enable can only be done by the user itself; which is not
+ * enough in Q we want it to be enabled for all profile users of the user.
+ * Therefore, as a simple workaround, we use a new class which is enabled by default.
  */
 @SearchIndexable
-public class BackupSettingsActivity extends FragmentActivity implements Indexable {
+public class UserBackupSettingsActivity extends FragmentActivity implements Indexable {
     private static final String TAG = "BackupSettingsActivity";
     private FragmentManager mFragmentManager;
 
@@ -108,29 +112,13 @@
                     data.screenTitle = context.getString(R.string.settings_label);
                     data.keywords = context.getString(R.string.keywords_backup);
                     data.intentTargetPackage = context.getPackageName();
-                    data.intentTargetClass = BackupSettingsActivity.class.getName();
+                    data.intentTargetClass = com.android.settings.backup.UserBackupSettingsActivity.class.getName();
                     data.intentAction = Intent.ACTION_MAIN;
                     data.key = BACKUP_SEARCH_INDEX_KEY;
                     result.add(data);
 
                     return result;
                 }
-
-                @Override
-                public List<String> getNonIndexableKeys(Context context) {
-                    final List<String> keys = super.getNonIndexableKeys(context);
-
-                    // For non-primary user, no backup is available, so don't show it in search
-                    // TODO: http://b/22388012
-                    if (UserHandle.myUserId() != UserHandle.USER_SYSTEM) {
-                        if (Log.isLoggable(TAG, Log.DEBUG)) {
-                            Log.d(TAG, "Not a system user, not indexing the screen");
-                        }
-                        keys.add(BACKUP_SEARCH_INDEX_KEY);
-                    }
-
-                    return keys;
-                }
             };
 
     @VisibleForTesting
diff --git a/src/com/android/settings/biometrics/BiometricEnrollActivity.java b/src/com/android/settings/biometrics/BiometricEnrollActivity.java
index ee35945..b650c6c 100644
--- a/src/com/android/settings/biometrics/BiometricEnrollActivity.java
+++ b/src/com/android/settings/biometrics/BiometricEnrollActivity.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.biometrics;
 
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
 import android.app.settings.SettingsEnums;
 import android.content.Intent;
 import android.content.pm.PackageManager;
@@ -33,8 +35,6 @@
  */
 public class BiometricEnrollActivity extends InstrumentedActivity {
 
-    private static final String SETTINGS_PACKAGE = "com.android.settings";
-
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -44,9 +44,10 @@
 
         // This logic may have to be modified on devices with multiple biometrics.
         if (pm.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)) {
-            intent.setClassName(SETTINGS_PACKAGE, FingerprintEnrollIntroduction.class.getName());
+            intent.setClassName(SETTINGS_PACKAGE_NAME,
+                    FingerprintEnrollIntroduction.class.getName());
         } else if (pm.hasSystemFeature(PackageManager.FEATURE_FACE)) {
-            intent.setClassName(SETTINGS_PACKAGE, FaceEnrollIntroduction.class.getName());
+            intent.setClassName(SETTINGS_PACKAGE_NAME, FaceEnrollIntroduction.class.getName());
         }
 
         startActivity(intent);
diff --git a/src/com/android/settings/biometrics/BiometricEnrollBase.java b/src/com/android/settings/biometrics/BiometricEnrollBase.java
index bca70d7..9c9f4fa 100644
--- a/src/com/android/settings/biometrics/BiometricEnrollBase.java
+++ b/src/com/android/settings/biometrics/BiometricEnrollBase.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.biometrics;
 
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
 import android.annotation.Nullable;
 import android.content.Intent;
 import android.content.res.Resources;
@@ -148,7 +150,7 @@
 
     protected Intent getFingerprintEnrollingIntent() {
         Intent intent = new Intent();
-        intent.setClassName("com.android.settings", FingerprintEnrollEnrolling.class.getName());
+        intent.setClassName(SETTINGS_PACKAGE_NAME, FingerprintEnrollEnrolling.class.getName());
         intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, mToken);
         if (mUserId != UserHandle.USER_NULL) {
             intent.putExtra(Intent.EXTRA_USER_ID, mUserId);
diff --git a/src/com/android/settings/biometrics/BiometricStatusPreferenceController.java b/src/com/android/settings/biometrics/BiometricStatusPreferenceController.java
index 379a02b..156d663 100644
--- a/src/com/android/settings/biometrics/BiometricStatusPreferenceController.java
+++ b/src/com/android/settings/biometrics/BiometricStatusPreferenceController.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.biometrics;
 
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
 import android.content.Context;
 import android.content.Intent;
 import android.os.UserHandle;
@@ -114,7 +116,7 @@
                 return false;
             }
             Intent intent = new Intent();
-            intent.setClassName("com.android.settings", clazz);
+            intent.setClassName(SETTINGS_PACKAGE_NAME, clazz);
             intent.putExtra(Intent.EXTRA_USER_ID, userId);
             context.startActivity(intent);
             return true;
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java b/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java
index 4c7276d..d696f2f 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java
@@ -17,6 +17,8 @@
 package com.android.settings.biometrics.fingerprint;
 
 
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
 import android.app.Activity;
 import android.app.Dialog;
 import android.app.admin.DevicePolicyManager;
@@ -460,7 +462,7 @@
             final String key = pref.getKey();
             if (KEY_FINGERPRINT_ADD.equals(key)) {
                 Intent intent = new Intent();
-                intent.setClassName("com.android.settings",
+                intent.setClassName(SETTINGS_PACKAGE_NAME,
                         FingerprintEnrollEnrolling.class.getName());
                 intent.putExtra(Intent.EXTRA_USER_ID, mUserId);
                 intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, mToken);
@@ -613,7 +615,7 @@
             if (!helper.launchConfirmationActivity(CONFIRM_REQUEST,
                     getString(R.string.security_settings_fingerprint_preference_title),
                     null, null, challenge, mUserId)) {
-                intent.setClassName("com.android.settings", ChooseLockGeneric.class.getName());
+                intent.setClassName(SETTINGS_PACKAGE_NAME, ChooseLockGeneric.class.getName());
                 intent.putExtra(ChooseLockGeneric.ChooseLockGenericFragment.MINIMUM_QUALITY_KEY,
                         DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);
                 intent.putExtra(ChooseLockGeneric.ChooseLockGenericFragment.HIDE_DISABLED_PREFS,
diff --git a/src/com/android/settings/core/FeatureFlags.java b/src/com/android/settings/core/FeatureFlags.java
index 7f14c0d..d1c2fd5 100644
--- a/src/com/android/settings/core/FeatureFlags.java
+++ b/src/com/android/settings/core/FeatureFlags.java
@@ -28,4 +28,5 @@
     public static final String NETWORK_INTERNET_V2 = "settings_network_and_internet_v2";
     public static final String WIFI_SHARING = "settings_wifi_sharing";
     public static final String SLICE_INJECTION = "settings_slice_injection";
+    public static final String MAINLINE_MODULE = "settings_mainline_module";
 }
diff --git a/src/com/android/settings/core/gateway/SettingsGateway.java b/src/com/android/settings/core/gateway/SettingsGateway.java
index 7ba3688..bb292a1 100644
--- a/src/com/android/settings/core/gateway/SettingsGateway.java
+++ b/src/com/android/settings/core/gateway/SettingsGateway.java
@@ -49,6 +49,7 @@
 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.biometrics.face.FaceSettings;
@@ -298,5 +299,6 @@
             Settings.DateTimeSettingsActivity.class.getName(),
             Settings.EnterprisePrivacySettingsActivity.class.getName(),
             Settings.MyDeviceInfoActivity.class.getName(),
+            UserBackupSettingsActivity.class.getName(),
     };
 }
diff --git a/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java b/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java
index f79cf5b..69e86cd 100644
--- a/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java
+++ b/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.dashboard;
 
+import static android.content.Intent.EXTRA_USER;
+
 import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_ICON_URI;
 import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_SUMMARY;
 import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_SUMMARY_URI;
@@ -29,6 +31,7 @@
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.Icon;
 import android.os.Bundle;
+import android.os.UserHandle;
 import android.provider.Settings;
 import android.text.TextUtils;
 import android.util.ArrayMap;
@@ -239,7 +242,14 @@
             mMetricsFeatureProvider.logDashboardStartIntent(mContext, intent, sourceMetricCategory);
             activity.startActivityForResultAsUser(intent, 0, tile.userHandle.get(0));
         } else {
-            ProfileSelectDialog.show(activity.getSupportFragmentManager(), tile);
+            final UserHandle userHandle = intent.getParcelableExtra(EXTRA_USER);
+            if (userHandle != null && tile.userHandle.contains(userHandle)) {
+                mMetricsFeatureProvider.logDashboardStartIntent(
+                    mContext, intent, sourceMetricCategory);
+                activity.startActivityForResultAsUser(intent, 0, userHandle);
+            } else {
+                ProfileSelectDialog.show(activity.getSupportFragmentManager(), tile);
+            }
         }
     }
 
diff --git a/src/com/android/settings/datetime/timezone/TimeZoneSettings.java b/src/com/android/settings/datetime/timezone/TimeZoneSettings.java
index 6f776c9..d557bf9 100644
--- a/src/com/android/settings/datetime/timezone/TimeZoneSettings.java
+++ b/src/com/android/settings/datetime/timezone/TimeZoneSettings.java
@@ -69,6 +69,7 @@
     private Locale mLocale;
     private boolean mSelectByRegion;
     private TimeZoneData mTimeZoneData;
+    private Intent mPendingZonePickerRequestResult;
 
     private String mSelectedTimeZoneId;
     private TimeZoneInfo.Formatter mTimeZoneInfoFormatter;
@@ -136,12 +137,10 @@
         switch (requestCode) {
             case REQUEST_CODE_REGION_PICKER:
             case REQUEST_CODE_ZONE_PICKER: {
-                String regionId = data.getStringExtra(RegionSearchPicker.EXTRA_RESULT_REGION_ID);
-                String tzId = data.getStringExtra(RegionZonePicker.EXTRA_RESULT_TIME_ZONE_ID);
-                // Ignore the result if user didn't change the region or time zone.
-                if (!Objects.equals(regionId, use(RegionPreferenceController.class).getRegionId())
-                        || !Objects.equals(tzId, mSelectedTimeZoneId)) {
-                    onRegionZoneChanged(regionId, tzId);
+                if (mTimeZoneData == null) {
+                    mPendingZonePickerRequestResult = data;
+                } else {
+                    onZonePickerRequestResult(mTimeZoneData, data);
                 }
                 break;
             }
@@ -166,8 +165,11 @@
             mTimeZoneData = timeZoneData;
             setupForCurrentTimeZone();
             getActivity().invalidateOptionsMenu();
+            if (mPendingZonePickerRequestResult != null) {
+                onZonePickerRequestResult(timeZoneData, mPendingZonePickerRequestResult);
+                mPendingZonePickerRequestResult = null;
+            }
         }
-
     }
 
     private void startRegionPicker() {
@@ -226,9 +228,17 @@
         updatePreferenceStates();
     }
 
-    private void onRegionZoneChanged(String regionId, String tzId) {
+    private void onZonePickerRequestResult(TimeZoneData timeZoneData, Intent data) {
+        String regionId = data.getStringExtra(RegionSearchPicker.EXTRA_RESULT_REGION_ID);
+        String tzId = data.getStringExtra(RegionZonePicker.EXTRA_RESULT_TIME_ZONE_ID);
+        // Ignore the result if user didn't change the region or time zone.
+        if (Objects.equals(regionId, use(RegionPreferenceController.class).getRegionId())
+            && Objects.equals(tzId, mSelectedTimeZoneId)) {
+            return;
+        }
+
         FilteredCountryTimeZones countryTimeZones =
-                mTimeZoneData.lookupCountryTimeZones(regionId);
+                timeZoneData.lookupCountryTimeZones(regionId);
         if (countryTimeZones == null || !countryTimeZones.getTimeZoneIds().contains(tzId)) {
             Log.e(TAG, "Unknown time zone id is selected: " + tzId);
             return;
diff --git a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
index ed6a19f..48597c6 100644
--- a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
+++ b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
@@ -429,7 +429,6 @@
         controllers.add(new CameraLaserSensorPreferenceController(context));
         controllers.add(new WifiDisplayCertificationPreferenceController(context));
         controllers.add(new WifiVerboseLoggingPreferenceController(context));
-        controllers.add(new WifiConnectedMacRandomizationPreferenceController(context));
         controllers.add(new MobileDataAlwaysOnPreferenceController(context));
         controllers.add(new TetheringHardwareAccelPreferenceController(context));
         controllers.add(new BluetoothDeviceNoNamePreferenceController(context));
@@ -498,6 +497,8 @@
                 "android.theme.customization.font"));
         controllers.add(new OverlayCategoryPreferenceController(context,
                 "android.theme.customization.adaptive_icon_shape"));
+        controllers.add(new TrustAgentsExtendUnlockPreferenceController(context));
+        controllers.add(new TrustLostLocksScreenPreferenceController(context));
         return controllers;
     }
 
diff --git a/src/com/android/settings/development/FileEncryptionPreferenceController.java b/src/com/android/settings/development/FileEncryptionPreferenceController.java
index a0628b0..8aadfb9 100644
--- a/src/com/android/settings/development/FileEncryptionPreferenceController.java
+++ b/src/com/android/settings/development/FileEncryptionPreferenceController.java
@@ -19,10 +19,9 @@
 import android.content.Context;
 import android.os.RemoteException;
 import android.os.ServiceManager;
-import android.os.SystemProperties;
 import android.os.storage.IStorageManager;
 import android.text.TextUtils;
-
+import android.sysprop.CryptoProperties;
 import androidx.annotation.VisibleForTesting;
 import androidx.preference.Preference;
 
@@ -36,9 +35,6 @@
     private static final String KEY_CONVERT_FBE = "convert_to_file_encryption";
     private static final String KEY_STORAGE_MANAGER = "mount";
 
-    @VisibleForTesting
-    static final String FILE_ENCRYPTION_PROPERTY_KEY = "ro.crypto.type";
-
     private final IStorageManager mStorageManager;
 
     public FileEncryptionPreferenceController(Context context) {
@@ -67,8 +63,7 @@
 
     @Override
     public void updateState(Preference preference) {
-        if (!TextUtils.equals("file",
-                SystemProperties.get(FILE_ENCRYPTION_PROPERTY_KEY, "none" /* default */))) {
+        if (!TextUtils.equals("file", CryptoProperties.type().orElse("none"))) {
             return;
         }
 
diff --git a/src/com/android/settings/development/TrustAgentsExtendUnlockPreferenceController.java b/src/com/android/settings/development/TrustAgentsExtendUnlockPreferenceController.java
new file mode 100644
index 0000000..0834f9b
--- /dev/null
+++ b/src/com/android/settings/development/TrustAgentsExtendUnlockPreferenceController.java
@@ -0,0 +1,58 @@
+/*
+ * 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.development;
+
+import android.content.Context;
+import android.provider.Settings;
+
+import androidx.preference.Preference;
+import androidx.preference.SwitchPreference;
+
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.development.DeveloperOptionsPreferenceController;
+
+public class TrustAgentsExtendUnlockPreferenceController extends
+        DeveloperOptionsPreferenceController implements
+                Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
+
+    private static final String KEY_TRUST_AGENTS_EXTEND_UNLOCK =
+        "security_setting_trust_agents_extend_unlock";
+
+    public TrustAgentsExtendUnlockPreferenceController(Context context) {
+        super(context);
+    }
+
+    @Override
+    public String getPreferenceKey() {
+        return KEY_TRUST_AGENTS_EXTEND_UNLOCK;
+    }
+
+    @Override
+    public boolean onPreferenceChange(Preference preference, Object newValue) {
+        final boolean isEnabled = (Boolean) newValue;
+        Settings.Secure.putInt(mContext.getContentResolver(),
+                Settings.Secure.TRUST_AGENTS_EXTEND_UNLOCK, isEnabled ? 1 : 0);
+        return true;
+    }
+
+    @Override
+    public void updateState(Preference preference) {
+        int trustAgentsExtendUnlock = Settings.Secure.getInt(mContext.getContentResolver(),
+                Settings.Secure.TRUST_AGENTS_EXTEND_UNLOCK, 0);
+        ((SwitchPreference) mPreference).setChecked(trustAgentsExtendUnlock != 0);
+    }
+}
diff --git a/src/com/android/settings/development/TrustLostLocksScreenPreferenceController.java b/src/com/android/settings/development/TrustLostLocksScreenPreferenceController.java
new file mode 100644
index 0000000..3800fd6
--- /dev/null
+++ b/src/com/android/settings/development/TrustLostLocksScreenPreferenceController.java
@@ -0,0 +1,58 @@
+/*
+ * 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.development;
+
+import android.content.Context;
+import android.provider.Settings;
+
+import androidx.preference.Preference;
+import androidx.preference.SwitchPreference;
+
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.development.DeveloperOptionsPreferenceController;
+
+public class TrustLostLocksScreenPreferenceController
+        extends DeveloperOptionsPreferenceController implements
+                Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
+
+    private static final String KEY_TRUST_LOST_LOCKS_SCREEN =
+        "security_setting_trust_lost_locks_screen";
+
+    public TrustLostLocksScreenPreferenceController(Context context) {
+        super(context);
+    }
+
+    @Override
+    public String getPreferenceKey() {
+        return KEY_TRUST_LOST_LOCKS_SCREEN;
+    }
+
+    @Override
+    public boolean onPreferenceChange(Preference preference, Object newValue) {
+        final boolean isEnabled = (Boolean) newValue;
+        Settings.Secure.putInt(mContext.getContentResolver(),
+                Settings.Secure.LOCK_SCREEN_WHEN_TRUST_LOST, isEnabled ? 1 : 0);
+        return true;
+    }
+
+    @Override
+    public void updateState(Preference preference) {
+        int lockOnTrustLost = Settings.Secure.getInt(mContext.getContentResolver(),
+                Settings.Secure.LOCK_SCREEN_WHEN_TRUST_LOST, 0);
+        ((SwitchPreference) mPreference).setChecked(lockOnTrustLost != 0);
+    }
+}
diff --git a/src/com/android/settings/development/WifiConnectedMacRandomizationPreferenceController.java b/src/com/android/settings/development/WifiConnectedMacRandomizationPreferenceController.java
deleted file mode 100644
index fed07f6..0000000
--- a/src/com/android/settings/development/WifiConnectedMacRandomizationPreferenceController.java
+++ /dev/null
@@ -1,80 +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.development;
-
-import android.content.Context;
-import android.provider.Settings;
-
-import androidx.annotation.VisibleForTesting;
-import androidx.preference.Preference;
-import androidx.preference.SwitchPreference;
-
-import com.android.settings.R;
-import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settingslib.development.DeveloperOptionsPreferenceController;
-
-public class WifiConnectedMacRandomizationPreferenceController extends
-        DeveloperOptionsPreferenceController implements Preference.OnPreferenceChangeListener,
-        PreferenceControllerMixin {
-
-    private static final String WIFI_CONNECTED_MAC_RANDOMIZATION_KEY =
-            "wifi_connected_mac_randomization";
-
-    @VisibleForTesting
-    static final int SETTING_VALUE_ON = 1;
-    @VisibleForTesting
-    static final int SETTING_VALUE_OFF = 0;
-
-    public WifiConnectedMacRandomizationPreferenceController(Context context) {
-        super(context);
-    }
-
-    @Override
-    public boolean isAvailable() {
-        return mContext.getResources().getBoolean(
-                R.bool.config_wifi_support_connected_mac_randomization);
-    }
-
-    @Override
-    public String getPreferenceKey() {
-        return WIFI_CONNECTED_MAC_RANDOMIZATION_KEY;
-    }
-
-    @Override
-    public boolean onPreferenceChange(Preference preference, Object newValue) {
-        final boolean isEnabled = (Boolean) newValue;
-        Settings.Global.putInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED,
-                isEnabled ? SETTING_VALUE_ON : SETTING_VALUE_OFF);
-        return true;
-    }
-
-    @Override
-    public void updateState(Preference preference) {
-        final int enableMode = Settings.Global.getInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, SETTING_VALUE_OFF);
-        ((SwitchPreference) mPreference).setChecked(enableMode != SETTING_VALUE_OFF);
-    }
-
-    @Override
-    protected void onDeveloperOptionsSwitchDisabled() {
-        super.onDeveloperOptionsSwitchDisabled();
-        Settings.Global.putInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, SETTING_VALUE_OFF);
-        ((SwitchPreference) mPreference).setChecked(false);
-    }
-}
diff --git a/src/com/android/settings/development/gamedriver/GameDriverEnableForAllAppsPreferenceController.java b/src/com/android/settings/development/gamedriver/GameDriverEnableForAllAppsPreferenceController.java
index 68be526..dd48f69 100644
--- a/src/com/android/settings/development/gamedriver/GameDriverEnableForAllAppsPreferenceController.java
+++ b/src/com/android/settings/development/gamedriver/GameDriverEnableForAllAppsPreferenceController.java
@@ -74,6 +74,7 @@
     public void displayPreference(PreferenceScreen screen) {
         super.displayPreference(screen);
         mPreference = screen.findPreference(getPreferenceKey());
+        mPreference.setOnPreferenceChangeListener(this);
     }
 
     @Override
@@ -98,8 +99,20 @@
 
     @Override
     public boolean onPreferenceChange(Preference preference, Object newValue) {
+        final boolean isChecked = (boolean) newValue;
+        final int gameDriver = Settings.Global.getInt(
+                mContentResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
+
+        if (isChecked && gameDriver == GAME_DRIVER_ALL_APPS) {
+            return true;
+        }
+
+        if (!isChecked && (gameDriver == GAME_DRIVER_DEFAULT || gameDriver == GAME_DRIVER_OFF)) {
+            return true;
+        }
+
         Settings.Global.putInt(mContentResolver, Settings.Global.GAME_DRIVER_ALL_APPS,
-                (boolean) newValue ? GAME_DRIVER_ALL_APPS : GAME_DRIVER_DEFAULT);
+                isChecked ? GAME_DRIVER_ALL_APPS : GAME_DRIVER_DEFAULT);
 
         return true;
     }
diff --git a/src/com/android/settings/development/gamedriver/GameDriverGlobalSwitchBarController.java b/src/com/android/settings/development/gamedriver/GameDriverGlobalSwitchBarController.java
index 125d95b..d84c28f 100644
--- a/src/com/android/settings/development/gamedriver/GameDriverGlobalSwitchBarController.java
+++ b/src/com/android/settings/development/gamedriver/GameDriverGlobalSwitchBarController.java
@@ -79,19 +79,21 @@
 
     @Override
     public boolean onSwitchToggled(boolean isChecked) {
-        if (!isChecked) {
-            Settings.Global.putInt(
-                    mContentResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_OFF);
+        final int gameDriver = Settings.Global.getInt(
+                mContentResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
+
+        if (isChecked
+                && (gameDriver == GAME_DRIVER_DEFAULT || gameDriver == GAME_DRIVER_ALL_APPS)) {
             return true;
         }
 
-        if (Settings.Global.getInt(
-                    mContentResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT)
-                != GAME_DRIVER_ALL_APPS) {
-            Settings.Global.putInt(
-                    mContentResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
+        if (!isChecked && gameDriver == GAME_DRIVER_OFF) {
+            return true;
         }
 
+        Settings.Global.putInt(mContentResolver, Settings.Global.GAME_DRIVER_ALL_APPS,
+                isChecked ? GAME_DRIVER_DEFAULT : GAME_DRIVER_OFF);
+
         return true;
     }
 
diff --git a/src/com/android/settings/deviceinfo/firmwareversion/ModuleVersionDialogController.java b/src/com/android/settings/deviceinfo/firmwareversion/ModuleVersionDialogController.java
index d6fcc38..0dc953d 100644
--- a/src/com/android/settings/deviceinfo/firmwareversion/ModuleVersionDialogController.java
+++ b/src/com/android/settings/deviceinfo/firmwareversion/ModuleVersionDialogController.java
@@ -19,9 +19,11 @@
 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;
 
@@ -48,6 +50,11 @@
      * 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)) {
diff --git a/src/com/android/settings/display/AdaptiveSleepPreferenceController.java b/src/com/android/settings/display/AdaptiveSleepPreferenceController.java
index 97bdb9e..bd9d386 100644
--- a/src/com/android/settings/display/AdaptiveSleepPreferenceController.java
+++ b/src/com/android/settings/display/AdaptiveSleepPreferenceController.java
@@ -17,7 +17,6 @@
 
 import android.content.Context;
 import android.provider.Settings;
-import android.text.TextUtils;
 
 import com.android.settings.R;
 import com.android.settings.core.TogglePreferenceController;
diff --git a/src/com/android/settings/display/NightDisplayActivationPreferenceController.java b/src/com/android/settings/display/NightDisplayActivationPreferenceController.java
index 17c16e7..1be8434 100644
--- a/src/com/android/settings/display/NightDisplayActivationPreferenceController.java
+++ b/src/com/android/settings/display/NightDisplayActivationPreferenceController.java
@@ -26,14 +26,13 @@
 import androidx.preference.Preference;
 import androidx.preference.PreferenceScreen;
 
-import com.android.internal.app.ColorDisplayController;
 import com.android.settings.R;
 import com.android.settings.core.TogglePreferenceController;
 import com.android.settingslib.widget.LayoutPreference;
 
 public class NightDisplayActivationPreferenceController extends TogglePreferenceController {
 
-    private ColorDisplayController mController;
+    private ColorDisplayManager mColorDisplayManager;
     private NightDisplayTimeFormatter mTimeFormatter;
     private Button mTurnOffButton;
     private Button mTurnOnButton;
@@ -41,14 +40,15 @@
     private final OnClickListener mListener = new OnClickListener() {
         @Override
         public void onClick(View v) {
-            mController.setActivated(!mController.isActivated());
+            mColorDisplayManager.setNightDisplayActivated(!mColorDisplayManager.isNightDisplayActivated());
             updateStateInternal();
         }
     };
 
     public NightDisplayActivationPreferenceController(Context context, String key) {
         super(context, key);
-        mController = new ColorDisplayController(context);
+
+        mColorDisplayManager = context.getSystemService(ColorDisplayManager.class);
         mTimeFormatter = new NightDisplayTimeFormatter(context);
     }
 
@@ -83,17 +83,17 @@
 
     @Override
     public boolean isChecked() {
-        return mController.isActivated();
+        return mColorDisplayManager.isNightDisplayActivated();
     }
 
     @Override
     public boolean setChecked(boolean isChecked) {
-        return mController.setActivated(isChecked);
+        return mColorDisplayManager.setNightDisplayActivated(isChecked);
     }
 
     @Override
     public CharSequence getSummary() {
-        return mTimeFormatter.getAutoModeTimeSummary(mContext, mController);
+        return mTimeFormatter.getAutoModeTimeSummary(mContext, mColorDisplayManager);
     }
 
     private void updateStateInternal() {
@@ -101,8 +101,8 @@
             return;
         }
 
-        final boolean isActivated = mController.isActivated();
-        final int autoMode = mController.getAutoMode();
+        final boolean isActivated = mColorDisplayManager.isNightDisplayActivated();
+        final int autoMode = mColorDisplayManager.getNightDisplayAutoMode();
 
         String buttonText;
         if (autoMode == ColorDisplayManager.AUTO_MODE_CUSTOM_TIME) {
@@ -110,8 +110,8 @@
                             ? R.string.night_display_activation_off_custom
                             : R.string.night_display_activation_on_custom,
                     mTimeFormatter.getFormattedTimeString(isActivated
-                            ? mController.getCustomStartTime()
-                            : mController.getCustomEndTime()));
+                            ? mColorDisplayManager.getNightDisplayCustomStartTime()
+                            : mColorDisplayManager.getNightDisplayCustomEndTime()));
         } else if (autoMode == ColorDisplayManager.AUTO_MODE_TWILIGHT) {
             buttonText = mContext.getString(isActivated
                     ? R.string.night_display_activation_off_twilight
diff --git a/src/com/android/settings/display/NightDisplayAutoModePreferenceController.java b/src/com/android/settings/display/NightDisplayAutoModePreferenceController.java
index 33e3e6f..121b062 100644
--- a/src/com/android/settings/display/NightDisplayAutoModePreferenceController.java
+++ b/src/com/android/settings/display/NightDisplayAutoModePreferenceController.java
@@ -30,11 +30,11 @@
         implements Preference.OnPreferenceChangeListener {
 
     private DropDownPreference mPreference;
-    private ColorDisplayManager mManager;
+    private ColorDisplayManager mColorDisplayManager;
 
     public NightDisplayAutoModePreferenceController(Context context, String key) {
         super(context, key);
-        mManager = context.getSystemService(ColorDisplayManager.class);
+        mColorDisplayManager = context.getSystemService(ColorDisplayManager.class);
     }
 
     @Override
@@ -63,11 +63,11 @@
 
     @Override
     public final void updateState(Preference preference) {
-        mPreference.setValue(String.valueOf(mManager.getNightDisplayAutoMode()));
+        mPreference.setValue(String.valueOf(mColorDisplayManager.getNightDisplayAutoMode()));
     }
 
     @Override
     public final boolean onPreferenceChange(Preference preference, Object newValue) {
-        return mManager.setNightDisplayAutoMode(Integer.parseInt((String) newValue));
+        return mColorDisplayManager.setNightDisplayAutoMode(Integer.parseInt((String) newValue));
     }
 }
diff --git a/src/com/android/settings/display/NightDisplayCustomEndTimePreferenceController.java b/src/com/android/settings/display/NightDisplayCustomEndTimePreferenceController.java
index b12c18a..0ebbeae 100644
--- a/src/com/android/settings/display/NightDisplayCustomEndTimePreferenceController.java
+++ b/src/com/android/settings/display/NightDisplayCustomEndTimePreferenceController.java
@@ -19,18 +19,17 @@
 import android.content.Context;
 import android.hardware.display.ColorDisplayManager;
 import androidx.preference.Preference;
-import com.android.internal.app.ColorDisplayController;
 import com.android.settings.core.BasePreferenceController;
 
 public class NightDisplayCustomEndTimePreferenceController extends BasePreferenceController {
 
-    private ColorDisplayController mController;
+    private ColorDisplayManager mColorDisplayManager;
     private NightDisplayTimeFormatter mTimeFormatter;
 
     public NightDisplayCustomEndTimePreferenceController(Context context, String key) {
         super(context, key);
 
-        mController = new ColorDisplayController(context);
+        mColorDisplayManager = context.getSystemService(ColorDisplayManager.class);
         mTimeFormatter = new NightDisplayTimeFormatter(context);
     }
 
@@ -43,8 +42,9 @@
     @Override
     public final void updateState(Preference preference) {
         preference
-                .setVisible(mController.getAutoMode() == ColorDisplayManager.AUTO_MODE_CUSTOM_TIME);
+                .setVisible(mColorDisplayManager.getNightDisplayAutoMode()
+                        == ColorDisplayManager.AUTO_MODE_CUSTOM_TIME);
         preference.setSummary(mTimeFormatter.getFormattedTimeString(
-                mController.getCustomEndTime()));
+                mColorDisplayManager.getNightDisplayCustomEndTime()));
     }
 }
diff --git a/src/com/android/settings/display/NightDisplayCustomStartTimePreferenceController.java b/src/com/android/settings/display/NightDisplayCustomStartTimePreferenceController.java
index 10fb3a1..a2a85ef 100644
--- a/src/com/android/settings/display/NightDisplayCustomStartTimePreferenceController.java
+++ b/src/com/android/settings/display/NightDisplayCustomStartTimePreferenceController.java
@@ -19,18 +19,17 @@
 import android.content.Context;
 import android.hardware.display.ColorDisplayManager;
 import androidx.preference.Preference;
-import com.android.internal.app.ColorDisplayController;
 import com.android.settings.core.BasePreferenceController;
 
 public class NightDisplayCustomStartTimePreferenceController extends BasePreferenceController {
 
-    private ColorDisplayController mController;
+    private ColorDisplayManager mColorDisplayManager;
     private NightDisplayTimeFormatter mTimeFormatter;
 
     public NightDisplayCustomStartTimePreferenceController(Context context, String key) {
         super(context, key);
 
-        mController = new ColorDisplayController(context);
+        mColorDisplayManager = context.getSystemService(ColorDisplayManager.class);
         mTimeFormatter = new NightDisplayTimeFormatter(context);
     }
 
@@ -43,8 +42,9 @@
     @Override
     public final void updateState(Preference preference) {
         preference
-                .setVisible(mController.getAutoMode() == ColorDisplayManager.AUTO_MODE_CUSTOM_TIME);
+                .setVisible(mColorDisplayManager.getNightDisplayAutoMode()
+                        == ColorDisplayManager.AUTO_MODE_CUSTOM_TIME);
         preference.setSummary(mTimeFormatter.getFormattedTimeString(
-                mController.getCustomStartTime()));
+                mColorDisplayManager.getNightDisplayCustomStartTime()));
     }
 }
diff --git a/src/com/android/settings/display/NightDisplayIntensityPreferenceController.java b/src/com/android/settings/display/NightDisplayIntensityPreferenceController.java
index 7487873..48e261e 100644
--- a/src/com/android/settings/display/NightDisplayIntensityPreferenceController.java
+++ b/src/com/android/settings/display/NightDisplayIntensityPreferenceController.java
@@ -22,26 +22,24 @@
 
 import androidx.preference.Preference;
 import androidx.preference.PreferenceScreen;
-import androidx.annotation.VisibleForTesting;
 
-import com.android.internal.app.ColorDisplayController;
 import com.android.settings.core.SliderPreferenceController;
 import com.android.settings.widget.SeekBarPreference;
 
 public class NightDisplayIntensityPreferenceController extends SliderPreferenceController {
 
-    private ColorDisplayController mController;
+    private ColorDisplayManager mColorDisplayManager;
 
     public NightDisplayIntensityPreferenceController(Context context, String key) {
         super(context, key);
-        mController = new ColorDisplayController(context);
+        mColorDisplayManager = context.getSystemService(ColorDisplayManager.class);
     }
 
     @Override
     public int getAvailabilityStatus() {
         if (!ColorDisplayManager.isNightDisplayAvailable(mContext)) {
             return UNSUPPORTED_ON_DEVICE;
-        } else if (!mController.isActivated()) {
+        } else if (!mColorDisplayManager.isNightDisplayActivated()) {
             return DISABLED_DEPENDENT_SETTING;
         }
         return AVAILABLE;
@@ -63,22 +61,22 @@
     @Override
     public final void updateState(Preference preference) {
         super.updateState(preference);
-        preference.setEnabled(mController.isActivated());
+        preference.setEnabled(mColorDisplayManager.isNightDisplayActivated());
     }
 
     @Override
     public int getSliderPosition() {
-        return convertTemperature(mController.getColorTemperature());
+        return convertTemperature(mColorDisplayManager.getNightDisplayColorTemperature());
     }
 
     @Override
     public boolean setSliderPosition(int position) {
-        return mController.setColorTemperature(convertTemperature(position));
+        return mColorDisplayManager.setNightDisplayColorTemperature(convertTemperature(position));
     }
 
     @Override
     public int getMaxSteps() {
-        return convertTemperature(mController.getMinimumColorTemperature());
+        return convertTemperature(ColorDisplayManager.getMinimumColorTemperature(mContext));
     }
 
     /**
@@ -87,6 +85,6 @@
      * adjustment status of the input.
      */
     private int convertTemperature(int temperature) {
-        return mController.getMaximumColorTemperature() - temperature;
+        return ColorDisplayManager.getMaximumColorTemperature(mContext) - temperature;
     }
 }
\ No newline at end of file
diff --git a/src/com/android/settings/display/NightDisplayPreference.java b/src/com/android/settings/display/NightDisplayPreference.java
index a84ba58..82e2596 100644
--- a/src/com/android/settings/display/NightDisplayPreference.java
+++ b/src/com/android/settings/display/NightDisplayPreference.java
@@ -15,6 +15,7 @@
 package com.android.settings.display;
 
 import android.content.Context;
+import android.hardware.display.ColorDisplayManager;
 import android.util.AttributeSet;
 
 import androidx.preference.SwitchPreference;
@@ -26,12 +27,14 @@
 public class NightDisplayPreference extends SwitchPreference
         implements ColorDisplayController.Callback {
 
+    private ColorDisplayManager mColorDisplayManager;
     private ColorDisplayController mController;
     private NightDisplayTimeFormatter mTimeFormatter;
 
     public NightDisplayPreference(Context context, AttributeSet attrs) {
         super(context, attrs);
 
+        mColorDisplayManager = context.getSystemService(ColorDisplayManager.class);
         mController = new ColorDisplayController(context);
         mTimeFormatter = new NightDisplayTimeFormatter(context);
     }
@@ -76,6 +79,6 @@
     }
 
     private void updateSummary() {
-        setSummary(mTimeFormatter.getAutoModeTimeSummary(getContext(), mController));
+        setSummary(mTimeFormatter.getAutoModeTimeSummary(getContext(), mColorDisplayManager));
     }
 }
diff --git a/src/com/android/settings/display/NightDisplayPreferenceController.java b/src/com/android/settings/display/NightDisplayPreferenceController.java
index ab0250d..6891d65 100644
--- a/src/com/android/settings/display/NightDisplayPreferenceController.java
+++ b/src/com/android/settings/display/NightDisplayPreferenceController.java
@@ -16,7 +16,6 @@
 import android.content.Context;
 import android.hardware.display.ColorDisplayManager;
 
-import com.android.internal.app.ColorDisplayController;
 import com.android.settings.R;
 import com.android.settings.core.PreferenceControllerMixin;
 import com.android.settingslib.core.AbstractPreferenceController;
@@ -37,8 +36,8 @@
         if (!isEnabled) {
             return true;
         }
-        final ColorDisplayController controller = new ColorDisplayController(context);
-        return controller.getAutoMode() != ColorDisplayManager.AUTO_MODE_DISABLED;
+        final ColorDisplayManager manager = context.getSystemService(ColorDisplayManager.class);
+        return manager.getNightDisplayAutoMode() != ColorDisplayManager.AUTO_MODE_DISABLED;
     }
 
     @Override
diff --git a/src/com/android/settings/display/NightDisplaySettings.java b/src/com/android/settings/display/NightDisplaySettings.java
index fb81a8c..4896b53 100644
--- a/src/com/android/settings/display/NightDisplaySettings.java
+++ b/src/com/android/settings/display/NightDisplaySettings.java
@@ -50,6 +50,7 @@
     private static final int DIALOG_START_TIME = 0;
     private static final int DIALOG_END_TIME = 1;
 
+    private ColorDisplayManager mColorDisplayManager;
     private ColorDisplayController mController;
 
     @Override
@@ -57,6 +58,7 @@
         super.onCreate(savedInstanceState);
 
         final Context context = getContext();
+        mColorDisplayManager = context.getSystemService(ColorDisplayManager.class);
         mController = new ColorDisplayController(context);
     }
 
@@ -93,9 +95,9 @@
         if (dialogId == DIALOG_START_TIME || dialogId == DIALOG_END_TIME) {
             final LocalTime initialTime;
             if (dialogId == DIALOG_START_TIME) {
-                initialTime = mController.getCustomStartTime();
+                initialTime = mColorDisplayManager.getNightDisplayCustomStartTime();
             } else {
-                initialTime = mController.getCustomEndTime();
+                initialTime = mColorDisplayManager.getNightDisplayCustomEndTime();
             }
 
             final Context context = getContext();
@@ -103,9 +105,9 @@
             return new TimePickerDialog(context, (view, hourOfDay, minute) -> {
                 final LocalTime time = LocalTime.of(hourOfDay, minute);
                 if (dialogId == DIALOG_START_TIME) {
-                    mController.setCustomStartTime(time);
+                    mColorDisplayManager.setNightDisplayCustomStartTime(time);
                 } else {
-                    mController.setCustomEndTime(time);
+                    mColorDisplayManager.setNightDisplayCustomEndTime(time);
                 }
             }, initialTime.getHour(), initialTime.getMinute(), use24HourFormat);
         }
diff --git a/src/com/android/settings/display/NightDisplayTimeFormatter.java b/src/com/android/settings/display/NightDisplayTimeFormatter.java
index 1b82e0a..1b5b146 100644
--- a/src/com/android/settings/display/NightDisplayTimeFormatter.java
+++ b/src/com/android/settings/display/NightDisplayTimeFormatter.java
@@ -19,7 +19,6 @@
 import android.content.Context;
 
 import android.hardware.display.ColorDisplayManager;
-import com.android.internal.app.ColorDisplayController;
 import com.android.settings.R;
 
 import java.text.DateFormat;
@@ -46,22 +45,23 @@
         return mTimeFormatter.format(c.getTime());
     }
 
-    public String getAutoModeTimeSummary(Context context, ColorDisplayController controller) {
-        final int summaryFormatResId = controller.isActivated() ? R.string.night_display_summary_on
-                : R.string.night_display_summary_off;
-        return context.getString(summaryFormatResId, getAutoModeSummary(context, controller));
+    public String getAutoModeTimeSummary(Context context, ColorDisplayManager manager) {
+        final int summaryFormatResId =
+                manager.isNightDisplayActivated() ? R.string.night_display_summary_on
+                        : R.string.night_display_summary_off;
+        return context.getString(summaryFormatResId, getAutoModeSummary(context, manager));
     }
 
-    private String getAutoModeSummary(Context context, ColorDisplayController controller) {
-        final boolean isActivated = controller.isActivated();
-        final int autoMode = controller.getAutoMode();
+    private String getAutoModeSummary(Context context, ColorDisplayManager manager) {
+        final boolean isActivated = manager.isNightDisplayActivated();
+        final int autoMode = manager.getNightDisplayAutoMode();
         if (autoMode == ColorDisplayManager.AUTO_MODE_CUSTOM_TIME) {
             if (isActivated) {
                 return context.getString(R.string.night_display_summary_on_auto_mode_custom,
-                        getFormattedTimeString(controller.getCustomEndTime()));
+                        getFormattedTimeString(manager.getNightDisplayCustomEndTime()));
             } else {
                 return context.getString(R.string.night_display_summary_off_auto_mode_custom,
-                        getFormattedTimeString(controller.getCustomStartTime()));
+                        getFormattedTimeString(manager.getNightDisplayCustomStartTime()));
             }
         } else if (autoMode == ColorDisplayManager.AUTO_MODE_TWILIGHT) {
             return context.getString(isActivated
diff --git a/src/com/android/settings/fuelgauge/BatteryCellParser.java b/src/com/android/settings/fuelgauge/BatteryCellParser.java
deleted file mode 100644
index 9139084..0000000
--- a/src/com/android/settings/fuelgauge/BatteryCellParser.java
+++ /dev/null
@@ -1,101 +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.fuelgauge;
-
-import android.os.BatteryStats.HistoryItem;
-import android.telephony.ServiceState;
-import android.util.SparseIntArray;
-
-import com.android.settings.Utils;
-import com.android.settings.fuelgauge.BatteryActiveView.BatteryActiveProvider;
-
-public class BatteryCellParser implements BatteryInfo.BatteryDataParser, BatteryActiveProvider {
-
-    private final SparseIntArray mData = new SparseIntArray();
-
-    private int mLastValue;
-    private long mLength;
-    private long mLastTime;
-
-    protected int getValue(HistoryItem rec) {
-        int bin;
-        if (((rec.states & HistoryItem.STATE_PHONE_STATE_MASK)
-                >> HistoryItem.STATE_PHONE_STATE_SHIFT)
-                == ServiceState.STATE_POWER_OFF) {
-            bin = 0;
-        } else if ((rec.states & HistoryItem.STATE_PHONE_SCANNING_FLAG) != 0) {
-            bin = 1;
-        } else {
-            bin = (rec.states & HistoryItem.STATE_PHONE_SIGNAL_STRENGTH_MASK)
-                    >> HistoryItem.STATE_PHONE_SIGNAL_STRENGTH_SHIFT;
-            bin += 2;
-        }
-        return bin;
-    }
-
-    @Override
-    public void onParsingStarted(long startTime, long endTime) {
-        mLength = endTime - startTime;
-    }
-
-    @Override
-    public void onDataPoint(long time, HistoryItem record) {
-        int value = getValue(record);
-        if (value != mLastValue) {
-            mData.put((int) time, value);
-            mLastValue = value;
-        }
-        mLastTime = time;
-    }
-
-    @Override
-    public void onDataGap() {
-        if (mLastValue != 0) {
-            mData.put((int) mLastTime, 0);
-            mLastValue = 0;
-        }
-    }
-
-    @Override
-    public void onParsingDone() {
-        if (mLastValue != 0) {
-            mData.put((int) mLastTime, 0);
-            mLastValue = 0;
-        }
-    }
-
-    @Override
-    public long getPeriod() {
-        return mLength;
-    }
-
-    @Override
-    public boolean hasData() {
-        return mData.size() > 1;
-    }
-
-    @Override
-    public SparseIntArray getColorArray() {
-        SparseIntArray ret = new SparseIntArray();
-        for (int i = 0; i < mData.size(); i++) {
-            ret.put(mData.keyAt(i), getColor(mData.valueAt(i)));
-        }
-        return ret;
-    }
-
-    private int getColor(int i) {
-        return Utils.BADNESS_COLORS[i];
-    }
-}
diff --git a/src/com/android/settings/fuelgauge/batterytip/detectors/HighUsageDetector.java b/src/com/android/settings/fuelgauge/batterytip/detectors/HighUsageDetector.java
index 13ba5f6..02af00c 100644
--- a/src/com/android/settings/fuelgauge/batterytip/detectors/HighUsageDetector.java
+++ b/src/com/android/settings/fuelgauge/batterytip/detectors/HighUsageDetector.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.fuelgauge.batterytip.detectors;
 
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
 import android.content.Context;
 import android.os.BatteryStats;
 import android.text.format.DateUtils;
@@ -91,7 +93,7 @@
                 // When in test mode, add an app if necessary
                 if (mPolicy.testHighUsageTip && mHighUsageAppList.isEmpty()) {
                     mHighUsageAppList.add(new AppInfo.Builder()
-                            .setPackageName("com.android.settings")
+                            .setPackageName(SETTINGS_PACKAGE_NAME)
                             .setScreenOnTimeMs(TimeUnit.HOURS.toMillis(3))
                             .build());
                 }
diff --git a/src/com/android/settings/fuelgauge/batterytip/detectors/RestrictAppDetector.java b/src/com/android/settings/fuelgauge/batterytip/detectors/RestrictAppDetector.java
index 63bb977..70ae0ec 100644
--- a/src/com/android/settings/fuelgauge/batterytip/detectors/RestrictAppDetector.java
+++ b/src/com/android/settings/fuelgauge/batterytip/detectors/RestrictAppDetector.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.fuelgauge.batterytip.detectors;
 
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
 import android.content.Context;
 
 import androidx.annotation.VisibleForTesting;
@@ -87,7 +89,7 @@
     private BatteryTip getFakeData() {
         final List<AppInfo> highUsageApps = new ArrayList<>();
         highUsageApps.add(new AppInfo.Builder()
-                .setPackageName("com.android.settings")
+                .setPackageName(SETTINGS_PACKAGE_NAME)
                 .build());
         return new RestrictAppTip(BatteryTip.StateType.NEW, highUsageApps);
     }
diff --git a/src/com/android/settings/gestures/WakeLockScreenGesturePreferenceController.java b/src/com/android/settings/gestures/WakeLockScreenGesturePreferenceController.java
deleted file mode 100644
index 2b61ec8..0000000
--- a/src/com/android/settings/gestures/WakeLockScreenGesturePreferenceController.java
+++ /dev/null
@@ -1,96 +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.gestures;
-
-import static android.provider.Settings.Secure.DOZE_WAKE_LOCK_SCREEN_GESTURE;
-
-import android.annotation.UserIdInt;
-import android.content.Context;
-import android.os.UserHandle;
-import android.provider.Settings;
-import android.text.TextUtils;
-
-import com.android.internal.hardware.AmbientDisplayConfiguration;
-
-public class WakeLockScreenGesturePreferenceController extends GesturePreferenceController {
-
-    private static final int ON = 1;
-    private static final int OFF = 0;
-
-    private static final String PREF_KEY_VIDEO = "gesture_wake_lock_screen_video";
-    private final String mWakeLockScreenPrefKey;
-
-    private AmbientDisplayConfiguration mAmbientConfig;
-    @UserIdInt
-    private final int mUserId;
-
-    public WakeLockScreenGesturePreferenceController(Context context, String key) {
-        super(context, key);
-        mUserId = UserHandle.myUserId();
-        mWakeLockScreenPrefKey = key;
-    }
-
-    public WakeLockScreenGesturePreferenceController
-        setConfig(AmbientDisplayConfiguration config) {
-        mAmbientConfig = config;
-        return this;
-    }
-
-    @Override
-    public int getAvailabilityStatus() {
-        // No hardware support for this Gesture
-        if (!getAmbientConfig().wakeScreenGestureAvailable()) {
-            return UNSUPPORTED_ON_DEVICE;
-        }
-
-        return AVAILABLE;
-    }
-
-    @Override
-    public boolean isSliceable() {
-        return TextUtils.equals(getPreferenceKey(), "gesture_wake_lock_screen");
-    }
-
-    @Override
-    protected String getVideoPrefKey() {
-        return PREF_KEY_VIDEO;
-    }
-
-    @Override
-    public boolean isChecked() {
-        return getAmbientConfig().wakeLockScreenGestureEnabled(mUserId);
-    }
-
-    @Override
-    public String getPreferenceKey() {
-        return mWakeLockScreenPrefKey;
-    }
-
-    @Override
-    public boolean setChecked(boolean isChecked) {
-        return Settings.Secure.putInt(mContext.getContentResolver(), DOZE_WAKE_LOCK_SCREEN_GESTURE,
-                isChecked ? ON : OFF);
-    }
-
-    private AmbientDisplayConfiguration getAmbientConfig() {
-        if (mAmbientConfig == null) {
-            mAmbientConfig = new AmbientDisplayConfiguration(mContext);
-        }
-
-        return mAmbientConfig;
-    }
-}
diff --git a/src/com/android/settings/gestures/WakeLockScreenGestureSettings.java b/src/com/android/settings/gestures/WakeLockScreenGestureSettings.java
deleted file mode 100644
index 0fbdaa1..0000000
--- a/src/com/android/settings/gestures/WakeLockScreenGestureSettings.java
+++ /dev/null
@@ -1,81 +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.gestures;
-
-import android.app.settings.SettingsEnums;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.provider.SearchIndexableResource;
-
-import com.android.internal.hardware.AmbientDisplayConfiguration;
-import com.android.settings.R;
-import com.android.settings.dashboard.DashboardFragment;
-import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider;
-import com.android.settings.overlay.FeatureFactory;
-import com.android.settings.search.BaseSearchIndexProvider;
-import com.android.settingslib.search.SearchIndexable;
-
-import java.util.Arrays;
-import java.util.List;
-
-@SearchIndexable
-public class WakeLockScreenGestureSettings extends DashboardFragment {
-
-    private static final String TAG = "WakeLockScreenGestureSettings";
-
-    public static final String PREF_KEY_SUGGESTION_COMPLETE =
-            "pref_wake_lock_screen_gesture_suggestion_complete";
-
-    @Override
-    public void onAttach(Context context) {
-        super.onAttach(context);
-        SuggestionFeatureProvider suggestionFeatureProvider = FeatureFactory.getFactory(context)
-                .getSuggestionFeatureProvider(context);
-        SharedPreferences prefs = suggestionFeatureProvider.getSharedPrefs(context);
-        prefs.edit().putBoolean(PREF_KEY_SUGGESTION_COMPLETE, true).apply();
-
-        use(WakeLockScreenGesturePreferenceController.class)
-            .setConfig(new AmbientDisplayConfiguration(context));
-    }
-
-    @Override
-    public int getMetricsCategory() {
-        return SettingsEnums.SETTINGS_GESTURE_WAKE_LOCK_SCREEN;
-    }
-
-    @Override
-    protected String getLogTag() {
-        return TAG;
-    }
-
-    @Override
-    protected int getPreferenceScreenResId() {
-        return R.xml.wake_lock_screen_gesture_settings;
-    }
-
-    public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
-            new BaseSearchIndexProvider() {
-                @Override
-                public List<SearchIndexableResource> getXmlResourcesToIndex(
-                        Context context, boolean enabled) {
-                    final SearchIndexableResource sir = new SearchIndexableResource(context);
-                    sir.xmlResId = R.xml.wake_lock_screen_gesture_settings;
-                    return Arrays.asList(sir);
-                }
-            };
-
-}
diff --git a/src/com/android/settings/gestures/WakeScreenGesturePreferenceController.java b/src/com/android/settings/gestures/WakeScreenGesturePreferenceController.java
index 2c7bed2..a43fad1 100644
--- a/src/com/android/settings/gestures/WakeScreenGesturePreferenceController.java
+++ b/src/com/android/settings/gestures/WakeScreenGesturePreferenceController.java
@@ -26,6 +26,8 @@
 
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.hardware.AmbientDisplayConfiguration;
+import com.android.settings.aware.AwareFeatureProvider;
+import com.android.settings.overlay.FeatureFactory;
 
 public class WakeScreenGesturePreferenceController extends GesturePreferenceController {
 
@@ -34,6 +36,7 @@
 
     private static final String PREF_KEY_VIDEO = "gesture_wake_screen_video";
 
+    private final AwareFeatureProvider mFeatureProvider;
     private AmbientDisplayConfiguration mAmbientConfig;
     @UserIdInt
     private final int mUserId;
@@ -41,16 +44,16 @@
     public WakeScreenGesturePreferenceController(Context context, String key) {
         super(context, key);
         mUserId = UserHandle.myUserId();
+        mFeatureProvider = FeatureFactory.getFactory(context).getAwareFeatureProvider();
     }
 
     @Override
     public int getAvailabilityStatus() {
-        // No hardware support for Wake Screen Gesture
-        if (!getAmbientConfig().wakeScreenGestureAvailable()) {
+        if (!getAmbientConfig().wakeScreenGestureAvailable()
+                || !mFeatureProvider.isSupported(mContext)) {
             return UNSUPPORTED_ON_DEVICE;
         }
-
-        return AVAILABLE;
+        return mFeatureProvider.isEnabled(mContext) ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
     }
 
     @Override
diff --git a/src/com/android/settings/homepage/SettingsHomepageActivity.java b/src/com/android/settings/homepage/SettingsHomepageActivity.java
index 9acda68..a2e3a9c 100644
--- a/src/com/android/settings/homepage/SettingsHomepageActivity.java
+++ b/src/com/android/settings/homepage/SettingsHomepageActivity.java
@@ -16,6 +16,7 @@
 
 package com.android.settings.homepage;
 
+import android.app.settings.SettingsEnums;
 import android.content.Intent;
 import android.os.Bundle;
 import android.util.FeatureFlagUtils;
@@ -23,6 +24,7 @@
 import android.widget.ImageView;
 import android.widget.Toolbar;
 
+import androidx.annotation.VisibleForTesting;
 import androidx.fragment.app.Fragment;
 import androidx.fragment.app.FragmentManager;
 import androidx.fragment.app.FragmentTransaction;
@@ -50,10 +52,11 @@
 
         updateWindowProperties();
         setContentView(R.layout.settings_homepage_container);
+        setHomepageContainerPaddingTop();
 
         final Toolbar toolbar = findViewById(R.id.search_action_bar);
         FeatureFactory.getFactory(this).getSearchFeatureProvider()
-                .initSearchToolbar(this /* activity */, toolbar);
+                .initSearchToolbar(this /* activity */, toolbar, SettingsEnums.SETTINGS_HOMEPAGE);
 
         final ImageView avatarView = findViewById(R.id.account_avatar);
         final AvatarViewMixin avatarViewMixin = new AvatarViewMixin(this, avatarView);
@@ -86,4 +89,19 @@
 
         getWindow().setStatusBarColor(getResources().getColor(R.color.homepage_status_bar_color));
     }
+
+    @VisibleForTesting
+    void setHomepageContainerPaddingTop() {
+        final View view = this.findViewById(R.id.homepage_container);
+
+        final int statusBarHeight = getResources().getDimensionPixelSize(
+                com.android.internal.R.dimen.status_bar_height);
+        final int searchBarHeight = getResources().getDimensionPixelSize(R.dimen.search_bar_height);
+        final int searchBarMargin = getResources().getDimensionPixelSize(R.dimen.search_bar_margin);
+
+        // The top padding is the height of status bar + height of action bar(48dp) + top/bottom
+        // margins(16dp)
+        final int paddingTop = statusBarHeight + searchBarHeight + searchBarMargin * 2;
+        view.setPadding(0 /* left */, paddingTop, 0 /* right */, 0 /* bottom */);
+    }
 }
\ No newline at end of file
diff --git a/src/com/android/settings/homepage/contextualcards/legacysuggestion/LegacySuggestionContextualCardController.java b/src/com/android/settings/homepage/contextualcards/legacysuggestion/LegacySuggestionContextualCardController.java
index bbcebbe..3b0b46d 100644
--- a/src/com/android/settings/homepage/contextualcards/legacysuggestion/LegacySuggestionContextualCardController.java
+++ b/src/com/android/settings/homepage/contextualcards/legacysuggestion/LegacySuggestionContextualCardController.java
@@ -128,8 +128,10 @@
                 return;
             }
             final List<Suggestion> suggestions = mSuggestionController.getSuggestions();
-            Log.d(TAG, "Loaded suggests: "
-                    + suggestions == null ? "null" : String.valueOf(suggestions.size()));
+            final String suggestionCount = suggestions == null
+                    ? "null"
+                    : String.valueOf(suggestions.size());
+            Log.d(TAG, "Loaded suggests: " + suggestionCount);
 
             final List<ContextualCard> cards = new ArrayList<>();
             if (suggestions != null) {
diff --git a/src/com/android/settings/inputmethod/UserDictionarySettings.java b/src/com/android/settings/inputmethod/UserDictionarySettings.java
index eccfb3c..c8fb625 100644
--- a/src/com/android/settings/inputmethod/UserDictionarySettings.java
+++ b/src/com/android/settings/inputmethod/UserDictionarySettings.java
@@ -154,7 +154,7 @@
     public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
         MenuItem actionItem =
                 menu.add(0, OPTIONS_MENU_ADD, 0, R.string.user_dict_settings_add_menu_title)
-                        .setIcon(R.drawable.ic_menu_add_white);
+                        .setIcon(R.drawable.ic_menu_add);
         actionItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM |
                 MenuItem.SHOW_AS_ACTION_WITH_TEXT);
     }
diff --git a/src/com/android/settings/location/AppLocationPermissionPreferenceController.java b/src/com/android/settings/location/AppLocationPermissionPreferenceController.java
index 1fd1986..43a6a9b 100644
--- a/src/com/android/settings/location/AppLocationPermissionPreferenceController.java
+++ b/src/com/android/settings/location/AppLocationPermissionPreferenceController.java
@@ -76,7 +76,7 @@
         PermissionControllerManager permController =
                 mContext.getSystemService(PermissionControllerManager.class);
         permController.countPermissionApps(
-                Arrays.asList(ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION), false, false,
+                Arrays.asList(ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION), 0,
                 (numApps) -> {
                     mNumTotal = numApps;
                     if (loadingInProgress.decrementAndGet() == 0) {
@@ -85,7 +85,8 @@
                 }, null);
 
         permController.countPermissionApps(
-                Collections.singletonList(ACCESS_BACKGROUND_LOCATION), true, false,
+                Collections.singletonList(ACCESS_BACKGROUND_LOCATION),
+                PermissionControllerManager.COUNT_ONLY_WHEN_GRANTED,
                 (numApps) -> {
                     mNumBackground = numApps;
                     if (loadingInProgress.decrementAndGet() == 0) {
diff --git a/src/com/android/settings/location/LocationEnabler.java b/src/com/android/settings/location/LocationEnabler.java
index e1bdf16..db53973 100644
--- a/src/com/android/settings/location/LocationEnabler.java
+++ b/src/com/android/settings/location/LocationEnabler.java
@@ -15,9 +15,7 @@
 
 import static com.android.settingslib.RestrictedLockUtilsInternal.checkIfRestrictionEnforced;
 import static com.android.settingslib.Utils.updateLocationEnabled;
-import static com.android.settingslib.Utils.updateLocationMode;
 
-import android.app.ActivityManager;
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
@@ -125,26 +123,6 @@
         refreshLocationMode();
     }
 
-    void setLocationMode(int mode) {
-        final int currentMode = Settings.Secure.getInt(mContext.getContentResolver(),
-                Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF);
-        if (isRestricted()) {
-            // Location toggling disabled by user restriction. Read the current location mode to
-            // update the location master switch.
-            if (Log.isLoggable(TAG, Log.INFO)) {
-                Log.i(TAG, "Restricted user, not setting location mode");
-            }
-            if (mListener != null) {
-                mListener.onLocationModeChanged(currentMode, true);
-            }
-            return;
-        }
-
-        updateLocationMode(mContext, currentMode, mode, ActivityManager.getCurrentUser(),
-                Settings.Secure.LOCATION_CHANGER_SYSTEM_SETTINGS);
-        refreshLocationMode();
-    }
-
     boolean isEnabled(int mode) {
         return mode != Settings.Secure.LOCATION_MODE_OFF && !isRestricted();
     }
diff --git a/src/com/android/settings/location/RecentLocationAccessPreferenceController.java b/src/com/android/settings/location/RecentLocationAccessPreferenceController.java
index 3adc489..214dcd5 100644
--- a/src/com/android/settings/location/RecentLocationAccessPreferenceController.java
+++ b/src/com/android/settings/location/RecentLocationAccessPreferenceController.java
@@ -18,6 +18,7 @@
 import android.Manifest;
 import android.content.Context;
 import android.content.Intent;
+import android.provider.DeviceConfig;
 import android.view.View;
 
 import androidx.annotation.VisibleForTesting;
@@ -60,7 +61,9 @@
 
     @Override
     public boolean isAvailable() {
-        return true;
+        return Boolean.parseBoolean(
+                DeviceConfig.getProperty(DeviceConfig.Privacy.NAMESPACE,
+                        DeviceConfig.Privacy.PROPERTY_PERMISSIONS_HUB_ENABLED));
     }
 
     @Override
diff --git a/src/com/android/settings/location/TopLevelLocationPreferenceController.java b/src/com/android/settings/location/TopLevelLocationPreferenceController.java
index 6d7789f..2a7a3d7 100644
--- a/src/com/android/settings/location/TopLevelLocationPreferenceController.java
+++ b/src/com/android/settings/location/TopLevelLocationPreferenceController.java
@@ -71,7 +71,7 @@
             return;
         }
         mContext.getSystemService(PermissionControllerManager.class).countPermissionApps(
-                Arrays.asList(ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION), false, false,
+                Arrays.asList(ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION), 0,
                 (numApps) -> {
                     setLocationAppCount(numApps);
                 }, null);
diff --git a/src/com/android/settings/network/ApnSettings.java b/src/com/android/settings/network/ApnSettings.java
index 174257b..c397600 100755
--- a/src/com/android/settings/network/ApnSettings.java
+++ b/src/com/android/settings/network/ApnSettings.java
@@ -351,7 +351,7 @@
             if (mAllowAddingApns) {
                 menu.add(0, MENU_NEW, 0,
                         getResources().getString(R.string.menu_new))
-                        .setIcon(R.drawable.ic_menu_add_white)
+                        .setIcon(R.drawable.ic_menu_add)
                         .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
             }
             menu.add(0, MENU_RESTORE, 0,
diff --git a/src/com/android/settings/network/MobileNetworkSummaryController.java b/src/com/android/settings/network/MobileNetworkSummaryController.java
index cc15676..fff1fea 100644
--- a/src/com/android/settings/network/MobileNetworkSummaryController.java
+++ b/src/com/android/settings/network/MobileNetworkSummaryController.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.network;
 
+import static android.telephony.TelephonyManager.MultiSimVariants.UNKNOWN;
+
 import static androidx.lifecycle.Lifecycle.Event.ON_PAUSE;
 import static androidx.lifecycle.Lifecycle.Event.ON_RESUME;
 
@@ -23,6 +25,15 @@
 import android.content.Intent;
 import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
+import android.telephony.euicc.EuiccManager;
+
+import com.android.settings.R;
+import com.android.settings.network.telephony.MobileNetworkActivity;
+import com.android.settings.widget.AddPreference;
+import com.android.settingslib.core.AbstractPreferenceController;
+
+import java.util.List;
 
 import androidx.lifecycle.Lifecycle;
 import androidx.lifecycle.LifecycleObserver;
@@ -30,12 +41,6 @@
 import androidx.preference.Preference;
 import androidx.preference.PreferenceScreen;
 
-import com.android.settings.R;
-import com.android.settings.network.telephony.MobileNetworkActivity;
-import com.android.settingslib.core.AbstractPreferenceController;
-
-import java.util.List;
-
 public class MobileNetworkSummaryController extends AbstractPreferenceController implements
         SubscriptionsChangeListener.SubscriptionsChangeListenerClient, LifecycleObserver {
     private static final String TAG = "MobileNetSummaryCtlr";
@@ -44,7 +49,8 @@
 
     private SubscriptionManager mSubscriptionManager;
     private SubscriptionsChangeListener mChangeListener;
-    private PreferenceScreen mScreen;
+    private TelephonyManager mTelephonyMgr;
+    private AddPreference mPreference;
 
     /**
      * This controls the summary text and click behavior of the "Mobile network" item on the
@@ -64,6 +70,7 @@
     public MobileNetworkSummaryController(Context context, Lifecycle lifecycle) {
         super(context);
         mSubscriptionManager = context.getSystemService(SubscriptionManager.class);
+        mTelephonyMgr = mContext.getSystemService(TelephonyManager.class);
         mChangeListener = new SubscriptionsChangeListener(context, this);
         lifecycle.addObserver(this);
     }
@@ -82,7 +89,7 @@
     @Override
     public void displayPreference(PreferenceScreen screen) {
         super.displayPreference(screen);
-        mScreen = screen;
+        mPreference = screen.findPreference(getPreferenceKey());
     }
 
     @Override
@@ -100,29 +107,51 @@
         }
     }
 
-    private void update() {
-        if (mScreen != null) {
-            final Preference preference = mScreen.findPreference(getPreferenceKey());
-            refreshSummary(preference);
-            final List<SubscriptionInfo> subs = SubscriptionUtil.getAvailableSubscriptions(
-                    mSubscriptionManager);
+    private void startAddSimFlow() {
+        final Intent intent = new Intent(EuiccManager.ACTION_PROVISION_EMBEDDED_SUBSCRIPTION);
+        mContext.startActivity(intent);
+    }
 
-            preference.setOnPreferenceClickListener(null);
-            preference.setFragment(null);
-            if (subs.size() == 0) {
-                preference.setOnPreferenceClickListener((Preference pref) -> {
-                    // TODO(asargent) - need to get correct intent to fire here
-                    return true;
-                });
-            } else if (subs.size() == 1) {
-                preference.setOnPreferenceClickListener((Preference pref) -> {
-                    final Intent intent = new Intent(mContext, MobileNetworkActivity.class);
-                    mContext.startActivity(intent);
-                    return true;
-                });
+    private boolean shouldEnableAddButton() {
+        // The add button should only show up if the device is in multi-sim mode.
+        return mTelephonyMgr.getMultiSimConfiguration() != UNKNOWN;
+    }
+
+    private void update() {
+        if (mPreference == null) {
+            return;
+        }
+        final boolean enableAddButton = shouldEnableAddButton();
+        refreshSummary(mPreference);
+        if (!enableAddButton) {
+            mPreference.setOnAddClickListener(null);
+        } else {
+            mPreference.setOnAddClickListener(p -> {
+                startAddSimFlow();
+            });
+        }
+        final List<SubscriptionInfo> subs = SubscriptionUtil.getAvailableSubscriptions(
+                mSubscriptionManager);
+        mPreference.setOnPreferenceClickListener(null);
+        mPreference.setFragment(null);
+        mPreference.setEnabled(true);
+        if (subs.isEmpty()) {
+            if (enableAddButton) {
+                mPreference.setEnabled(false);
             } else {
-                preference.setFragment(MobileNetworkListFragment.class.getCanonicalName());
+                mPreference.setOnPreferenceClickListener((Preference pref) -> {
+                    startAddSimFlow();
+                    return true;
+                });
             }
+        } else if (subs.size() == 1) {
+            mPreference.setOnPreferenceClickListener((Preference pref) -> {
+                final Intent intent = new Intent(mContext, MobileNetworkActivity.class);
+                mContext.startActivity(intent);
+                return true;
+            });
+        } else {
+            mPreference.setFragment(MobileNetworkListFragment.class.getCanonicalName());
         }
     }
 
@@ -142,6 +171,7 @@
 
     @Override
     public void onSubscriptionsChanged() {
+        refreshSummary(mPreference);
         update();
     }
 }
diff --git a/src/com/android/settings/network/telephony/MobileNetworkActivity.java b/src/com/android/settings/network/telephony/MobileNetworkActivity.java
index a5f011c..821b1e1e 100644
--- a/src/com/android/settings/network/telephony/MobileNetworkActivity.java
+++ b/src/com/android/settings/network/telephony/MobileNetworkActivity.java
@@ -97,13 +97,6 @@
             actionBar.setDisplayHomeAsUpEnabled(true);
         }
 
-        // Set the title to the name of the subscription. If we don't have subscription info, the
-        // title will just default to the label for this activity that's already specified in
-        // AndroidManifest.xml.
-        final SubscriptionInfo subscription = getSubscription();
-        if (subscription != null) {
-            setTitle(subscription.getDisplayName());
-        }
         updateSubscriptions(savedInstanceState);
     }
 
@@ -136,6 +129,14 @@
 
     @VisibleForTesting
     void updateSubscriptions(Bundle savedInstanceState) {
+        // Set the title to the name of the subscription. If we don't have subscription info, the
+        // title will just default to the label for this activity that's already specified in
+        // AndroidManifest.xml.
+        final SubscriptionInfo subscription = getSubscription();
+        if (subscription != null) {
+            setTitle(subscription.getDisplayName());
+        }
+
         mSubscriptionInfos = mSubscriptionManager.getActiveSubscriptionInfoList(true);
 
         if (!FeatureFlagPersistent.isEnabled(this, FeatureFlags.NETWORK_INTERNET_V2)) {
diff --git a/src/com/android/settings/network/telephony/MobileNetworkSettings.java b/src/com/android/settings/network/telephony/MobileNetworkSettings.java
index 5201586..a4156f5 100644
--- a/src/com/android/settings/network/telephony/MobileNetworkSettings.java
+++ b/src/com/android/settings/network/telephony/MobileNetworkSettings.java
@@ -28,9 +28,9 @@
 import android.telephony.TelephonyManager;
 import android.text.TextUtils;
 import android.util.Log;
-
-import androidx.annotation.VisibleForTesting;
-import androidx.preference.Preference;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
 
 import com.android.internal.telephony.TelephonyIntents;
 import com.android.settings.R;
@@ -52,6 +52,9 @@
 import java.util.Arrays;
 import java.util.List;
 
+import androidx.annotation.VisibleForTesting;
+import androidx.preference.Preference;
+
 @SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
 public class MobileNetworkSettings extends RestrictedDashboardFragment {
 
@@ -219,6 +222,31 @@
         }
     }
 
+    @Override
+    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+        if (FeatureFlagPersistent.isEnabled(getContext(), FeatureFlags.NETWORK_INTERNET_V2) &&
+                mSubId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+            final MenuItem item = menu.add(Menu.NONE, R.id.edit_sim_name, Menu.NONE,
+                    R.string.mobile_network_sim_name);
+            item.setIcon(com.android.internal.R.drawable.ic_mode_edit);
+            item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
+        }
+        super.onCreateOptionsMenu(menu, inflater);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem menuItem) {
+        if (FeatureFlagPersistent.isEnabled(getContext(), FeatureFlags.NETWORK_INTERNET_V2) &&
+                mSubId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+            if (menuItem.getItemId() == R.id.edit_sim_name) {
+                RenameMobileNetworkDialogFragment.newInstance(mSubId).show(
+                        getFragmentManager(), RenameMobileNetworkDialogFragment.TAG);
+                return true;
+            }
+        }
+        return super.onOptionsItemSelected(menuItem);
+    }
+
     public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
             new BaseSearchIndexProvider() {
                 @Override
diff --git a/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragment.java b/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragment.java
new file mode 100644
index 0000000..488f930
--- /dev/null
+++ b/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragment.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.network.telephony;
+
+import android.app.Dialog;
+import android.app.settings.SettingsEnums;
+import android.content.Context;
+import android.os.Bundle;
+import android.telephony.ServiceState;
+import android.telephony.SubscriptionInfo;
+import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
+import android.text.BidiFormatter;
+import android.text.TextDirectionHeuristics;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.TextView;
+
+import com.android.settings.R;
+import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
+import com.android.settingslib.DeviceInfoUtils;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.annotation.VisibleForTesting;
+import androidx.appcompat.app.AlertDialog;
+
+/** A dialog allowing the display name of a mobile network subscription to be changed */
+public class RenameMobileNetworkDialogFragment extends InstrumentedDialogFragment {
+    public static final String TAG ="RenameMobileNetwork";
+
+    private static final String KEY_SUBSCRIPTION_ID = "subscription_id";
+
+    private TelephonyManager mTelephonyManager;
+    private SubscriptionManager mSubscriptionManager;
+    private int mSubId;
+    private EditText mNameView;
+
+    public static RenameMobileNetworkDialogFragment newInstance(int subscriptionId) {
+        final Bundle args = new Bundle(1);
+        args.putInt(KEY_SUBSCRIPTION_ID, subscriptionId);
+        final RenameMobileNetworkDialogFragment fragment = new RenameMobileNetworkDialogFragment();
+        fragment.setArguments(args);
+        return fragment;
+    }
+
+    @VisibleForTesting
+    protected TelephonyManager getTelephonyManager(Context context) {
+        return context.getSystemService(TelephonyManager.class);
+    }
+
+    @VisibleForTesting
+    protected SubscriptionManager getSubscriptionManager(Context context) {
+        return context.getSystemService(SubscriptionManager.class);
+    }
+
+    @VisibleForTesting
+    protected EditText getNameView() {
+        return mNameView;
+    }
+
+    @Override
+    public void onAttach(Context context) {
+        super.onAttach(context);
+        mTelephonyManager = getTelephonyManager(context);
+        mSubscriptionManager = getSubscriptionManager(context);
+        mSubId = getArguments().getInt(KEY_SUBSCRIPTION_ID);
+    }
+
+    @NonNull
+    @Override
+    public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
+        final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+        final LayoutInflater layoutInflater = builder.getContext().getSystemService(
+                LayoutInflater.class);
+        final View view = layoutInflater.inflate(R.layout.dialog_mobile_network_rename, null);
+        populateView(view);
+        builder.setTitle(R.string.mobile_network_sim_name)
+                .setView(view)
+                .setPositiveButton(R.string.mobile_network_sim_name_rename, (dialog, which) -> {
+                    SubscriptionInfo currentInfo = mSubscriptionManager.getActiveSubscriptionInfo(
+                            mSubId);
+                    String newName = mNameView.getText().toString();
+                    if (currentInfo != null && !currentInfo.getDisplayName().equals(newName)) {
+                        mSubscriptionManager.setDisplayName(newName, mSubId);
+                    }
+                })
+                .setNegativeButton(android.R.string.cancel, null);
+        return builder.create();
+    }
+
+    @VisibleForTesting
+    protected void populateView(View view) {
+        mNameView = (EditText) view.findViewById(R.id.edittext);
+        final SubscriptionInfo info = mSubscriptionManager.getActiveSubscriptionInfo(mSubId);
+        if (info == null) {
+            Log.w(TAG, "got null SubscriptionInfo for mSubId:" + mSubId);
+            return;
+        }
+        final CharSequence displayName = info.getDisplayName();
+        mNameView.setText(displayName);
+        if (!TextUtils.isEmpty(displayName)) {
+            mNameView.setSelection(displayName.length());
+        }
+
+        final TextView operatorName = view.findViewById(R.id.operator_name_value);
+        final ServiceState serviceState = mTelephonyManager.getServiceStateForSubscriber(mSubId);
+        operatorName.setText(serviceState.getOperatorAlphaLong());
+
+        final TextView phoneNumber = view.findViewById(R.id.number_value);
+        final String formattedNumber = DeviceInfoUtils.getFormattedPhoneNumber(getContext(), info);
+        phoneNumber.setText(BidiFormatter.getInstance().unicodeWrap(formattedNumber,
+                TextDirectionHeuristics.LTR));
+    }
+
+    @Override
+    public int getMetricsCategory() {
+        return SettingsEnums.MOBILE_NETWORK_RENAME_DIALOG;
+    }
+}
diff --git a/src/com/android/settings/nfc/AndroidBeamEnabler.java b/src/com/android/settings/nfc/AndroidBeamEnabler.java
index 4dda2fd..31ef702 100644
--- a/src/com/android/settings/nfc/AndroidBeamEnabler.java
+++ b/src/com/android/settings/nfc/AndroidBeamEnabler.java
@@ -53,7 +53,7 @@
         switch (newState) {
             case NfcAdapter.STATE_OFF:
                 mPreference.setEnabled(false);
-                mPreference.setSummary(R.string.android_beam_disabled_summary);
+                mPreference.setSummary(R.string.nfc_disabled_summary);
                 break;
             case NfcAdapter.STATE_ON:
                 if (mBeamDisallowedBySystem) {
diff --git a/src/com/android/settings/nfc/SecureNfcEnabler.java b/src/com/android/settings/nfc/SecureNfcEnabler.java
new file mode 100644
index 0000000..065dc8b
--- /dev/null
+++ b/src/com/android/settings/nfc/SecureNfcEnabler.java
@@ -0,0 +1,60 @@
+/*
+ * 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.nfc;
+
+import android.content.Context;
+import android.nfc.NfcAdapter;
+import android.provider.Settings;
+
+import androidx.annotation.VisibleForTesting;
+import androidx.preference.SwitchPreference;
+
+import com.android.settings.R;
+
+/**
+ * SecureNfcEnabler is a helper to manage the Secure Nfc on/off checkbox preference
+ * It turns on/off Secure NFC and ensures the summary of the preference reflects
+ * the current state.
+ */
+public class SecureNfcEnabler extends BaseNfcEnabler {
+    private final SwitchPreference mPreference;
+
+    public SecureNfcEnabler(Context context, SwitchPreference preference) {
+        super(context);
+        mPreference = preference;
+    }
+
+    @Override
+    protected void handleNfcStateChanged(int newState) {
+        switch (newState) {
+            case NfcAdapter.STATE_OFF:
+                mPreference.setSummary(R.string.nfc_disabled_summary);
+                mPreference.setEnabled(false);
+                break;
+            case NfcAdapter.STATE_ON:
+                mPreference.setChecked(mPreference.isEnabled());
+                mPreference.setEnabled(true);
+                break;
+            case NfcAdapter.STATE_TURNING_ON:
+                mPreference.setEnabled(false);
+                break;
+            case NfcAdapter.STATE_TURNING_OFF:
+                mPreference.setEnabled(false);
+                break;
+        }
+    }
+}
diff --git a/src/com/android/settings/nfc/SecureNfcPreferenceController.java b/src/com/android/settings/nfc/SecureNfcPreferenceController.java
new file mode 100644
index 0000000..2c23672
--- /dev/null
+++ b/src/com/android/settings/nfc/SecureNfcPreferenceController.java
@@ -0,0 +1,99 @@
+/*
+ * 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.nfc;
+
+import android.content.Context;
+import android.nfc.NfcAdapter;
+import android.os.SystemProperties;
+
+import androidx.preference.PreferenceScreen;
+import androidx.preference.SwitchPreference;
+
+import com.android.settings.core.TogglePreferenceController;
+import com.android.settingslib.core.lifecycle.LifecycleObserver;
+import com.android.settingslib.core.lifecycle.events.OnPause;
+import com.android.settingslib.core.lifecycle.events.OnResume;
+
+public class SecureNfcPreferenceController extends TogglePreferenceController
+        implements LifecycleObserver, OnResume, OnPause {
+
+    public static final String KEY_TOGGLE_NFC = "nfc_secure_setting";
+    private final NfcAdapter mNfcAdapter;
+    private SecureNfcEnabler mSecureNfcEnabler;
+
+    public SecureNfcPreferenceController(Context context, String key) {
+        super(context, key);
+        mNfcAdapter = NfcAdapter.getDefaultAdapter(context);
+    }
+
+    @Override
+    public void displayPreference(PreferenceScreen screen) {
+        super.displayPreference(screen);
+        if (!isAvailable()) {
+            mSecureNfcEnabler = null;
+            return;
+        }
+
+        final SwitchPreference switchPreference =
+                (SwitchPreference) screen.findPreference(getPreferenceKey());
+
+        mSecureNfcEnabler = new SecureNfcEnabler(mContext, switchPreference);
+    }
+
+    @Override
+    public boolean isChecked() {
+        return mNfcAdapter.isNfcSecureEnabled();
+    }
+
+    @Override
+    public boolean setChecked(boolean isChecked) {
+        return mNfcAdapter.setNfcSecure(isChecked);
+    }
+
+    @Override
+    @AvailabilityStatus
+    public int getAvailabilityStatus() {
+        if (mNfcAdapter == null) {
+            return UNSUPPORTED_ON_DEVICE;
+        }
+        return mNfcAdapter.deviceSupportsNfcSecure() ? AVAILABLE
+            : UNSUPPORTED_ON_DEVICE;
+    }
+
+    @Override
+    public boolean hasAsyncUpdate() {
+        return true;
+    }
+
+    @Override
+    public boolean isSliceable() {
+        return true;
+    }
+
+    @Override
+    public void onResume() {
+        if (mSecureNfcEnabler != null) {
+            mSecureNfcEnabler.resume();
+        }
+    }
+
+    @Override
+    public void onPause() {
+        if (mSecureNfcEnabler != null) {
+            mSecureNfcEnabler.pause();
+        }
+    }
+}
diff --git a/src/com/android/settings/notification/NotificationBackend.java b/src/com/android/settings/notification/NotificationBackend.java
index a2be3ea..ec56369 100644
--- a/src/com/android/settings/notification/NotificationBackend.java
+++ b/src/com/android/settings/notification/NotificationBackend.java
@@ -300,6 +300,23 @@
         }
     }
 
+    public boolean shouldHideSilentStatusBarIcons(Context context) {
+        try {
+            return sINM.shouldHideSilentStatusIcons(context.getPackageName());
+        } catch (Exception e) {
+            Log.w(TAG, "Error calling NoMan", e);
+            return false;
+        }
+    }
+
+    public void setHideSilentStatusIcons(boolean hide) {
+        try {
+            sINM.setHideSilentStatusIcons(hide);
+        } catch (Exception e) {
+            Log.w(TAG, "Error calling NoMan", e);
+        }
+    }
+
     protected void recordAggregatedUsageEvents(Context context, AppRow appRow) {
         long now = System.currentTimeMillis();
         long startTime = now - (DateUtils.DAY_IN_MILLIS * DAYS_TO_CHECK);
diff --git a/src/com/android/settings/notification/OWNERS b/src/com/android/settings/notification/OWNERS
index 0d73685..edf266e 100644
--- a/src/com/android/settings/notification/OWNERS
+++ b/src/com/android/settings/notification/OWNERS
@@ -1,4 +1,4 @@
 # Default reviewers for this and subdirectories.
 asc@google.com
-dsandler@google.com
+dsandler@android.com
 juliacr@google.com
\ No newline at end of file
diff --git a/src/com/android/settings/notification/SilentStatusBarPreferenceController.java b/src/com/android/settings/notification/SilentStatusBarPreferenceController.java
new file mode 100644
index 0000000..5bf943a
--- /dev/null
+++ b/src/com/android/settings/notification/SilentStatusBarPreferenceController.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.notification;
+
+import static android.provider.Settings.Secure.NOTIFICATION_NEW_INTERRUPTION_MODEL;
+
+import android.content.Context;
+import android.os.UserHandle;
+import android.provider.Settings;
+
+import com.android.settings.core.TogglePreferenceController;
+
+import com.google.common.annotations.VisibleForTesting;
+
+public class SilentStatusBarPreferenceController extends TogglePreferenceController {
+
+    private static final String KEY = "hide_silent_icons";
+    private static final int MY_USER_ID = UserHandle.myUserId();
+    private NotificationBackend mBackend;
+
+    public SilentStatusBarPreferenceController(Context context) {
+        super(context, KEY);
+        mBackend = new NotificationBackend();
+    }
+
+    @VisibleForTesting
+    void setBackend(NotificationBackend backend) {
+        mBackend = backend;
+    }
+
+    @Override
+    public boolean isChecked() {
+        return mBackend.shouldHideSilentStatusBarIcons(mContext);
+    }
+
+    @Override
+    public boolean setChecked(boolean isChecked) {
+        mBackend.setHideSilentStatusIcons(isChecked);
+        return true;
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return Settings.Secure.getInt(
+                mContext.getContentResolver(), NOTIFICATION_NEW_INTERRUPTION_MODEL, 1) != 0
+                ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
+    }
+
+}
+
+
diff --git a/src/com/android/settings/notification/VibrateWhenRingPreferenceController.java b/src/com/android/settings/notification/VibrateWhenRingPreferenceController.java
index ae111b2..f1ce0af 100644
--- a/src/com/android/settings/notification/VibrateWhenRingPreferenceController.java
+++ b/src/com/android/settings/notification/VibrateWhenRingPreferenceController.java
@@ -23,6 +23,7 @@
 import android.database.ContentObserver;
 import android.net.Uri;
 import android.os.Handler;
+import android.provider.DeviceConfig;
 import android.provider.Settings;
 import android.text.TextUtils;
 
@@ -62,7 +63,11 @@
     @Override
     @AvailabilityStatus
     public int getAvailabilityStatus() {
-        return Utils.isVoiceCapable(mContext) ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
+        // If ramping ringer is enabled then this setting will be injected
+        // with additional options.
+        return Utils.isVoiceCapable(mContext) && !isRampingRingerEnabled()
+            ? AVAILABLE
+            : UNSUPPORTED_ON_DEVICE;
     }
 
     @Override
@@ -123,4 +128,19 @@
             }
         }
     }
+
+    private boolean isRampingRingerEnabled() {
+        String enableRampingRinger = DeviceConfig.getProperty(
+            DeviceConfig.Telephony.NAMESPACE,
+            DeviceConfig.Telephony.RAMPING_RINGER_ENABLED);
+        if (enableRampingRinger == null) {
+            return false;
+        }
+        try {
+            return Boolean.valueOf(enableRampingRinger);
+        } catch (Exception e) {
+            return false;
+        }
+    }
+
 }
diff --git a/src/com/android/settings/password/BiometricFragment.java b/src/com/android/settings/password/BiometricFragment.java
index 3809a4a..7a685ab 100644
--- a/src/com/android/settings/password/BiometricFragment.java
+++ b/src/com/android/settings/password/BiometricFragment.java
@@ -125,7 +125,8 @@
             .setUseDefaultTitle() // use default title if title is null/empty
             .setSubtitle(mBundle.getString(BiometricPrompt.KEY_SUBTITLE))
             .setDescription(mBundle.getString(BiometricPrompt.KEY_DESCRIPTION))
-            .setRequireConfirmation(mBundle.getBoolean(BiometricPrompt.KEY_REQUIRE_CONFIRMATION))
+            .setRequireConfirmation(
+                    mBundle.getBoolean(BiometricPrompt.KEY_REQUIRE_CONFIRMATION, true))
             .setNegativeButton(getResources().getString(
                     R.string.confirm_device_credential_use_alternate_method),
                     mClientExecutor, mNegativeButtonListener)
diff --git a/src/com/android/settings/password/ChooseLockSettingsHelper.java b/src/com/android/settings/password/ChooseLockSettingsHelper.java
index 32e8eaf..00e0bcd 100644
--- a/src/com/android/settings/password/ChooseLockSettingsHelper.java
+++ b/src/com/android/settings/password/ChooseLockSettingsHelper.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.password;
 
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
 import android.annotation.Nullable;
 import android.app.Activity;
 import android.app.KeyguardManager;
@@ -408,7 +410,7 @@
         if (extras != null) {
             intent.putExtras(extras);
         }
-        intent.setClassName(ConfirmDeviceCredentialBaseFragment.PACKAGE, activityClass.getName());
+        intent.setClassName(SETTINGS_PACKAGE_NAME, activityClass.getName());
         if (external) {
             intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
             if (mFragment != null) {
diff --git a/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java b/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
index 3fa2f6a..db0935d 100644
--- a/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
+++ b/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
@@ -17,6 +17,8 @@
 
 package com.android.settings.password;
 
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
 import android.app.Activity;
 import android.app.KeyguardManager;
 import android.app.admin.DevicePolicyManager;
@@ -62,7 +64,7 @@
 
     public static Intent createIntent(CharSequence title, CharSequence details) {
         Intent intent = new Intent();
-        intent.setClassName("com.android.settings",
+        intent.setClassName(SETTINGS_PACKAGE_NAME,
                 ConfirmDeviceCredentialActivity.class.getName());
         intent.putExtra(KeyguardManager.EXTRA_TITLE, title);
         intent.putExtra(KeyguardManager.EXTRA_DESCRIPTION, details);
@@ -71,7 +73,7 @@
 
     public static Intent createIntent(CharSequence title, CharSequence details, long challenge) {
         Intent intent = new Intent();
-        intent.setClassName("com.android.settings",
+        intent.setClassName(SETTINGS_PACKAGE_NAME,
                 ConfirmDeviceCredentialActivity.class.getName());
         intent.putExtra(KeyguardManager.EXTRA_TITLE, title);
         intent.putExtra(KeyguardManager.EXTRA_DESCRIPTION, details);
diff --git a/src/com/android/settings/password/ConfirmDeviceCredentialBaseFragment.java b/src/com/android/settings/password/ConfirmDeviceCredentialBaseFragment.java
index e14ec81..bb953a1 100644
--- a/src/com/android/settings/password/ConfirmDeviceCredentialBaseFragment.java
+++ b/src/com/android/settings/password/ConfirmDeviceCredentialBaseFragment.java
@@ -17,6 +17,8 @@
 // TODO (b/35202196): move this class out of the root of the package.
 package com.android.settings.password;
 
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
 import android.annotation.Nullable;
 import android.app.Dialog;
 import android.app.KeyguardManager;
@@ -55,17 +57,16 @@
  */
 public abstract class ConfirmDeviceCredentialBaseFragment extends InstrumentedFragment {
 
-    public static final String PACKAGE = "com.android.settings";
-    public static final String TITLE_TEXT = PACKAGE + ".ConfirmCredentials.title";
-    public static final String HEADER_TEXT = PACKAGE + ".ConfirmCredentials.header";
-    public static final String DETAILS_TEXT = PACKAGE + ".ConfirmCredentials.details";
-    public static final String DARK_THEME = PACKAGE + ".ConfirmCredentials.darkTheme";
+    public static final String TITLE_TEXT = SETTINGS_PACKAGE_NAME + ".ConfirmCredentials.title";
+    public static final String HEADER_TEXT = SETTINGS_PACKAGE_NAME + ".ConfirmCredentials.header";
+    public static final String DETAILS_TEXT = SETTINGS_PACKAGE_NAME + ".ConfirmCredentials.details";
+    public static final String DARK_THEME = SETTINGS_PACKAGE_NAME + ".ConfirmCredentials.darkTheme";
     public static final String SHOW_CANCEL_BUTTON =
-            PACKAGE + ".ConfirmCredentials.showCancelButton";
+            SETTINGS_PACKAGE_NAME + ".ConfirmCredentials.showCancelButton";
     public static final String SHOW_WHEN_LOCKED =
-            PACKAGE + ".ConfirmCredentials.showWhenLocked";
+            SETTINGS_PACKAGE_NAME + ".ConfirmCredentials.showWhenLocked";
     public static final String USE_FADE_ANIMATION =
-            PACKAGE + ".ConfirmCredentials.useFadeAnimation";
+            SETTINGS_PACKAGE_NAME + ".ConfirmCredentials.useFadeAnimation";
 
     protected static final int USER_TYPE_PRIMARY = 1;
     protected static final int USER_TYPE_MANAGED_PROFILE = 2;
diff --git a/src/com/android/settings/password/PasswordUtils.java b/src/com/android/settings/password/PasswordUtils.java
index 5f118cf..2300b98 100644
--- a/src/com/android/settings/password/PasswordUtils.java
+++ b/src/com/android/settings/password/PasswordUtils.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.password;
 
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
 import android.annotation.Nullable;
 import android.app.ActivityManager;
 import android.app.IActivityManager;
@@ -32,8 +34,6 @@
 
     private static final String TAG = "Settings";
 
-    private static final String SETTINGS_PACKAGE_NAME = "com.android.settings";
-
     /**
      * Returns whether the uid which the activity with {@code activityToken} is launched from has
      * been granted the {@code permission}.
diff --git a/src/com/android/settings/privacy/PermissionBarChartPreferenceController.java b/src/com/android/settings/privacy/PermissionBarChartPreferenceController.java
index e43140f..8b9b595 100644
--- a/src/com/android/settings/privacy/PermissionBarChartPreferenceController.java
+++ b/src/com/android/settings/privacy/PermissionBarChartPreferenceController.java
@@ -26,6 +26,7 @@
 import android.graphics.drawable.Drawable;
 import android.permission.PermissionControllerManager;
 import android.permission.RuntimePermissionUsageInfo;
+import android.provider.DeviceConfig;
 import android.util.Log;
 import android.view.View;
 
@@ -38,6 +39,7 @@
 import com.android.settingslib.widget.BarChartInfo;
 import com.android.settingslib.widget.BarChartPreference;
 import com.android.settingslib.widget.BarViewInfo;
+import com.android.settingslib.Utils;
 
 import java.util.ArrayList;
 import java.util.Comparator;
@@ -62,7 +64,10 @@
 
     @Override
     public int getAvailabilityStatus() {
-        return AVAILABLE_UNSEARCHABLE;
+        return Boolean.parseBoolean(
+                DeviceConfig.getProperty(DeviceConfig.Privacy.NAMESPACE,
+                        DeviceConfig.Privacy.PROPERTY_PERMISSIONS_HUB_ENABLED)) ?
+                AVAILABLE_UNSEARCHABLE : UNSUPPORTED_ON_DEVICE;
     }
 
     @Override
@@ -143,6 +148,7 @@
         try {
             icon = mPackageManager.getPermissionGroupInfo(permissionGroup.toString(), 0)
                     .loadIcon(mPackageManager);
+            icon.setTintList(Utils.getColorAttr(mContext, android.R.attr.textColorSecondary));
         } catch (PackageManager.NameNotFoundException e) {
             Log.w(TAG, "Cannot find group icon for " + permissionGroup, e);
         }
diff --git a/src/com/android/settings/search/SearchFeatureProvider.java b/src/com/android/settings/search/SearchFeatureProvider.java
index b98936e..dcb4acc 100644
--- a/src/com/android/settings/search/SearchFeatureProvider.java
+++ b/src/com/android/settings/search/SearchFeatureProvider.java
@@ -25,7 +25,6 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.PackageManager;
-import android.provider.Settings;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.Toolbar;
@@ -40,7 +39,6 @@
  */
 public interface SearchFeatureProvider {
 
-    Intent SEARCH_UI_INTENT = new Intent(Settings.ACTION_APP_SEARCH_SETTINGS);
     int REQUEST_CODE = 0;
 
     /**
@@ -64,7 +62,7 @@
     /**
      * Initializes the search toolbar.
      */
-    default void initSearchToolbar(Activity activity, Toolbar toolbar) {
+    default void initSearchToolbar(Activity activity, Toolbar toolbar, int pageId) {
         if (activity == null || toolbar == null) {
             return;
         }
@@ -87,9 +85,8 @@
         navView.setBackground(null);
 
         toolbar.setOnClickListener(tb -> {
-            final Intent intent = SEARCH_UI_INTENT;
-            intent.setPackage(getSettingsIntelligencePkgName(activity));
             final Context context = activity.getApplicationContext();
+            final Intent intent = buildSearchIntent(context, pageId);
 
             if (activity.getPackageManager().queryIntentActivities(intent,
                     PackageManager.MATCH_DEFAULT_ONLY).isEmpty()) {
@@ -97,10 +94,12 @@
             }
 
             FeatureFactory.getFactory(context).getSlicesFeatureProvider()
-                    .indexSliceDataAsync(activity.getApplicationContext());
+                    .indexSliceDataAsync(context);
             FeatureFactory.getFactory(context).getMetricsFeatureProvider()
                     .action(context, SettingsEnums.ACTION_SEARCH_RESULTS);
             activity.startActivityForResult(intent, REQUEST_CODE);
         });
     }
+
+    Intent buildSearchIntent(Context context, int pageId);
 }
diff --git a/src/com/android/settings/search/SearchFeatureProviderImpl.java b/src/com/android/settings/search/SearchFeatureProviderImpl.java
index a5a8777..63bf420 100644
--- a/src/com/android/settings/search/SearchFeatureProviderImpl.java
+++ b/src/com/android/settings/search/SearchFeatureProviderImpl.java
@@ -19,6 +19,9 @@
 
 import android.content.ComponentName;
 import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.provider.Settings;
 import android.text.TextUtils;
 
 import com.android.settingslib.search.SearchIndexableResources;
@@ -59,7 +62,22 @@
         return mSearchIndexableResources;
     }
 
+    @Override
+    public Intent buildSearchIntent(Context context, int pageId) {
+        return new Intent(Settings.ACTION_APP_SEARCH_SETTINGS)
+                .setPackage(getSettingsIntelligencePkgName(context))
+                .putExtra(Intent.EXTRA_REFERRER, buildReferrer(context, pageId));
+    }
+
     protected boolean isSignatureWhitelisted(Context context, String callerPackage) {
         return false;
     }
+
+    private static Uri buildReferrer(Context context, int pageId) {
+        return new Uri.Builder()
+                .scheme("android-app")
+                .authority(context.getPackageName())
+                .path(String.valueOf(pageId))
+                .build();
+    }
 }
diff --git a/src/com/android/settings/search/actionbar/SearchMenuController.java b/src/com/android/settings/search/actionbar/SearchMenuController.java
index 2f1c270..af7141e 100644
--- a/src/com/android/settings/search/actionbar/SearchMenuController.java
+++ b/src/com/android/settings/search/actionbar/SearchMenuController.java
@@ -30,11 +30,10 @@
 
 import com.android.settings.R;
 import com.android.settings.Utils;
+import com.android.settings.core.InstrumentedFragment;
+import com.android.settings.core.InstrumentedPreferenceFragment;
 import com.android.settings.overlay.FeatureFactory;
-import com.android.settings.search.SearchFeatureProvider;
 import com.android.settingslib.core.lifecycle.LifecycleObserver;
-import com.android.settingslib.core.lifecycle.ObservableFragment;
-import com.android.settingslib.core.lifecycle.ObservablePreferenceFragment;
 import com.android.settingslib.core.lifecycle.events.OnCreateOptionsMenu;
 
 public class SearchMenuController implements LifecycleObserver, OnCreateOptionsMenu {
@@ -42,17 +41,21 @@
     public static final String NEED_SEARCH_ICON_IN_ACTION_BAR = "need_search_icon_in_action_bar";
 
     private final Fragment mHost;
+    private final int mPageId;
 
-    public static void init(@NonNull ObservablePreferenceFragment host) {
-        host.getSettingsLifecycle().addObserver(new SearchMenuController(host));
+    public static void init(@NonNull InstrumentedPreferenceFragment host) {
+        host.getSettingsLifecycle().addObserver(
+                new SearchMenuController(host, host.getMetricsCategory()));
     }
 
-    public static void init(@NonNull ObservableFragment host) {
-        host.getSettingsLifecycle().addObserver(new SearchMenuController(host));
+    public static void init(@NonNull InstrumentedFragment host) {
+        host.getSettingsLifecycle().addObserver(
+                new SearchMenuController(host, host.getMetricsCategory()));
     }
 
-    private SearchMenuController(@NonNull Fragment host) {
+    private SearchMenuController(@NonNull Fragment host, int pageId) {
         mHost = host;
+        mPageId = pageId;
     }
 
     @Override
@@ -79,8 +82,9 @@
         searchItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
 
         searchItem.setOnMenuItemClickListener(target -> {
-            final Intent intent = SearchFeatureProvider.SEARCH_UI_INTENT;
-            intent.setPackage(SettingsIntelligencePkgName);
+            final Intent intent = FeatureFactory.getFactory(context)
+                    .getSearchFeatureProvider()
+                    .buildSearchIntent(context, mPageId);
 
             if (context.getPackageManager().queryIntentActivities(intent,
                     PackageManager.MATCH_DEFAULT_ONLY).isEmpty()) {
diff --git a/src/com/android/settings/security/trustagent/TrustAgentManager.java b/src/com/android/settings/security/trustagent/TrustAgentManager.java
index e039db8..f5c693a 100644
--- a/src/com/android/settings/security/trustagent/TrustAgentManager.java
+++ b/src/com/android/settings/security/trustagent/TrustAgentManager.java
@@ -53,7 +53,7 @@
 public class TrustAgentManager {
 
     // Only allow one trust agent on the platform.
-    private static final boolean ONLY_ONE_TRUST_AGENT = true;
+    private static final boolean ONLY_ONE_TRUST_AGENT = false;
 
     public static class TrustAgentComponentInfo {
         public ComponentName componentName;
diff --git a/src/com/android/settings/security/trustagent/TrustAgentsExtendUnlockPreferenceController.java b/src/com/android/settings/security/trustagent/TrustAgentsExtendUnlockPreferenceController.java
deleted file mode 100644
index 036e07f..0000000
--- a/src/com/android/settings/security/trustagent/TrustAgentsExtendUnlockPreferenceController.java
+++ /dev/null
@@ -1,47 +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.security.trustagent;
-
-import android.content.Context;
-import android.provider.Settings;
-
-import com.android.settings.core.TogglePreferenceController;
-
-public class TrustAgentsExtendUnlockPreferenceController extends TogglePreferenceController {
-
-    public TrustAgentsExtendUnlockPreferenceController(Context context, String key) {
-        super(context, key);
-    }
-
-    @Override
-    public int getAvailabilityStatus() {
-        return AVAILABLE;
-    }
-
-    @Override
-    public boolean isChecked() {
-        return Settings.Secure.getInt(mContext.getContentResolver(),
-                Settings.Secure.TRUST_AGENTS_EXTEND_UNLOCK, 1) == 1;
-    }
-
-    @Override
-    public boolean setChecked(boolean isChecked) {
-        Settings.Secure.putInt(mContext.getContentResolver(),
-                Settings.Secure.TRUST_AGENTS_EXTEND_UNLOCK, isChecked ? 1 : 0);
-        return true;
-    }
-}
diff --git a/src/com/android/settings/security/trustagent/TrustLostLocksScreenPreferenceController.java b/src/com/android/settings/security/trustagent/TrustLostLocksScreenPreferenceController.java
deleted file mode 100644
index e0c5168..0000000
--- a/src/com/android/settings/security/trustagent/TrustLostLocksScreenPreferenceController.java
+++ /dev/null
@@ -1,47 +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.security.trustagent;
-
-import android.content.Context;
-import android.provider.Settings;
-
-import com.android.settings.core.TogglePreferenceController;
-
-public class TrustLostLocksScreenPreferenceController extends TogglePreferenceController {
-
-    public TrustLostLocksScreenPreferenceController(Context context, String key) {
-        super(context, key);
-    }
-
-    @Override
-    public int getAvailabilityStatus() {
-        return AVAILABLE;
-    }
-
-    @Override
-    public boolean isChecked() {
-        return Settings.Secure.getInt(mContext.getContentResolver(),
-                Settings.Secure.LOCK_SCREEN_WHEN_TRUST_LOST, 1) == 1;
-    }
-
-    @Override
-    public boolean setChecked(boolean isChecked) {
-        Settings.Secure.putInt(mContext.getContentResolver(),
-                Settings.Secure.LOCK_SCREEN_WHEN_TRUST_LOST, isChecked ? 1 : 0);
-        return true;
-    }
-}
diff --git a/src/com/android/settings/widget/ActionBarShadowController.java b/src/com/android/settings/widget/ActionBarShadowController.java
deleted file mode 100644
index 1b8d319..0000000
--- a/src/com/android/settings/widget/ActionBarShadowController.java
+++ /dev/null
@@ -1,134 +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.widget;
-
-import android.app.ActionBar;
-import android.app.Activity;
-import android.view.View;
-
-import androidx.annotation.VisibleForTesting;
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.android.settingslib.core.lifecycle.Lifecycle;
-import com.android.settingslib.core.lifecycle.LifecycleObserver;
-import com.android.settingslib.core.lifecycle.events.OnStart;
-import com.android.settingslib.core.lifecycle.events.OnStop;
-
-/**
- * A controller that adds shadow to actionbar when content view scrolls.
- * <p/>
- * It also works on custom views acting as an actionbar.
- */
-public class ActionBarShadowController implements LifecycleObserver, OnStart, OnStop {
-
-    @VisibleForTesting
-    static final float ELEVATION_HIGH = 8;
-    @VisibleForTesting
-    static final float ELEVATION_LOW = 0;
-
-    @VisibleForTesting
-    ScrollChangeWatcher mScrollChangeWatcher;
-    private RecyclerView mRecyclerView;
-    private boolean isScrollWatcherAttached;
-
-    public static ActionBarShadowController attachToRecyclerView(Activity activity,
-            Lifecycle lifecycle, RecyclerView recyclerView) {
-        return new ActionBarShadowController(activity, lifecycle, recyclerView);
-    }
-
-    public static ActionBarShadowController attachToRecyclerView(View anchorView,
-            Lifecycle lifecycle, RecyclerView recyclerView) {
-        return new ActionBarShadowController(anchorView, lifecycle, recyclerView);
-    }
-
-    private ActionBarShadowController(Activity activity, Lifecycle lifecycle,
-            RecyclerView recyclerView) {
-        mScrollChangeWatcher = new ScrollChangeWatcher(activity);
-        mRecyclerView = recyclerView;
-        attachScrollWatcher();
-        lifecycle.addObserver(this);
-    }
-
-    private ActionBarShadowController(View anchorView, Lifecycle lifecycle,
-            RecyclerView recyclerView) {
-        mScrollChangeWatcher = new ScrollChangeWatcher(anchorView);
-        mRecyclerView = recyclerView;
-        attachScrollWatcher();
-        lifecycle.addObserver(this);
-    }
-
-    @Override
-    public void onStop() {
-        detachScrollWatcher();
-    }
-
-    private void detachScrollWatcher() {
-        mRecyclerView.removeOnScrollListener(mScrollChangeWatcher);
-        isScrollWatcherAttached = false;
-    }
-
-    @Override
-    public void onStart() {
-        attachScrollWatcher();
-    }
-
-    private void attachScrollWatcher() {
-        if (!isScrollWatcherAttached) {
-            isScrollWatcherAttached = true;
-            mRecyclerView.addOnScrollListener(mScrollChangeWatcher);
-            mScrollChangeWatcher.updateDropShadow(mRecyclerView);
-        }
-    }
-
-    /**
-     * Update the drop shadow as the scrollable entity is scrolled.
-     */
-    final class ScrollChangeWatcher extends RecyclerView.OnScrollListener {
-
-        private final Activity mActivity;
-        private final View mAnchorView;
-
-        public ScrollChangeWatcher(Activity activity) {
-            mActivity = activity;
-            mAnchorView = null;
-        }
-
-        public ScrollChangeWatcher(View anchorView) {
-            mAnchorView = anchorView;
-            mActivity = null;
-        }
-
-        // RecyclerView scrolled.
-        @Override
-        public void onScrolled(RecyclerView view, int dx, int dy) {
-            updateDropShadow(view);
-        }
-
-        public void updateDropShadow(View view) {
-            final boolean shouldShowShadow = view.canScrollVertically(-1);
-            if (mAnchorView != null) {
-                mAnchorView.setElevation(shouldShowShadow ? ELEVATION_HIGH : ELEVATION_LOW);
-            } else if (mActivity != null) { // activity can become null when running monkey
-                final ActionBar actionBar = mActivity.getActionBar();
-                if (actionBar != null) {
-                    actionBar.setElevation(shouldShowShadow ? ELEVATION_HIGH : ELEVATION_LOW);
-                }
-            }
-        }
-    }
-
-}
diff --git a/src/com/android/settings/widget/AddPreference.java b/src/com/android/settings/widget/AddPreference.java
new file mode 100644
index 0000000..ce36ab3
--- /dev/null
+++ b/src/com/android/settings/widget/AddPreference.java
@@ -0,0 +1,85 @@
+/*
+ * 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.widget;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.View;
+
+import com.android.settings.R;
+import com.android.settingslib.RestrictedPreference;
+
+import androidx.annotation.VisibleForTesting;
+import androidx.preference.PreferenceViewHolder;
+
+/**
+ * A preference with a plus button on the side representing an "add" action. The plus button will
+ * only be visible when a non-null click listener is registered.
+ */
+public class AddPreference extends RestrictedPreference implements View.OnClickListener {
+
+    private OnAddClickListener mListener;
+    private View mWidgetFrame;
+
+    public AddPreference(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    @VisibleForTesting
+    int getAddWidgetResId() {
+        return R.id.add_preference_widget;
+    }
+
+    /** Sets a listener for clicks on the plus button. Passing null will cause the button to be
+     * hidden. */
+    public void setOnAddClickListener(OnAddClickListener listener) {
+        mListener = listener;
+       if (mWidgetFrame != null) {
+           mWidgetFrame.setVisibility(shouldHideSecondTarget() ? View.GONE : View.VISIBLE);
+       }
+    }
+
+    @Override
+    protected int getSecondTargetResId() {
+        return R.layout.preference_widget_add;
+    }
+
+    @Override
+    protected boolean shouldHideSecondTarget() {
+        return mListener == null;
+    }
+
+    @Override
+    public void onBindViewHolder(PreferenceViewHolder holder) {
+        super.onBindViewHolder(holder);
+        mWidgetFrame = holder.findViewById(android.R.id.widget_frame);
+        final View addWidget = holder.findViewById(getAddWidgetResId());
+        addWidget.setEnabled(true);
+        addWidget.setOnClickListener(this);
+    }
+
+    @Override
+    public void onClick(View view) {
+        if (view.getId() == getAddWidgetResId() && mListener != null) {
+            mListener.onAddClick(this);
+        }
+    }
+
+    public interface OnAddClickListener {
+        void onAddClick(AddPreference p);
+    }
+}
diff --git a/src/com/android/settings/widget/EntityHeaderController.java b/src/com/android/settings/widget/EntityHeaderController.java
index 2714859..8e31290 100644
--- a/src/com/android/settings/widget/EntityHeaderController.java
+++ b/src/com/android/settings/widget/EntityHeaderController.java
@@ -49,6 +49,7 @@
 import com.android.settings.overlay.FeatureFactory;
 import com.android.settingslib.applications.ApplicationsState;
 import com.android.settingslib.core.lifecycle.Lifecycle;
+import com.android.settingslib.widget.ActionBarShadowController;
 import com.android.settingslib.widget.LayoutPreference;
 
 import java.lang.annotation.Retention;
@@ -321,7 +322,7 @@
                         Utils.getColorAttrDefaultColor(activity, android.R.attr.colorPrimaryDark)));
         actionBar.setElevation(0);
         if (mRecyclerView != null && mLifecycle != null) {
-            ActionBarShadowController.attachToRecyclerView(mActivity, mLifecycle, mRecyclerView);
+            ActionBarShadowController.attachToView(mActivity, mLifecycle, mRecyclerView);
         }
 
         return this;
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index a679d37..1d78485 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -359,8 +359,15 @@
                         if (config != null && config.isPasspoint()) {
                             providerFriendlyName = config.providerFriendlyName;
                         }
+                        String suggestionOrSpecifierPackageName = null;
+                        if (config != null
+                                && (config.fromWifiNetworkSpecifier
+                                || config.fromWifiNetworkSuggestion)) {
+                            suggestionOrSpecifierPackageName = config.creatorName;
+                        }
                         String summary = AccessPoint.getSummary(
-                                mConfigUi.getContext(), state, isEphemeral, providerFriendlyName);
+                                mConfigUi.getContext(), /* ssid */ null, state, isEphemeral,
+                                suggestionOrSpecifierPackageName);
                         addRow(group, R.string.wifi_status, summary);
                     }
 
diff --git a/src/com/android/settings/wifi/WifiInfoPreferenceController.java b/src/com/android/settings/wifi/WifiInfoPreferenceController.java
index e847712..2a8c7b5 100644
--- a/src/com/android/settings/wifi/WifiInfoPreferenceController.java
+++ b/src/com/android/settings/wifi/WifiInfoPreferenceController.java
@@ -98,12 +98,11 @@
     public void updateWifiInfo() {
         if (mWifiMacAddressPref != null) {
             final WifiInfo wifiInfo = mWifiManager.getConnectionInfo();
-            final int macRandomizationMode = Settings.Global.getInt(mContext.getContentResolver(),
-                    Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, 0);
+            final boolean macRandomizationSupported = mContext.getResources().getBoolean(
+                com.android.internal.R.bool.config_wifi_connected_mac_randomization_supported);
             final String macAddress = wifiInfo == null ? null : wifiInfo.getMacAddress();
 
-            if (macRandomizationMode == 1
-                    && WifiInfo.DEFAULT_MAC_ADDRESS.equals(macAddress)) {
+            if (macRandomizationSupported && WifiInfo.DEFAULT_MAC_ADDRESS.equals(macAddress)) {
                 mWifiMacAddressPref.setSummary(R.string.wifi_status_mac_randomized);
             } else if (TextUtils.isEmpty(macAddress)
                     || WifiInfo.DEFAULT_MAC_ADDRESS.equals(macAddress)) {
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index 3a0040c..881e3d2 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -562,24 +562,24 @@
              * Bypass dialog and connect to unsecured networks, or previously connected saved
              * networks, or Passpoint provided networks.
              */
-            WifiConfiguration config = mSelectedAccessPoint.getConfig();
-            if (mSelectedAccessPoint.isOsuProvider()) {
-                mSelectedAccessPoint.startOsuProvisioning();
-                mClickedConnect = true;
-            } else if ((mSelectedAccessPoint.getSecurity() == AccessPoint.SECURITY_NONE) ||
-                    (mSelectedAccessPoint.getSecurity() == AccessPoint.SECURITY_OWE)) {
-                mSelectedAccessPoint.generateOpenNetworkConfig();
-                connect(mSelectedAccessPoint.getConfig(), mSelectedAccessPoint.isSaved());
-            } else if (mSelectedAccessPoint.isSaved() && config != null
-                    && config.getNetworkSelectionStatus() != null
-                    && config.getNetworkSelectionStatus().getHasEverConnected()) {
-                connect(config, true /* isSavedNetwork */);
-            } else if (mSelectedAccessPoint.isPasspoint()) {
-                // Access point provided by an installed Passpoint provider, connect using
-                // the associated config.
-                connect(config, true /* isSavedNetwork */);
-            } else {
-                showDialog(mSelectedAccessPoint, WifiConfigUiBase.MODE_CONNECT);
+            switch (WifiUtils.getConnectingType(mSelectedAccessPoint)) {
+                case WifiUtils.CONNECT_TYPE_OSU_PROVISION:
+                    mSelectedAccessPoint.startOsuProvisioning();
+                    mClickedConnect = true;
+                    break;
+
+                case WifiUtils.CONNECT_TYPE_OPEN_NETWORK:
+                    mSelectedAccessPoint.generateOpenNetworkConfig();
+                    connect(mSelectedAccessPoint.getConfig(), mSelectedAccessPoint.isSaved());
+                    break;
+
+                case WifiUtils.CONNECT_TYPE_SAVED_NETWORK:
+                    connect(mSelectedAccessPoint.getConfig(), true /* isSavedNetwork */);
+                    break;
+
+                default:
+                    showDialog(mSelectedAccessPoint, WifiConfigUiBase.MODE_CONNECT);
+                    break;
             }
         } else if (preference == mAddPreference) {
             onAddNetworkPressed();
diff --git a/src/com/android/settings/wifi/WifiStatusTest.java b/src/com/android/settings/wifi/WifiStatusTest.java
index 6c1a3fc..ca7f5f7 100644
--- a/src/com/android/settings/wifi/WifiStatusTest.java
+++ b/src/com/android/settings/wifi/WifiStatusTest.java
@@ -299,7 +299,8 @@
             WifiInfo info = mWifiManager.getConnectionInfo();
             String summary = AccessPoint.getSummary(this, info.getSSID(),
                     networkInfo.getDetailedState(),
-                    info.getNetworkId() == WifiConfiguration.INVALID_NETWORK_ID, null);
+                    info.getNetworkId() == WifiConfiguration.INVALID_NETWORK_ID,
+                    /* suggestionOrSpecifierPackageName */ null);
             mNetworkState.setText(summary);
         }
     }
diff --git a/src/com/android/settings/wifi/WifiUtils.java b/src/com/android/settings/wifi/WifiUtils.java
index 751fc91..a22bdba 100644
--- a/src/com/android/settings/wifi/WifiUtils.java
+++ b/src/com/android/settings/wifi/WifiUtils.java
@@ -253,4 +253,33 @@
 
         return AccessPoint.SECURITY_NONE;
     }
+
+
+    public static final int CONNECT_TYPE_OTHERS = 0;
+    public static final int CONNECT_TYPE_OPEN_NETWORK = 1;
+    public static final int CONNECT_TYPE_SAVED_NETWORK = 2;
+    public static final int CONNECT_TYPE_OSU_PROVISION = 3;
+
+    /**
+     * Gets the connecting type of {@link AccessPoint}.
+     */
+    public static int getConnectingType(AccessPoint accessPoint) {
+        final WifiConfiguration config = accessPoint.getConfig();
+        if (accessPoint.isOsuProvider()) {
+            return CONNECT_TYPE_OSU_PROVISION;
+        } else if ((accessPoint.getSecurity() == AccessPoint.SECURITY_NONE) ||
+                (accessPoint.getSecurity() == AccessPoint.SECURITY_OWE)) {
+            return CONNECT_TYPE_OPEN_NETWORK;
+        } else if (accessPoint.isSaved() && config != null
+                && config.getNetworkSelectionStatus() != null
+                && config.getNetworkSelectionStatus().getHasEverConnected()) {
+            return CONNECT_TYPE_SAVED_NETWORK;
+        } else if (accessPoint.isPasspoint()) {
+            // Access point provided by an installed Passpoint provider, connect using
+            // the associated config.
+            return CONNECT_TYPE_SAVED_NETWORK;
+        } else {
+            return CONNECT_TYPE_OTHERS;
+        }
+    }
 }
diff --git a/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java b/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java
index 52243d4..4523def 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java
@@ -55,7 +55,7 @@
         @Override
         public void onConfiguratorSuccess(int code) {
             // Update success UI.
-            mHeaderIcon.setImageResource(R.drawable.ic_check_circle_green);
+            setHeaderIconImageResource(R.drawable.ic_devices_check_circle_green);
             mTitle.setText(R.string.wifi_dpp_wifi_shared_with_device);
             mSummary.setVisibility(View.INVISIBLE);
             mWifiApPictureView.setImageResource(R.drawable.wifi_dpp_success);
@@ -63,7 +63,11 @@
             mButtonLeft.setText(R.string.wifi_dpp_add_another_device);
             mButtonLeft.setOnClickListener(v -> getFragmentManager().popBackStack());
             mButtonRight.setText(R.string.done);
-            mButtonRight.setOnClickListener(v -> getActivity().finish());
+            mButtonRight.setOnClickListener(v -> {
+                final Activity activity = getActivity();
+                activity.setResult(Activity.RESULT_OK);
+                activity.finish();
+            });
         }
 
         @Override
@@ -110,7 +114,7 @@
     public void onViewCreated(View view, Bundle savedInstanceState) {
         super.onViewCreated(view, savedInstanceState);
 
-        mHeaderIcon.setImageResource(R.drawable.ic_devices_other_opaque_black);
+        setHeaderIconImageResource(R.drawable.ic_devices_other_opaque_black);
 
         final WifiQrCode wifiQrCode = ((WifiDppConfiguratorActivity) getActivity())
                 .getWifiDppQrCode();
@@ -138,10 +142,7 @@
 
         mButtonLeft = view.findViewById(R.id.button_left);
         mButtonLeft.setText(R.string.cancel);
-        mButtonLeft.setOnClickListener(v -> {
-            getActivity().setResult(Activity.RESULT_CANCELED);
-            getActivity().finish();
-        });
+        mButtonLeft.setOnClickListener(v -> getActivity().finish());
 
         mButtonRight = view.findViewById(R.id.button_right);
         mButtonRight.setText(R.string.wifi_dpp_share_wifi);
diff --git a/src/com/android/settings/wifi/dpp/WifiDppChooseSavedWifiNetworkFragment.java b/src/com/android/settings/wifi/dpp/WifiDppChooseSavedWifiNetworkFragment.java
index 6a229a1..72e845f 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppChooseSavedWifiNetworkFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppChooseSavedWifiNetworkFragment.java
@@ -17,7 +17,6 @@
 package com.android.settings.wifi.dpp;
 
 import android.app.ActionBar;
-import android.app.Activity;
 import android.app.settings.SettingsEnums;
 import android.content.Intent;
 import android.os.Bundle;
@@ -82,6 +81,8 @@
     public void onViewCreated(View view, Bundle savedInstanceState) {
         super.onViewCreated(view, savedInstanceState);
 
+        setHeaderIconImageResource(R.drawable.ic_wifi_signal_4);
+
         mTitle.setText(R.string.wifi_dpp_choose_network);
         mSummary.setText(R.string.wifi_dpp_choose_network_to_connect_device);
 
@@ -98,9 +99,7 @@
                     .ACTION_CONFIGURATOR_QR_CODE_GENERATOR.equals(action)) {
                 getFragmentManager().popBackStack();
             } else {
-                final Activity activity = getActivity();
-                activity.setResult(Activity.RESULT_CANCELED);
-                activity.finish();
+                getActivity().finish();
             }
         });
 
diff --git a/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java b/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java
index e5beea0..4aac538 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java
@@ -17,7 +17,6 @@
 package com.android.settings.wifi.dpp;
 
 import android.app.ActionBar;
-import android.app.Activity;
 import android.app.settings.SettingsEnums;
 import android.content.Intent;
 import android.os.Bundle;
@@ -160,7 +159,6 @@
         }
 
         if (cancelActivity) {
-            setResult(Activity.RESULT_CANCELED);
             finish();
         }
     }
@@ -279,8 +277,8 @@
         return mWifiDppQrCode;
     }
 
-    @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
-    protected boolean setWifiNetworkConfig(WifiNetworkConfig config) {
+    @VisibleForTesting
+    boolean setWifiNetworkConfig(WifiNetworkConfig config) {
         if(!WifiNetworkConfig.isValidConfig(config)) {
             return false;
         } else {
@@ -289,8 +287,8 @@
         }
     }
 
-    @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
-    protected boolean setWifiDppQrCode(WifiQrCode wifiQrCode) {
+    @VisibleForTesting
+    boolean setWifiDppQrCode(WifiQrCode wifiQrCode) {
         if (wifiQrCode == null) {
             return false;
         }
@@ -307,7 +305,6 @@
     public boolean onNavigateUp() {
         Fragment fragment = mFragmentManager.findFragmentById(R.id.fragment_container);
         if (fragment instanceof WifiDppQrCodeGeneratorFragment) {
-            setResult(Activity.RESULT_CANCELED);
             finish();
             return true;
         } else if (fragment instanceof WifiDppQrCodeScannerFragment) {
diff --git a/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivity.java b/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivity.java
index 3dea7a0..df36ae5 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivity.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivity.java
@@ -117,7 +117,6 @@
                 break;
             default:
                 Log.e(TAG, "Launch with an invalid action");
-                setResult(Activity.RESULT_CANCELED);
                 finish();
         }
     }
@@ -141,7 +140,6 @@
 
     @Override
     public boolean onNavigateUp(){
-        setResult(Activity.RESULT_CANCELED);
         finish();
         return true;
     }
diff --git a/src/com/android/settings/wifi/dpp/WifiDppQrCodeBaseFragment.java b/src/com/android/settings/wifi/dpp/WifiDppQrCodeBaseFragment.java
index cd0db62..fab495d 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppQrCodeBaseFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppQrCodeBaseFragment.java
@@ -21,6 +21,7 @@
 import android.widget.ImageView;
 import android.widget.TextView;
 
+import com.android.settings.R;
 import com.android.settings.core.InstrumentedFragment;
 
 /**
@@ -33,7 +34,8 @@
  * {@code WifiDppAddDeviceFragment}
  */
 public abstract class WifiDppQrCodeBaseFragment extends InstrumentedFragment {
-    protected ImageView mHeaderIcon;
+    private ImageView mHeaderIcon;
+    private ImageView mDevicesCheckCircleGreenHeaderIcon;
     protected TextView mTitle;
     protected TextView mSummary;
 
@@ -42,7 +44,22 @@
         super.onViewCreated(view, savedInstanceState);
 
         mHeaderIcon = view.findViewById(android.R.id.icon);
+        mDevicesCheckCircleGreenHeaderIcon =
+                view.findViewById(R.id.devices_check_circle_green_icon);
         mTitle = view.findViewById(android.R.id.title);
         mSummary = view.findViewById(android.R.id.summary);
     }
+
+    protected void setHeaderIconImageResource(int resId) {
+        // ic_devices_check_circle_green is a LayerDrawable,
+        // it has different size from other VectorDrawable icons
+        if (resId == R.drawable.ic_devices_check_circle_green) {
+            mHeaderIcon.setVisibility(View.GONE);
+            mDevicesCheckCircleGreenHeaderIcon.setVisibility(View.VISIBLE);
+        } else {
+            mDevicesCheckCircleGreenHeaderIcon.setVisibility(View.GONE);
+            mHeaderIcon.setImageResource(resId);
+            mHeaderIcon.setVisibility(View.VISIBLE);
+        }
+    }
 }
diff --git a/src/com/android/settings/wifi/dpp/WifiDppQrCodeGeneratorFragment.java b/src/com/android/settings/wifi/dpp/WifiDppQrCodeGeneratorFragment.java
index d0a9638..2264ba6 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppQrCodeGeneratorFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppQrCodeGeneratorFragment.java
@@ -124,7 +124,8 @@
 
         mQrCodeView = view.findViewById(R.id.qrcode_view);
 
-        mHeaderIcon.setImageResource(R.drawable.ic_qrcode_24dp);
+        setHeaderIconImageResource(R.drawable.ic_qrcode_24dp);
+
         final WifiNetworkConfig wifiNetworkConfig = getWifiNetworkConfigFromHostActivity();
         mTitle.setText(R.string.wifi_dpp_share_wifi);
         mSummary.setText(getString(R.string.wifi_dpp_scan_qr_code_with_another_device,
diff --git a/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java b/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
index 7beeeb2..9524fee 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
@@ -171,7 +171,7 @@
 
         mDecorateView = (QrDecorateView) view.findViewById(R.id.decorate_view);
 
-        mHeaderIcon.setImageResource(R.drawable.ic_scan_24dp);
+        setHeaderIconImageResource(R.drawable.ic_scan_24dp);
         if (mIsConfiguratorMode) {
             mTitle.setText(R.string.wifi_dpp_add_device_to_network);
 
diff --git a/src/com/android/settings/wifi/dpp/WifiDppUtils.java b/src/com/android/settings/wifi/dpp/WifiDppUtils.java
index b43ee92..9c69032 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppUtils.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppUtils.java
@@ -139,7 +139,7 @@
             case AccessPoint.SECURITY_WEP:
                 return WifiQrCode.SECURITY_WEP;
             case AccessPoint.SECURITY_PSK:
-                return WifiQrCode.SECURITY_WPA;
+                return WifiQrCode.SECURITY_WPA_PSK;
             case AccessPoint.SECURITY_SAE:
                 return WifiQrCode.SECURITY_SAE;
             default:
diff --git a/src/com/android/settings/wifi/dpp/WifiNetworkConfig.java b/src/com/android/settings/wifi/dpp/WifiNetworkConfig.java
index 8e95b3e..979e602 100644
--- a/src/com/android/settings/wifi/dpp/WifiNetworkConfig.java
+++ b/src/com/android/settings/wifi/dpp/WifiNetworkConfig.java
@@ -19,7 +19,7 @@
 import static com.android.settings.wifi.dpp.WifiQrCode.SECURITY_NO_PASSWORD;
 import static com.android.settings.wifi.dpp.WifiQrCode.SECURITY_SAE;
 import static com.android.settings.wifi.dpp.WifiQrCode.SECURITY_WEP;
-import static com.android.settings.wifi.dpp.WifiQrCode.SECURITY_WPA;
+import static com.android.settings.wifi.dpp.WifiQrCode.SECURITY_WPA_PSK;
 
 import android.content.Context;
 import android.content.Intent;
@@ -53,8 +53,8 @@
     private boolean mHiddenSsid;
     private int mNetworkId;
 
-    @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
-    protected WifiNetworkConfig(String security, String ssid, String preSharedKey,
+    @VisibleForTesting
+    WifiNetworkConfig(String security, String ssid, String preSharedKey,
             boolean hiddenSsid, int networkId) {
         mSecurity = security;
         mSsid = ssid;
@@ -218,7 +218,7 @@
         }
 
         // DPP 1.0 only supports SAE and PSK.
-        if (SECURITY_SAE.equals(mSecurity) || SECURITY_WPA.equals(mSecurity)) {
+        if (SECURITY_SAE.equals(mSecurity) || SECURITY_WPA_PSK.equals(mSecurity)) {
             return true;
         }
 
@@ -256,7 +256,7 @@
             } else {
                 wifiConfiguration.wepKeys[0] = addQuotationIfNeeded(mPreSharedKey);
             }
-        } else if (mSecurity.startsWith(SECURITY_WPA)) {
+        } else if (mSecurity.startsWith(SECURITY_WPA_PSK)) {
             wifiConfiguration.allowedKeyManagement.set(KeyMgmt.WPA_PSK);
 
             if (mPreSharedKey.matches("[0-9A-Fa-f]{64}")) {
diff --git a/src/com/android/settings/wifi/dpp/WifiNetworkListFragment.java b/src/com/android/settings/wifi/dpp/WifiNetworkListFragment.java
index b078b01..89efc31 100644
--- a/src/com/android/settings/wifi/dpp/WifiNetworkListFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiNetworkListFragment.java
@@ -235,7 +235,7 @@
             if (mOnChooseNetworkListener != null) {
                 mOnChooseNetworkListener.onChooseNetwork(
                         new WifiNetworkConfig(
-                                WifiQrCode.SECURITY_WPA,
+                                WifiQrCode.SECURITY_WPA_PSK,
                                 /* ssid */ WifiNetworkConfig.FAKE_SSID,
                                 /* preSharedKey */ WifiNetworkConfig.FAKE_PASSWORD,
                                 /* hiddenSsid */ true,
diff --git a/src/com/android/settings/wifi/dpp/WifiQrCode.java b/src/com/android/settings/wifi/dpp/WifiQrCode.java
index d3f8ebf..a08fb44 100644
--- a/src/com/android/settings/wifi/dpp/WifiQrCode.java
+++ b/src/com/android/settings/wifi/dpp/WifiQrCode.java
@@ -66,7 +66,7 @@
     // Ignores password if security is SECURITY_NO_PASSWORD or absent
     public static final String SECURITY_NO_PASSWORD = "nopass";
     public static final String SECURITY_WEP = "WEP";
-    public static final String SECURITY_WPA = "WPA";
+    public static final String SECURITY_WPA_PSK = "WPA";
     public static final String SECURITY_SAE = "WPA3";
 
     private String mQrCode;
@@ -169,8 +169,8 @@
         return null;
     }
 
-    @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
-    protected String removeBackSlash(String input) {
+    @VisibleForTesting
+    String removeBackSlash(String input) {
         if (input == null) {
             return null;
         }
@@ -210,8 +210,8 @@
     }
 
     /** Available when {@code getScheme()} returns SCHEME_DPP */
-     @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
-    protected String getPublicKey() {
+    @VisibleForTesting
+    String getPublicKey() {
         return mPublicKey;
     }
 
diff --git a/src/com/android/settings/wifi/p2p/WifiP2pSettings.java b/src/com/android/settings/wifi/p2p/WifiP2pSettings.java
index d1500e7..1c1da38 100644
--- a/src/com/android/settings/wifi/p2p/WifiP2pSettings.java
+++ b/src/com/android/settings/wifi/p2p/WifiP2pSettings.java
@@ -85,6 +85,7 @@
     private boolean mWifiP2pSearching;
     private int mConnectedDevices;
     private boolean mLastGroupFormed = false;
+    private boolean mIsIgnoreInitConnectionInfoCallback = false;
 
     private P2pPeerCategoryPreferenceController mPeerCategoryController;
     private P2pPersistentCategoryPreferenceController mPersistentCategoryController;
@@ -131,6 +132,7 @@
                     startSearch();
                 }
                 mLastGroupFormed = wifip2pinfo.groupFormed;
+                mIsIgnoreInitConnectionInfoCallback = true;
             } else if (WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION.equals(action)) {
                 mThisDevice = (WifiP2pDevice) intent.getParcelableExtra(
                         WifiP2pManager.EXTRA_WIFI_P2P_DEVICE);
@@ -338,6 +340,29 @@
         getActivity().registerReceiver(mReceiver, mIntentFilter);
         if (mWifiP2pManager != null) {
             mWifiP2pManager.requestPeers(mChannel, WifiP2pSettings.this);
+            mWifiP2pManager.requestDeviceInfo(mChannel, wifiP2pDevice -> {
+                if (DBG) {
+                    Log.d(TAG, "Get device info: " + wifiP2pDevice);
+                }
+                mThisDevice = wifiP2pDevice;
+                mThisDevicePreferenceController.updateDeviceName(wifiP2pDevice);
+            });
+            mIsIgnoreInitConnectionInfoCallback = false;
+            mWifiP2pManager.requestNetworkInfo(mChannel, networkInfo -> {
+                mWifiP2pManager.requestConnectionInfo(mChannel, wifip2pinfo -> {
+                    if (!mIsIgnoreInitConnectionInfoCallback) {
+                        if (networkInfo.isConnected()) {
+                            if (DBG) {
+                                Log.d(TAG, "Connected");
+                            }
+                        } else if (!mLastGroupFormed) {
+                            // Find peers when p2p doesn't connected.
+                            startSearch();
+                        }
+                        mLastGroupFormed = wifip2pinfo.groupFormed;
+                    }
+                });
+            });
         }
     }
 
diff --git a/src/com/android/settings/wifi/slice/ConnectToWifiHandler.java b/src/com/android/settings/wifi/slice/ConnectToWifiHandler.java
new file mode 100644
index 0000000..7b21b65
--- /dev/null
+++ b/src/com/android/settings/wifi/slice/ConnectToWifiHandler.java
@@ -0,0 +1,63 @@
+/*
+ * 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.wifi.slice;
+
+import android.app.Activity;
+import android.net.wifi.WifiManager;
+import android.os.Bundle;
+
+import androidx.annotation.VisibleForTesting;
+
+import com.android.settings.wifi.WifiDialogActivity;
+import com.android.settings.wifi.WifiUtils;
+import com.android.settingslib.wifi.AccessPoint;
+
+/**
+ * This activity helps connect to the Wi-Fi network which is open or saved
+ */
+public class ConnectToWifiHandler extends Activity {
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        final Bundle accessPointState = getIntent().getBundleExtra(
+                WifiDialogActivity.KEY_ACCESS_POINT_STATE);
+
+        if (accessPointState != null) {
+            connect(new AccessPoint(this, accessPointState));
+        }
+        finish();
+    }
+
+    @VisibleForTesting
+    void connect(AccessPoint accessPoint) {
+        switch (WifiUtils.getConnectingType(accessPoint)) {
+            case WifiUtils.CONNECT_TYPE_OSU_PROVISION:
+                accessPoint.startOsuProvisioning();
+                break;
+
+            case WifiUtils.CONNECT_TYPE_OPEN_NETWORK:
+                accessPoint.generateOpenNetworkConfig();
+
+            case WifiUtils.CONNECT_TYPE_SAVED_NETWORK:
+                final WifiManager wifiManager = getSystemService(WifiManager.class);
+                wifiManager.connect(accessPoint.getConfig(), null /* listener */);
+                break;
+        }
+    }
+}
diff --git a/src/com/android/settings/wifi/slice/WifiSlice.java b/src/com/android/settings/wifi/slice/WifiSlice.java
index 88fa8b2..1a0ed0c 100644
--- a/src/com/android/settings/wifi/slice/WifiSlice.java
+++ b/src/com/android/settings/wifi/slice/WifiSlice.java
@@ -48,6 +48,7 @@
 import com.android.settings.slices.SliceBuilderUtils;
 import com.android.settings.wifi.WifiDialogActivity;
 import com.android.settings.wifi.WifiSettings;
+import com.android.settings.wifi.WifiUtils;
 import com.android.settings.wifi.details.WifiNetworkDetailsFragment;
 import com.android.settingslib.wifi.AccessPoint;
 import com.android.settingslib.wifi.WifiTracker;
@@ -176,6 +177,9 @@
                     .setArguments(extras)
                     .setSourceMetricsCategory(SettingsEnums.WIFI)
                     .toIntent();
+        } else if (WifiUtils.getConnectingType(accessPoint) != WifiUtils.CONNECT_TYPE_OTHERS) {
+            intent = new Intent(mContext, ConnectToWifiHandler.class);
+            intent.putExtra(WifiDialogActivity.KEY_ACCESS_POINT_STATE, extras);
         } else {
             intent = new Intent(mContext, WifiDialogActivity.class);
             intent.putExtra(WifiDialogActivity.KEY_ACCESS_POINT_STATE, extras);
diff --git a/tests/robotests/Android.mk b/tests/robotests/Android.mk
index 50133d9..b0733f4 100644
--- a/tests/robotests/Android.mk
+++ b/tests/robotests/Android.mk
@@ -3,11 +3,11 @@
 SETTINGS_AOSP_PATH := packages/apps/Settings
 
 #############################################################
-# Build SettingsTest.apk which includes test-only resources.#
+# Build SettingsRoboTestStub.apk which includes test-only resources.#
 #############################################################
 include $(CLEAR_VARS)
 
-LOCAL_PACKAGE_NAME := SettingsTest
+LOCAL_PACKAGE_NAME := SettingsRoboTestStub
 LOCAL_PRIVATE_PLATFORM_APIS := true
 LOCAL_CERTIFICATE := platform
 LOCAL_PRIVILEGED_MODULE := true
@@ -77,7 +77,7 @@
     mockito-robolectric-prebuilt \
     truth-prebuilt
 
-LOCAL_INSTRUMENTATION_FOR := SettingsTest
+LOCAL_INSTRUMENTATION_FOR := SettingsRoboTestStub
 
 LOCAL_MODULE_TAGS := optional
 
@@ -100,7 +100,7 @@
     mockito-robolectric-prebuilt \
     truth-prebuilt
 
-LOCAL_TEST_PACKAGE := SettingsTest
+LOCAL_TEST_PACKAGE := SettingsRoboTestStub
 
 LOCAL_INSTRUMENT_SOURCE_DIRS := $(dir $(LOCAL_PATH))../src \
     frameworks/base/packages/SettingsLib/search/src \
diff --git a/tests/robotests/res/values-mcc999/config.xml b/tests/robotests/res/values-mcc999/config.xml
index da71273..b54781d 100644
--- a/tests/robotests/res/values-mcc999/config.xml
+++ b/tests/robotests/res/values-mcc999/config.xml
@@ -56,7 +56,6 @@
     <bool name="config_show_vibrate_input_devices">false</bool>
     <bool name="config_show_reset_dashboard">false</bool>
     <bool name="config_show_system_update_settings">false</bool>
-    <bool name="config_wifi_support_connected_mac_randomization">false</bool>
     <bool name="config_show_device_model">false</bool>
     <bool name="config_show_top_level_battery">false</bool>
     <bool name="config_show_top_level_connected_devices">false</bool>
diff --git a/tests/robotests/res/values/config.xml b/tests/robotests/res/values/config.xml
index 1252ece..15ae899 100644
--- a/tests/robotests/res/values/config.xml
+++ b/tests/robotests/res/values/config.xml
@@ -20,7 +20,6 @@
     <bool name="config_show_camera_laser_sensor">true</bool>
     <bool name="config_show_connectivity_monitor">true</bool>
     <bool name="config_display_recent_apps">true</bool>
-    <bool name="config_wifi_support_connected_mac_randomization">true</bool>
 
     <!-- Fake dimen value for restricted icon size - needed to get around Robolectric
          issue loading framework hidden resources -->
diff --git a/tests/robotests/src/com/android/settings/accessibility/LiveCaptionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/LiveCaptionPreferenceControllerTest.java
deleted file mode 100644
index f6160b2..0000000
--- a/tests/robotests/src/com/android/settings/accessibility/LiveCaptionPreferenceControllerTest.java
+++ /dev/null
@@ -1,66 +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.accessibility;
-
-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 android.content.pm.ResolveInfo;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.Shadows;
-import org.robolectric.shadows.ShadowPackageManager;
-
-import java.util.Collections;
-
-@RunWith(RobolectricTestRunner.class)
-public class LiveCaptionPreferenceControllerTest {
-
-    private LiveCaptionPreferenceController mController;
-
-    @Before
-    public void setUp() {
-        mController = new LiveCaptionPreferenceController(RuntimeEnvironment.application,
-                "test_key");
-    }
-
-    @Test
-    public void getAvailabilityStatus_canResolveIntent_shouldReturnAvailable() {
-        final ShadowPackageManager pm = Shadows.shadowOf(
-                RuntimeEnvironment.application.getPackageManager());
-        pm.addResolveInfoForIntent(LiveCaptionPreferenceController.LIVE_CAPTION_INTENT,
-                new ResolveInfo());
-
-        assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
-    }
-
-    @Test
-    public void getAvailabilityStatus_noResolveIntent_shouldReturnUnavailable() {
-        final ShadowPackageManager pm = Shadows.shadowOf(
-                RuntimeEnvironment.application.getPackageManager());
-        pm.setResolveInfosForIntent(LiveCaptionPreferenceController.LIVE_CAPTION_INTENT,
-                Collections.emptyList());
-
-        assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/accounts/AccountDetailDashboardFragmentTest.java b/tests/robotests/src/com/android/settings/accounts/AccountDetailDashboardFragmentTest.java
index 0be51c3..dffa968 100644
--- a/tests/robotests/src/com/android/settings/accounts/AccountDetailDashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/AccountDetailDashboardFragmentTest.java
@@ -15,6 +15,8 @@
  */
 package com.android.settings.accounts;
 
+import static android.content.Intent.EXTRA_USER;
+
 import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_KEYHINT;
 import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_TITLE;
 
@@ -161,6 +163,20 @@
     }
 
     @Test
+    public void displayTile_shouldAddUserHandleToTileIntent() {
+        mFragment.mUserHandle = new UserHandle(1);
+
+        final Tile tile = new Tile(mActivityInfo, CategoryKey.CATEGORY_ACCOUNT_DETAIL);
+        mActivityInfo.metaData.putString(METADATA_CATEGORY, CategoryKey.CATEGORY_ACCOUNT);
+        mActivityInfo.metaData.putString(METADATA_ACCOUNT_TYPE, "com.abc");
+
+        mFragment.displayTile(tile);
+
+        final UserHandle userHandle = tile.getIntent().getParcelableExtra(EXTRA_USER);
+        assertThat(userHandle.getIdentifier()).isEqualTo(1);
+    }
+
+    @Test
     public void onResume_accountMissing_shouldFinish() {
         ShadowUserManager userManager =
             Shadow.extract(mContext.getSystemService(UserManager.class));
diff --git a/tests/robotests/src/com/android/settings/applications/appinfo/DefaultPhoneShortcutPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/appinfo/DefaultPhoneShortcutPreferenceControllerTest.java
index bdb7ba3..4e7a800 100644
--- a/tests/robotests/src/com/android/settings/applications/appinfo/DefaultPhoneShortcutPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/appinfo/DefaultPhoneShortcutPreferenceControllerTest.java
@@ -18,13 +18,8 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
 import android.content.Context;
-import android.content.pm.PackageManager;
-
-import com.android.settings.applications.defaultapps.DefaultPhonePreferenceController;
+import android.permission.PermissionControllerManager;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -33,64 +28,30 @@
 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.shadows.ShadowApplication;
 
 @RunWith(RobolectricTestRunner.class)
 public class DefaultPhoneShortcutPreferenceControllerTest {
 
-    @Mock
-    private PackageManager mPackageManager;
+    private static final String TEST_PACKAGE_NAME = "TestPackage";
+    private static final String PREFERENCE_KEY = "default_phone_app";
 
-    private Context mContext;
+    @Mock
+    private PermissionControllerManager mPermissionControllerManager;
+
     private DefaultPhoneShortcutPreferenceController mController;
 
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
-        mContext = spy(RuntimeEnvironment.application);
-        when(mContext.getPackageManager()).thenReturn(mPackageManager);
-        mController = new DefaultPhoneShortcutPreferenceController(mContext, "Package1");
+        ShadowApplication.getInstance().setSystemService(Context.PERMISSION_CONTROLLER_SERVICE,
+                mPermissionControllerManager);
+        mController = new DefaultPhoneShortcutPreferenceController(RuntimeEnvironment.application,
+                TEST_PACKAGE_NAME);
     }
 
     @Test
     public void getPreferenceKey_shouldReturnDefaultPhone() {
-        assertThat(mController.getPreferenceKey()).isEqualTo("default_phone_app");
-    }
-
-    @Test
-    @Config(shadows = ShadowDefaultPhonePreferenceController.class)
-    public void hasAppCapability_hasPhoneCapability_shouldReturnTrue() {
-        assertThat(mController.hasAppCapability()).isTrue();
-    }
-
-    @Test
-    public void hasAppCapability_noPhoneCapability_shouldReturnFalse() {
-        assertThat(mController.hasAppCapability()).isFalse();
-    }
-
-    @Test
-    @Config(shadows = ShadowDefaultPhonePreferenceController.class)
-    public void isDefaultApp_isDefaultPhone_shouldReturnTrue() {
-        assertThat(mController.isDefaultApp()).isTrue();
-    }
-
-    @Test
-    public void isDefaultApp_notDefaultPhone_shouldReturnFalse() {
-        assertThat(mController.isDefaultApp()).isFalse();
-    }
-
-    @Implements(DefaultPhonePreferenceController.class)
-    public static class ShadowDefaultPhonePreferenceController {
-        @Implementation
-        protected static boolean hasPhonePreference(String pkg, Context context) {
-            return true;
-        }
-
-        @Implementation
-        protected static boolean isPhoneDefault(String pkg, Context context) {
-            return true;
-        }
+        assertThat(mController.getPreferenceKey()).isEqualTo(PREFERENCE_KEY);
     }
 }
diff --git a/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java b/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java
index 3dc0bc4..27aeccc 100644
--- a/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java
@@ -91,6 +91,8 @@
     private UserManager mUserManager;
     @Mock
     private PackageManager mPackageManager;
+
+    private Context mContext;
     private MenuItem mAppReset;
     private MenuItem mSortRecent;
     private MenuItem mSortFrequent;
@@ -99,6 +101,7 @@
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
+        mContext = RuntimeEnvironment.application;
         mAppReset = new RoboMenuItem(R.id.reset_app_preferences);
         mSortRecent = new RoboMenuItem(R.id.sort_order_recent_notification);
         mSortFrequent = new RoboMenuItem(R.id.sort_order_frequent_notification);
@@ -107,6 +110,7 @@
         when(mState.getBackgroundLooper()).thenReturn(Looper.myLooper());
 
         mFragment = spy(new ManageApplications());
+        when(mFragment.getContext()).thenReturn(mContext);
         when(mFragment.getActivity()).thenReturn(mActivity);
         when(mActivity.getResources()).thenReturn(mResources);
         when(mActivity.getSystemService(UserManager.class)).thenReturn(mUserManager);
@@ -460,6 +464,31 @@
         assertThat(mFragment.mSortOrder).isEqualTo(mSortFrequent.getItemId());
     }
 
+    @Test
+    public void updateFilterView_hasFilterSet_shouldShowFilterAndHavePaddingTop() {
+        mFragment.mContentContainer = new View(mContext);
+        mFragment.mSpinnerHeader = new View(mContext);
+        mFragment.mFilterAdapter = new ManageApplications.FilterSpinnerAdapter(mFragment);
+
+        mFragment.mFilterAdapter.updateFilterView(true);
+
+        assertThat(mFragment.mSpinnerHeader.getVisibility()).isEqualTo(View.VISIBLE);
+        assertThat(mFragment.mContentContainer.getPaddingTop()).isEqualTo(
+                mContext.getResources().getDimensionPixelSize(R.dimen.app_bar_height));
+    }
+
+    @Test
+    public void updateFilterView_noFilterSet_shouldHideFilterAndNoPaddingTop() {
+        mFragment.mContentContainer = new View(mContext);
+        mFragment.mSpinnerHeader = new View(mContext);
+        mFragment.mFilterAdapter = new ManageApplications.FilterSpinnerAdapter(mFragment);
+
+        mFragment.mFilterAdapter.updateFilterView(false);
+
+        assertThat(mFragment.mSpinnerHeader.getVisibility()).isEqualTo(View.GONE);
+        assertThat(mFragment.mContentContainer.getPaddingTop()).isEqualTo(0);
+    }
+
     private void setUpOptionMenus() {
         when(mMenu.findItem(anyInt())).thenAnswer(invocation -> {
             final Object[] args = invocation.getArguments();
diff --git a/tests/robotests/src/com/android/settings/backup/BackupSettingsActivityPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/backup/BackupSettingsActivityPreferenceControllerTest.java
deleted file mode 100644
index 97ddc4b..0000000
--- a/tests/robotests/src/com/android/settings/backup/BackupSettingsActivityPreferenceControllerTest.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.backup;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.verify;
-
-import android.app.backup.BackupManager;
-import android.content.Context;
-import android.os.UserManager;
-
-import androidx.preference.Preference;
-
-import com.android.settings.R;
-
-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.shadow.api.Shadow;
-import org.robolectric.shadows.ShadowApplication;
-import org.robolectric.shadows.ShadowUserManager;
-
-@RunWith(RobolectricTestRunner.class)
-public class BackupSettingsActivityPreferenceControllerTest {
-
-    private static final String KEY_BACKUP_SETTINGS = "backup_settings";
-
-    private Context mContext;
-    private BackupManager mBackupManager;
-    private UserManager mUserManager;
-
-    @Mock
-    private Preference mBackupPreference;
-
-    private BackupSettingsActivityPreferenceController mController;
-
-    @Before
-    public void setUp() {
-        MockitoAnnotations.initMocks(this);
-
-        mContext = RuntimeEnvironment.application;
-        mBackupManager = new BackupManager(mContext);
-
-        final ShadowApplication shadowApplication = ShadowApplication.getInstance();
-        shadowApplication.grantPermissions(android.Manifest.permission.BACKUP);
-        shadowApplication.setSystemService(Context.BACKUP_SERVICE, mBackupManager);
-
-        mUserManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
-
-        mController = new BackupSettingsActivityPreferenceController(mContext, KEY_BACKUP_SETTINGS);
-    }
-
-    @Test
-    public void updateState_backupOn() {
-        mBackupManager.setBackupEnabled(true);
-
-        mController.updateState(mBackupPreference);
-        String summaryString = mContext.getString(R.string.backup_summary_state_on);
-        verify(mBackupPreference).setSummary(summaryString);
-    }
-
-    @Test
-    public void updateState_backupOff() {
-        mBackupManager.setBackupEnabled(false);
-
-        mController.updateState(mBackupPreference);
-        String summaryString = mContext.getString(R.string.backup_summary_state_off);
-        verify(mBackupPreference).setSummary(summaryString);
-    }
-
-    @Test
-    public void isAvailable_systemUser() {
-        final ShadowUserManager sum = Shadow.extract(mUserManager);
-        sum.setIsAdminUser(true);
-
-        assertThat(mController.isAvailable()).isTrue();
-    }
-
-    @Test
-    public void isAvailable_nonSystemUser() {
-        final ShadowUserManager sum = Shadow.extract(mUserManager);
-        sum.setIsAdminUser(false);
-
-        assertThat(mController.isAvailable()).isFalse();
-    }
-
-    @Test
-    public void getPreferenceKey() {
-        assertThat(mController.getPreferenceKey()).isEqualTo(KEY_BACKUP_SETTINGS);
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/backup/BackupSettingsHelperTest.java b/tests/robotests/src/com/android/settings/backup/BackupSettingsHelperTest.java
index 9a809cc..ee8912a 100644
--- a/tests/robotests/src/com/android/settings/backup/BackupSettingsHelperTest.java
+++ b/tests/robotests/src/com/android/settings/backup/BackupSettingsHelperTest.java
@@ -31,12 +31,16 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.PackageManager;
+import android.content.pm.UserInfo;
 import android.content.res.Resources;
 import android.os.IBinder;
 import android.os.RemoteException;
 
+import android.os.UserHandle;
+import android.os.UserManager;
 import com.android.settings.R;
 
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -47,11 +51,12 @@
 import org.robolectric.annotation.Config;
 import org.robolectric.annotation.Implementation;
 import org.robolectric.annotation.Implements;
+import org.robolectric.shadow.api.Shadow;
+import org.robolectric.shadows.ShadowUserManager;
 
 @RunWith(RobolectricTestRunner.class)
 @Config(shadows = BackupSettingsHelperTest.ShadowBackupManagerStub.class)
 public class BackupSettingsHelperTest {
-
     private static final String DEFAULT_SETTINGS_CLASSNAME =
             "com.android.settings.Settings$PrivacySettingsActivity";
 
@@ -72,12 +77,46 @@
     @Mock
     private static IBackupManager mBackupManager;
 
+    private ShadowUserManager mUserManager;
+
     @Before
     public void setUp() throws Exception {
         MockitoAnnotations.initMocks(this);
         mContext = spy(RuntimeEnvironment.application.getApplicationContext());
         when(mBackupManager.getCurrentTransport()).thenReturn("test_transport");
         mBackupSettingsHelper = new BackupSettingsHelper(mContext);
+        mUserManager = Shadow.extract(mContext.getSystemService(Context.USER_SERVICE));
+    }
+
+    @Test
+    public void testGetSummary_backupEnabledOnlyOneProfile_showsOn() throws Exception {
+        mUserManager.addUserProfile(new UserHandle(0));
+        when(mBackupManager.isBackupEnabled()).thenReturn(true);
+
+        String backupSummary = mBackupSettingsHelper.getSummary();
+
+        assertThat(backupSummary).isEqualTo(mContext.getString(R.string.backup_summary_state_on));
+    }
+
+    @Test
+    public void testGetSummary_backupDisabledOnlyOneProfile_showsOff() throws Exception {
+        mUserManager.addUserProfile(new UserHandle(0));
+        when(mBackupManager.isBackupEnabled()).thenReturn(false);
+
+        String backupSummary = mBackupSettingsHelper.getSummary();
+
+        assertThat(backupSummary).isEqualTo(mContext.getString(R.string.backup_summary_state_off));
+    }
+
+    @Test
+    public void testGetSummary_TwoProfiles_returnsNull() throws Exception {
+        mUserManager.addUserProfile(new UserHandle(0));
+        mUserManager.addUserProfile(new UserHandle(10));
+        when(mBackupManager.isBackupEnabled()).thenReturn(true);
+
+        String backupSummary = mBackupSettingsHelper.getSummary();
+
+        assertThat(backupSummary).isNull();
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/backup/BackupSettingsActivityTest.java b/tests/robotests/src/com/android/settings/backup/UserBackupSettingsActivityTest.java
similarity index 82%
rename from tests/robotests/src/com/android/settings/backup/BackupSettingsActivityTest.java
rename to tests/robotests/src/com/android/settings/backup/UserBackupSettingsActivityTest.java
index 931bc1e..19a6051 100644
--- a/tests/robotests/src/com/android/settings/backup/BackupSettingsActivityTest.java
+++ b/tests/robotests/src/com/android/settings/backup/UserBackupSettingsActivityTest.java
@@ -35,8 +35,6 @@
 import androidx.fragment.app.FragmentManager;
 import androidx.fragment.app.FragmentTransaction;
 
-import com.android.settings.search.SearchIndexableRaw;
-
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -54,14 +52,12 @@
 import org.robolectric.annotation.Resetter;
 import org.robolectric.shadows.ShadowPackageManager;
 
-import java.util.List;
-
 @RunWith(RobolectricTestRunner.class)
-@Config(shadows = {BackupSettingsActivityTest.ShadowBackupSettingsHelper.class,
-                BackupSettingsActivityTest.ShadowUserHandle.class})
-public class BackupSettingsActivityTest {
-    private ActivityController<BackupSettingsActivity> mActivityController;
-    private BackupSettingsActivity mActivity;
+@Config(shadows = {UserBackupSettingsActivityTest.ShadowBackupSettingsHelper.class,
+                UserBackupSettingsActivityTest.ShadowUserHandle.class})
+public class UserBackupSettingsActivityTest {
+    private ActivityController<UserBackupSettingsActivity> mActivityController;
+    private UserBackupSettingsActivity mActivity;
     private Application mApplication;
     private ShadowPackageManager mPackageManager;
     private static boolean mIsBackupProvidedByOEM;
@@ -81,7 +77,7 @@
         MockitoAnnotations.initMocks(this);
 
         mApplication = RuntimeEnvironment.application;
-        mActivityController = Robolectric.buildActivity(BackupSettingsActivity.class);
+        mActivityController = Robolectric.buildActivity(UserBackupSettingsActivity.class);
         mActivity = mActivityController.get();
         mPackageManager = Shadows.shadowOf(mApplication.getPackageManager());
         when(mIntent.getComponent()).thenReturn(mComponent);
@@ -130,9 +126,9 @@
 
     @Test
     public void getNonIndexableKeys_SystemUser() {
-        assertThat(BackupSettingsActivity.SEARCH_INDEX_DATA_PROVIDER.getRawDataToIndex(
+        assertThat(UserBackupSettingsActivity.SEARCH_INDEX_DATA_PROVIDER.getRawDataToIndex(
                 mApplication, true)).isNotEmpty();
-        assertThat(BackupSettingsActivity.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(
+        assertThat(UserBackupSettingsActivity.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(
                 mApplication)).isEmpty();
     }
 
@@ -140,16 +136,10 @@
     public void getNonIndexableKeys_NonSystemUser() {
         ShadowUserHandle.setUid(1); // Non-SYSTEM user.
 
-        final List<SearchIndexableRaw> indexableRaws =
-                BackupSettingsActivity.SEARCH_INDEX_DATA_PROVIDER.getRawDataToIndex(
-                        mApplication, true);
-        final List<String> nonIndexableKeys =
-                BackupSettingsActivity.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(
-                        mApplication);
-
-        assertThat(indexableRaws).isNotNull();
-        assertThat(indexableRaws).isNotEmpty();
-        assertThat(nonIndexableKeys).isNotEmpty();
+        assertThat(UserBackupSettingsActivity.SEARCH_INDEX_DATA_PROVIDER.getRawDataToIndex(
+            mApplication, true)).isNotEmpty();
+        assertThat(UserBackupSettingsActivity.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(
+            mApplication)).isEmpty();
     }
 
     @Implements(BackupSettingsHelper.class)
diff --git a/tests/robotests/src/com/android/settings/connecteddevice/AdvancedConnectedDeviceDashboardFragmentTest.java b/tests/robotests/src/com/android/settings/connecteddevice/AdvancedConnectedDeviceDashboardFragmentTest.java
index 658a952..2a8aa8e 100644
--- a/tests/robotests/src/com/android/settings/connecteddevice/AdvancedConnectedDeviceDashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/connecteddevice/AdvancedConnectedDeviceDashboardFragmentTest.java
@@ -16,7 +16,11 @@
 package com.android.settings.connecteddevice;
 
 import static com.google.common.truth.Truth.assertThat;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
 
+import android.content.Context;
+import android.nfc.NfcAdapter;
 import android.provider.SearchIndexableResource;
 
 import com.android.settings.testutils.shadow.ShadowConnectivityManager;
@@ -26,6 +30,7 @@
 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;
@@ -40,6 +45,9 @@
 
     private AdvancedConnectedDeviceDashboardFragment mFragment;
 
+    @Mock
+    private NfcAdapter mNfcAdapter;
+
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
@@ -69,9 +77,13 @@
 
     @Test
     public void testSearchIndexProvider_correctNonIndexables() {
+        Context context = spy(RuntimeEnvironment.application);
+        when(context.getApplicationContext()).thenReturn(context);
+        when(NfcAdapter.getDefaultAdapter(context)).thenReturn(mNfcAdapter);
+        when(mNfcAdapter.deviceSupportsNfcSecure()).thenReturn(true);
         final List<String> niks =
                 AdvancedConnectedDeviceDashboardFragment.SEARCH_INDEX_DATA_PROVIDER
-                        .getNonIndexableKeys(RuntimeEnvironment.application);
+                        .getNonIndexableKeys(context);
 
         assertThat(niks).contains(AdvancedConnectedDeviceDashboardFragment.KEY_BLUETOOTH);
     }
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java
index 2aa6ae2..1c51b81 100644
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.dashboard;
 
+import static android.content.Intent.EXTRA_USER;
+
 import static com.android.settingslib.drawer.TileUtils.META_DATA_KEY_ORDER;
 import static com.android.settingslib.drawer.TileUtils.META_DATA_KEY_PROFILE;
 import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_KEYHINT;
@@ -67,6 +69,7 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Answers;
+import org.mockito.ArgumentCaptor;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 import org.robolectric.Robolectric;
@@ -412,4 +415,44 @@
                 .startActivityForResult(any(Intent.class), eq(0));
         verify(mActivity, never()).getSupportFragmentManager();
     }
+
+    @Test
+    public void openTileIntent_profileSelectionDialog_validUserHandleShouldNotShow() {
+        final int userId = 10;
+        ShadowUserManager.getShadow().addUser(userId, "Someone", 0);
+
+        final UserHandle userHandle = new UserHandle(userId);
+        final Tile tile = new Tile(mActivityInfo, CategoryKey.CATEGORY_HOMEPAGE);
+        tile.getIntent().putExtra(EXTRA_USER, userHandle);
+        final ArrayList<UserHandle> handles = new ArrayList<>();
+        handles.add(new UserHandle(0));
+        handles.add(userHandle);
+        tile.userHandle = handles;
+
+        mImpl.openTileIntent(mActivity, tile);
+
+        final ArgumentCaptor<UserHandle> argument = ArgumentCaptor.forClass(UserHandle.class);
+        verify(mActivity)
+            .startActivityForResultAsUser(any(Intent.class), anyInt(), argument.capture());
+        assertThat(argument.getValue().getIdentifier()).isEqualTo(userId);
+        verify(mActivity, never()).getSupportFragmentManager();
+    }
+
+    @Test
+    public void openTileIntent_profileSelectionDialog_invalidUserHandleShouldShow() {
+        ShadowUserManager.getShadow().addUser(10, "Someone", 0);
+
+        final Tile tile = new Tile(mActivityInfo, CategoryKey.CATEGORY_HOMEPAGE);
+        tile.getIntent().putExtra(EXTRA_USER, new UserHandle(30));
+        final ArrayList<UserHandle> handles = new ArrayList<>();
+        handles.add(new UserHandle(0));
+        handles.add(new UserHandle(10));
+        tile.userHandle = handles;
+
+        mImpl.openTileIntent(mActivity, tile);
+
+        verify(mActivity, never())
+            .startActivityForResultAsUser(any(Intent.class), anyInt(), any(UserHandle.class));
+        verify(mActivity).getSupportFragmentManager();
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/development/FileEncryptionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/FileEncryptionPreferenceControllerTest.java
index 68cbd32..61e650f 100644
--- a/tests/robotests/src/com/android/settings/development/FileEncryptionPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/FileEncryptionPreferenceControllerTest.java
@@ -16,9 +16,6 @@
 
 package com.android.settings.development;
 
-import static com.android.settings.development.FileEncryptionPreferenceController
-        .FILE_ENCRYPTION_PROPERTY_KEY;
-
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.ArgumentMatchers.anyBoolean;
@@ -29,9 +26,8 @@
 
 import android.content.Context;
 import android.os.RemoteException;
-import android.os.SystemProperties;
 import android.os.storage.IStorageManager;
-
+import android.sysprop.CryptoProperties;
 import androidx.preference.Preference;
 import androidx.preference.PreferenceScreen;
 
@@ -96,7 +92,7 @@
         ReflectionHelpers.setField(mController, "mStorageManager", mStorageManager);
         when(mStorageManager.isConvertibleToFBE()).thenReturn(true);
         mController.displayPreference(mPreferenceScreen);
-        SystemProperties.set(FILE_ENCRYPTION_PROPERTY_KEY, "foobar");
+        CryptoProperties.type("foobar");
 
         mController.updateState(mPreference);
 
@@ -110,7 +106,7 @@
         ReflectionHelpers.setField(mController, "mStorageManager", mStorageManager);
         when(mStorageManager.isConvertibleToFBE()).thenReturn(true);
         mController.displayPreference(mPreferenceScreen);
-        SystemProperties.set(FILE_ENCRYPTION_PROPERTY_KEY, "file");
+        CryptoProperties.type("file");
 
         mController.updateState(mPreference);
 
diff --git a/tests/robotests/src/com/android/settings/development/WifiConnectedMacRandomizationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/WifiConnectedMacRandomizationPreferenceControllerTest.java
deleted file mode 100644
index 60e7d47..0000000
--- a/tests/robotests/src/com/android/settings/development/WifiConnectedMacRandomizationPreferenceControllerTest.java
+++ /dev/null
@@ -1,124 +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.development;
-
-import static com.android.settings.development.WifiConnectedMacRandomizationPreferenceController
-        .SETTING_VALUE_OFF;
-import static com.android.settings.development.WifiConnectedMacRandomizationPreferenceController
-        .SETTING_VALUE_ON;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.when;
-
-import android.content.Context;
-import android.provider.Settings;
-
-import androidx.preference.PreferenceScreen;
-import androidx.preference.SwitchPreference;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.annotation.Config;
-
-@RunWith(RobolectricTestRunner.class)
-public class WifiConnectedMacRandomizationPreferenceControllerTest {
-
-    @Mock
-    private PreferenceScreen mPreferenceScreen;
-
-    private Context mContext;
-    private SwitchPreference mPreference;
-    private WifiConnectedMacRandomizationPreferenceController mController;
-
-    @Before
-    public void setup() {
-        MockitoAnnotations.initMocks(this);
-        mContext = RuntimeEnvironment.application;
-        mController = new WifiConnectedMacRandomizationPreferenceController(mContext);
-        mPreference = new SwitchPreference(mContext);
-        when(mPreferenceScreen.findPreference(mController.getPreferenceKey()))
-            .thenReturn(mPreference);
-        mController.displayPreference(mPreferenceScreen);
-    }
-
-    @Test
-    public void isAvailable_trueSupportFlag_shouldReturnTrue() {
-        assertThat(mController.isAvailable()).isTrue();
-    }
-
-    @Test
-    @Config(qualifiers = "mcc999")
-    public void isAvailable_falseSupportFlag_shouldReturnFalse() {
-        assertThat(mController.isAvailable()).isFalse();
-    }
-
-    @Test
-    public void onPreferenceChange_settingEnabled_shouldEnableConnectedMacRandomization() {
-        mController.onPreferenceChange(mPreference, true /* new value */);
-
-        final int mode = Settings.Global.getInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, -1 /* default */);
-
-        assertThat(mode).isEqualTo(SETTING_VALUE_ON);
-    }
-
-    @Test
-    public void onPreferenceChange_settingDisabled_shouldDisableConnectedMacRandomization() {
-        mController.onPreferenceChange(mPreference, false /* new value */);
-
-        final int mode = Settings.Global.getInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, -1 /* default */);
-
-        assertThat(mode).isEqualTo(SETTING_VALUE_OFF);
-    }
-
-    @Test
-    public void updateState_settingEnabled_shouldEnablePreference() {
-        Settings.Global.putInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, SETTING_VALUE_ON);
-        mController.updateState(mPreference);
-
-        assertThat(mPreference.isChecked()).isTrue();
-    }
-
-    @Test
-    public void updateState_settingDisabled_shouldDisablePreference() {
-        Settings.Global.putInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, SETTING_VALUE_OFF);
-        mController.updateState(mPreference);
-
-        assertThat(mPreference.isChecked()).isFalse();
-    }
-
-    @Test
-    public void onDeveloperOptionsSwitchDisabled_shouldDisablePreference() {
-        mController.onDeveloperOptionsSwitchDisabled();
-
-        final int mode = Settings.Global.getInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, -1 /* default */);
-
-        assertThat(mode).isEqualTo(SETTING_VALUE_OFF);
-        assertThat(mPreference.isChecked()).isFalse();
-        assertThat(mPreference.isEnabled()).isFalse();
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/development/gamedriver/GameDriverEnableForAllAppsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/gamedriver/GameDriverEnableForAllAppsPreferenceControllerTest.java
index 094cd21..3d418d9 100644
--- a/tests/robotests/src/com/android/settings/development/gamedriver/GameDriverEnableForAllAppsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/gamedriver/GameDriverEnableForAllAppsPreferenceControllerTest.java
@@ -21,6 +21,7 @@
 import static com.android.settings.development.gamedriver.GameDriverEnableForAllAppsPreferenceController.GAME_DRIVER_ALL_APPS;
 import static com.android.settings.development.gamedriver.GameDriverEnableForAllAppsPreferenceController.GAME_DRIVER_DEFAULT;
 import static com.android.settings.development.gamedriver.GameDriverEnableForAllAppsPreferenceController.GAME_DRIVER_OFF;
+
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.Mockito.atLeastOnce;
@@ -61,11 +62,14 @@
         MockitoAnnotations.initMocks(this);
         mContext = RuntimeEnvironment.application;
         mResolver = mContext.getContentResolver();
+
+        Settings.Global.putInt(mResolver, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
+        Settings.Global.putInt(
+                mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
+
         mController = new GameDriverEnableForAllAppsPreferenceController(mContext, "testKey");
         when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
         mController.displayPreference(mScreen);
-
-        Settings.Global.putInt(mResolver, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
     }
 
     @Test
@@ -151,7 +155,7 @@
         mController.onPreferenceChange(mPreference, true);
 
         assertThat(Settings.Global.getInt(
-                           mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT))
+                mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT))
                 .isEqualTo(GAME_DRIVER_ALL_APPS);
     }
 
@@ -162,7 +166,7 @@
         mController.onPreferenceChange(mPreference, false);
 
         assertThat(Settings.Global.getInt(
-                           mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT))
+                mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT))
                 .isEqualTo(GAME_DRIVER_DEFAULT);
     }
 }
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/ModuleVersionDialogControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/ModuleVersionDialogControllerTest.java
index e5958aa..b84ea99 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/ModuleVersionDialogControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/ModuleVersionDialogControllerTest.java
@@ -25,6 +25,9 @@
 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;
@@ -52,6 +55,17 @@
         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
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/batterytip/BatteryTipUtilsTest.java b/tests/robotests/src/com/android/settings/fuelgauge/batterytip/BatteryTipUtilsTest.java
index 3b024eb..275bfe0 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/batterytip/BatteryTipUtilsTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/batterytip/BatteryTipUtilsTest.java
@@ -18,7 +18,6 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
-import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
 
@@ -60,7 +59,8 @@
         MockitoAnnotations.initMocks(this);
 
         FakeFeatureFactory.setupForTest();
-        doReturn(RuntimeEnvironment.application).when(mFragment).getContext();
+        when(mSettingsActivity.getApplicationContext()).thenReturn(RuntimeEnvironment.application);
+        when(mFragment.getContext()).thenReturn(RuntimeEnvironment.application);
         mRestrictAppTip = spy(new RestrictAppTip(BatteryTip.StateType.NEW, new ArrayList<>()));
         mEarlyWarningTip = spy(
                 new EarlyWarningTip(BatteryTip.StateType.NEW, true /* powerSaveModeOn */));
diff --git a/tests/robotests/src/com/android/settings/gestures/WakeLockScreenGesturePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/gestures/WakeLockScreenGesturePreferenceControllerTest.java
deleted file mode 100644
index cd21351..0000000
--- a/tests/robotests/src/com/android/settings/gestures/WakeLockScreenGesturePreferenceControllerTest.java
+++ /dev/null
@@ -1,101 +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.gestures;
-
-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.ArgumentMatchers.anyInt;
-import static org.mockito.Mockito.when;
-
-import android.content.Context;
-
-import com.android.internal.hardware.AmbientDisplayConfiguration;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Answers;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-
-@RunWith(RobolectricTestRunner.class)
-public class WakeLockScreenGesturePreferenceControllerTest {
-
-    private static final String KEY_WAKE_LOCK_SCREEN = "gesture_wake_lock_screen";
-
-    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
-    private Context mContext;
-    @Mock
-    private AmbientDisplayConfiguration mAmbientDisplayConfiguration;
-
-    private WakeLockScreenGesturePreferenceController mController;
-
-    @Before
-    public void setUp() {
-        MockitoAnnotations.initMocks(this);
-        mController = new WakeLockScreenGesturePreferenceController(mContext, KEY_WAKE_LOCK_SCREEN);
-        mController.setConfig(mAmbientDisplayConfiguration);
-    }
-
-    @Test
-    public void testIsChecked_configIsSet_shouldReturnTrue() {
-        // Set the setting to be enabled.
-        when(mAmbientDisplayConfiguration.wakeLockScreenGestureEnabled(anyInt())).thenReturn(true);
-        assertThat(mController.isChecked()).isTrue();
-    }
-
-    @Test
-    public void testIsChecked_configIsNotSet_shouldReturnFalse() {
-        // Set the setting to be disabled.
-        when(mAmbientDisplayConfiguration.wakeLockScreenGestureEnabled(anyInt())).thenReturn(false);
-        assertThat(mController.isChecked()).isFalse();
-    }
-
-    @Test
-    public void getAvailabilityStatus_gestureNotSupported_UNSUPPORTED_ON_DEVICE() {
-        when(mAmbientDisplayConfiguration.wakeScreenGestureAvailable()).thenReturn(false);
-        final int availabilityStatus = mController.getAvailabilityStatus();
-
-        assertThat(availabilityStatus).isEqualTo(UNSUPPORTED_ON_DEVICE);
-    }
-
-    @Test
-    public void getAvailabilityStatus_gestureSupported_AVAILABLE() {
-        when(mAmbientDisplayConfiguration.wakeScreenGestureAvailable()).thenReturn(true);
-        final int availabilityStatus = mController.getAvailabilityStatus();
-
-        assertThat(availabilityStatus).isEqualTo(AVAILABLE);
-    }
-
-    @Test
-    public void isSliceableCorrectKey_returnsTrue() {
-        final WakeLockScreenGesturePreferenceController controller =
-                new WakeLockScreenGesturePreferenceController(mContext, KEY_WAKE_LOCK_SCREEN);
-        assertThat(controller.isSliceable()).isTrue();
-    }
-
-    @Test
-    public void isSliceableIncorrectKey_returnsFalse() {
-        final WakeLockScreenGesturePreferenceController controller =
-                new WakeLockScreenGesturePreferenceController(mContext, "bad_key");
-        assertThat(controller.isSliceable()).isFalse();
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/gestures/WakeLockScreenGestureSettingsTest.java b/tests/robotests/src/com/android/settings/gestures/WakeLockScreenGestureSettingsTest.java
deleted file mode 100644
index 686a0ff..0000000
--- a/tests/robotests/src/com/android/settings/gestures/WakeLockScreenGestureSettingsTest.java
+++ /dev/null
@@ -1,50 +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.gestures;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.provider.SearchIndexableResource;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-
-import java.util.List;
-
-@RunWith(RobolectricTestRunner.class)
-public class WakeLockScreenGestureSettingsTest {
-
-    private WakeLockScreenGestureSettings mSettings;
-
-    @Before
-    public void setUp() {
-        mSettings = new WakeLockScreenGestureSettings();
-    }
-
-    @Test
-    public void testSearchIndexProvider_shouldIndexResource() {
-        final List<SearchIndexableResource> indexRes =
-            WakeLockScreenGestureSettings.SEARCH_INDEX_DATA_PROVIDER.getXmlResourcesToIndex(
-                RuntimeEnvironment.application, true /* enabled */);
-
-        assertThat(indexRes).isNotNull();
-        assertThat(indexRes.get(0).xmlResId).isEqualTo(mSettings.getPreferenceScreenResId());
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/gestures/WakeScreenGesturePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/gestures/WakeScreenGesturePreferenceControllerTest.java
index ebc0f27..6149539 100644
--- a/tests/robotests/src/com/android/settings/gestures/WakeScreenGesturePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/gestures/WakeScreenGesturePreferenceControllerTest.java
@@ -21,12 +21,15 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
 
 import com.android.internal.hardware.AmbientDisplayConfiguration;
+import com.android.settings.aware.AwareFeatureProvider;
+import com.android.settings.testutils.FakeFeatureFactory;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -45,12 +48,15 @@
     private Context mContext;
     @Mock
     private AmbientDisplayConfiguration mAmbientDisplayConfiguration;
-
     private WakeScreenGesturePreferenceController mController;
 
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
+        AwareFeatureProvider featureProvider =
+                FakeFeatureFactory.setupForTest().getAwareFeatureProvider();
+        when(featureProvider.isSupported(any())).thenReturn(true);
+        when(featureProvider.isEnabled(any())).thenReturn(true);
         mController = new WakeScreenGesturePreferenceController(mContext, KEY_WAKE_SCREEN);
         mController.setConfig(mAmbientDisplayConfiguration);
     }
diff --git a/tests/robotests/src/com/android/settings/homepage/SettingsHomepageActivityTest.java b/tests/robotests/src/com/android/settings/homepage/SettingsHomepageActivityTest.java
index 1af8c32..b100460 100644
--- a/tests/robotests/src/com/android/settings/homepage/SettingsHomepageActivityTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/SettingsHomepageActivityTest.java
@@ -19,7 +19,9 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import android.util.FeatureFlagUtils;
+import android.view.View;
 
+import com.android.settings.R;
 import com.android.settings.SettingsActivity;
 import com.android.settings.core.FeatureFlags;
 
@@ -44,4 +46,23 @@
         assertThat(shadowActivity.getNextStartedActivity().getComponent().getClassName())
                 .isEqualTo(SettingsActivity.class.getName());
     }
+
+    @Test
+    public void setHomepageContainerPaddingTop_shouldBeSetPaddingTop() {
+        final SettingsHomepageActivity activity = Robolectric.buildActivity(
+                SettingsHomepageActivity.class).create().get();
+        final int statusBarHeight = activity.getResources().getDimensionPixelSize(
+                com.android.internal.R.dimen.status_bar_height);
+        final int searchBarHeight = activity.getResources().getDimensionPixelSize(
+                R.dimen.search_bar_height);
+        final int searchBarMargin = activity.getResources().getDimensionPixelSize(
+                R.dimen.search_bar_margin);
+        final View view = activity.findViewById(R.id.homepage_container);
+
+        activity.setHomepageContainerPaddingTop();
+
+        final int actualPaddingTop = view.getPaddingTop();
+        assertThat(actualPaddingTop).isEqualTo(
+                statusBarHeight + searchBarHeight + searchBarMargin * 2);
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/legacysuggestion/LegacySuggestionContextualCardControllerTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/legacysuggestion/LegacySuggestionContextualCardControllerTest.java
index ebc2154..a2d4d09 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/legacysuggestion/LegacySuggestionContextualCardControllerTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/legacysuggestion/LegacySuggestionContextualCardControllerTest.java
@@ -19,6 +19,7 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 import android.content.Context;
 
@@ -84,8 +85,10 @@
 
     @Test
     public void onServiceConnected_shouldLoadSuggestion() {
+        when(mSuggestionController.getSuggestions()).thenReturn(null);
         mController.mSuggestionController = mSuggestionController;
         mController.setCardUpdateListener(mCardUpdateListener);
+
         mController.onServiceConnected();
 
         verify(mSuggestionController).getSuggestions();
diff --git a/tests/robotests/src/com/android/settings/location/LocationEnablerTest.java b/tests/robotests/src/com/android/settings/location/LocationEnablerTest.java
index 806e2ec..fbae2f4 100644
--- a/tests/robotests/src/com/android/settings/location/LocationEnablerTest.java
+++ b/tests/robotests/src/com/android/settings/location/LocationEnablerTest.java
@@ -142,57 +142,6 @@
     }
 
     @Test
-    public void setLocationMode_restricted_shouldSetCurrentMode() {
-        when(mUserManager.hasUserRestriction(anyString())).thenReturn(true);
-        Settings.Secure.putInt(mContext.getContentResolver(),
-                Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_BATTERY_SAVING);
-
-        mEnabler.setLocationMode(Settings.Secure.LOCATION_MODE_HIGH_ACCURACY);
-
-        verify(mListener).onLocationModeChanged(Settings.Secure.LOCATION_MODE_BATTERY_SAVING, true);
-    }
-
-    @Test
-    public void setLocationMode_notRestricted_shouldUpdateSecureSettings() {
-        when(mUserManager.hasUserRestriction(anyString())).thenReturn(false);
-        Settings.Secure.putInt(mContext.getContentResolver(),
-                Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_BATTERY_SAVING);
-
-        mEnabler.setLocationMode(Settings.Secure.LOCATION_MODE_HIGH_ACCURACY);
-
-        assertThat(Settings.Secure.getInt(mContext.getContentResolver(),
-                Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_BATTERY_SAVING))
-                .isEqualTo(Settings.Secure.LOCATION_MODE_HIGH_ACCURACY);
-    }
-
-    @Test
-    public void setLocationMode_notRestricted_shouldRefreshLocation() {
-        when(mUserManager.hasUserRestriction(anyString())).thenReturn(false);
-        Settings.Secure.putInt(mContext.getContentResolver(),
-                Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_BATTERY_SAVING);
-
-        mEnabler.setLocationMode(Settings.Secure.LOCATION_MODE_HIGH_ACCURACY);
-
-        verify(mEnabler).refreshLocationMode();
-    }
-
-    @Test
-    public void setLocationMode_notRestricted_shouldBroadcastUpdateAndSetChanger() {
-        when(mUserManager.hasUserRestriction(anyString())).thenReturn(false);
-        Settings.Secure.putInt(mContext.getContentResolver(),
-                Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_BATTERY_SAVING);
-        mEnabler.setLocationMode(Settings.Secure.LOCATION_MODE_HIGH_ACCURACY);
-
-        verify(mContext).sendBroadcastAsUser(
-                argThat(actionMatches(LocationManager.MODE_CHANGING_ACTION)),
-                eq(UserHandle.of(ActivityManager.getCurrentUser())),
-                eq(WRITE_SECURE_SETTINGS));
-        assertThat(Settings.Secure.getInt(mContext.getContentResolver(),
-                Settings.Secure.LOCATION_CHANGER, Settings.Secure.LOCATION_CHANGER_UNKNOWN))
-                .isEqualTo(Settings.Secure.LOCATION_CHANGER_SYSTEM_SETTINGS);
-    }
-
-    @Test
     public void setLocationEnabled_notRestricted_shouldRefreshLocation() {
         when(mUserManager.hasUserRestriction(anyString())).thenReturn(false);
         Settings.Secure.putInt(mContext.getContentResolver(),
diff --git a/tests/robotests/src/com/android/settings/location/RecentLocationAccessPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/location/RecentLocationAccessPreferenceControllerTest.java
index 8cba1de..2d3cb0c 100644
--- a/tests/robotests/src/com/android/settings/location/RecentLocationAccessPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/location/RecentLocationAccessPreferenceControllerTest.java
@@ -24,6 +24,7 @@
 
 import android.content.Context;
 import android.graphics.drawable.Drawable;
+import android.provider.DeviceConfig;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.ImageView;
@@ -32,9 +33,11 @@
 import androidx.preference.PreferenceScreen;
 
 import com.android.settings.R;
+import com.android.settings.testutils.shadow.ShadowDeviceConfig;
 import com.android.settingslib.location.RecentLocationAccesses;
 import com.android.settingslib.widget.LayoutPreference;
 
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -43,11 +46,13 @@
 import org.mockito.MockitoAnnotations;
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
 
 import java.util.ArrayList;
 import java.util.List;
 
 @RunWith(RobolectricTestRunner.class)
+@Config(shadows = {ShadowDeviceConfig.class})
 public class RecentLocationAccessPreferenceControllerTest {
     @Mock
     private LayoutPreference mLayoutPreference;
@@ -76,6 +81,25 @@
                 mAppEntitiesHeaderView);
     }
 
+    @After
+    public void tearDown() {
+        ShadowDeviceConfig.reset();
+    }
+
+    @Test
+    public void isAvailable_permissionHubNotSet_shouldReturnFalse() {
+        // We have not yet set the property to show the Permissions Hub.
+        assertThat(mController.isAvailable()).isEqualTo(false);
+    }
+
+    @Test
+    public void isAvailable_permissionHubEnabled_shouldReturnTrue() {
+        DeviceConfig.setProperty(DeviceConfig.Privacy.NAMESPACE,
+                DeviceConfig.Privacy.PROPERTY_PERMISSIONS_HUB_ENABLED, "true", true);
+
+        assertThat(mController.isAvailable()).isEqualTo(true);
+    }
+
     /** Verifies the title text, details text are correct, and the click listener is set. */
     @Test
     @Ignore
diff --git a/tests/robotests/src/com/android/settings/network/MobileNetworkSummaryControllerTest.java b/tests/robotests/src/com/android/settings/network/MobileNetworkSummaryControllerTest.java
index f0c012d..6a1abd1 100644
--- a/tests/robotests/src/com/android/settings/network/MobileNetworkSummaryControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/MobileNetworkSummaryControllerTest.java
@@ -16,10 +16,16 @@
 
 package com.android.settings.network;
 
+import static android.telephony.TelephonyManager.MultiSimVariants.DSDS;
+import static android.telephony.TelephonyManager.MultiSimVariants.UNKNOWN;
+
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.isNull;
+import static org.mockito.ArgumentMatchers.notNull;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
@@ -28,8 +34,11 @@
 import android.content.Context;
 import android.content.Intent;
 import android.telephony.SubscriptionInfo;
+import android.telephony.TelephonyManager;
+import android.telephony.euicc.EuiccManager;
 
 import com.android.settings.network.telephony.MobileNetworkActivity;
+import com.android.settings.widget.AddPreference;
 
 import org.junit.After;
 import org.junit.Before;
@@ -44,7 +53,6 @@
 import java.util.Arrays;
 
 import androidx.lifecycle.Lifecycle;
-import androidx.preference.Preference;
 import androidx.preference.PreferenceScreen;
 
 @RunWith(RobolectricTestRunner.class)
@@ -52,10 +60,12 @@
     @Mock
     private Lifecycle mLifecycle;
     @Mock
-    PreferenceScreen mPreferenceScreen;
+    private TelephonyManager mTelephonyManager;
 
-    Preference mPreference;
+    @Mock
+    private PreferenceScreen mPreferenceScreen;
 
+    private AddPreference mPreference;
     private Context mContext;
     private MobileNetworkSummaryController mController;
 
@@ -63,8 +73,11 @@
     public void setUp() {
         MockitoAnnotations.initMocks(this);
         mContext = spy(Robolectric.setupActivity(Activity.class));
+        when(mContext.getSystemService(eq(TelephonyManager.class))).thenReturn(mTelephonyManager);
+        when(mTelephonyManager.getMultiSimConfiguration()).thenReturn(UNKNOWN);
+
         mController = new MobileNetworkSummaryController(mContext, mLifecycle);
-        mPreference = new Preference(mContext);
+        mPreference = spy(new AddPreference(mContext, null));
         mPreference.setKey(mController.getPreferenceKey());
         when(mPreferenceScreen.findPreference(eq(mController.getPreferenceKey()))).thenReturn(
                 mPreference);
@@ -76,15 +89,21 @@
     }
 
     @Test
-    public void getSummary_noSubscriptions_correctSummary() {
+    public void getSummary_noSubscriptions_correctSummaryAndClickHandler() {
         mController.displayPreference(mPreferenceScreen);
         mController.onResume();
         assertThat(mController.getSummary()).isEqualTo("Add a network");
+
+        mPreference.getOnPreferenceClickListener().onPreferenceClick(mPreference);
+        final ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
+        verify(mContext).startActivity(intentCaptor.capture());
+        assertThat(intentCaptor.getValue().getAction()).isEqualTo(
+                EuiccManager.ACTION_PROVISION_EMBEDDED_SUBSCRIPTION);
     }
 
     @Test
     public void getSummary_oneSubscription_correctSummaryAndClickHandler() {
-        SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
+        final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
         when(sub1.getSubscriptionId()).thenReturn(1);
         when(sub1.getDisplayName()).thenReturn("sub1");
         SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(sub1));
@@ -93,7 +112,7 @@
         assertThat(mController.getSummary()).isEqualTo("sub1");
         assertThat(mPreference.getFragment()).isNull();
         mPreference.getOnPreferenceClickListener().onPreferenceClick(mPreference);
-        ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
+        final ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
         verify(mContext).startActivity(intentCaptor.capture());
         assertThat(intentCaptor.getValue().getComponent().getClassName()).isEqualTo(
                 MobileNetworkActivity.class.getName());
@@ -101,8 +120,8 @@
 
     @Test
     public void getSummary_twoSubscriptions_correctSummaryAndFragment() {
-        SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
-        SubscriptionInfo sub2 = mock(SubscriptionInfo.class);
+        final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
+        final SubscriptionInfo sub2 = mock(SubscriptionInfo.class);
         when(sub1.getSubscriptionId()).thenReturn(1);
         when(sub2.getSubscriptionId()).thenReturn(2);
 
@@ -115,8 +134,8 @@
 
     @Test
     public void getSummaryAfterUpdate_twoSubscriptionsBecomesOne_correctSummaryAndFragment() {
-        SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
-        SubscriptionInfo sub2 = mock(SubscriptionInfo.class);
+        final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
+        final SubscriptionInfo sub2 = mock(SubscriptionInfo.class);
         when(sub1.getSubscriptionId()).thenReturn(1);
         when(sub2.getSubscriptionId()).thenReturn(2);
         when(sub1.getDisplayName()).thenReturn("sub1");
@@ -135,7 +154,7 @@
         assertThat(mController.getSummary()).isEqualTo("sub1");
         assertThat(mPreference.getFragment()).isNull();
         mPreference.getOnPreferenceClickListener().onPreferenceClick(mPreference);
-        ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
+        final ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
         verify(mContext).startActivity(intentCaptor.capture());
         assertThat(intentCaptor.getValue().getComponent().getClassName()).isEqualTo(
                 MobileNetworkActivity.class.getName());
@@ -143,8 +162,8 @@
 
     @Test
     public void getSummaryAfterUpdate_oneSubscriptionBecomesTwo_correctSummaryAndFragment() {
-        SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
-        SubscriptionInfo sub2 = mock(SubscriptionInfo.class);
+        final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
+        final SubscriptionInfo sub2 = mock(SubscriptionInfo.class);
         when(sub1.getSubscriptionId()).thenReturn(1);
         when(sub2.getSubscriptionId()).thenReturn(2);
         when(sub1.getDisplayName()).thenReturn("sub1");
@@ -156,7 +175,7 @@
         assertThat(mController.getSummary()).isEqualTo("sub1");
         assertThat(mPreference.getFragment()).isNull();
         mPreference.getOnPreferenceClickListener().onPreferenceClick(mPreference);
-        ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
+        final ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
         verify(mContext).startActivity(intentCaptor.capture());
         assertThat(intentCaptor.getValue().getComponent().getClassName()).isEqualTo(
                 MobileNetworkActivity.class.getName());
@@ -168,4 +187,53 @@
         assertThat(mController.getSummary()).isEqualTo("2 SIMs");
         assertThat(mPreference.getFragment()).isEqualTo(MobileNetworkListFragment.class.getName());
     }
+
+    @Test
+    public void addButton_noSubscriptionsSingleSimMode_noAddClickListener() {
+        mController.displayPreference(mPreferenceScreen);
+        mController.onResume();
+        verify(mPreference, never()).setOnAddClickListener(notNull());
+    }
+
+    @Test
+    public void addButton_oneSubscriptionSingleSimMode_noAddClickListener() {
+        final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
+        SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(sub1));
+        mController.displayPreference(mPreferenceScreen);
+        mController.onResume();
+        verify(mPreference, never()).setOnAddClickListener(notNull());
+    }
+
+    @Test
+    public void addButton_noSubscriptionsMultiSimMode_hasAddClickListenerAndPrefDisabled() {
+        when(mTelephonyManager.getMultiSimConfiguration()).thenReturn(DSDS);
+        mController.displayPreference(mPreferenceScreen);
+        mController.onResume();
+        assertThat(mPreference.isEnabled()).isFalse();
+        verify(mPreference, never()).setOnAddClickListener(isNull());
+        verify(mPreference).setOnAddClickListener(notNull());
+    }
+
+    @Test
+    public void addButton_oneSubscriptionMultiSimMode_hasAddClickListener() {
+        when(mTelephonyManager.getMultiSimConfiguration()).thenReturn(DSDS);
+        final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
+        SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(sub1));
+        mController.displayPreference(mPreferenceScreen);
+        mController.onResume();
+        verify(mPreference, never()).setOnAddClickListener(isNull());
+        verify(mPreference).setOnAddClickListener(notNull());
+    }
+
+    @Test
+    public void addButton_twoSubscriptionsMultiSimMode_hasAddClickListener() {
+        when(mTelephonyManager.getMultiSimConfiguration()).thenReturn(DSDS);
+        final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
+        final SubscriptionInfo sub2 = mock(SubscriptionInfo.class);
+        SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(sub1, sub2));
+        mController.displayPreference(mPreferenceScreen);
+        mController.onResume();
+        verify(mPreference, never()).setOnAddClickListener(isNull());
+        verify(mPreference).setOnAddClickListener(notNull());
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragmentTest.java b/tests/robotests/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragmentTest.java
new file mode 100644
index 0000000..df52302
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragmentTest.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.network.telephony;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.content.DialogInterface;
+import android.telephony.ServiceState;
+import android.telephony.SubscriptionInfo;
+import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
+import android.widget.Button;
+import android.widget.EditText;
+
+import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.Robolectric;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.annotation.Config;
+
+import androidx.appcompat.app.AlertDialog;
+import androidx.fragment.app.FragmentActivity;
+
+@RunWith(RobolectricTestRunner.class)
+@Config(shadows = ShadowAlertDialogCompat.class)
+public class RenameMobileNetworkDialogFragmentTest {
+    @Mock
+    private TelephonyManager mTelephonyMgr;
+    @Mock
+    private SubscriptionManager mSubscriptionMgr;
+    @Mock
+    private SubscriptionInfo mSubscriptionInfo;
+
+    private FragmentActivity mActivity;
+    private RenameMobileNetworkDialogFragment mFragment;
+    private int mSubscriptionId = 1234;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mActivity = spy(Robolectric.buildActivity(FragmentActivity.class).setup().get());
+
+        when(mSubscriptionInfo.getSubscriptionId()).thenReturn(mSubscriptionId);
+        when(mSubscriptionInfo.getDisplayName()).thenReturn("test");
+
+        mFragment = spy(RenameMobileNetworkDialogFragment.newInstance(mSubscriptionId));
+        doReturn(mTelephonyMgr).when(mFragment).getTelephonyManager(any());
+        doReturn(mSubscriptionMgr).when(mFragment).getSubscriptionManager(any());
+
+        final ServiceState serviceState = mock(ServiceState.class);
+        when(serviceState.getOperatorAlphaLong()).thenReturn("fake carrier name");
+        when(mTelephonyMgr.getServiceStateForSubscriber(mSubscriptionId)).thenReturn(serviceState);
+    }
+
+    @Test
+    public void dialog_subscriptionMissing_noCrash() {
+        final AlertDialog dialog = startDialog();
+        final Button negativeButton = dialog.getButton(DialogInterface.BUTTON_NEGATIVE);
+        assertThat(negativeButton).isNotNull();
+        negativeButton.performClick();
+    }
+
+    @Test
+    public void dialog_cancelButtonClicked_setDisplayNameNotCalled() {
+        when(mSubscriptionMgr.getActiveSubscriptionInfo(mSubscriptionId)).thenReturn(
+                mSubscriptionInfo);
+        final AlertDialog dialog = startDialog();
+        final EditText nameView = mFragment.getNameView();
+        nameView.setText("test2");
+
+        final Button negativeButton = dialog.getButton(DialogInterface.BUTTON_NEGATIVE);
+        negativeButton.performClick();
+
+        verify(mSubscriptionMgr, never()).setDisplayName(anyString(), anyInt());
+    }
+
+    @Test
+    public void dialog_renameButtonClicked_setDisplayNameCalled() {
+        when(mSubscriptionMgr.getActiveSubscriptionInfo(mSubscriptionId)).thenReturn(
+                mSubscriptionInfo);
+
+        final AlertDialog dialog = startDialog();
+        final EditText nameView = mFragment.getNameView();
+        nameView.setText("test2");
+
+        final Button positiveButton = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
+        positiveButton.performClick();
+
+        final ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
+        verify(mSubscriptionMgr).setDisplayName(captor.capture(), eq(mSubscriptionId));
+        assertThat(captor.getValue()).isEqualTo("test2");
+    }
+
+    /** Helper method to start the dialog */
+    private AlertDialog startDialog() {
+        mFragment.show(mActivity.getSupportFragmentManager(), null);
+        return ShadowAlertDialogCompat.getLatestAlertDialog();
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/notification/OWNERS b/tests/robotests/src/com/android/settings/notification/OWNERS
index 0d73685..edf266e 100644
--- a/tests/robotests/src/com/android/settings/notification/OWNERS
+++ b/tests/robotests/src/com/android/settings/notification/OWNERS
@@ -1,4 +1,4 @@
 # Default reviewers for this and subdirectories.
 asc@google.com
-dsandler@google.com
+dsandler@android.com
 juliacr@google.com
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/notification/SilentStatusBarPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/SilentStatusBarPreferenceControllerTest.java
new file mode 100644
index 0000000..9dd8ff9
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/notification/SilentStatusBarPreferenceControllerTest.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.notification;
+
+import static android.provider.Settings.Secure.NOTIFICATION_NEW_INTERRUPTION_MODEL;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.provider.Settings;
+
+import com.android.settings.testutils.FakeFeatureFactory;
+
+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 androidx.preference.Preference;
+import androidx.preference.PreferenceScreen;
+
+@RunWith(RobolectricTestRunner.class)
+public class SilentStatusBarPreferenceControllerTest {
+
+    @Mock
+    private NotificationBackend mBackend;
+    @Mock
+    private PreferenceScreen mScreen;
+
+    private Context mContext;
+    private SilentStatusBarPreferenceController mController;
+    private Preference mPreference;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mContext = RuntimeEnvironment.application;
+        mController = new SilentStatusBarPreferenceController(mContext);
+        mController.setBackend(mBackend);
+        mPreference = new Preference(mContext);
+        mPreference.setKey(mController.getPreferenceKey());
+        when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
+    }
+
+    @Test
+    public void isAvailable_featureEnabled() {
+        Settings.Secure.putInt(
+                mContext.getContentResolver(), NOTIFICATION_NEW_INTERRUPTION_MODEL, 1);
+        assertThat(mController.isAvailable()).isTrue();
+    }
+
+    @Test
+    public void isAvailable_featureDisabled() {
+        Settings.Secure.putInt(
+                mContext.getContentResolver(), NOTIFICATION_NEW_INTERRUPTION_MODEL, 0);
+        assertThat(mController.isAvailable()).isFalse();
+    }
+
+    @Test
+    public void isChecked_settingIsOff_false() {
+        when(mBackend.shouldHideSilentStatusBarIcons(any())).thenReturn(false);
+        assertThat(mController.isChecked()).isFalse();
+    }
+
+    @Test
+    public void isChecked_settingIsOn_true() {
+        when(mBackend.shouldHideSilentStatusBarIcons(any())).thenReturn(true);
+        assertThat(mController.isChecked()).isTrue();
+    }
+
+    @Test
+    public void onPreferenceChange_on() {
+        mController.onPreferenceChange(mPreference, true);
+        verify(mBackend).setHideSilentStatusIcons(true);
+    }
+
+    @Test
+    public void onPreferenceChange_off() {
+        mController.onPreferenceChange(mPreference, false);
+        verify(mBackend).setHideSilentStatusIcons(false);
+    }
+}
+
diff --git a/tests/robotests/src/com/android/settings/notification/SoundSettingsTest.java b/tests/robotests/src/com/android/settings/notification/SoundSettingsTest.java
index 4f3dce6..56d0828 100644
--- a/tests/robotests/src/com/android/settings/notification/SoundSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/notification/SoundSettingsTest.java
@@ -32,6 +32,7 @@
 import com.android.settings.R;
 import com.android.settings.testutils.XmlTestUtils;
 import com.android.settings.testutils.shadow.ShadowAudioHelper;
+import com.android.settings.testutils.shadow.ShadowDeviceConfig;
 import com.android.settings.testutils.shadow.ShadowUserManager;
 
 import org.junit.Test;
@@ -47,7 +48,7 @@
 public class SoundSettingsTest {
 
     @Test
-    @Config(shadows = {ShadowUserManager.class, ShadowAudioHelper.class})
+    @Config(shadows = {ShadowUserManager.class, ShadowAudioHelper.class, ShadowDeviceConfig.class})
     public void getNonIndexableKeys_existInXmlLayout() {
         final Context context = spy(RuntimeEnvironment.application);
         AudioManager audioManager = mock(AudioManager.class);
diff --git a/tests/robotests/src/com/android/settings/notification/VibrateWhenRingPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/VibrateWhenRingPreferenceControllerTest.java
index 7334b45..3f53ce9 100644
--- a/tests/robotests/src/com/android/settings/notification/VibrateWhenRingPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/VibrateWhenRingPreferenceControllerTest.java
@@ -29,6 +29,7 @@
 
 import android.content.ContentResolver;
 import android.content.Context;
+import android.provider.DeviceConfig;
 import android.provider.Settings;
 import android.telephony.TelephonyManager;
 
@@ -36,17 +37,21 @@
 import androidx.preference.PreferenceScreen;
 import androidx.preference.TwoStatePreference;
 
+import com.android.settings.testutils.shadow.ShadowDeviceConfig;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
+import org.robolectric.annotation.Config;
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
 import org.robolectric.shadow.api.Shadow;
 import org.robolectric.shadows.ShadowContentResolver;
 
 @RunWith(RobolectricTestRunner.class)
+@Config(shadows={ShadowDeviceConfig.class})
 public class VibrateWhenRingPreferenceControllerTest {
 
     private static final String KEY_VIBRATE_WHEN_RINGING = "vibrate_when_ringing";
@@ -74,20 +79,42 @@
     }
 
     @Test
-    public void display_voiceCapable_shouldDisplay() {
+    public void display_shouldDisplay() {
         when(mTelephonyManager.isVoiceCapable()).thenReturn(true);
-
+        DeviceConfig.setProperty("namespace", "key", "false", false);
         mController.displayPreference(mScreen);
-
         assertThat(mPreference.isVisible()).isTrue();
     }
 
     @Test
-    public void display_notVoiceCapable_shouldNotDisplay() {
+    public void display_shouldNotDisplay_notVoiceCapable() {
         when(mTelephonyManager.isVoiceCapable()).thenReturn(false);
-
+        DeviceConfig.setProperty("namespace", "key", "false", false);
         mController.displayPreference(mScreen);
+        assertThat(mPreference.isVisible()).isFalse();
+    }
 
+    @Test
+    public void display_shouldNotDisplay_RampingRingerEnabled() {
+        when(mTelephonyManager.isVoiceCapable()).thenReturn(true);
+        DeviceConfig.setProperty("namespace", "key", "true", false);
+        mController.displayPreference(mScreen);
+        assertThat(mPreference.isVisible()).isFalse();
+    }
+
+    @Test
+    public void display_shouldNotDisplay_VoiceEnabled_RampingRingerEnabled() {
+        when(mTelephonyManager.isVoiceCapable()).thenReturn(true);
+        DeviceConfig.setProperty("namespace", "key", "true", false);
+        mController.displayPreference(mScreen);
+        assertThat(mPreference.isVisible()).isFalse();
+    }
+
+    @Test
+    public void display_shouldNotDisplay_VoiceDisabled_RampingRingerEnabled() {
+        when(mTelephonyManager.isVoiceCapable()).thenReturn(false);
+        DeviceConfig.setProperty("namespace", "key", "true", false);
+        mController.displayPreference(mScreen);
         assertThat(mPreference.isVisible()).isFalse();
     }
 
@@ -112,14 +139,14 @@
     @Test
     public void voiceCapable_availabled() {
         when(mTelephonyManager.isVoiceCapable()).thenReturn(true);
-
+        DeviceConfig.setProperty("namespace", "key", "false", false);
         assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
     }
 
     @Test
     public void voiceCapable_notAvailabled() {
         when(mTelephonyManager.isVoiceCapable()).thenReturn(false);
-
+        DeviceConfig.setProperty("namespace", "key", "false", false);
         assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
     }
 
@@ -197,4 +224,5 @@
                 new VibrateWhenRingPreferenceController(mContext, "bad_key");
         assertThat(controller.isSliceable()).isFalse();
     }
+
 }
diff --git a/tests/robotests/src/com/android/settings/privacy/PermissionBarChartPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/privacy/PermissionBarChartPreferenceControllerTest.java
index 119ac7d..b947630 100644
--- a/tests/robotests/src/com/android/settings/privacy/PermissionBarChartPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/privacy/PermissionBarChartPreferenceControllerTest.java
@@ -17,6 +17,7 @@
 package com.android.settings.privacy;
 
 import static com.android.settings.core.BasePreferenceController.AVAILABLE_UNSEARCHABLE;
+import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
 
 import static com.google.common.truth.Truth.assertThat;
 
@@ -28,13 +29,16 @@
 
 import android.content.Context;
 import android.permission.RuntimePermissionUsageInfo;
+import android.provider.DeviceConfig;
 
 import androidx.preference.PreferenceScreen;
 
+import com.android.settings.testutils.shadow.ShadowDeviceConfig;
 import com.android.settingslib.widget.BarChartInfo;
 import com.android.settingslib.widget.BarChartPreference;
 import com.android.settingslib.widget.BarViewInfo;
 
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -42,11 +46,13 @@
 import org.mockito.MockitoAnnotations;
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
 
 import java.util.ArrayList;
 import java.util.List;
 
 @RunWith(RobolectricTestRunner.class)
+@Config(shadows = {ShadowDeviceConfig.class})
 public class PermissionBarChartPreferenceControllerTest {
 
     @Mock
@@ -65,8 +71,22 @@
                 .thenReturn((BarChartPreference) mPreference);
     }
 
+    @After
+    public void tearDown() {
+        ShadowDeviceConfig.reset();
+    }
+
     @Test
-    public void getAvailabilityStatus_shouldReturnAvailableUnsearchable() {
+    public void getAvailabilityStatus_permissionHubNotSet_shouldReturnUnsupported() {
+        // We have not yet set the property to show the Permissions Hub.
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
+    }
+
+    @Test
+    public void getAvailabilityStatus_permissionHubEnabled_shouldReturnAvailableUnsearchable() {
+        DeviceConfig.setProperty(DeviceConfig.Privacy.NAMESPACE,
+                DeviceConfig.Privacy.PROPERTY_PERMISSIONS_HUB_ENABLED, "true", true);
+
         assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE_UNSEARCHABLE);
     }
 
diff --git a/tests/robotests/src/com/android/settings/search/SearchFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/search/SearchFeatureProviderImplTest.java
index 7f709d6..444a813 100644
--- a/tests/robotests/src/com/android/settings/search/SearchFeatureProviderImplTest.java
+++ b/tests/robotests/src/com/android/settings/search/SearchFeatureProviderImplTest.java
@@ -20,10 +20,12 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import android.app.Activity;
+import android.app.settings.SettingsEnums;
 import android.content.ComponentName;
 import android.content.Intent;
 import android.content.pm.ActivityInfo;
 import android.content.pm.ResolveInfo;
+import android.net.Uri;
 import android.provider.Settings;
 import android.widget.Toolbar;
 
@@ -60,19 +62,19 @@
     @Test
     @Config(shadows = ShadowUtils.class)
     public void initSearchToolbar_hasResolvedInfo_shouldStartCorrectIntent() {
-        final Intent searchIntent = new Intent(SearchFeatureProvider.SEARCH_UI_INTENT)
+        final Intent searchIntent = new Intent(Settings.ACTION_APP_SEARCH_SETTINGS)
                 .setPackage(mActivity.getString(R.string.config_settingsintelligence_package_name));
         final ResolveInfo info = new ResolveInfo();
         info.activityInfo = new ActivityInfo();
         mPackageManager.addResolveInfoForIntent(searchIntent, info);
 
         // Should not crash.
-        mProvider.initSearchToolbar(mActivity, null);
+        mProvider.initSearchToolbar(mActivity, null, SettingsEnums.TESTING);
 
         final Toolbar toolbar = new Toolbar(mActivity);
         // This ensures navigationView is created.
         toolbar.setNavigationContentDescription("test");
-        mProvider.initSearchToolbar(mActivity, toolbar);
+        mProvider.initSearchToolbar(mActivity, toolbar, SettingsEnums.TESTING);
 
         toolbar.performClick();
 
@@ -87,7 +89,7 @@
         final Toolbar toolbar = new Toolbar(mActivity);
         // This ensures navigationView is created.
         toolbar.setNavigationContentDescription("test");
-        mProvider.initSearchToolbar(mActivity, toolbar);
+        mProvider.initSearchToolbar(mActivity, toolbar, SettingsEnums.TESTING);
 
         toolbar.performClick();
 
@@ -108,6 +110,15 @@
         assertThat(Shadows.shadowOf(mActivity).getNextStartedActivity()).isNull();
     }
 
+    @Test
+    public void buildSearchIntent_shouldIncludeReferrer() {
+        final Intent searchIntent = mProvider.buildSearchIntent(mActivity, SettingsEnums.TESTING);
+        final Uri referrer = searchIntent.getParcelableExtra(Intent.EXTRA_REFERRER);
+
+        assertThat(referrer.toSafeString()).isEqualTo(
+                "android-app://" + mActivity.getPackageName() + "/" + SettingsEnums.TESTING);
+    }
+
     @Test(expected = IllegalArgumentException.class)
     public void verifyLaunchSearchResultPageCaller_nullCaller_shouldCrash() {
         mProvider.verifyLaunchSearchResultPageCaller(mActivity, null /* caller */);
diff --git a/tests/robotests/src/com/android/settings/search/actionbar/SearchMenuControllerTest.java b/tests/robotests/src/com/android/settings/search/actionbar/SearchMenuControllerTest.java
index af1a82d..3063912 100644
--- a/tests/robotests/src/com/android/settings/search/actionbar/SearchMenuControllerTest.java
+++ b/tests/robotests/src/com/android/settings/search/actionbar/SearchMenuControllerTest.java
@@ -17,11 +17,11 @@
 package com.android.settings.search.actionbar;
 
 import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verifyZeroInteractions;
 import static org.mockito.Mockito.when;
 
+import android.app.settings.SettingsEnums;
 import android.content.Context;
 import android.os.Bundle;
 import android.provider.Settings.Global;
@@ -29,9 +29,9 @@
 import android.view.MenuItem;
 
 import com.android.settings.R;
+import com.android.settings.core.InstrumentedFragment;
+import com.android.settings.core.InstrumentedPreferenceFragment;
 import com.android.settings.testutils.shadow.ShadowUtils;
-import com.android.settingslib.core.lifecycle.ObservableFragment;
-import com.android.settingslib.core.lifecycle.ObservablePreferenceFragment;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -49,15 +49,24 @@
     @Mock
     private Menu mMenu;
     private TestPreferenceFragment mPreferenceHost;
-    private ObservableFragment mHost;
+    private InstrumentedFragment mHost;
     private Context mContext;
 
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
         mContext = RuntimeEnvironment.application;
-        mHost = spy(new ObservableFragment());
-        when(mHost.getContext()).thenReturn(mContext);
+        mHost = new InstrumentedFragment() {
+            @Override
+            public Context getContext() {
+                return mContext;
+            }
+
+            @Override
+            public int getMetricsCategory() {
+                return SettingsEnums.TESTING;
+            }
+        };
         mPreferenceHost = new TestPreferenceFragment();
         Global.putInt(mContext.getContentResolver(), Global.DEVICE_PROVISIONED, 1);
 
@@ -101,7 +110,7 @@
         verifyZeroInteractions(mMenu);
     }
 
-    private static class TestPreferenceFragment extends ObservablePreferenceFragment {
+    private static class TestPreferenceFragment extends InstrumentedPreferenceFragment {
         @Override
         public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
         }
@@ -110,5 +119,10 @@
         public Context getContext() {
             return RuntimeEnvironment.application;
         }
+
+        @Override
+        public int getMetricsCategory() {
+            return SettingsEnums.TESTING;
+        }
     }
 }
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowDeviceConfig.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowDeviceConfig.java
new file mode 100644
index 0000000..dfd0988
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowDeviceConfig.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.testutils.shadow;
+
+import org.robolectric.annotation.Config;
+import org.robolectric.annotation.Implementation;
+import org.robolectric.annotation.Implements;
+import org.robolectric.annotation.Resetter;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Implements(android.provider.DeviceConfig.class)
+public class ShadowDeviceConfig {
+
+    private static Map<String, String> sPropertyMaps = new HashMap<>();
+
+    @Resetter
+    public static void reset() {
+        sPropertyMaps.clear();
+    }
+
+    @Implementation
+    public static boolean setProperty(
+            String namespace, String name, String value, boolean makeDefault) {
+        sPropertyMaps.put(name, value);
+        return true;
+    }
+
+    @Implementation
+    public static String getProperty(String namespace, String name) {
+        return sPropertyMaps.get(name);
+    }
+}
+
+
diff --git a/tests/robotests/src/com/android/settings/widget/ActionBarShadowControllerTest.java b/tests/robotests/src/com/android/settings/widget/ActionBarShadowControllerTest.java
deleted file mode 100644
index befac3f..0000000
--- a/tests/robotests/src/com/android/settings/widget/ActionBarShadowControllerTest.java
+++ /dev/null
@@ -1,116 +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.widget;
-
-import static androidx.lifecycle.Lifecycle.Event.ON_START;
-import static androidx.lifecycle.Lifecycle.Event.ON_STOP;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.app.ActionBar;
-import android.app.Activity;
-import android.view.View;
-
-import androidx.lifecycle.LifecycleOwner;
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.android.settingslib.core.lifecycle.Lifecycle;
-
-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 ActionBarShadowControllerTest {
-
-    @Mock
-    private RecyclerView mRecyclerView;
-    @Mock
-    private Activity mActivity;
-    @Mock
-    private ActionBar mActionBar;
-    private Lifecycle mLifecycle;
-    private LifecycleOwner mLifecycleOwner;
-    private View mView;
-
-    @Before
-    public void setUp() {
-        MockitoAnnotations.initMocks(this);
-        when(mActivity.getActionBar()).thenReturn(mActionBar);
-        mView = new View(RuntimeEnvironment.application);
-        mLifecycleOwner = () -> mLifecycle;
-        mLifecycle = new Lifecycle(mLifecycleOwner);
-    }
-
-    @Test
-    public void attachToRecyclerView_shouldAddScrollWatcherAndUpdateActionBar() {
-        when(mRecyclerView.canScrollVertically(-1)).thenReturn(false);
-
-        ActionBarShadowController.attachToRecyclerView(mActivity, mLifecycle, mRecyclerView);
-
-        verify(mActionBar).setElevation(ActionBarShadowController.ELEVATION_LOW);
-    }
-
-    @Test
-    public void attachToRecyclerView_customViewAsActionBar_shouldUpdateElevationOnScroll() {
-        // Setup
-        mView.setElevation(50);
-        when(mRecyclerView.canScrollVertically(-1)).thenReturn(false);
-        final ActionBarShadowController controller =
-                ActionBarShadowController.attachToRecyclerView(mView, mLifecycle, mRecyclerView);
-        assertThat(mView.getElevation()).isEqualTo(ActionBarShadowController.ELEVATION_LOW);
-
-        // Scroll
-        when(mRecyclerView.canScrollVertically(-1)).thenReturn(true);
-        controller.mScrollChangeWatcher.onScrolled(mRecyclerView, 10 /* dx */, 10 /* dy */);
-        assertThat(mView.getElevation()).isEqualTo(ActionBarShadowController.ELEVATION_HIGH);
-    }
-
-    @Test
-    public void attachToRecyclerView_lifecycleChange_shouldAttachDetach() {
-        ActionBarShadowController.attachToRecyclerView(mActivity, mLifecycle, mRecyclerView);
-
-        verify(mRecyclerView).addOnScrollListener(any());
-
-        mLifecycle.handleLifecycleEvent(ON_START);
-        mLifecycle.handleLifecycleEvent(ON_STOP);
-        verify(mRecyclerView).removeOnScrollListener(any());
-
-        mLifecycle.handleLifecycleEvent(ON_START);
-        verify(mRecyclerView, times(2)).addOnScrollListener(any());
-    }
-
-    @Test
-    public void onScrolled_nullAnchorViewAndActivity_shouldNotCrash() {
-        final Activity activity = null;
-        final ActionBarShadowController controller =
-                ActionBarShadowController.attachToRecyclerView(activity, mLifecycle, mRecyclerView);
-
-        // Scroll
-        controller.mScrollChangeWatcher.onScrolled(mRecyclerView, 10 /* dx */, 10 /* dy */);
-        // no crash
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/widget/AddPreferenceTest.java b/tests/robotests/src/com/android/settings/widget/AddPreferenceTest.java
new file mode 100644
index 0000000..3fccb34
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/widget/AddPreferenceTest.java
@@ -0,0 +1,149 @@
+/*
+ * 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.widget;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.ArgumentMatchers.eq;
+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.content.Context;
+import android.view.View;
+
+import com.android.settings.R;
+
+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 androidx.preference.PreferenceViewHolder;
+
+@RunWith(RobolectricTestRunner.class)
+public class AddPreferenceTest {
+
+    private Context mContext;
+    private PreferenceViewHolder mViewHolder;
+    private View mWidgetFrame;
+    private View mAddWidget;
+    private AddPreference mPreference;
+
+    @Before
+    public void setUp() {
+        mContext = RuntimeEnvironment.application;
+        mPreference = new AddPreference(mContext, null);
+
+        final View view = spy(View.inflate(mContext, mPreference.getLayoutResource(), null));
+        mViewHolder = PreferenceViewHolder.createInstanceForTests(view);
+        mWidgetFrame = view.findViewById(android.R.id.widget_frame);
+        mAddWidget = spy(View.inflate(mContext, mPreference.getSecondTargetResId(), null));
+        when(mViewHolder.findViewById(mPreference.getAddWidgetResId())).thenReturn(mAddWidget);
+    }
+
+    @Test
+    public void onBindViewHolder_noListener_addButtonNotVisible() {
+        mPreference.onBindViewHolder(mViewHolder);
+        assertThat(mPreference.shouldHideSecondTarget()).isTrue();
+        assertThat(mWidgetFrame.getVisibility()).isEqualTo(View.GONE);
+    }
+
+    @Test
+    public void onBindViewHolder_hasListener_addButtonVisible() {
+        mPreference.setOnAddClickListener(p -> {});
+        mPreference.onBindViewHolder(mViewHolder);
+        assertThat(mPreference.shouldHideSecondTarget()).isFalse();
+        assertThat(mWidgetFrame.getVisibility()).isEqualTo(View.VISIBLE);
+    }
+
+    @Test
+    public void setOnAddClickListener_listenerAddedAfterBinding_addButtonBecomesVisible() {
+        mPreference.onBindViewHolder(mViewHolder);
+        assertThat(mPreference.shouldHideSecondTarget()).isTrue();
+        assertThat(mWidgetFrame.getVisibility()).isEqualTo(View.GONE);
+
+        mPreference.setOnAddClickListener(p -> {});
+        assertThat(mPreference.shouldHideSecondTarget()).isFalse();
+        assertThat(mWidgetFrame.getVisibility()).isEqualTo(View.VISIBLE);
+    }
+
+    @Test
+    public void setOnAddClickListener_listenerRemovedAfterBinding_addButtonNotVisible() {
+        mPreference.setOnAddClickListener(p -> {});
+
+        mPreference.onBindViewHolder(mViewHolder);
+        assertThat(mPreference.shouldHideSecondTarget()).isFalse();
+        assertThat(mWidgetFrame.getVisibility()).isEqualTo(View.VISIBLE);
+
+        mPreference.setOnAddClickListener(null);
+        assertThat(mPreference.shouldHideSecondTarget()).isTrue();
+        assertThat(mWidgetFrame.getVisibility()).isEqualTo(View.GONE);
+    }
+
+    @Test
+    public void setOnAddClickListener_listenerAddedAndRemovedAfterBinding_addButtonNotVisible() {
+        mPreference.onBindViewHolder(mViewHolder);
+        assertThat(mPreference.shouldHideSecondTarget()).isTrue();
+        assertThat(mWidgetFrame.getVisibility()).isEqualTo(View.GONE);
+
+        mPreference.setOnAddClickListener(p -> {});
+        assertThat(mPreference.shouldHideSecondTarget()).isFalse();
+        assertThat(mWidgetFrame.getVisibility()).isEqualTo(View.VISIBLE);
+
+        mPreference.setOnAddClickListener(null);
+        assertThat(mPreference.shouldHideSecondTarget()).isTrue();
+        assertThat(mWidgetFrame.getVisibility()).isEqualTo(View.GONE);
+    }
+
+    @Test
+    public void onClick_noListener_noCrash() {
+        mPreference.onBindViewHolder(mViewHolder);
+        // should be no crash here
+        mPreference.onClick(mAddWidget);
+    }
+
+    @Test
+    public void onClick_hasListenerBeforeBind_firesCorrectly() {
+        final AddPreference.OnAddClickListener listener = mock(
+                AddPreference.OnAddClickListener.class);
+        mPreference.setOnAddClickListener(listener);
+
+        mPreference.onBindViewHolder(mViewHolder);
+        assertThat(mWidgetFrame.getVisibility()).isEqualTo(View.VISIBLE);
+
+        mPreference.onClick(mAddWidget);
+        verify(listener).onAddClick(eq(mPreference));
+    }
+
+    @Test
+    public void onClick_listenerAddedAfterBind_firesCorrectly() {
+        mPreference.onBindViewHolder(mViewHolder);
+        assertThat(mWidgetFrame.getVisibility()).isEqualTo(View.GONE);
+
+        final AddPreference.OnAddClickListener listener = mock(
+                AddPreference.OnAddClickListener.class);
+        mPreference.setOnAddClickListener(listener);
+        assertThat(mWidgetFrame.getVisibility()).isEqualTo(View.VISIBLE);
+
+        mPreference.onClick(mAddWidget);
+        verify(listener).onAddClick(eq(mPreference));
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/wifi/WifiInfoPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/WifiInfoPreferenceControllerTest.java
index c4a5c78..85d7726 100644
--- a/tests/robotests/src/com/android/settings/wifi/WifiInfoPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/WifiInfoPreferenceControllerTest.java
@@ -29,6 +29,7 @@
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.IntentFilter;
+import android.content.res.Resources;
 import android.net.wifi.WifiInfo;
 import android.net.wifi.WifiManager;
 import android.provider.Settings;
@@ -65,6 +66,8 @@
     private Preference mMacPreference;
     @Mock
     private WifiInfo mWifiInfo;
+    @Mock
+    private Resources mResources;
 
     private Lifecycle mLifecycle;
     private LifecycleOwner mLifecycleOwner;
@@ -82,6 +85,7 @@
                 .thenReturn(mIpPreference);
         when(mWifiManager.getConnectionInfo()).thenReturn(mWifiInfo);
         when(mWifiManager.getCurrentNetwork()).thenReturn(null);
+        when(mContext.getResources()).thenReturn(mResources);
         mController = new WifiInfoPreferenceController(mContext, mLifecycle, mWifiManager);
     }
 
@@ -117,8 +121,9 @@
 
     @Test
     public void updateWifiInfo_nullWifiInfoWithMacRandomizationOff_setMacUnavailable() {
-        Settings.Global.putInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, 0);
+        when(mResources.getBoolean(
+                com.android.internal.R.bool.config_wifi_connected_mac_randomization_supported))
+                .thenReturn(false);
         mController.displayPreference(mScreen);
         when(mWifiManager.getConnectionInfo()).thenReturn(null);
 
@@ -129,8 +134,9 @@
 
     @Test
     public void updateWifiInfo_nullMacWithMacRandomizationOff_setMacUnavailable() {
-        Settings.Global.putInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, 0);
+        when(mResources.getBoolean(
+                com.android.internal.R.bool.config_wifi_connected_mac_randomization_supported))
+                .thenReturn(false);
         mController.displayPreference(mScreen);
         when(mWifiInfo.getMacAddress()).thenReturn(null);
 
@@ -141,8 +147,9 @@
 
     @Test
     public void updateWifiInfo_defaultMacWithMacRandomizationOff_setMacUnavailable() {
-        Settings.Global.putInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, 0);
+        when(mResources.getBoolean(
+                com.android.internal.R.bool.config_wifi_connected_mac_randomization_supported))
+                .thenReturn(false);
         mController.displayPreference(mScreen);
         when(mWifiInfo.getMacAddress()).thenReturn(WifiInfo.DEFAULT_MAC_ADDRESS);
 
@@ -153,8 +160,9 @@
 
     @Test
     public void updateWifiInfo_validMacWithMacRandomizationOff_setValidMac() {
-        Settings.Global.putInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, 0);
+        when(mResources.getBoolean(
+                com.android.internal.R.bool.config_wifi_connected_mac_randomization_supported))
+                .thenReturn(false);
         mController.displayPreference(mScreen);
         when(mWifiInfo.getMacAddress()).thenReturn(TEST_MAC_ADDRESS);
 
@@ -165,8 +173,9 @@
 
     @Test
     public void updateWifiInfo_nullWifiInfoWithMacRandomizationOn_setMacUnavailable() {
-        Settings.Global.putInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, 1);
+        when(mResources.getBoolean(
+                com.android.internal.R.bool.config_wifi_connected_mac_randomization_supported))
+                .thenReturn(true);
         mController.displayPreference(mScreen);
         when(mWifiManager.getConnectionInfo()).thenReturn(null);
 
@@ -177,8 +186,9 @@
 
     @Test
     public void updateWifiInfo_nullMacWithMacRandomizationOn_setMacUnavailable() {
-        Settings.Global.putInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, 1);
+        when(mResources.getBoolean(
+                com.android.internal.R.bool.config_wifi_connected_mac_randomization_supported))
+                .thenReturn(true);
         mController.displayPreference(mScreen);
         when(mWifiInfo.getMacAddress()).thenReturn(null);
 
@@ -189,8 +199,9 @@
 
     @Test
     public void updateWifiInfo_defaultMacWithMacRandomizationOn_setMacRandomized() {
-        Settings.Global.putInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, 1);
+        when(mResources.getBoolean(
+                com.android.internal.R.bool.config_wifi_connected_mac_randomization_supported))
+                .thenReturn(true);
         mController.displayPreference(mScreen);
         when(mWifiInfo.getMacAddress()).thenReturn(WifiInfo.DEFAULT_MAC_ADDRESS);
 
@@ -201,8 +212,9 @@
 
     @Test
     public void updateWifiInfo_validMacWithMacRandomizationOn_setValidMac() {
-        Settings.Global.putInt(mContext.getContentResolver(),
-                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, 1);
+        when(mResources.getBoolean(
+                com.android.internal.R.bool.config_wifi_connected_mac_randomization_supported))
+                .thenReturn(true);
         mController.displayPreference(mScreen);
         when(mWifiInfo.getMacAddress()).thenReturn(TEST_MAC_ADDRESS);
 
diff --git a/tests/robotests/src/com/android/settings/wifi/slice/ConnectToWifiHandlerTest.java b/tests/robotests/src/com/android/settings/wifi/slice/ConnectToWifiHandlerTest.java
new file mode 100644
index 0000000..a7cf327
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/wifi/slice/ConnectToWifiHandlerTest.java
@@ -0,0 +1,117 @@
+/*
+ * 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.wifi.slice;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.net.wifi.WifiConfiguration;
+import android.net.wifi.WifiConfiguration.NetworkSelectionStatus;
+
+import com.android.settings.testutils.shadow.ShadowConnectivityManager;
+import com.android.settings.testutils.shadow.ShadowWifiManager;
+import com.android.settingslib.wifi.AccessPoint;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.Robolectric;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.annotation.Config;
+
+@RunWith(RobolectricTestRunner.class)
+@Config(shadows = {
+        ShadowConnectivityManager.class,
+        ShadowWifiManager.class,
+})
+public class ConnectToWifiHandlerTest {
+
+    private static final String AP1_SSID = "\"ap1\"";
+    private ConnectToWifiHandler mHandler;
+    private WifiConfiguration mWifiConfig;
+    @Mock
+    private AccessPoint mAccessPoint;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+
+        mHandler = Robolectric.setupActivity(ConnectToWifiHandler.class);
+        mWifiConfig = new WifiConfiguration();
+        mWifiConfig.SSID = AP1_SSID;
+        doReturn(mWifiConfig).when(mAccessPoint).getConfig();
+    }
+
+    @Test
+    public void connect_shouldConnectToUnsavedOpenNetwork() {
+        when(mAccessPoint.isSaved()).thenReturn(false);
+        when(mAccessPoint.getSecurity()).thenReturn(AccessPoint.SECURITY_NONE);
+
+        mHandler.connect(mAccessPoint);
+
+        assertThat(ShadowWifiManager.get().savedWifiConfig.SSID).isEqualTo(AP1_SSID);
+    }
+
+    @Test
+    public void connect_shouldStartOsuProvisioning() {
+        when(mAccessPoint.isSaved()).thenReturn(false);
+        when(mAccessPoint.isOsuProvider()).thenReturn(true);
+
+        mHandler.connect(mAccessPoint);
+
+        verify(mAccessPoint).startOsuProvisioning();
+    }
+
+
+    @Test
+    public void connect_shouldConnectWithPasspointProvider() {
+        when(mAccessPoint.isSaved()).thenReturn(false);
+        when(mAccessPoint.isPasspoint()).thenReturn(true);
+
+        mHandler.connect(mAccessPoint);
+
+        assertThat(ShadowWifiManager.get().savedWifiConfig.SSID).isEqualTo(AP1_SSID);
+    }
+
+    @Test
+    public void connect_shouldConnectToSavedSecuredNetwork() {
+        when(mAccessPoint.isSaved()).thenReturn(true);
+        when(mAccessPoint.getSecurity()).thenReturn(AccessPoint.SECURITY_PSK);
+        final NetworkSelectionStatus status = new NetworkSelectionStatus();
+        status.setHasEverConnected(true);
+        mWifiConfig.setNetworkSelectionStatus(status);
+
+        mHandler.connect(mAccessPoint);
+
+        assertThat(ShadowWifiManager.get().savedWifiConfig.SSID).isEqualTo(AP1_SSID);
+    }
+
+    @Test
+    public void connect_shouldNotConnectToUnsavedSecuredNetwork() {
+        when(mAccessPoint.isSaved()).thenReturn(false);
+        when(mAccessPoint.getSecurity()).thenReturn(AccessPoint.SECURITY_PSK);
+
+        mHandler.connect(mAccessPoint);
+
+        assertThat(ShadowWifiManager.get().savedWifiConfig).isNull();
+    }
+}
diff --git a/tests/uitests/src/com/android/settings/ui/LocationSettingsTests.java b/tests/uitests/src/com/android/settings/ui/LocationSettingsTests.java
index b4a1baa..8e391f3 100644
--- a/tests/uitests/src/com/android/settings/ui/LocationSettingsTests.java
+++ b/tests/uitests/src/com/android/settings/ui/LocationSettingsTests.java
@@ -95,7 +95,7 @@
     public void testLocationDeviceOnlyMode() throws Exception {
         // Changing the value from default before testing the toggle to Device only mode
         Settings.Secure.putInt(getInstrumentation().getContext().getContentResolver(),
-                Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_HIGH_ACCURACY);
+                Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_ON);
         dismissAlertDialogs();
         Thread.sleep(TIMEOUT);
         verifyLocationSettingsMode(Settings.Secure.LOCATION_MODE_SENSORS_ONLY);
@@ -114,7 +114,7 @@
         Settings.Secure.putInt(getInstrumentation().getContext().getContentResolver(),
                 Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_SENSORS_ONLY);
         Thread.sleep(TIMEOUT);
-        verifyLocationSettingsMode(Settings.Secure.LOCATION_MODE_HIGH_ACCURACY);
+        verifyLocationSettingsMode(Settings.Secure.LOCATION_MODE_ON);
     }
 
     @MediumTest
@@ -145,7 +145,7 @@
     private void verifyLocationSettingsMode(int mode) throws Exception {
         int modeIntValue = 1;
         String textMode = "Device only";
-        if (mode == Settings.Secure.LOCATION_MODE_HIGH_ACCURACY) {
+        if (mode == Settings.Secure.LOCATION_MODE_ON) {
             modeIntValue = 3;
             textMode = "High accuracy";
         }
@@ -169,7 +169,7 @@
         dismissAlertDialogs();
         mDevice.wait(Until.findObject(By.desc("Navigate up")), TIMEOUT).click();
         Thread.sleep(TIMEOUT);
-        if (mode == Settings.Secure.LOCATION_MODE_HIGH_ACCURACY ||
+        if (mode == Settings.Secure.LOCATION_MODE_ON ||
                 mode == Settings.Secure.LOCATION_MODE_BATTERY_SAVING) {
             dismissAlertDialogs();
         }
@@ -190,7 +190,7 @@
         }
         else {
             Settings.Secure.putInt(getInstrumentation().getContext().getContentResolver(),
-                    Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_HIGH_ACCURACY);
+                    Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_ON);
         }
         dismissAlertDialogs();
         // Load location settings
diff --git a/tests/unit/src/com/android/settings/backup/BackupIntentTest.java b/tests/unit/src/com/android/settings/backup/BackupIntentTest.java
index 18fb17a..0115c56 100644
--- a/tests/unit/src/com/android/settings/backup/BackupIntentTest.java
+++ b/tests/unit/src/com/android/settings/backup/BackupIntentTest.java
@@ -37,12 +37,9 @@
 @RunWith(AndroidJUnit4.class)
 @SmallTest
 public class BackupIntentTest {
-
     private static final String INTENT_PRIVACY_SETTINGS = "android.settings.PRIVACY_SETTINGS";
-    private static final String INTENT_BACKUP_SETTINGS =
-            "android.settings.BACKUP_AND_RESET_SETTINGS";
     private static final String BACKUP_SETTINGS_ACTIVITY =
-            "com.android.settings.backup.BackupSettingsActivity";
+            "com.android.settings.backup.UserBackupSettingsActivity";
 
     private Context mContext;
 
@@ -53,17 +50,6 @@
     }
 
     @Test
-    public void testBackupSettingsIntentResolvesToOnlyOneActivity(){
-        PackageManager pm = mContext.getPackageManager();
-        Intent intent = new Intent(INTENT_BACKUP_SETTINGS);
-        List<ResolveInfo> activities = pm.queryIntentActivities(intent, 0);
-        assertThat(activities).isNotNull();
-        assertThat(activities.size()).isEqualTo(1);
-        assertThat(activities.get(0).activityInfo.getComponentName().getClassName()).
-                isEqualTo(BACKUP_SETTINGS_ACTIVITY);
-    }
-
-    @Test
     public void testPrivacySettingsIntentResolvesToOnlyOneActivity(){
         PackageManager pm = mContext.getPackageManager();
         Intent intent = new Intent(INTENT_PRIVACY_SETTINGS);
@@ -73,5 +59,4 @@
         assertThat(activities.get(0).activityInfo.getComponentName().getClassName()).
                 isEqualTo(BACKUP_SETTINGS_ACTIVITY);
     }
-
 }
diff --git a/tests/unit/src/com/android/settings/notification/OWNERS b/tests/unit/src/com/android/settings/notification/OWNERS
index 0d73685..edf266e 100644
--- a/tests/unit/src/com/android/settings/notification/OWNERS
+++ b/tests/unit/src/com/android/settings/notification/OWNERS
@@ -1,4 +1,4 @@
 # Default reviewers for this and subdirectories.
 asc@google.com
-dsandler@google.com
+dsandler@android.com
 juliacr@google.com
\ No newline at end of file