Merge "Revert "Update proguard""
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 6e1d8f8..90aa55f 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" />
@@ -1245,6 +1246,17 @@
                 android:value="true" />
         </activity>
 
+        <activity android:name="Settings$PrivacyDashboardActivity"
+                  android:label="@string/privacy_dashboard_title"
+                  android:icon="@drawable/ic_settings_privacy">
+            <intent-filter>
+                <action android:name="android.settings.PRIVACY_SETTINGS" />
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
+                       android:value="com.android.settings.privacy.PrivacyDashboardFragment" />
+        </activity>
+
         <activity android:name="SetFullBackupPassword"
                   android:label="@string/local_backup_password_title"
                   android:exported="false" />
@@ -1825,7 +1837,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 +2603,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"
@@ -2785,10 +2803,6 @@
         <activity android:name=".backup.UserBackupSettingsActivity"
                   android:label="@string/privacy_settings_title"
                   android:icon="@drawable/ic_settings_backup">
-            <intent-filter android:priority="1">
-                <action android:name="android.settings.PRIVACY_SETTINGS" />
-                <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.DEFAULT" />
diff --git a/res/drawable/ic_homepage_about.xml b/res/drawable/ic_homepage_about.xml
index d47a740..07dbb34 100644
--- a/res/drawable/ic_homepage_about.xml
+++ b/res/drawable/ic_homepage_about.xml
@@ -18,13 +18,10 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item>
-        <shape android:shape="oval">
-            <solid
-                android:color="@color/homepage_about_background" />
-            <size
-                android:width="@dimen/dashboard_tile_image_size"
-                android:height="@dimen/dashboard_tile_image_size" />
-        </shape>
+        <com.android.settings.homepage.AdaptiveIconShapeDrawable
+            android:width="@dimen/dashboard_tile_image_size"
+            android:height="@dimen/dashboard_tile_image_size"
+            android:color="@color/homepage_about_background" />
     </item>
 
     <item
diff --git a/res/drawable/ic_homepage_accessibility.xml b/res/drawable/ic_homepage_accessibility.xml
index 07c9ef2..39f241b 100644
--- a/res/drawable/ic_homepage_accessibility.xml
+++ b/res/drawable/ic_homepage_accessibility.xml
@@ -18,13 +18,10 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item>
-        <shape android:shape="oval">
-            <solid
-                android:color="@color/homepage_accessibility_background" />
-            <size
-                android:width="@dimen/dashboard_tile_image_size"
-                android:height="@dimen/dashboard_tile_image_size" />
-        </shape>
+        <com.android.settings.homepage.AdaptiveIconShapeDrawable
+            android:width="@dimen/dashboard_tile_image_size"
+            android:height="@dimen/dashboard_tile_image_size"
+            android:color="@color/homepage_accessibility_background" />
     </item>
 
     <item
diff --git a/res/drawable/ic_homepage_accounts.xml b/res/drawable/ic_homepage_accounts.xml
index ee33505..17408ed 100644
--- a/res/drawable/ic_homepage_accounts.xml
+++ b/res/drawable/ic_homepage_accounts.xml
@@ -18,13 +18,10 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item>
-        <shape android:shape="oval">
-            <solid
-                android:color="@color/homepage_accounts_background" />
-            <size
-                android:width="@dimen/dashboard_tile_image_size"
-                android:height="@dimen/dashboard_tile_image_size" />
-        </shape>
+        <com.android.settings.homepage.AdaptiveIconShapeDrawable
+            android:width="@dimen/dashboard_tile_image_size"
+            android:height="@dimen/dashboard_tile_image_size"
+            android:color="@color/homepage_accounts_background" />
     </item>
 
     <item
diff --git a/res/drawable/ic_homepage_apps.xml b/res/drawable/ic_homepage_apps.xml
index 3d18d09..2a6789c 100644
--- a/res/drawable/ic_homepage_apps.xml
+++ b/res/drawable/ic_homepage_apps.xml
@@ -18,13 +18,10 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item>
-        <shape android:shape="oval">
-            <solid
-                android:color="@color/homepage_app_and_notification_background" />
-            <size
-                android:width="@dimen/dashboard_tile_image_size"
-                android:height="@dimen/dashboard_tile_image_size" />
-        </shape>
+        <com.android.settings.homepage.AdaptiveIconShapeDrawable
+            android:width="@dimen/dashboard_tile_image_size"
+            android:height="@dimen/dashboard_tile_image_size"
+            android:color="@color/homepage_app_and_notification_background" />
     </item>
 
     <item
diff --git a/res/drawable/ic_homepage_battery.xml b/res/drawable/ic_homepage_battery.xml
index abafdcb..87bb5be 100644
--- a/res/drawable/ic_homepage_battery.xml
+++ b/res/drawable/ic_homepage_battery.xml
@@ -18,13 +18,10 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item>
-        <shape android:shape="oval">
-            <solid
-                android:color="@color/homepage_battery_background" />
-            <size
-                android:width="@dimen/dashboard_tile_image_size"
-                android:height="@dimen/dashboard_tile_image_size" />
-        </shape>
+        <com.android.settings.homepage.AdaptiveIconShapeDrawable
+            android:width="@dimen/dashboard_tile_image_size"
+            android:height="@dimen/dashboard_tile_image_size"
+            android:color="@color/homepage_battery_background" />
     </item>
 
     <item
diff --git a/res/drawable/ic_homepage_connected_device.xml b/res/drawable/ic_homepage_connected_device.xml
index 483427c..f3ce186 100644
--- a/res/drawable/ic_homepage_connected_device.xml
+++ b/res/drawable/ic_homepage_connected_device.xml
@@ -18,13 +18,10 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item>
-        <shape android:shape="oval">
-            <solid
-                android:color="@color/homepage_connected_device_background" />
-            <size
-                android:width="@dimen/dashboard_tile_image_size"
-                android:height="@dimen/dashboard_tile_image_size" />
-        </shape>
+        <com.android.settings.homepage.AdaptiveIconShapeDrawable
+            android:width="@dimen/dashboard_tile_image_size"
+            android:height="@dimen/dashboard_tile_image_size"
+            android:color="@color/homepage_connected_device_background" />
     </item>
 
     <item
diff --git a/res/drawable/ic_homepage_display.xml b/res/drawable/ic_homepage_display.xml
index 893a583..fba7149 100644
--- a/res/drawable/ic_homepage_display.xml
+++ b/res/drawable/ic_homepage_display.xml
@@ -18,13 +18,10 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item>
-        <shape android:shape="oval">
-            <solid
-                android:color="@color/homepage_display_background" />
-            <size
-                android:width="@dimen/dashboard_tile_image_size"
-                android:height="@dimen/dashboard_tile_image_size" />
-        </shape>
+        <com.android.settings.homepage.AdaptiveIconShapeDrawable
+            android:width="@dimen/dashboard_tile_image_size"
+            android:height="@dimen/dashboard_tile_image_size"
+            android:color="@color/homepage_display_background" />
     </item>
 
     <item
diff --git a/res/drawable/ic_homepage_generic_background.xml b/res/drawable/ic_homepage_generic_background.xml
deleted file mode 100644
index 37273a0..0000000
--- a/res/drawable/ic_homepage_generic_background.xml
+++ /dev/null
@@ -1,24 +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.
-  -->
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
-       android:shape="oval">
-    <solid
-        android:color="@color/homepage_generic_icon_background" />
-    <size
-        android:width="@dimen/dashboard_tile_image_size"
-        android:height="@dimen/dashboard_tile_image_size" />
-</shape>
\ No newline at end of file
diff --git a/res/drawable/ic_homepage_location.xml b/res/drawable/ic_homepage_location.xml
index 413801b..c5d6e89 100644
--- a/res/drawable/ic_homepage_location.xml
+++ b/res/drawable/ic_homepage_location.xml
@@ -18,13 +18,10 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item>
-        <shape android:shape="oval">
-            <solid
-                android:color="@color/homepage_location_background"/>
-            <size
-                android:width="@dimen/dashboard_tile_image_size"
-                android:height="@dimen/dashboard_tile_image_size"/>
-        </shape>
+        <com.android.settings.homepage.AdaptiveIconShapeDrawable
+            android:width="@dimen/dashboard_tile_image_size"
+            android:height="@dimen/dashboard_tile_image_size"
+            android:color="@color/homepage_location_background" />
     </item>
 
     <item
diff --git a/res/drawable/ic_homepage_network.xml b/res/drawable/ic_homepage_network.xml
index 5ed023a..1457ab9 100644
--- a/res/drawable/ic_homepage_network.xml
+++ b/res/drawable/ic_homepage_network.xml
@@ -18,13 +18,10 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item>
-        <shape android:shape="oval">
-            <solid
-                android:color="@color/homepage_network_background" />
-            <size
-                android:width="@dimen/dashboard_tile_image_size"
-                android:height="@dimen/dashboard_tile_image_size" />
-        </shape>
+        <com.android.settings.homepage.AdaptiveIconShapeDrawable
+            android:width="@dimen/dashboard_tile_image_size"
+            android:height="@dimen/dashboard_tile_image_size"
+            android:color="@color/homepage_network_background" />
     </item>
 
     <item
diff --git a/res/drawable/ic_homepage_privacy.xml b/res/drawable/ic_homepage_privacy.xml
index eec3c94..a102905 100644
--- a/res/drawable/ic_homepage_privacy.xml
+++ b/res/drawable/ic_homepage_privacy.xml
@@ -18,13 +18,10 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item>
-        <shape android:shape="oval">
-            <solid
-                android:color="@color/homepage_privacy_background"/>
-            <size
-                android:width="@dimen/dashboard_tile_image_size"
-                android:height="@dimen/dashboard_tile_image_size"/>
-        </shape>
+        <com.android.settings.homepage.AdaptiveIconShapeDrawable
+            android:width="@dimen/dashboard_tile_image_size"
+            android:height="@dimen/dashboard_tile_image_size"
+            android:color="@color/homepage_privacy_background" />
     </item>
 
     <item
diff --git a/res/drawable/ic_homepage_security.xml b/res/drawable/ic_homepage_security.xml
index 5a6ed97..0b6a1fd 100644
--- a/res/drawable/ic_homepage_security.xml
+++ b/res/drawable/ic_homepage_security.xml
@@ -18,13 +18,10 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item>
-        <shape android:shape="oval">
-            <solid
-                android:color="@color/homepage_security_background" />
-            <size
-                android:width="@dimen/dashboard_tile_image_size"
-                android:height="@dimen/dashboard_tile_image_size" />
-        </shape>
+        <com.android.settings.homepage.AdaptiveIconShapeDrawable
+            android:width="@dimen/dashboard_tile_image_size"
+            android:height="@dimen/dashboard_tile_image_size"
+            android:color="@color/homepage_security_background" />
     </item>
 
     <item
diff --git a/res/drawable/ic_homepage_sound.xml b/res/drawable/ic_homepage_sound.xml
index a7369ad..21995c5 100644
--- a/res/drawable/ic_homepage_sound.xml
+++ b/res/drawable/ic_homepage_sound.xml
@@ -18,13 +18,10 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item>
-        <shape android:shape="oval">
-            <solid
-                android:color="@color/homepage_sound_background" />
-            <size
-                android:width="@dimen/dashboard_tile_image_size"
-                android:height="@dimen/dashboard_tile_image_size" />
-        </shape>
+        <com.android.settings.homepage.AdaptiveIconShapeDrawable
+            android:width="@dimen/dashboard_tile_image_size"
+            android:height="@dimen/dashboard_tile_image_size"
+            android:color="@color/homepage_sound_background" />
     </item>
 
     <item
diff --git a/res/drawable/ic_homepage_storage.xml b/res/drawable/ic_homepage_storage.xml
index 604cf51..5e5c3ab 100644
--- a/res/drawable/ic_homepage_storage.xml
+++ b/res/drawable/ic_homepage_storage.xml
@@ -18,13 +18,10 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item>
-        <shape android:shape="oval">
-            <solid
-                android:color="@color/homepage_storage_background" />
-            <size
-                android:width="@dimen/dashboard_tile_image_size"
-                android:height="@dimen/dashboard_tile_image_size" />
-        </shape>
+        <com.android.settings.homepage.AdaptiveIconShapeDrawable
+            android:width="@dimen/dashboard_tile_image_size"
+            android:height="@dimen/dashboard_tile_image_size"
+            android:color="@color/homepage_storage_background" />
     </item>
 
     <item
diff --git a/res/drawable/ic_homepage_support.xml b/res/drawable/ic_homepage_support.xml
index 0936304..906dd6c 100644
--- a/res/drawable/ic_homepage_support.xml
+++ b/res/drawable/ic_homepage_support.xml
@@ -18,13 +18,10 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item>
-        <shape android:shape="oval">
-            <solid
-                android:color="@color/homepage_support_background" />
-            <size
-                android:width="@dimen/dashboard_tile_image_size"
-                android:height="@dimen/dashboard_tile_image_size" />
-        </shape>
+        <com.android.settings.homepage.AdaptiveIconShapeDrawable
+            android:width="@dimen/dashboard_tile_image_size"
+            android:height="@dimen/dashboard_tile_image_size"
+            android:color="@color/homepage_support_background" />
     </item>
 
     <item
diff --git a/res/drawable/ic_homepage_system_dashboard.xml b/res/drawable/ic_homepage_system_dashboard.xml
index 60f0476..5e9f372 100644
--- a/res/drawable/ic_homepage_system_dashboard.xml
+++ b/res/drawable/ic_homepage_system_dashboard.xml
@@ -18,13 +18,10 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item>
-        <shape android:shape="oval">
-            <solid
-                android:color="@color/homepage_system_background" />
-            <size
-                android:width="@dimen/dashboard_tile_image_size"
-                android:height="@dimen/dashboard_tile_image_size" />
-        </shape>
+        <com.android.settings.homepage.AdaptiveIconShapeDrawable
+            android:width="@dimen/dashboard_tile_image_size"
+            android:height="@dimen/dashboard_tile_image_size"
+            android:color="@color/homepage_system_background" />
     </item>
 
     <item
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/preference_balance_slider.xml b/res/layout/preference_balance_slider.xml
new file mode 100644
index 0000000..32010c3
--- /dev/null
+++ b/res/layout/preference_balance_slider.xml
@@ -0,0 +1,109 @@
+<?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.
+-->
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:minHeight="?android:attr/listPreferredItemHeightSmall"
+    android:gravity="center_vertical"
+    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+    android:clickable="false"
+    android:orientation="horizontal">
+
+    <LinearLayout
+        android:id="@+id/icon_frame"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:minWidth="56dp"
+        android:gravity="start|center_vertical"
+        android:orientation="horizontal"
+        android:paddingEnd="12dp"
+        android:paddingTop="4dp"
+        android:paddingBottom="4dp">
+        <com.android.internal.widget.PreferenceImageView
+            android:id="@android:id/icon"
+            android:layout_width="24dp"
+            android:layout_height="24dp"/>
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical"
+        android:layout_marginTop="8dp"
+        android:layout_marginBottom="8dp">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content">
+            <TextView
+                android:id="@android:id/title"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:singleLine="true"
+                android:textAppearance="@*android:style/TextAppearance.Material.Subhead"
+                android:textColor="?android:attr/textColorPrimary"
+                android:ellipsize="marquee"
+                android:fadingEdge="horizontal"/>
+            <LinearLayout
+                android:id="@android:id/widget_frame"
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:gravity="center_vertical"
+                android:orientation="vertical"/>
+        </LinearLayout>
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="vertical">
+
+            <com.android.settings.accessibility.BalanceSeekBar
+                android:id="@*android:id/seekbar"
+                android:layout_gravity="center_vertical"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"/>
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_gravity="center_vertical"
+                android:orientation="horizontal">
+                <TextView
+                    android:id="@+id/left_text"
+                    android:text="@string/accessibility_toggle_master_balance_left_label"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:maxLines="1"
+                    android:textAlignment="viewStart" />
+                <TextView
+                    android:id="@+id/right_text"
+                    android:text="@string/accessibility_toggle_master_balance_right_label"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:maxLines="1"
+                    android:textAlignment="viewEnd" />
+
+            </LinearLayout>
+        </LinearLayout>
+    </LinearLayout>
+
+</LinearLayout>
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/bools.xml b/res/values/bools.xml
deleted file mode 100644
index a5043a2..0000000
--- a/res/values/bools.xml
+++ /dev/null
@@ -1,191 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 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.
--->
-
-<resources>
-    <!-- Whether or not the dock settings are to be displayed for this device when docked -->
-    <bool name="has_dock_settings">false</bool>
-    <!-- Whether there is a boot sounds checkbox -->
-    <bool name="has_boot_sounds">false</bool>
-    <!-- Whether there is a silent mode checkbox  -->
-    <bool name="has_silent_mode">true</bool>
-
-    <!-- Display additional System Update menu if true -->
-    <bool name="config_additional_system_update_setting_enable">false</bool>
-
-    <!-- Whether the bluetooth activation confirmation dialogs should be auto dismissed.
-         Can be overridden for specific product builds. -->
-    <bool name="auto_confirm_bluetooth_activation_dialog">false</bool>
-
-    <!-- Whether the device name is shown in About device or not -->
-    <bool name="config_show_device_name">true</bool>
-
-    <!-- Whether to show a preference item for the manual in About phone -->
-    <bool name="config_show_manual">false</bool>
-    <!-- Whether to show a preference item for regulatory information in About phone -->
-    <bool name="config_show_regulatory_info">false</bool>
-
-    <!-- Whether to show a preference item for mobile plan -->
-    <bool name="config_show_mobile_plan">true</bool>
-
-    <!-- Whether none security option is hide or not  (country specific). -->
-    <bool name="config_hide_none_security_option">false</bool>
-
-    <!-- Whether swipe security option is hidden or not -->
-    <bool name="config_hide_swipe_security_option">false</bool>
-
-    <!--Whether help links are defined. -->
-    <bool name="config_has_help">false</bool>
-
-    <!-- Whether Wi-Fi settings should be shown or not.
-    This also controls whether Wi-fi related sub-settings (e.g. Wi-Fi preferences) will
-    surface in search results or not.-->
-    <bool name="config_show_wifi_settings">true</bool>
-
-    <!-- Whether toggle_airplane is available or not. -->
-    <bool name="config_show_toggle_airplane">true</bool>
-
-    <!-- Whether private_dns_settings is available or not. -->
-    <bool name="config_show_private_dns_settings">true</bool>
-
-    <!-- Whether memory from app_info_settings is available or not. -->
-    <bool name="config_show_app_info_settings_memory">false</bool>
-
-    <!-- Whether battery from app_info_settings is available or not. -->
-    <bool name="config_show_app_info_settings_battery">true</bool>
-
-    <!-- Whether location mode is available or not. -->
-    <bool name="config_location_mode_available">true</bool>
-
-    <!-- Whether location scanning is available or not. -->
-    <bool name="config_show_location_scanning">true</bool>
-
-    <!-- Whether high_power_apps should be shown or not. -->
-    <bool name="config_show_high_power_apps">true</bool>
-
-    <!-- Whether media_volume should be shown or not. -->
-    <bool name="config_show_media_volume">true</bool>
-
-    <!-- Whether alarm_volume should be shown or not. -->
-    <bool name="config_show_alarm_volume">true</bool>
-
-    <!-- Whether call_volume should be shown or not. -->
-    <bool name="config_show_call_volume">true</bool>
-
-    <!-- Whether notification_volume should be shown or not. -->
-    <bool name="config_show_notification_volume">true</bool>
-
-    <!-- Whether notification_ringtone should be shown or not. -->
-    <bool name="config_show_notification_ringtone">true</bool>
-
-    <!-- Whether screen_locking_sounds should be shown or not. -->
-    <bool name="config_show_screen_locking_sounds">true</bool>
-
-    <!-- Whether charging_sounds should be shown or not. -->
-    <bool name="config_show_charging_sounds">true</bool>
-
-    <!-- Whether touch_sounds should be shown or not. -->
-    <bool name="config_show_touch_sounds">true</bool>
-
-    <!-- Whether encryption_and_credentials_encryption_status should be shown or not. -->
-    <bool name="config_show_encryption_and_credentials_encryption_status">true</bool>
-
-    <!-- Whether premium_sms should be shown or not. -->
-    <bool name="config_show_premium_sms">true</bool>
-
-    <!-- Whether data_saver should be shown or not. -->
-    <bool name="config_show_data_saver">true</bool>
-
-    <!-- Whether enabled_vr_listeners should be shown or not. -->
-    <bool name="config_show_enabled_vr_listeners">true</bool>
-
-    <!-- Whether phone_language should be shown or not. -->
-    <bool name="config_show_phone_language">true</bool>
-
-    <!-- Whether virtual_keyboard_pref should be shown or not. -->
-    <bool name="config_show_virtual_keyboard_pref">true</bool>
-
-    <!-- Whether physical_keyboard_pref should be shown or not. -->
-    <bool name="config_show_physical_keyboard_pref">true</bool>
-
-    <!-- Whether spellcheckers_settings should be shown or not. -->
-    <bool name="config_show_spellcheckers_settings">true</bool>
-
-    <!-- Whether tts_settings_summary should be shown or not. -->
-    <bool name="config_show_tts_settings_summary">true</bool>
-
-    <!-- Whether pointer_speed should be shown or not. -->
-    <bool name="config_show_pointer_speed">true</bool>
-
-    <!-- Whether vibrate_input_devices should be shown or not. -->
-    <bool name="config_show_vibrate_input_devices">true</bool>
-
-    <!-- Whether manage_device_admin should be shown or not. -->
-    <bool name="config_show_manage_device_admin">true</bool>
-
-    <!-- Whether unlock_set_or_change should be shown or not. -->
-    <bool name="config_show_unlock_set_or_change">true</bool>
-
-    <!-- Whether screen_pinning_settings should be shown or not. -->
-    <bool name="config_show_screen_pinning_settings">true</bool>
-
-    <!-- Whether manage_trust_agents should be shown or not. -->
-    <bool name="config_show_manage_trust_agents">true</bool>
-
-    <!-- Whether show_password should be shown or not. -->
-    <bool name="config_show_show_password">true</bool>
-
-    <!-- Whether trust_agent_click_intent should be shown or not. -->
-    <bool name="config_show_trust_agent_click_intent">true</bool>
-
-    <!-- Whether wallpaper attribution should be shown or not. -->
-    <bool name="config_show_wallpaper_attribution">true</bool>
-
-    <!-- Whether default_home should be shown or not. -->
-    <bool name="config_show_default_home">true</bool>
-
-    <!-- Whether assist_and_voice_input should be shown or not. -->
-    <bool name="config_show_assist_and_voice_input">true</bool>
-
-    <!-- Whether reset_dashboard should be shown or not. -->
-    <bool name="config_show_reset_dashboard">true</bool>
-
-    <!-- Whether system_update_settings should be shown or not. -->
-    <bool name="config_show_system_update_settings">true</bool>
-
-    <!-- Whether device_model should be shown or not. -->
-    <bool name="config_show_device_model">true</bool>
-
-    <!-- Whether top_level_battery should be shown or not. -->
-    <bool name="config_show_top_level_battery">true</bool>
-
-    <!-- Whether top_level_connected_devices should be shown or not. -->
-    <bool name="config_show_top_level_connected_devices">true</bool>
-
-    <!-- Whether top_level_display should be shown or not. -->
-    <bool name="config_show_top_level_display">true</bool>
-
-    <!-- Whether wifi_ip_address should be shown or not. -->
-    <bool name="config_show_wifi_ip_address">true</bool>
-
-    <!-- Whether wifi_mac_address should be shown or not. -->
-    <bool name="config_show_wifi_mac_address">true</bool>
-
-    <!-- Whether to disable "Uninstall Updates" menu item for System apps or not. -->
-    <bool name="config_disable_uninstall_update">false</bool>
-
-    <!-- Whether or not extra preview panels should be used for screen zoom setting. -->
-    <bool name="config_enable_extra_screen_zoom_preview">true</bool>
-</resources>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index da01be0..f6723a8 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -15,9 +15,6 @@
 -->
 
 <resources>
-    <color name="black">#000</color>
-    <color name="red">#F00</color>
-    <color name="blue">#00F</color>
 
     <color name="bluetooth_dialog_text_color">#8a000000</color>
 
diff --git a/res/values/config.xml b/res/values/config.xml
index 0e46200..3023067 100755
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -179,4 +179,178 @@
 
     <!-- App intent -->
     <string name="config_account_intent_uri" translatable="false"></string>
+
+    <!-- Whether or not the dock settings are to be displayed for this device when docked -->
+    <bool name="has_dock_settings">false</bool>
+    <!-- Whether there is a boot sounds checkbox -->
+    <bool name="has_boot_sounds">false</bool>
+    <!-- Whether there is a silent mode checkbox  -->
+    <bool name="has_silent_mode">true</bool>
+
+    <!-- Display additional System Update menu if true -->
+    <bool name="config_additional_system_update_setting_enable">false</bool>
+
+    <!-- Whether the bluetooth activation confirmation dialogs should be auto dismissed.
+         Can be overridden for specific product builds. -->
+    <bool name="auto_confirm_bluetooth_activation_dialog">false</bool>
+
+    <!-- Whether the device name is shown in About device or not -->
+    <bool name="config_show_device_name">true</bool>
+
+    <!-- Whether to show a preference item for the manual in About phone -->
+    <bool name="config_show_manual">false</bool>
+    <!-- Whether to show a preference item for regulatory information in About phone -->
+    <bool name="config_show_regulatory_info">false</bool>
+
+    <!-- Whether to show a preference item for mobile plan -->
+    <bool name="config_show_mobile_plan">true</bool>
+
+    <!-- Whether none security option is hide or not  (country specific). -->
+    <bool name="config_hide_none_security_option">false</bool>
+
+    <!-- Whether swipe security option is hidden or not -->
+    <bool name="config_hide_swipe_security_option">false</bool>
+
+    <!--Whether help links are defined. -->
+    <bool name="config_has_help">false</bool>
+
+    <!-- Whether Wi-Fi settings should be shown or not.
+    This also controls whether Wi-fi related sub-settings (e.g. Wi-Fi preferences) will
+    surface in search results or not.-->
+    <bool name="config_show_wifi_settings">true</bool>
+
+    <!-- Whether toggle_airplane is available or not. -->
+    <bool name="config_show_toggle_airplane">true</bool>
+
+    <!-- Whether private_dns_settings is available or not. -->
+    <bool name="config_show_private_dns_settings">true</bool>
+
+    <!-- Whether memory from app_info_settings is available or not. -->
+    <bool name="config_show_app_info_settings_memory">false</bool>
+
+    <!-- Whether battery from app_info_settings is available or not. -->
+    <bool name="config_show_app_info_settings_battery">true</bool>
+
+    <!-- Whether location mode is available or not. -->
+    <bool name="config_location_mode_available">true</bool>
+
+    <!-- Whether location scanning is available or not. -->
+    <bool name="config_show_location_scanning">true</bool>
+
+    <!-- Whether high_power_apps should be shown or not. -->
+    <bool name="config_show_high_power_apps">true</bool>
+
+    <!-- Whether media_volume should be shown or not. -->
+    <bool name="config_show_media_volume">true</bool>
+
+    <!-- Whether alarm_volume should be shown or not. -->
+    <bool name="config_show_alarm_volume">true</bool>
+
+    <!-- Whether call_volume should be shown or not. -->
+    <bool name="config_show_call_volume">true</bool>
+
+    <!-- Whether notification_volume should be shown or not. -->
+    <bool name="config_show_notification_volume">true</bool>
+
+    <!-- Whether notification_ringtone should be shown or not. -->
+    <bool name="config_show_notification_ringtone">true</bool>
+
+    <!-- Whether screen_locking_sounds should be shown or not. -->
+    <bool name="config_show_screen_locking_sounds">true</bool>
+
+    <!-- Whether charging_sounds should be shown or not. -->
+    <bool name="config_show_charging_sounds">true</bool>
+
+    <!-- Whether touch_sounds should be shown or not. -->
+    <bool name="config_show_touch_sounds">true</bool>
+
+    <!-- Whether encryption_and_credentials_encryption_status should be shown or not. -->
+    <bool name="config_show_encryption_and_credentials_encryption_status">true</bool>
+
+    <!-- Whether premium_sms should be shown or not. -->
+    <bool name="config_show_premium_sms">true</bool>
+
+    <!-- Whether data_saver should be shown or not. -->
+    <bool name="config_show_data_saver">true</bool>
+
+    <!-- Whether enabled_vr_listeners should be shown or not. -->
+    <bool name="config_show_enabled_vr_listeners">true</bool>
+
+    <!-- Whether phone_language should be shown or not. -->
+    <bool name="config_show_phone_language">true</bool>
+
+    <!-- Whether virtual_keyboard_pref should be shown or not. -->
+    <bool name="config_show_virtual_keyboard_pref">true</bool>
+
+    <!-- Whether physical_keyboard_pref should be shown or not. -->
+    <bool name="config_show_physical_keyboard_pref">true</bool>
+
+    <!-- Whether spellcheckers_settings should be shown or not. -->
+    <bool name="config_show_spellcheckers_settings">true</bool>
+
+    <!-- Whether tts_settings_summary should be shown or not. -->
+    <bool name="config_show_tts_settings_summary">true</bool>
+
+    <!-- Whether pointer_speed should be shown or not. -->
+    <bool name="config_show_pointer_speed">true</bool>
+
+    <!-- Whether vibrate_input_devices should be shown or not. -->
+    <bool name="config_show_vibrate_input_devices">true</bool>
+
+    <!-- Whether manage_device_admin should be shown or not. -->
+    <bool name="config_show_manage_device_admin">true</bool>
+
+    <!-- Whether unlock_set_or_change should be shown or not. -->
+    <bool name="config_show_unlock_set_or_change">true</bool>
+
+    <!-- Whether screen_pinning_settings should be shown or not. -->
+    <bool name="config_show_screen_pinning_settings">true</bool>
+
+    <!-- Whether manage_trust_agents should be shown or not. -->
+    <bool name="config_show_manage_trust_agents">true</bool>
+
+    <!-- Whether show_password should be shown or not. -->
+    <bool name="config_show_show_password">true</bool>
+
+    <!-- Whether trust_agent_click_intent should be shown or not. -->
+    <bool name="config_show_trust_agent_click_intent">true</bool>
+
+    <!-- Whether wallpaper attribution should be shown or not. -->
+    <bool name="config_show_wallpaper_attribution">true</bool>
+
+    <!-- Whether default_home should be shown or not. -->
+    <bool name="config_show_default_home">true</bool>
+
+    <!-- Whether assist_and_voice_input should be shown or not. -->
+    <bool name="config_show_assist_and_voice_input">true</bool>
+
+    <!-- Whether reset_dashboard should be shown or not. -->
+    <bool name="config_show_reset_dashboard">true</bool>
+
+    <!-- Whether system_update_settings should be shown or not. -->
+    <bool name="config_show_system_update_settings">true</bool>
+
+    <!-- Whether device_model should be shown or not. -->
+    <bool name="config_show_device_model">true</bool>
+
+    <!-- Whether top_level_battery should be shown or not. -->
+    <bool name="config_show_top_level_battery">true</bool>
+
+    <!-- Whether top_level_connected_devices should be shown or not. -->
+    <bool name="config_show_top_level_connected_devices">true</bool>
+
+    <!-- Whether top_level_display should be shown or not. -->
+    <bool name="config_show_top_level_display">true</bool>
+
+    <!-- Whether wifi_ip_address should be shown or not. -->
+    <bool name="config_show_wifi_ip_address">true</bool>
+
+    <!-- Whether wifi_mac_address should be shown or not. -->
+    <bool name="config_show_wifi_mac_address">true</bool>
+
+    <!-- Whether to disable "Uninstall Updates" menu item for System apps or not. -->
+    <bool name="config_disable_uninstall_update">false</bool>
+
+    <!-- Whether or not extra preview panels should be used for screen zoom setting. -->
+    <bool name="config_enable_extra_screen_zoom_preview">true</bool>
 </resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 0a35188..d42f073 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -38,6 +38,9 @@
 
     <dimen name="volume_seekbar_side_margin">8dip</dimen>
 
+    <dimen name="balance_seekbar_center_marker_height">14dp</dimen>
+    <dimen name="balance_seekbar_center_marker_width">1dp</dimen>
+
     <dimen name="crypt_clock_size">100sp</dimen>
 
     <dimen name="divider_height">3dip</dimen>
diff --git a/res/values/donottranslate.xml b/res/values/donottranslate.xml
index 611e2b4..e6bd9a6 100644
--- a/res/values/donottranslate.xml
+++ b/res/values/donottranslate.xml
@@ -33,8 +33,4 @@
         <item>@string/input_method_selector_always_show_value</item>
         <item>@string/input_method_selector_always_hide_value</item>
     </string-array>
-    <string name="category_key_wireless">com.android.settings.category.wireless</string>
-    <string name="category_key_device">com.android.settings.category.device</string>
-    <string name="category_key_personal">com.android.settings.category.personal</string>
-    <string name="category_key_system">com.android.settings.category.system</string>
 </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 ab52c5c..08c46d5 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -820,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>
@@ -4487,8 +4487,8 @@
     <string name="keyboard_shortcuts_helper">Keyboard shortcuts helper</string>
     <!-- Summary text for the 'keyboard shortcuts helper' dialog. [CHAR LIMIT=100] -->
     <string name="keyboard_shortcuts_helper_summary">Display available shortcuts</string>
-    <!-- Title for the 'Work profile' preference category inside Languages and inputs'. [CHAR LIMIT=45] -->
-    <string name="language_and_input_for_work_category_title">Work profile</string>
+    <!-- Title for the 'Work profile input & assistance' preference category inside Languages and inputs'. [CHAR LIMIT=50] -->
+    <string name="language_and_input_for_work_category_title">Work profile input &amp; assistance</string>
     <!-- Title for the 'Virtual keyboards for work' preference. [CHAR LIMIT=45] -->
     <string name="virtual_keyboards_for_work_title">Virtual keyboard for work</string>
 
@@ -4717,6 +4717,12 @@
     <string name="accessibility_toggle_master_mono_title">Mono audio</string>
     <!-- Summary for the accessibility preference for master mono. [CHAR LIMIT=50] -->
     <string name="accessibility_toggle_master_mono_summary">Combine channels when playing audio</string>
+    <!-- Title for the accessibility preference for master balance. [CHAR LIMIT=35] -->
+    <string name="accessibility_toggle_master_balance_title">Audio balance</string>
+    <!-- 'Left' balance text for the accessibility preference for master balance. [CHAR LIMIT=20] -->
+    <string name="accessibility_toggle_master_balance_left_label">Left</string>
+    <!-- 'Right' balance text for the accessibility preference for master balance. [CHAR LIMIT=20] -->
+    <string name="accessibility_toggle_master_balance_right_label">Right</string>
 
     <!-- Option heading to leave the timeout requirement for accessibility users at its default level. [CHAR LIMIT=35] -->
     <string name="accessibility_timeout_default">Default</string>
@@ -4771,13 +4777,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>
@@ -5850,6 +5856,10 @@
     <string name="sms_access_restriction_enabled">Restrict SMS &amp; call log access</string>
     <!-- Summary for whether to enable SMS access restriction [CHAR LIMIT=NONE]-->
     <string name="sms_access_restriction_enabled_summary">Only default phone and messaging apps have SMS &amp; call log permissions</string>
+    <!-- Title for the new device identifier access restrictions [CHAR LIMIT=50]-->
+    <string name="device_identifier_access_restrictions_title">Disable device identifier restrictions</string>
+    <!-- Summary for the new device identifier access restrictions [CHAR LIMIT=NONE]-->
+    <string name="device_identifier_access_restrictions_summary">Disable the new access restrictions for device identifiers</string>
 
 
     <!-- Message when there are no available trust agents to display -->
@@ -7056,7 +7066,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] -->
@@ -7615,6 +7627,9 @@
     <!-- Configure Notifications: Title for the notification badging option. [CHAR LIMIT=30 BACKUP_MESSAGE_ID=5125022693565388760] -->
     <string name="notification_badging_title">Allow notification dots</string>
 
+    <!-- Configure Notifications: Title for the notification bubbles option. [CHAR LIMIT=60] -->
+    <string name="notification_bubbles_title">Allow notification bubbles</string>
+
     <!-- Configure Notifications: Title for the pulse notification light option. [CHAR LIMIT=30] -->
     <string name="notification_pulse_title">Blink light</string>
 
@@ -10268,11 +10283,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>
@@ -10456,6 +10471,20 @@
     <!-- 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>
+    <!-- Label for the on position of a switch on the mobile network details page which allows
+         disabling/enabling a SIM. The SIM is enabled in this state. [CHAR LIMIT=40] -->
+    <string name="mobile_network_use_sim_on">Use SIM</string>
+    <!-- Label for the off position of a switch on the mobile network details page which allows
+         disabling/enabling a SIM. The SIM is disabled in this state. [CHAR LIMIT=40] -->
+    <string name="mobile_network_use_sim_off">Off</string>
 
     <!-- Title for preferred network type [CHAR LIMIT=NONE] -->
     <string name="preferred_network_mode_title">Preferred network type</string>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 6d153e1..935bbf2 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -419,7 +419,7 @@
         <item name="android:layout_marginBottom">@dimen/homepage_card_vertical_margin</item>
         <item name="android:layout_marginStart">@dimen/homepage_card_side_margin</item>
         <item name="android:layout_marginEnd">@dimen/homepage_card_side_margin</item>
-        <item name="cardCornerRadius">8dp</item>
+        <item name="cardCornerRadius">@*android:dimen/config_dialogCornerRadius</item>
         <item name="cardElevation">0dp</item>
         <item name="strokeColor">@color/homepage_card_stroke_color</item>
         <item name="strokeWidth">1dp</item>
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index cc07ce1..9cb73a2 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -130,6 +130,10 @@
                 android:summary="@string/accessibility_toggle_master_mono_summary"
                 android:persistent="false"/>
 
+        <com.android.settings.accessibility.BalanceSeekBarPreference
+                android:key="seekbar_master_balance"
+                android:title="@string/accessibility_toggle_master_balance_title" />
+
         <Preference
             android:key="hearing_aid_preference"
             android:summary="@string/accessibility_hearingaid_not_connected_summary"
diff --git a/res/xml/app_notification_settings.xml b/res/xml/app_notification_settings.xml
index 49d64a9..54d6fe7 100644
--- a/res/xml/app_notification_settings.xml
+++ b/res/xml/app_notification_settings.xml
@@ -60,9 +60,14 @@
             settings:useAdditionalSummary="true"
             android:order="1001"
             settings:restrictedSwitchSummary="@string/enabled_by_admin" />
+        <com.android.settingslib.RestrictedSwitchPreference
+            android:key="bubble"
+            android:title="@string/notification_bubbles_title"
+            android:order="1002"
+            settings:restrictedSwitchSummary="@string/enabled_by_admin" />
         <Preference
             android:key="app_link"
-            android:order="1002"
+            android:order="1003"
             android:title="@string/app_settings_link" />
 
     </PreferenceCategory>
diff --git a/res/xml/channel_notification_settings.xml b/res/xml/channel_notification_settings.xml
index 9e9e7a9..94a2cdb 100644
--- a/res/xml/channel_notification_settings.xml
+++ b/res/xml/channel_notification_settings.xml
@@ -86,17 +86,23 @@
             settings:useAdditionalSummary="true"
             settings:restrictedSwitchSummary="@string/enabled_by_admin"/>
 
+        <com.android.settingslib.RestrictedSwitchPreference
+            android:key="bubble"
+            android:title="@string/notification_bubbles_title"
+            android:order="16"
+            settings:restrictedSwitchSummary="@string/enabled_by_admin" />
+
         <!-- Bypass DND -->
         <com.android.settingslib.RestrictedSwitchPreference
             android:key="bypass_dnd"
-            android:order="16"
+            android:order="17"
             android:title="@string/app_notification_override_dnd_title"
             android:summary="@string/app_notification_override_dnd_summary"
             settings:useAdditionalSummary="true"/>
 
         <Preference
             android:key="app_link"
-            android:order="17"
+            android:order="18"
             android:title="@string/app_settings_link"
             settings:allowDividerAbove="true"/>
     </PreferenceCategory>
diff --git a/res/xml/configure_notification_settings.xml b/res/xml/configure_notification_settings.xml
index ca82609..8df1197 100644
--- a/res/xml/configure_notification_settings.xml
+++ b/res/xml/configure_notification_settings.xml
@@ -38,6 +38,12 @@
         android:title="@string/notification_badging_title"
         settings:controller="com.android.settings.notification.BadgingNotificationPreferenceController"/>
 
+    <!-- Notification bubbles -->
+    <SwitchPreference
+        android:key="notification_bubbles"
+        android:title="@string/notification_bubbles_title"
+        settings:controller="com.android.settings.notification.BubbleNotificationPreferenceController"/>
+
     <!-- Pulse notification light -->
     <SwitchPreference
         android:key="notification_pulse"
diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml
index d7fcaec..d9b592c 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
@@ -529,6 +540,11 @@
             android:key="sms_access_restriction_enabled"
             android:title="@string/sms_access_restriction_enabled"
             android:summary="@string/sms_access_restriction_enabled_summary" />
+
+        <SwitchPreference
+            android:key="device_identifier_access_restrictions"
+            android:title="@string/device_identifier_access_restrictions_title"
+            android:summary="@string/device_identifier_access_restrictions_summary" />
     </PreferenceCategory>
 
     <com.android.settings.development.autofill.AutofillPreferenceCategory
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/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_settings_v2.xml b/res/xml/mobile_network_settings_v2.xml
index 6273ad9..f269fad 100644
--- a/res/xml/mobile_network_settings_v2.xml
+++ b/res/xml/mobile_network_settings_v2.xml
@@ -17,7 +17,12 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:settings="http://schemas.android.com/apk/res-auto"
     android:key="mobile_network_pref_screen"
-    settings:initialExpandedChildrenCount="7">
+    settings:initialExpandedChildrenCount="8">
+
+    <com.android.settingslib.widget.LayoutPreference
+        android:key="use_sim_switch"
+        android:layout="@layout/styled_switch_bar"
+        settings:controller="com.android.settings.network.telephony.MobileNetworkSwitchController"/>
 
     <com.android.settings.datausage.DataUsageSummaryPreference
         android:key="status_header"
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/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index 8cff5f1..e7f543a 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -71,6 +71,7 @@
     public static class AppUsageAccessSettingsActivity extends SettingsActivity { /* empty */ }
     public static class LocationSettingsActivity extends SettingsActivity { /* empty */ }
     public static class ScanningSettingsActivity extends SettingsActivity { /* empty */ }
+    public static class PrivacyDashboardActivity extends SettingsActivity { /* empty */ }
     public static class PrivacySettingsActivity extends SettingsActivity { /* empty */ }
     public static class FactoryResetActivity extends SettingsActivity { /* empty */ }
     public static class RunningServicesActivity extends SettingsActivity { /* empty */ }
diff --git a/src/com/android/settings/accessibility/BalanceSeekBar.java b/src/com/android/settings/accessibility/BalanceSeekBar.java
new file mode 100644
index 0000000..e18a593
--- /dev/null
+++ b/src/com/android/settings/accessibility/BalanceSeekBar.java
@@ -0,0 +1,152 @@
+/*
+ * 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.res.ColorStateList;
+import android.content.res.Resources;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.Rect;
+import android.os.UserHandle;
+import android.provider.Settings;
+import android.util.AttributeSet;
+import android.widget.SeekBar;
+
+import com.android.settings.R;
+
+/**
+ * A custom seekbar for the balance setting.
+ *
+ * Adds a center line indicator between left and right, which snaps to if close.
+ * Updates Settings.System for balance on progress changed.
+ */
+public class BalanceSeekBar extends SeekBar {
+    private static final String TAG = "BalanceSeekBar";
+    private final Context mContext;
+    private final Object mListenerLock = new Object();
+    private OnSeekBarChangeListener mOnSeekBarChangeListener;
+    private final OnSeekBarChangeListener mProxySeekBarListener = new OnSeekBarChangeListener() {
+        @Override
+        public void onStopTrackingTouch(SeekBar seekBar) {
+            synchronized(mListenerLock) {
+                if (mOnSeekBarChangeListener != null) {
+                    mOnSeekBarChangeListener.onStopTrackingTouch(seekBar);
+                }
+            }
+        }
+
+        @Override
+        public void onStartTrackingTouch(SeekBar seekBar) {
+            synchronized(mListenerLock) {
+                if (mOnSeekBarChangeListener != null) {
+                    mOnSeekBarChangeListener.onStartTrackingTouch(seekBar);
+                }
+            }
+        }
+
+        @Override
+        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+            if (fromUser) {
+                // Snap to centre when within the specified threshold
+                if (progress != mCenter
+                        && progress > mCenter - mSnapThreshold
+                        && progress < mCenter + mSnapThreshold) {
+                    progress = mCenter;
+                    seekBar.setProgress(progress); // direct update (fromUser becomes false)
+                }
+                final float balance = (progress - mCenter) * 0.01f;
+                Settings.System.putFloatForUser(mContext.getContentResolver(),
+                        Settings.System.MASTER_BALANCE, balance, UserHandle.USER_CURRENT);
+            }
+            // If fromUser is false, the call is a set from the framework on creation or on
+            // internal update. The progress may be zero, ignore (don't change system settings).
+
+            // after adjusting the seekbar, notify downstream listener.
+            // note that progress may have been adjusted in the code above to mCenter.
+            synchronized(mListenerLock) {
+                if (mOnSeekBarChangeListener != null) {
+                    mOnSeekBarChangeListener.onProgressChanged(seekBar, progress, fromUser);
+                }
+            }
+        }
+    };
+
+    // Percentage of max to be used as a snap to threshold
+    private static final float SNAP_TO_PERCENTAGE = 0.03f;
+    private final Paint mCenterMarkerPaint;
+    private final Rect mCenterMarkerRect;
+    // changed in setMax()
+    private float mSnapThreshold;
+    private int mCenter;
+
+    public BalanceSeekBar(Context context, AttributeSet attrs) {
+        this(context, attrs, com.android.internal.R.attr.seekBarStyle);
+    }
+
+    public BalanceSeekBar(Context context, AttributeSet attrs, int defStyleAttr) {
+        this(context, attrs, defStyleAttr, 0 /* defStyleRes */);
+    }
+
+    public BalanceSeekBar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+        super(context, attrs, defStyleAttr, defStyleRes);
+        mContext = context;
+        Resources res = getResources();
+        mCenterMarkerRect = new Rect(0 /* left */, 0 /* top */,
+                res.getDimensionPixelSize(R.dimen.balance_seekbar_center_marker_width),
+                res.getDimensionPixelSize(R.dimen.balance_seekbar_center_marker_height));
+        mCenterMarkerPaint = new Paint();
+        // TODO use a more suitable colour?
+        mCenterMarkerPaint.setColor(Color.BLACK);
+        mCenterMarkerPaint.setStyle(Paint.Style.FILL);
+        // Remove the progress colour
+        setProgressTintList(ColorStateList.valueOf(Color.TRANSPARENT));
+
+        super.setOnSeekBarChangeListener(mProxySeekBarListener);
+    }
+
+    @Override
+    public void setOnSeekBarChangeListener(OnSeekBarChangeListener listener) {
+        synchronized(mListenerLock) {
+            mOnSeekBarChangeListener = listener;
+        }
+    }
+
+    // Note: the superclass AbsSeekBar.setMax is synchronized.
+    @Override
+    public synchronized void setMax(int max) {
+        super.setMax(max);
+        // update snap to threshold
+        mCenter = max / 2;
+        mSnapThreshold = max * SNAP_TO_PERCENTAGE;
+    }
+
+    // Note: the superclass AbsSeekBar.onDraw is synchronized.
+    @Override
+    protected synchronized void onDraw(Canvas canvas) {
+        // Draw a vertical line at 50% that represents centred balance
+        int seekBarCenter = (canvas.getHeight() - getPaddingBottom()) / 2;
+        canvas.save();
+        canvas.translate((canvas.getWidth() - mCenterMarkerRect.right) / 2,
+                seekBarCenter - (mCenterMarkerRect.bottom / 2));
+        canvas.drawRect(mCenterMarkerRect, mCenterMarkerPaint);
+        canvas.restore();
+        super.onDraw(canvas);
+    }
+}
+
diff --git a/src/com/android/settings/accessibility/BalanceSeekBarPreference.java b/src/com/android/settings/accessibility/BalanceSeekBarPreference.java
new file mode 100644
index 0000000..a40282c
--- /dev/null
+++ b/src/com/android/settings/accessibility/BalanceSeekBarPreference.java
@@ -0,0 +1,70 @@
+/*
+ * 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.media.AudioSystem;
+import android.os.UserHandle;
+import android.provider.Settings;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.SeekBar;
+
+import androidx.core.content.res.TypedArrayUtils;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceViewHolder;
+
+import com.android.settings.R;
+import com.android.settings.widget.SeekBarPreference;
+
+/** A slider preference that directly controls audio balance **/
+public class BalanceSeekBarPreference extends SeekBarPreference {
+    private static final String TAG = "BalanceSeekBarPreference";
+    private final Context mContext;
+    private BalanceSeekBar mSeekBar;
+    private ImageView mIconView;
+
+    public BalanceSeekBarPreference(Context context, AttributeSet attrs) {
+        super(context, attrs, TypedArrayUtils.getAttr(context,
+                R.attr.preferenceStyle,
+                android.R.attr.preferenceStyle));
+        mContext = context;
+        setLayoutResource(R.layout.preference_balance_slider);
+    }
+
+    @Override
+    public void onBindViewHolder(PreferenceViewHolder view) {
+        super.onBindViewHolder(view);
+        mSeekBar = (BalanceSeekBar) view.findViewById(com.android.internal.R.id.seekbar);
+        mIconView = (ImageView) view.findViewById(com.android.internal.R.id.icon);
+        init();
+    }
+
+    private void init() {
+        if (mSeekBar == null) {
+            return;
+        }
+        final float balance = Settings.System.getFloatForUser(
+                mContext.getContentResolver(), Settings.System.MASTER_BALANCE,
+                0.f /* default */, UserHandle.USER_CURRENT);
+        // Rescale balance to range 0-200 centered at 100.
+        mSeekBar.setMax(200);
+        mSeekBar.setProgress((int)(balance * 100.f) + 100);
+        mSeekBar.setEnabled(isEnabled());
+    }
+}
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/appinfo/AppDataUsagePreferenceController.java b/src/com/android/settings/applications/appinfo/AppDataUsagePreferenceController.java
index 1bfcd7d..7d9fdcf 100644
--- a/src/com/android/settings/applications/appinfo/AppDataUsagePreferenceController.java
+++ b/src/com/android/settings/applications/appinfo/AppDataUsagePreferenceController.java
@@ -89,7 +89,7 @@
     public Loader<List<NetworkCycleDataForUid>> onCreateLoader(int id, Bundle args) {
         final NetworkTemplate template = getTemplate(mContext);
         return NetworkCycleDataForUidLoader.builder(mContext)
-            .setUid(mParent.getAppEntry().info.uid)
+            .addUid(mParent.getAppEntry().info.uid)
             .setRetrieveDetail(false)
             .setNetworkTemplate(template)
             .setSubscriberId(template.getSubscriberId())
diff --git a/src/com/android/settings/core/gateway/SettingsGateway.java b/src/com/android/settings/core/gateway/SettingsGateway.java
index bb292a1..fb3d0c5 100644
--- a/src/com/android/settings/core/gateway/SettingsGateway.java
+++ b/src/com/android/settings/core/gateway/SettingsGateway.java
@@ -274,6 +274,7 @@
             Settings.StorageDashboardActivity.class.getName(),
             Settings.PowerUsageSummaryActivity.class.getName(),
             Settings.AccountDashboardActivity.class.getName(),
+            Settings.PrivacySettingsActivity.class.getName(),
             Settings.SecurityDashboardActivity.class.getName(),
             Settings.AccessibilitySettingsActivity.class.getName(),
             Settings.SystemDashboardActivity.class.getName(),
diff --git a/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java b/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java
index f79cf5b..6348b91 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;
@@ -43,7 +46,7 @@
 import com.android.settings.SettingsActivity;
 import com.android.settings.dashboard.profileselector.ProfileSelectDialog;
 import com.android.settings.overlay.FeatureFactory;
-import com.android.settings.widget.RoundedHomepageIcon;
+import com.android.settings.widget.AdaptiveHomepageIcon;
 import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
 import com.android.settingslib.drawer.DashboardCategory;
 import com.android.settingslib.drawer.Tile;
@@ -194,8 +197,8 @@
             Drawable iconDrawable = tileIcon.loadDrawable(preference.getContext());
             if (forceRoundedIcon
                     && !TextUtils.equals(mContext.getPackageName(), tile.getPackageName())) {
-                iconDrawable = new RoundedHomepageIcon(mContext, iconDrawable);
-                ((RoundedHomepageIcon) iconDrawable).setBackgroundColor(mContext, tile);
+                iconDrawable = new AdaptiveHomepageIcon(mContext, iconDrawable);
+                ((AdaptiveHomepageIcon) iconDrawable).setBackgroundColor(mContext, tile);
             }
             preference.setIcon(iconDrawable);
         } else if (tile.getMetaData() != null
@@ -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/datausage/AppDataUsage.java b/src/com/android/settings/datausage/AppDataUsage.java
index 329bf68..4f38843 100644
--- a/src/com/android/settings/datausage/AppDataUsage.java
+++ b/src/com/android/settings/datausage/AppDataUsage.java
@@ -94,10 +94,12 @@
     private SpinnerPreference mCycle;
     private RestrictedSwitchPreference mUnrestrictedData;
     private DataSaverBackend mDataSaverBackend;
+    private Context mContext;
 
     @Override
     public void onCreate(Bundle icicle) {
         super.onCreate(icicle);
+        mContext = getContext();
         mPackageManager = getPackageManager();
         final Bundle args = getArguments();
 
@@ -105,9 +107,8 @@
         mTemplate = (args != null) ? (NetworkTemplate) args.getParcelable(ARG_NETWORK_TEMPLATE)
                 : null;
         if (mTemplate == null) {
-            Context context = getContext();
-            mTemplate = DataUsageUtils.getDefaultTemplate(context,
-                    DataUsageUtils.getDefaultSubscriptionId(context));
+            mTemplate = DataUsageUtils.getDefaultTemplate(mContext,
+                    DataUsageUtils.getDefaultSubscriptionId(mContext));
         }
         if (mAppItem == null) {
             int uid = (args != null) ? args.getInt(AppInfoBase.ARG_PACKAGE_UID, -1)
@@ -131,7 +132,7 @@
         mBackgroundUsage = findPreference(KEY_BACKGROUND_USAGE);
 
         mCycle = (SpinnerPreference) findPreference(KEY_CYCLE);
-        mCycleAdapter = new CycleAdapter(getContext(), mCycle, mCycleListener);
+        mCycleAdapter = new CycleAdapter(mContext, mCycle, mCycleListener);
 
         if (mAppItem.key > 0) {
             if (mPackages.size() != 0) {
@@ -155,7 +156,7 @@
                         KEY_UNRESTRICTED_DATA);
                 mUnrestrictedData.setOnPreferenceChangeListener(this);
             }
-            mDataSaverBackend = new DataSaverBackend(getContext());
+            mDataSaverBackend = new DataSaverBackend(mContext);
             mAppSettings = findPreference(KEY_APP_SETTINGS);
 
             mAppSettingsIntent = new Intent(Intent.ACTION_MANAGE_NETWORK_USAGE);
@@ -256,7 +257,7 @@
 
     private void updatePrefs(boolean restrictBackground, boolean unrestrictData) {
         final EnforcedAdmin admin = RestrictedLockUtilsInternal.checkIfMeteredDataRestricted(
-                getContext(), mPackageName, UserHandle.getUserId(mAppItem.key));
+                mContext, mPackageName, UserHandle.getUserId(mAppItem.key));
         if (mRestrictBackground != null) {
             mRestrictBackground.setChecked(!restrictBackground);
             mRestrictBackground.setDisabledByAdmin(admin);
@@ -294,11 +295,10 @@
             foregroundBytes = data.getForegroudUsage();
         }
         final long totalBytes = backgroundBytes + foregroundBytes;
-        final Context context = getContext();
 
-        mTotalUsage.setSummary(DataUsageUtils.formatDataUsage(context, totalBytes));
-        mForegroundUsage.setSummary(DataUsageUtils.formatDataUsage(context, foregroundBytes));
-        mBackgroundUsage.setSummary(DataUsageUtils.formatDataUsage(context, backgroundBytes));
+        mTotalUsage.setSummary(DataUsageUtils.formatDataUsage(mContext, totalBytes));
+        mForegroundUsage.setSummary(DataUsageUtils.formatDataUsage(mContext, foregroundBytes));
+        mBackgroundUsage.setSummary(DataUsageUtils.formatDataUsage(mContext, backgroundBytes));
     }
 
     private boolean getAppRestrictBackground() {
@@ -364,16 +364,24 @@
         }
     };
 
-    private final LoaderManager.LoaderCallbacks<List<NetworkCycleDataForUid>> mUidDataCallbacks =
+    @VisibleForTesting
+    final LoaderManager.LoaderCallbacks<List<NetworkCycleDataForUid>> mUidDataCallbacks =
         new LoaderManager.LoaderCallbacks<List<NetworkCycleDataForUid>>() {
             @Override
             public Loader<List<NetworkCycleDataForUid>> onCreateLoader(int id, Bundle args) {
-                return NetworkCycleDataForUidLoader.builder(getContext())
-                    .setUid(mAppItem.key)
-                    .setRetrieveDetail(true)
+                final NetworkCycleDataForUidLoader.Builder builder
+                    = NetworkCycleDataForUidLoader.builder(mContext);
+                builder.setRetrieveDetail(true)
                     .setNetworkTemplate(mTemplate)
-                    .setSubscriberId(mTemplate.getSubscriberId())
-                    .build();
+                    .setSubscriberId(mTemplate.getSubscriberId());
+                if (mAppItem.category == AppItem.CATEGORY_USER) {
+                    for (int i = 0; i < mAppItem.uids.size(); i++) {
+                        builder.addUid(mAppItem.uids.keyAt(i));
+                    }
+                } else {
+                    builder.addUid(mAppItem.key);
+                }
+                return builder.build();
             }
 
             @Override
diff --git a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
index 5135fbf..78520c6 100644
--- a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
+++ b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
@@ -478,6 +478,7 @@
         controllers.add(new FreeformWindowsPreferenceController(context));
         controllers.add(new DesktopModePreferenceController(context));
         controllers.add(new SmsAccessRestrictionPreferenceController(context));
+        controllers.add(new DeviceIdentifierAccessRestrictionsPreferenceController(context));
         controllers.add(new ShortcutManagerThrottlingPreferenceController(context));
         controllers.add(new EnableGnssRawMeasFullTrackingPreferenceController(context));
         controllers.add(new DefaultLaunchPreferenceController(context, "running_apps"));
@@ -497,6 +498,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/DeviceIdentifierAccessRestrictionsPreferenceController.java b/src/com/android/settings/development/DeviceIdentifierAccessRestrictionsPreferenceController.java
new file mode 100644
index 0000000..05ac8c7
--- /dev/null
+++ b/src/com/android/settings/development/DeviceIdentifierAccessRestrictionsPreferenceController.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.development;
+
+import android.content.Context;
+import android.provider.DeviceConfig;
+
+import androidx.preference.Preference;
+import androidx.preference.SwitchPreference;
+
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.development.DeveloperOptionsPreferenceController;
+
+public class DeviceIdentifierAccessRestrictionsPreferenceController
+        extends DeveloperOptionsPreferenceController
+        implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
+
+    private static final String DEVICE_IDENTIFIER_ACCESS_RESTRICTIONS_KEY =
+            "device_identifier_access_restrictions";
+
+    public DeviceIdentifierAccessRestrictionsPreferenceController(Context context) {
+        super(context);
+    }
+
+    @Override
+    public String getPreferenceKey() {
+        return DEVICE_IDENTIFIER_ACCESS_RESTRICTIONS_KEY;
+    }
+
+    @Override
+    public boolean onPreferenceChange(Preference preference, Object newValue) {
+        writeSetting((boolean) newValue);
+        return true;
+    }
+
+    private void writeSetting(boolean isEnabled) {
+        DeviceConfig.setProperty(DeviceConfig.Privacy.NAMESPACE,
+                DeviceConfig.Privacy.PROPERTY_DEVICE_IDENTIFIER_ACCESS_RESTRICTIONS_DISABLED,
+                String.valueOf(isEnabled), false);
+    }
+
+    @Override
+    public void updateState(Preference preference) {
+        boolean isEnabled = Boolean.parseBoolean(
+                DeviceConfig.getProperty(DeviceConfig.Privacy.NAMESPACE,
+                        DeviceConfig.Privacy.PROPERTY_DEVICE_IDENTIFIER_ACCESS_RESTRICTIONS_DISABLED));
+        ((SwitchPreference) mPreference).setChecked(isEnabled);
+    }
+
+    @Override
+    protected void onDeveloperOptionsSwitchDisabled() {
+        super.onDeveloperOptionsSwitchDisabled();
+        writeSetting(false);
+        ((SwitchPreference) mPreference).setChecked(true);
+    }
+}
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/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/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..7020c49 100644
--- a/src/com/android/settings/display/NightDisplayPreference.java
+++ b/src/com/android/settings/display/NightDisplayPreference.java
@@ -15,24 +15,26 @@
 package com.android.settings.display;
 
 import android.content.Context;
+import android.hardware.display.ColorDisplayManager;
+import android.hardware.display.NightDisplayListener;
 import android.util.AttributeSet;
 
 import androidx.preference.SwitchPreference;
 
-import com.android.internal.app.ColorDisplayController;
-
 import java.time.LocalTime;
 
 public class NightDisplayPreference extends SwitchPreference
-        implements ColorDisplayController.Callback {
+        implements NightDisplayListener.Callback {
 
-    private ColorDisplayController mController;
+    private ColorDisplayManager mColorDisplayManager;
+    private NightDisplayListener mNightDisplayListener;
     private NightDisplayTimeFormatter mTimeFormatter;
 
     public NightDisplayPreference(Context context, AttributeSet attrs) {
         super(context, attrs);
 
-        mController = new ColorDisplayController(context);
+        mColorDisplayManager = context.getSystemService(ColorDisplayManager.class);
+        mNightDisplayListener = new NightDisplayListener(context);
         mTimeFormatter = new NightDisplayTimeFormatter(context);
     }
 
@@ -41,7 +43,7 @@
         super.onAttached();
 
         // Listen for changes only while attached.
-        mController.setListener(this);
+        mNightDisplayListener.setCallback(this);
 
         // Update the summary since the state may have changed while not attached.
         updateSummary();
@@ -52,7 +54,7 @@
         super.onDetached();
 
         // Stop listening for state changes.
-        mController.setListener(null);
+        mNightDisplayListener.setCallback(null);
     }
 
     @Override
@@ -76,6 +78,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..6441d71 100644
--- a/src/com/android/settings/display/NightDisplaySettings.java
+++ b/src/com/android/settings/display/NightDisplaySettings.java
@@ -21,12 +21,12 @@
 import android.app.settings.SettingsEnums;
 import android.content.Context;
 import android.hardware.display.ColorDisplayManager;
+import android.hardware.display.NightDisplayListener;
 import android.os.Bundle;
 import android.provider.SearchIndexableResource;
 
 import androidx.preference.Preference;
 
-import com.android.internal.app.ColorDisplayController;
 import com.android.settings.R;
 import com.android.settings.dashboard.DashboardFragment;
 import com.android.settings.search.BaseSearchIndexProvider;
@@ -43,21 +43,23 @@
  */
 @SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
 public class NightDisplaySettings extends DashboardFragment
-        implements ColorDisplayController.Callback {
+        implements NightDisplayListener.Callback {
 
     private static final String TAG = "NightDisplaySettings";
 
     private static final int DIALOG_START_TIME = 0;
     private static final int DIALOG_END_TIME = 1;
 
-    private ColorDisplayController mController;
+    private ColorDisplayManager mColorDisplayManager;
+    private NightDisplayListener mNightDisplayListener;
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
         final Context context = getContext();
-        mController = new ColorDisplayController(context);
+        mColorDisplayManager = context.getSystemService(ColorDisplayManager.class);
+        mNightDisplayListener = new NightDisplayListener(context);
     }
 
     @Override
@@ -65,7 +67,7 @@
         super.onStart();
 
         // Listen for changes only while visible.
-        mController.setListener(this);
+        mNightDisplayListener.setCallback(this);
     }
 
     @Override
@@ -73,7 +75,7 @@
         super.onStop();
 
         // Stop listening for state changes.
-        mController.setListener(null);
+        mNightDisplayListener.setCallback(null);
     }
 
     @Override
@@ -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/homepage/AdaptiveIconShapeDrawable.java b/src/com/android/settings/homepage/AdaptiveIconShapeDrawable.java
new file mode 100644
index 0000000..62b768a
--- /dev/null
+++ b/src/com/android/settings/homepage/AdaptiveIconShapeDrawable.java
@@ -0,0 +1,43 @@
+package com.android.settings.homepage;
+
+import android.content.res.Resources;
+import android.content.res.Resources.Theme;
+import android.graphics.Path;
+import android.graphics.drawable.AdaptiveIconDrawable;
+import android.graphics.drawable.ShapeDrawable;
+import android.graphics.drawable.shapes.PathShape;
+import android.util.AttributeSet;
+import android.util.PathParser;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+import java.io.IOException;
+
+/**
+ * Draws a filled {@link ShapeDrawable} using the path from {@link AdaptiveIconDrawable}.
+ */
+public class AdaptiveIconShapeDrawable extends ShapeDrawable {
+    public AdaptiveIconShapeDrawable() {
+        super();
+    }
+
+    public AdaptiveIconShapeDrawable(Resources resources) {
+        super();
+        init(resources);
+    }
+
+    @Override
+    public void inflate(Resources r, XmlPullParser parser, AttributeSet attrs, Theme theme)
+            throws XmlPullParserException, IOException {
+        super.inflate(r, parser, attrs, theme);
+        init(r);
+    }
+
+    private void init(Resources resources) {
+        final float pathSize = AdaptiveIconDrawable.MASK_SIZE;
+        final Path path = new Path(PathParser.createPathFromPathData(
+                resources.getString(com.android.internal.R.string.config_icon_mask)));
+        setShape(new PathShape(path, pathSize, pathSize));
+    }
+}
diff --git a/src/com/android/settings/homepage/contextualcards/conditional/NightDisplayConditionController.java b/src/com/android/settings/homepage/contextualcards/conditional/NightDisplayConditionController.java
index a673e46..347d4eb 100644
--- a/src/com/android/settings/homepage/contextualcards/conditional/NightDisplayConditionController.java
+++ b/src/com/android/settings/homepage/contextualcards/conditional/NightDisplayConditionController.java
@@ -19,7 +19,8 @@
 import android.app.settings.SettingsEnums;
 import android.content.Context;
 
-import com.android.internal.app.ColorDisplayController;
+import android.hardware.display.ColorDisplayManager;
+import android.hardware.display.NightDisplayListener;
 import com.android.settings.R;
 import com.android.settings.core.SubSettingLauncher;
 import com.android.settings.display.NightDisplaySettings;
@@ -28,17 +29,20 @@
 import java.util.Objects;
 
 public class NightDisplayConditionController implements ConditionalCardController,
-        ColorDisplayController.Callback {
+        NightDisplayListener.Callback {
+
     static final int ID = Objects.hash("NightDisplayConditionController");
 
     private final Context mAppContext;
     private final ConditionManager mConditionManager;
-    private final ColorDisplayController mController;
+    private final ColorDisplayManager mColorDisplayManager;
+    private final NightDisplayListener mNightDisplayListener;
 
     public NightDisplayConditionController(Context appContext, ConditionManager manager) {
-        mController = new ColorDisplayController(appContext);
         mAppContext = appContext;
         mConditionManager = manager;
+        mColorDisplayManager = appContext.getSystemService(ColorDisplayManager.class);
+        mNightDisplayListener = new NightDisplayListener(appContext);
     }
 
     @Override
@@ -48,7 +52,7 @@
 
     @Override
     public boolean isDisplayable() {
-        return mController.isActivated();
+        return mColorDisplayManager.isNightDisplayActivated();
     }
 
     @Override
@@ -62,7 +66,7 @@
 
     @Override
     public void onActionClick() {
-        mController.setActivated(false);
+        mColorDisplayManager.setNightDisplayActivated(false);
     }
 
     @Override
@@ -84,12 +88,12 @@
 
     @Override
     public void startMonitoringStateChange() {
-        mController.setListener(this);
+        mNightDisplayListener.setCallback(this);
     }
 
     @Override
     public void stopMonitoringStateChange() {
-        mController.setListener(null);
+        mNightDisplayListener.setCallback(null);
     }
 
     @Override
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/telephony/MobileDataPreferenceController.java b/src/com/android/settings/network/telephony/MobileDataPreferenceController.java
index 9ebeda0..47822b6 100644
--- a/src/com/android/settings/network/telephony/MobileDataPreferenceController.java
+++ b/src/com/android/settings/network/telephony/MobileDataPreferenceController.java
@@ -118,7 +118,8 @@
 
     @Override
     public boolean isChecked() {
-        return mTelephonyManager.isDataEnabled();
+        return mTelephonyManager.isDataEnabled()
+                && mSubId == SubscriptionManager.getDefaultDataSubscriptionId();
     }
 
     public void init(FragmentManager fragmentManager, int subId) {
@@ -129,7 +130,7 @@
 
     @VisibleForTesting
     boolean isDialogNeeded() {
-        final boolean enableData = !mTelephonyManager.isDataEnabled();
+        final boolean enableData = !isChecked();
         final boolean isMultiSim = (mTelephonyManager.getSimCount() > 1);
         final int defaultSubId = mSubscriptionManager.getDefaultDataSubscriptionId();
         final boolean needToDisableOthers = mSubscriptionManager
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..e05f185 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 {
 
@@ -129,6 +132,7 @@
         if (FeatureFlagPersistent.isEnabled(getContext(), FeatureFlags.NETWORK_INTERNET_V2)) {
           use(CallsDefaultSubscriptionController.class).init(getLifecycle());
           use(SmsDefaultSubscriptionController.class).init(getLifecycle());
+          use(MobileNetworkSwitchController.class).init(getLifecycle(), mSubId);
         }
         use(MobileDataPreferenceController.class).init(getFragmentManager(), mSubId);
         use(RoamingPreferenceController.class).init(getFragmentManager(), mSubId);
@@ -219,6 +223,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/MobileNetworkSwitchController.java b/src/com/android/settings/network/telephony/MobileNetworkSwitchController.java
new file mode 100644
index 0000000..60170d3
--- /dev/null
+++ b/src/com/android/settings/network/telephony/MobileNetworkSwitchController.java
@@ -0,0 +1,128 @@
+/*
+ * 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 androidx.lifecycle.Lifecycle.Event.ON_PAUSE;
+import static androidx.lifecycle.Lifecycle.Event.ON_RESUME;
+
+import android.content.Context;
+import android.telephony.SubscriptionInfo;
+import android.telephony.SubscriptionManager;
+
+import com.android.settings.R;
+import com.android.settings.core.BasePreferenceController;
+import com.android.settings.core.FeatureFlags;
+import com.android.settings.development.featureflags.FeatureFlagPersistent;
+import com.android.settings.network.SubscriptionUtil;
+import com.android.settings.network.SubscriptionsChangeListener;
+import com.android.settings.widget.SwitchBar;
+import com.android.settingslib.widget.LayoutPreference;
+
+import java.util.List;
+
+import androidx.lifecycle.Lifecycle;
+import androidx.lifecycle.LifecycleObserver;
+import androidx.lifecycle.OnLifecycleEvent;
+import androidx.preference.PreferenceScreen;
+
+/** This controls a switch to allow enabling/disabling a mobile network */
+public class MobileNetworkSwitchController extends BasePreferenceController implements
+        SubscriptionsChangeListener.SubscriptionsChangeListenerClient, LifecycleObserver {
+    private static final String TAG = "MobileNetworkSwitchCtrl";
+    private SwitchBar mSwitchBar;
+    private int mSubId;
+    private SubscriptionsChangeListener mChangeListener;
+    private SubscriptionManager mSubscriptionManager;
+
+    public MobileNetworkSwitchController(Context context, String preferenceKey) {
+        super(context, preferenceKey);
+        mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
+        mSubscriptionManager = mContext.getSystemService(SubscriptionManager.class);
+        mChangeListener = new SubscriptionsChangeListener(context, this);
+    }
+
+    public void init(Lifecycle lifecycle, int subId) {
+        lifecycle.addObserver(this);
+        mSubId = subId;
+    }
+
+    @OnLifecycleEvent(ON_RESUME)
+    public void onResume() {
+        mChangeListener.start();
+        update();
+    }
+
+    @OnLifecycleEvent(ON_PAUSE)
+    public void onPause() {
+        mChangeListener.stop();
+    }
+
+    @Override
+    public void displayPreference(PreferenceScreen screen) {
+        super.displayPreference(screen);
+        final LayoutPreference pref = screen.findPreference(mPreferenceKey);
+        mSwitchBar = pref.findViewById(R.id.switch_bar);
+        mSwitchBar.setSwitchBarText(R.string.mobile_network_use_sim_on,
+                R.string.mobile_network_use_sim_off);
+
+        mSwitchBar.addOnSwitchChangeListener((switchView, isChecked) -> {
+            if (mSubscriptionManager.isSubscriptionEnabled(mSubId) != isChecked) {
+                mSubscriptionManager.setSubscriptionEnabled(mSubId, isChecked);
+            }
+        });
+        update();
+    }
+
+    private void update() {
+        if (mSwitchBar == null) {
+            return;
+        }
+        final List<SubscriptionInfo> subs = SubscriptionUtil.getAvailableSubscriptions(
+                mSubscriptionManager);
+        if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID || subs.size() < 2) {
+            mSwitchBar.hide();
+            return;
+        }
+
+        for (SubscriptionInfo info : subs) {
+            if (info.getSubscriptionId() == mSubId) {
+                mSwitchBar.show();
+                mSwitchBar.setChecked(mSubscriptionManager.isSubscriptionEnabled(mSubId));
+                return;
+            }
+        }
+        // This subscription was not found in the available list.
+        mSwitchBar.hide();
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        if (FeatureFlagPersistent.isEnabled(mContext, FeatureFlags.NETWORK_INTERNET_V2)) {
+            return AVAILABLE_UNSEARCHABLE;
+        } else {
+            return CONDITIONALLY_UNAVAILABLE;
+        }
+    }
+
+    @Override
+    public void onAirplaneModeChanged(boolean airplaneModeEnabled) {}
+
+    @Override
+    public void onSubscriptionsChanged() {
+        update();
+    }
+}
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/notification/AppNotificationSettings.java b/src/com/android/settings/notification/AppNotificationSettings.java
index 6da3165..3977e45 100644
--- a/src/com/android/settings/notification/AppNotificationSettings.java
+++ b/src/com/android/settings/notification/AppNotificationSettings.java
@@ -152,6 +152,7 @@
         mControllers.add(new DescriptionPreferenceController(context));
         mControllers.add(new NotificationsOffPreferenceController(context));
         mControllers.add(new DeletedChannelsPreferenceController(context, mBackend));
+        mControllers.add(new BubblePreferenceController(context, mBackend));
         return new ArrayList<>(mControllers);
     }
 
diff --git a/src/com/android/settings/notification/BadgePreferenceController.java b/src/com/android/settings/notification/BadgePreferenceController.java
index ad417b0..67332a4 100644
--- a/src/com/android/settings/notification/BadgePreferenceController.java
+++ b/src/com/android/settings/notification/BadgePreferenceController.java
@@ -60,7 +60,7 @@
             if (isDefaultChannel()) {
                 return true;
             } else {
-                return mAppRow.showBadge;
+                return mAppRow == null ? false : mAppRow.showBadge;
             }
         }
         return true;
diff --git a/src/com/android/settings/notification/BubbleNotificationPreferenceController.java b/src/com/android/settings/notification/BubbleNotificationPreferenceController.java
new file mode 100644
index 0000000..caba7d9
--- /dev/null
+++ b/src/com/android/settings/notification/BubbleNotificationPreferenceController.java
@@ -0,0 +1,124 @@
+/*
+ * 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_BUBBLES;
+import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.database.ContentObserver;
+import android.net.Uri;
+import android.os.Handler;
+import android.provider.Settings;
+import android.text.TextUtils;
+
+import com.android.settings.core.PreferenceControllerMixin;
+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;
+
+import androidx.annotation.VisibleForTesting;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceScreen;
+
+public class BubbleNotificationPreferenceController extends TogglePreferenceController
+        implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener,
+        LifecycleObserver, OnResume, OnPause {
+
+    private static final String TAG = "BubbleNotifPrefContr";
+    @VisibleForTesting
+    static final int ON = 1;
+    @VisibleForTesting
+    static final int OFF = 0;
+
+    private SettingObserver mSettingObserver;
+
+    public BubbleNotificationPreferenceController(Context context, String preferenceKey) {
+        super(context, preferenceKey);
+    }
+
+    @Override
+    public void displayPreference(PreferenceScreen screen) {
+        super.displayPreference(screen);
+        Preference preference = screen.findPreference(NOTIFICATION_BUBBLES);
+        if (preference != null) {
+            mSettingObserver = new SettingObserver(preference);
+        }
+    }
+
+    @Override
+    public void onResume() {
+        if (mSettingObserver != null) {
+            mSettingObserver.register(mContext.getContentResolver(), true /* register */);
+        }
+    }
+
+    @Override
+    public void onPause() {
+        if (mSettingObserver != null) {
+            mSettingObserver.register(mContext.getContentResolver(), false /* register */);
+        }
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return AVAILABLE;
+    }
+
+    @Override
+    public boolean isChecked() {
+        return Settings.Secure.getInt(mContext.getContentResolver(),
+                NOTIFICATION_BUBBLES, ON) == ON;
+    }
+
+    @Override
+    public boolean setChecked(boolean isChecked) {
+        return Settings.Secure.putInt(mContext.getContentResolver(),
+                NOTIFICATION_BUBBLES, isChecked ? ON : OFF);
+    }
+
+    class SettingObserver extends ContentObserver {
+
+        private final Uri NOTIFICATION_BUBBLES_URI =
+                Settings.Secure.getUriFor(NOTIFICATION_BUBBLES);
+
+        private final Preference mPreference;
+
+        public SettingObserver(Preference preference) {
+            super(new Handler());
+            mPreference = preference;
+        }
+
+        public void register(ContentResolver cr, boolean register) {
+            if (register) {
+                cr.registerContentObserver(NOTIFICATION_BUBBLES_URI, false, this);
+            } else {
+                cr.unregisterContentObserver(this);
+            }
+        }
+
+        @Override
+        public void onChange(boolean selfChange, Uri uri) {
+            super.onChange(selfChange, uri);
+            if (NOTIFICATION_BUBBLES_URI.equals(uri)) {
+                updateState(mPreference);
+            }
+        }
+    }
+}
diff --git a/src/com/android/settings/notification/BubblePreferenceController.java b/src/com/android/settings/notification/BubblePreferenceController.java
new file mode 100644
index 0000000..e61de4b
--- /dev/null
+++ b/src/com/android/settings/notification/BubblePreferenceController.java
@@ -0,0 +1,94 @@
+/*
+ * 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_BUBBLES;
+
+import android.content.Context;
+import android.provider.Settings;
+
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.RestrictedSwitchPreference;
+
+import androidx.preference.Preference;
+
+public class BubblePreferenceController extends NotificationPreferenceController
+        implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener {
+
+    private static final String TAG = "BubblePrefContr";
+    private static final String KEY = "bubble";
+    private static final int SYSTEM_WIDE_ON = 1;
+    private static final int SYSTEM_WIDE_OFF = 0;
+
+    public BubblePreferenceController(Context context, NotificationBackend backend) {
+        super(context, backend);
+    }
+
+    @Override
+    public String getPreferenceKey() {
+        return KEY;
+    }
+
+    @Override
+    public boolean isAvailable() {
+        if (!super.isAvailable()) {
+            return false;
+        }
+        if (mAppRow == null && mChannel == null) {
+            return false;
+        }
+        if (Settings.Secure.getInt(mContext.getContentResolver(),
+                NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON) == SYSTEM_WIDE_OFF) {
+            return false;
+        }
+        if (mChannel != null) {
+            if (isDefaultChannel()) {
+                return true;
+            } else {
+                return mAppRow == null ? false : mAppRow.allowBubbles;
+            }
+        }
+        return true;
+    }
+
+    public void updateState(Preference preference) {
+        if (mAppRow != null) {
+            RestrictedSwitchPreference pref = (RestrictedSwitchPreference) preference;
+            pref.setDisabledByAdmin(mAdmin);
+            if (mChannel != null) {
+                pref.setChecked(mChannel.canBubble());
+                pref.setEnabled(isChannelConfigurable() && !pref.isDisabledByAdmin());
+            } else {
+                pref.setChecked(mAppRow.allowBubbles);
+            }
+        }
+    }
+
+    @Override
+    public boolean onPreferenceChange(Preference preference, Object newValue) {
+        final boolean value = (Boolean) newValue;
+        if (mChannel != null) {
+            mChannel.setAllowBubbles(value);
+            saveChannel();
+        } else if (mAppRow != null){
+            mAppRow.allowBubbles = value;
+            mBackend.setAllowBubbles(mAppRow.pkg, mAppRow.uid, value);
+        }
+        return true;
+    }
+
+}
diff --git a/src/com/android/settings/notification/ChannelNotificationSettings.java b/src/com/android/settings/notification/ChannelNotificationSettings.java
index 0e1f386..f92e529 100644
--- a/src/com/android/settings/notification/ChannelNotificationSettings.java
+++ b/src/com/android/settings/notification/ChannelNotificationSettings.java
@@ -110,6 +110,7 @@
         mControllers.add(new BadgePreferenceController(context, mBackend));
         mControllers.add(new DndPreferenceController(context, mBackend));
         mControllers.add(new NotificationsOffPreferenceController(context));
+        mControllers.add(new BubblePreferenceController(context, mBackend));
         return new ArrayList<>(mControllers);
     }
 }
diff --git a/src/com/android/settings/notification/NotificationBackend.java b/src/com/android/settings/notification/NotificationBackend.java
index ec56369..dbba616 100644
--- a/src/com/android/settings/notification/NotificationBackend.java
+++ b/src/com/android/settings/notification/NotificationBackend.java
@@ -71,6 +71,7 @@
         row.icon = IconDrawableFactory.newInstance(context).getBadgedIcon(app);
         row.banned = getNotificationsBanned(row.pkg, row.uid);
         row.showBadge = canShowBadge(row.pkg, row.uid);
+        row.allowBubbles = canBubble(row.pkg, row.uid);
         row.userId = UserHandle.getUserId(row.uid);
         row.blockedChannelCount = getBlockedChannelCount(row.pkg, row.uid);
         row.channelCount = getChannelCount(row.pkg, row.uid);
@@ -175,6 +176,26 @@
         }
     }
 
+    public boolean canBubble(String pkg, int uid) {
+        try {
+            return sINM.areBubblesAllowedForPackage(pkg, uid);
+        } catch (Exception e) {
+            Log.w(TAG, "Error calling NoMan", e);
+            return false;
+        }
+    }
+
+    public boolean setAllowBubbles(String pkg, int uid, boolean allow) {
+        try {
+            sINM.setBubblesAllowed(pkg, uid, allow);
+            return true;
+        } catch (Exception e) {
+            Log.w(TAG, "Error calling NoMan", e);
+            return false;
+        }
+    }
+
+
     public NotificationChannel getChannel(String pkg, int uid, String channelId) {
         if (channelId == null) {
             return null;
@@ -416,6 +437,7 @@
         public boolean lockedImportance;
         public String lockedChannelId;
         public boolean showBadge;
+        public boolean allowBubbles;
         public int userId;
         public int blockedChannelCount;
         public int channelCount;
diff --git a/src/com/android/settings/notification/SilentStatusBarPreferenceController.java b/src/com/android/settings/notification/SilentStatusBarPreferenceController.java
index 4721f5c..5bf943a 100644
--- a/src/com/android/settings/notification/SilentStatusBarPreferenceController.java
+++ b/src/com/android/settings/notification/SilentStatusBarPreferenceController.java
@@ -24,17 +24,24 @@
 
 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 final NotificationBackend mBackend;
+    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);
diff --git a/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java b/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
index db0935d..236e3d9 100644
--- a/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
+++ b/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
@@ -157,7 +157,6 @@
         boolean frp = KeyguardManager.ACTION_CONFIRM_FRP_CREDENTIAL.equals(intent.getAction());
 
         mUserId = UserHandle.myUserId();
-        final int effectiveUserId = mUserManager.getCredentialOwnerProfile(mUserId);
         if (isInternalActivity()) {
             try {
                 mUserId = Utils.getUserIdFromBundle(this, intent.getExtras());
@@ -165,6 +164,7 @@
                 Log.e(TAG, "Invalid intent extra", se);
             }
         }
+        final int effectiveUserId = mUserManager.getCredentialOwnerProfile(mUserId);
         final boolean isManagedProfile = UserManager.get(this).isManagedProfile(mUserId);
         // if the client app did not hand in a title and we are about to show the work challenge,
         // check whether there is a policy setting the organization name and use that as title
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/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/sim/SimDialogActivity.java b/src/com/android/settings/sim/SimDialogActivity.java
index 987826c..13148c8 100644
--- a/src/com/android/settings/sim/SimDialogActivity.java
+++ b/src/com/android/settings/sim/SimDialogActivity.java
@@ -118,7 +118,10 @@
 
     private static void setDefaultDataSubId(final Context context, final int subId) {
         final SubscriptionManager subscriptionManager = SubscriptionManager.from(context);
+        final TelephonyManager telephonyManager = TelephonyManager.from(context)
+                .createForSubscriptionId(subId);
         subscriptionManager.setDefaultDataSubId(subId);
+        telephonyManager.setDataEnabled(true);
         Toast.makeText(context, R.string.data_switch_started, Toast.LENGTH_LONG).show();
     }
 
diff --git a/src/com/android/settings/slices/SlicesDatabaseAccessor.java b/src/com/android/settings/slices/SlicesDatabaseAccessor.java
index ae77dd2..fcc42e4 100644
--- a/src/com/android/settings/slices/SlicesDatabaseAccessor.java
+++ b/src/com/android/settings/slices/SlicesDatabaseAccessor.java
@@ -75,8 +75,9 @@
         if (pathData == null) {
             throw new IllegalStateException("Invalid Slices uri: " + uri);
         }
-        Cursor cursor = getIndexedSliceData(pathData.second /* key */);
-        return buildSliceData(cursor, uri, pathData.first /* isIntentOnly */);
+        try (Cursor cursor = getIndexedSliceData(pathData.second /* key */)) {
+            return buildSliceData(cursor, uri, pathData.first /* isIntentOnly */);
+        }
     }
 
     /**
@@ -85,8 +86,9 @@
      * Used when handling the action of the {@link Slice}.
      */
     public SliceData getSliceDataFromKey(String key) {
-        Cursor cursor = getIndexedSliceData(key);
-        return buildSliceData(cursor, null /* uri */, false /* isIntentOnly */);
+        try (Cursor cursor = getIndexedSliceData(key)) {
+            return buildSliceData(cursor, null /* uri */, false /* isIntentOnly */);
+        }
     }
 
     /**
diff --git a/src/com/android/settings/widget/RoundedHomepageIcon.java b/src/com/android/settings/widget/AdaptiveHomepageIcon.java
similarity index 90%
rename from src/com/android/settings/widget/RoundedHomepageIcon.java
rename to src/com/android/settings/widget/AdaptiveHomepageIcon.java
index f7927e7..bec5d8d 100644
--- a/src/com/android/settings/widget/RoundedHomepageIcon.java
+++ b/src/com/android/settings/widget/AdaptiveHomepageIcon.java
@@ -32,18 +32,19 @@
 import androidx.annotation.VisibleForTesting;
 
 import com.android.settings.R;
+import com.android.settings.homepage.AdaptiveIconShapeDrawable;
 import com.android.settingslib.drawer.Tile;
 
-public class RoundedHomepageIcon extends LayerDrawable {
+public class AdaptiveHomepageIcon extends LayerDrawable {
 
-    private static final String TAG = "RoundedHomepageIcon";
+    private static final String TAG = "AdaptiveHomepageIcon";
 
     @VisibleForTesting(otherwise = NONE)
     int mBackgroundColor = -1;
 
-    public RoundedHomepageIcon(Context context, Drawable foreground) {
+    public AdaptiveHomepageIcon(Context context, Drawable foreground) {
         super(new Drawable[]{
-                context.getDrawable(R.drawable.ic_homepage_generic_background),
+                new AdaptiveIconShapeDrawable(context.getResources()),
                 foreground
         });
         final int insetPx = context.getResources()
diff --git a/src/com/android/settings/widget/EntityHeaderController.java b/src/com/android/settings/widget/EntityHeaderController.java
index 5672178..8e31290 100644
--- a/src/com/android/settings/widget/EntityHeaderController.java
+++ b/src/com/android/settings/widget/EntityHeaderController.java
@@ -322,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 739ddd7..1d78485 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -366,9 +366,8 @@
                             suggestionOrSpecifierPackageName = config.creatorName;
                         }
                         String summary = AccessPoint.getSummary(
-                                mConfigUi.getContext(), state, isEphemeral,
-                                suggestionOrSpecifierPackageName,
-                                providerFriendlyName);
+                                mConfigUi.getContext(), /* ssid */ null, state, isEphemeral,
+                                suggestionOrSpecifierPackageName);
                         addRow(group, R.string.wifi_status, summary);
                     }
 
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 b063433..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, 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/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/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/backup/BackupSettingsHelperTest.java b/tests/robotests/src/com/android/settings/backup/BackupSettingsHelperTest.java
index ee8912a..5587783 100644
--- a/tests/robotests/src/com/android/settings/backup/BackupSettingsHelperTest.java
+++ b/tests/robotests/src/com/android/settings/backup/BackupSettingsHelperTest.java
@@ -31,16 +31,13 @@
 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;
@@ -57,8 +54,6 @@
 @RunWith(RobolectricTestRunner.class)
 @Config(shadows = BackupSettingsHelperTest.ShadowBackupManagerStub.class)
 public class BackupSettingsHelperTest {
-    private static final String DEFAULT_SETTINGS_CLASSNAME =
-            "com.android.settings.Settings$PrivacySettingsActivity";
 
     private static final int DEFAULT_SUMMARY_RESOURCE =
             R.string.backup_configure_account_default_summary;
@@ -295,16 +290,6 @@
     }
 
     @Test
-    public void testGetIntentForBackupSettings_WithoutIntentFromTransport() throws Exception {
-        when(mBackupManager.getDataManagementIntent(anyString())).thenReturn(null);
-
-        Intent backupIntent = mBackupSettingsHelper.getIntentForBackupSettings();
-
-        assertThat(backupIntent.getComponent().getClassName())
-            .isEqualTo(DEFAULT_SETTINGS_CLASSNAME);
-    }
-
-    @Test
     public void testGetLabelForBackupSettings_WithLabelFromTransport() throws Exception {
         String label = "test_label";
 
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/datausage/AppDataUsageTest.java b/tests/robotests/src/com/android/settings/datausage/AppDataUsageTest.java
index 37bb3cd..12559f4 100644
--- a/tests/robotests/src/com/android/settings/datausage/AppDataUsageTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/AppDataUsageTest.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.datausage;
 
+import static com.google.common.truth.Truth.assertThat;
+
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyBoolean;
 import static org.mockito.ArgumentMatchers.anyInt;
@@ -31,7 +33,9 @@
 import android.content.Context;
 import android.content.pm.PackageManager;
 import android.net.NetworkPolicyManager;
+import android.net.NetworkTemplate;
 import android.os.Bundle;
+import android.text.format.DateUtils;
 import android.util.ArraySet;
 import android.view.View;
 
@@ -47,6 +51,7 @@
 import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
 import com.android.settingslib.RestrictedSwitchPreference;
 import com.android.settingslib.net.NetworkCycleDataForUid;
+import com.android.settingslib.net.NetworkCycleDataForUidLoader;
 
 import org.junit.After;
 import org.junit.Before;
@@ -188,7 +193,7 @@
         ReflectionHelpers.setField(mFragment, "mBackgroundUsage", preference);
         ReflectionHelpers.setField(mFragment, "mForegroundUsage", preference);
         ReflectionHelpers.setField(mFragment, "mTotalUsage", preference);
-        doReturn(RuntimeEnvironment.application).when(mFragment).getContext();
+        ReflectionHelpers.setField(mFragment, "mContext", RuntimeEnvironment.application);
 
         mFragment.bindData(0 /* position */);
 
@@ -199,7 +204,7 @@
     public void bindData_hasAppUsageData_shouldShowCycleSpinnerAndUpdateUsageSummary() {
         mFragment = spy(new AppDataUsage());
         final Context context = RuntimeEnvironment.application;
-        doReturn(context).when(mFragment).getContext();
+        ReflectionHelpers.setField(mFragment, "mContext", context);
         final long backgroundBytes = 1234L;
         final long foregroundBytes = 5678L;
         final List<NetworkCycleDataForUid> appUsage = new ArrayList<>();
@@ -223,4 +228,53 @@
         verify(backgroundPref).setSummary(DataUsageUtils.formatDataUsage(context, backgroundBytes));
         verify(foregroundPref).setSummary(DataUsageUtils.formatDataUsage(context, foregroundBytes));
     }
+
+    @Test
+    public void onCreateLoader_categoryApp_shouldQueryDataUsageUsingAppKey() {
+        mFragment = new AppDataUsage();
+        final Context context = RuntimeEnvironment.application;
+        final int testUid = 123123;
+        final AppItem appItem = new AppItem(testUid);
+        appItem.category = AppItem.CATEGORY_APP;
+        ReflectionHelpers.setField(mFragment, "mContext", context);
+        ReflectionHelpers.setField(mFragment, "mAppItem", appItem);
+        ReflectionHelpers.setField(mFragment, "mTemplate",
+            NetworkTemplate.buildTemplateWifiWildcard());
+        final long end = System.currentTimeMillis();
+        final long start = end - (DateUtils.WEEK_IN_MILLIS * 4);
+
+        final NetworkCycleDataForUidLoader loader = (NetworkCycleDataForUidLoader)
+            mFragment.mUidDataCallbacks.onCreateLoader(0, Bundle.EMPTY);
+
+        final List<Integer> uids = loader.getUids();
+        assertThat(uids).hasSize(1);
+        assertThat(uids.get(0)).isEqualTo(testUid);
+    }
+
+    @Test
+    public void onCreateLoader_categoryUser_shouldQueryDataUsageUsingAssociatedUids() {
+        mFragment = new AppDataUsage();
+        final Context context = RuntimeEnvironment.application;
+        final int testUserId = 11;
+        final AppItem appItem = new AppItem(testUserId);
+        appItem.category = AppItem.CATEGORY_USER;
+        appItem.addUid(123);
+        appItem.addUid(456);
+        appItem.addUid(789);
+        ReflectionHelpers.setField(mFragment, "mContext", context);
+        ReflectionHelpers.setField(mFragment, "mAppItem", appItem);
+        ReflectionHelpers.setField(mFragment, "mTemplate",
+            NetworkTemplate.buildTemplateWifiWildcard());
+        final long end = System.currentTimeMillis();
+        final long start = end - (DateUtils.WEEK_IN_MILLIS * 4);
+
+        final NetworkCycleDataForUidLoader loader = (NetworkCycleDataForUidLoader)
+            mFragment.mUidDataCallbacks.onCreateLoader(0, Bundle.EMPTY);
+
+        final List<Integer> uids = loader.getUids();
+        assertThat(uids).hasSize(3);
+        assertThat(uids.get(0)).isEqualTo(123);
+        assertThat(uids.get(1)).isEqualTo(456);
+        assertThat(uids.get(2)).isEqualTo(789);
+    }
 }
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/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/telephony/MobileDataPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/telephony/MobileDataPreferenceControllerTest.java
index e0bfce4..4c242c1 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/MobileDataPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/MobileDataPreferenceControllerTest.java
@@ -20,7 +20,6 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
-import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.spy;
@@ -31,10 +30,6 @@
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
 
-import androidx.fragment.app.FragmentManager;
-import androidx.fragment.app.FragmentTransaction;
-import androidx.preference.SwitchPreference;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -42,10 +37,18 @@
 import org.mockito.MockitoAnnotations;
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
+import org.robolectric.shadows.ShadowSubscriptionManager;
+
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentTransaction;
+import androidx.preference.SwitchPreference;
 
 @RunWith(RobolectricTestRunner.class)
+@Config(shadows = ShadowSubscriptionManager.class)
 public class MobileDataPreferenceControllerTest {
     private static final int SUB_ID = 2;
+    private static final int SUB_ID_OTHER = 3;
 
     @Mock
     private FragmentManager mFragmentManager;
@@ -78,6 +81,7 @@
 
         mPreference = new SwitchPreference(mContext);
         mController = new MobileDataPreferenceController(mContext, "mobile_data");
+        ShadowSubscriptionManager.setDefaultDataSubscriptionId(SUB_ID);
         mController.init(mFragmentManager, SUB_ID);
         mPreference.setKey(mController.getPreferenceKey());
     }
@@ -104,7 +108,8 @@
     public void isDialogNeeded_enableNonDefaultSimInMultiSimMode_returnTrue() {
         doReturn(false).when(mTelephonyManager).isDataEnabled();
         doReturn(mSubscriptionInfo).when(mSubscriptionManager).getActiveSubscriptionInfo(SUB_ID);
-        doReturn(true).when(mSubscriptionManager).isActiveSubscriptionId(anyInt());
+        doReturn(true).when(mSubscriptionManager).isActiveSubscriptionId(SUB_ID_OTHER);
+        ShadowSubscriptionManager.setDefaultDataSubscriptionId(SUB_ID_OTHER);
         doReturn(2).when(mTelephonyManager).getSimCount();
 
         assertThat(mController.isDialogNeeded()).isTrue();
diff --git a/tests/robotests/src/com/android/settings/network/telephony/MobileNetworkSwitchControllerTest.java b/tests/robotests/src/com/android/settings/network/telephony/MobileNetworkSwitchControllerTest.java
new file mode 100644
index 0000000..2a596d9
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/network/telephony/MobileNetworkSwitchControllerTest.java
@@ -0,0 +1,140 @@
+/*
+ * 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.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.telephony.SubscriptionInfo;
+import android.telephony.SubscriptionManager;
+
+import com.android.settings.R;
+import com.android.settings.network.SubscriptionUtil;
+import com.android.settings.widget.SwitchBar;
+import com.android.settingslib.core.lifecycle.Lifecycle;
+import com.android.settingslib.widget.LayoutPreference;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+import java.util.Arrays;
+
+import androidx.lifecycle.LifecycleOwner;
+import androidx.preference.PreferenceScreen;
+
+@RunWith(RobolectricTestRunner.class)
+public class MobileNetworkSwitchControllerTest {
+    @Mock
+    private SubscriptionManager mSubscriptionManager;
+    @Mock
+    private PreferenceScreen mScreen;
+    @Mock
+    private LayoutPreference mLayoutPreference;
+    @Mock
+    private SubscriptionInfo mSubscription;
+
+    private Context mContext;
+    private LifecycleOwner mLifecycleOwner;
+    private Lifecycle mLifecycle;
+    private MobileNetworkSwitchController mController;
+    private SwitchBar mSwitchBar;
+    private int mSubId = 123;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mContext = spy(RuntimeEnvironment.application);
+        when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubscriptionManager);
+
+        mLifecycleOwner = () -> mLifecycle;
+        mLifecycle = new Lifecycle(mLifecycleOwner);
+
+        when(mSubscription.getSubscriptionId()).thenReturn(mSubId);
+        // Most tests want to have 2 available subscriptions so that the switch bar will show.
+        SubscriptionInfo sub2 = mock(SubscriptionInfo.class);
+        when(sub2.getSubscriptionId()).thenReturn(456);
+        SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(mSubscription, sub2));
+
+        String key = "prefKey";
+        mController = new MobileNetworkSwitchController(mContext, key);
+        mController.init(mLifecycle, mSubscription.getSubscriptionId());
+
+        mSwitchBar = new SwitchBar(mContext);
+        when(mScreen.findPreference(key)).thenReturn(mLayoutPreference);
+        when(mLayoutPreference.findViewById(R.id.switch_bar)).thenReturn(mSwitchBar);
+    }
+
+    @After
+    public void cleanUp() {
+        SubscriptionUtil.setAvailableSubscriptionsForTesting(null);
+    }
+
+    @Test
+    public void displayPreference_onlyOneSubscription_switchBarHidden() {
+        SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(mSubscription));
+        mController.displayPreference(mScreen);
+        assertThat(mSwitchBar.isShowing()).isFalse();
+    }
+
+    @Test
+    public void displayPreference_subscriptionEnabled_switchIsOn() {
+        when(mSubscriptionManager.isSubscriptionEnabled(mSubId)).thenReturn(true);
+        mController.displayPreference(mScreen);
+        assertThat(mSwitchBar.isShowing()).isTrue();
+        assertThat(mSwitchBar.isChecked()).isTrue();
+    }
+
+    @Test
+    public void displayPreference_subscriptionDisabled_switchIsOff() {
+        when(mSubscriptionManager.isSubscriptionEnabled(mSubId)).thenReturn(false);
+        mController.displayPreference(mScreen);
+        assertThat(mSwitchBar.isShowing()).isTrue();
+        assertThat(mSwitchBar.isChecked()).isFalse();
+    }
+
+    @Test
+    public void switchChangeListener_fromEnabledToDisabled_setSubscriptionEnabledCalledCorrectly() {
+        when(mSubscriptionManager.isSubscriptionEnabled(mSubId)).thenReturn(true);
+        mController.displayPreference(mScreen);
+        assertThat(mSwitchBar.isShowing()).isTrue();
+        assertThat(mSwitchBar.isChecked()).isTrue();
+        mSwitchBar.setChecked(false);
+        verify(mSubscriptionManager).setSubscriptionEnabled(eq(mSubId), eq(false));
+    }
+
+    @Test
+    public void switchChangeListener_fromDisabledToEnabled_setSubscriptionEnabledCalledCorrectly() {
+        when(mSubscriptionManager.isSubscriptionEnabled(mSubId)).thenReturn(false);
+        mController.displayPreference(mScreen);
+        assertThat(mSwitchBar.isShowing()).isTrue();
+        assertThat(mSwitchBar.isChecked()).isFalse();
+        mSwitchBar.setChecked(true);
+        verify(mSubscriptionManager).setSubscriptionEnabled(eq(mSubId), eq(true));
+    }
+}
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/BubbleNotificationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/BubbleNotificationPreferenceControllerTest.java
new file mode 100644
index 0000000..c4587af
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/notification/BubbleNotificationPreferenceControllerTest.java
@@ -0,0 +1,136 @@
+/*
+ * 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_BUBBLES;
+
+import static com.android.settings.notification.BadgingNotificationPreferenceController.OFF;
+import static com.android.settings.notification.BadgingNotificationPreferenceController.ON;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.provider.Settings;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Answers;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+import androidx.preference.Preference;
+import androidx.preference.PreferenceScreen;
+import androidx.preference.TwoStatePreference;
+
+@RunWith(RobolectricTestRunner.class)
+public class BubbleNotificationPreferenceControllerTest {
+
+    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
+    private Context mContext;
+    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
+    private PreferenceScreen mScreen;
+
+    private BubbleNotificationPreferenceController mController;
+    private Preference mPreference;
+
+    private static final String KEY_NOTIFICATION_BUBBLES = "notification_bubbles";
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mController = new BubbleNotificationPreferenceController(mContext,
+                KEY_NOTIFICATION_BUBBLES);
+        mPreference = new Preference(RuntimeEnvironment.application);
+        mPreference.setKey(mController.getPreferenceKey());
+        when(mScreen.findPreference(mPreference.getKey())).thenReturn(mPreference);
+    }
+
+    @Test
+    public void display_shouldDisplay() {
+        assertThat(mPreference.isVisible()).isTrue();
+    }
+
+    @Test
+    public void updateState_preferenceSetCheckedWhenSettingIsOn() {
+        final TwoStatePreference preference = mock(TwoStatePreference.class);
+        final Context context = RuntimeEnvironment.application;
+        Settings.Secure.putInt(context.getContentResolver(), NOTIFICATION_BUBBLES, ON);
+
+        mController.updateState(preference);
+
+        verify(preference).setChecked(true);
+    }
+
+    @Test
+    public void updateState_preferenceSetUncheckedWhenSettingIsOff() {
+        final TwoStatePreference preference = mock(TwoStatePreference.class);
+        final Context context = RuntimeEnvironment.application;
+        Settings.Secure.putInt(context.getContentResolver(), NOTIFICATION_BUBBLES, OFF);
+
+        mController.updateState(preference);
+
+        verify(preference).setChecked(false);
+    }
+
+    @Test
+    public void isChecked_settingIsOff_shouldReturnFalse() {
+        Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, OFF);
+
+        assertThat(mController.isChecked()).isFalse();
+    }
+
+    @Test
+    public void isChecked_settingIsOn_shouldReturnTrue() {
+        Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, ON);
+
+        assertThat(mController.isChecked()).isTrue();
+    }
+
+    @Test
+    public void setChecked_setFalse_disablesSetting() {
+        Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, ON);
+
+        mController.setChecked(false);
+        int updatedValue = Settings.Secure.getInt(mContext.getContentResolver(),
+                NOTIFICATION_BUBBLES, -1);
+
+        assertThat(updatedValue).isEqualTo(OFF);
+    }
+
+    @Test
+    public void setChecked_setTrue_enablesSetting() {
+        Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, OFF);
+
+        mController.setChecked(true);
+        int updatedValue = Settings.Secure.getInt(mContext.getContentResolver(),
+                NOTIFICATION_BUBBLES, -1);
+
+        assertThat(updatedValue).isEqualTo(ON);
+    }
+
+    @Test
+    public void isSliceable_returnsFalse() {
+        assertThat(mController.isSliceable()).isFalse();
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/notification/BubblePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/BubblePreferenceControllerTest.java
new file mode 100644
index 0000000..99787d8
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/notification/BubblePreferenceControllerTest.java
@@ -0,0 +1,311 @@
+/*
+ * 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.app.NotificationChannel.DEFAULT_CHANNEL_ID;
+import static android.app.NotificationManager.IMPORTANCE_HIGH;
+import static android.app.NotificationManager.IMPORTANCE_LOW;
+import static android.app.NotificationManager.IMPORTANCE_NONE;
+import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.app.NotificationChannel;
+import android.app.NotificationManager;
+import android.content.Context;
+import android.os.UserManager;
+import android.provider.Settings;
+
+import com.android.settingslib.RestrictedLockUtils;
+import com.android.settingslib.RestrictedSwitchPreference;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Answers;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+import org.robolectric.shadows.ShadowApplication;
+
+import androidx.preference.Preference;
+import androidx.preference.PreferenceScreen;
+
+@RunWith(RobolectricTestRunner.class)
+public class BubblePreferenceControllerTest {
+
+    private Context mContext;
+    @Mock
+    private NotificationBackend mBackend;
+    @Mock
+    private NotificationManager mNm;
+    @Mock
+    private UserManager mUm;
+    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
+    private PreferenceScreen mScreen;
+
+    private BubblePreferenceController mController;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        ShadowApplication shadowApplication = ShadowApplication.getInstance();
+        shadowApplication.setSystemService(Context.NOTIFICATION_SERVICE, mNm);
+        shadowApplication.setSystemService(Context.USER_SERVICE, mUm);
+        mContext = RuntimeEnvironment.application;
+        mController = spy(new BubblePreferenceController(mContext, mBackend));
+    }
+
+    @Test
+    public void testNoCrashIfNoOnResume() {
+        mController.isAvailable();
+        mController.updateState(mock(RestrictedSwitchPreference.class));
+        mController.onPreferenceChange(mock(RestrictedSwitchPreference.class), true);
+    }
+
+    @Test
+    public void testIsAvailable_notIfAppBlocked() {
+        NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
+        appRow.banned = true;
+        mController.onResume(appRow, mock(NotificationChannel.class), null, null);
+        assertFalse(mController.isAvailable());
+    }
+
+    @Test
+    public void testIsAvailable_notIfChannelBlocked() {
+        NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
+        NotificationChannel channel = mock(NotificationChannel.class);
+        when(channel.getImportance()).thenReturn(IMPORTANCE_NONE);
+        mController.onResume(appRow, channel, null, null);
+        assertFalse(mController.isAvailable());
+    }
+
+    @Test
+    public void testIsAvailable_channel_notIfAppOff() {
+        NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
+        appRow.allowBubbles = false;
+        NotificationChannel channel = mock(NotificationChannel.class);
+        when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH);
+        mController.onResume(appRow, channel, null, null);
+
+        assertFalse(mController.isAvailable());
+    }
+
+    @Test
+    public void testIsAvailable_notIfOffGlobally() {
+        NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
+        NotificationChannel channel = mock(NotificationChannel.class);
+        when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH);
+        mController.onResume(appRow, channel, null, null);
+        Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, 0);
+
+        assertFalse(mController.isAvailable());
+    }
+
+    @Test
+    public void testIsAvailable_app() {
+        NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
+        mController.onResume(appRow, null, null, null);
+        Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, 1);
+
+        assertTrue(mController.isAvailable());
+    }
+
+    @Test
+    public void testIsAvailable_defaultChannel() {
+        NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
+        appRow.allowBubbles = true;
+        NotificationChannel channel = mock(NotificationChannel.class);
+        when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH);
+        when(channel.getId()).thenReturn(DEFAULT_CHANNEL_ID);
+        mController.onResume(appRow, channel, null, null);
+        Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, 1);
+
+        assertTrue(mController.isAvailable());
+    }
+
+    @Test
+    public void testIsAvailable_channel() {
+        NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
+        appRow.allowBubbles = true;
+        NotificationChannel channel = mock(NotificationChannel.class);
+        when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH);
+        mController.onResume(appRow, channel, null, null);
+        Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, 1);
+
+        assertTrue(mController.isAvailable());
+    }
+
+    @Test
+    public void testIsAvailable_channelAppOff() {
+        NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
+        appRow.allowBubbles = false;
+        NotificationChannel channel = mock(NotificationChannel.class);
+        when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH);
+        mController.onResume(appRow, channel, null, null);
+        Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, 1);
+
+        assertFalse(mController.isAvailable());
+    }
+
+    @Test
+    public void testUpdateState_disabledByAdmin() {
+        NotificationChannel channel = mock(NotificationChannel.class);
+        when(channel.getId()).thenReturn("something");
+        mController.onResume(new NotificationBackend.AppRow(), channel, null,
+                mock(RestrictedLockUtils.EnforcedAdmin.class));
+
+        Preference pref = new RestrictedSwitchPreference(mContext);
+        mController.updateState(pref);
+
+        assertFalse(pref.isEnabled());
+    }
+
+    @Test
+    public void testUpdateState_channelNotConfigurable() {
+        String lockedId = "locked";
+        NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
+        appRow.lockedChannelId = lockedId;
+        NotificationChannel channel = mock(NotificationChannel.class);
+        when(channel.getId()).thenReturn(lockedId);
+        mController.onResume(appRow, channel, null, null);
+
+        Preference pref = new RestrictedSwitchPreference(mContext);
+        mController.updateState(pref);
+
+        assertFalse(pref.isEnabled());
+    }
+
+    @Test
+    public void testUpdateState_channel() {
+        NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
+        appRow.lockedChannelId = "a";
+        NotificationChannel channel = mock(NotificationChannel.class);
+        when(channel.canBubble()).thenReturn(true);
+        mController.onResume(appRow, channel, null, null);
+
+        RestrictedSwitchPreference pref = new RestrictedSwitchPreference(mContext);
+        mController.updateState(pref);
+
+        assertTrue(pref.isChecked());
+
+        when(channel.canBubble()).thenReturn(false);
+        mController.onResume(appRow, channel, null, null);
+        mController.updateState(pref);
+
+        assertFalse(pref.isChecked());
+    }
+
+    @Test
+    public void testUpdateState_app() {
+        NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
+        appRow.allowBubbles = true;
+        mController.onResume(appRow, null, null, null);
+
+        RestrictedSwitchPreference pref = new RestrictedSwitchPreference(mContext);
+        mController.updateState(pref);
+        assertTrue(pref.isChecked());
+
+        appRow.allowBubbles = false;
+        mController.onResume(appRow, null, null, null);
+
+        mController.updateState(pref);
+        assertFalse(pref.isChecked());
+    }
+
+    @Test
+    public void testOnPreferenceChange_on_channel() {
+        NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
+        appRow.allowBubbles = true;
+        NotificationChannel channel =
+                new NotificationChannel(DEFAULT_CHANNEL_ID, "a", IMPORTANCE_LOW);
+        channel.setAllowBubbles(false);
+        mController.onResume(appRow, channel, null, null);
+
+        RestrictedSwitchPreference pref = new RestrictedSwitchPreference(mContext);
+        when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(pref);
+        mController.displayPreference(mScreen);
+        mController.updateState(pref);
+
+        mController.onPreferenceChange(pref, true);
+        assertTrue(channel.canBubble());
+        verify(mBackend, times(1)).updateChannel(any(), anyInt(), any());
+    }
+
+    @Test
+    public void testOnPreferenceChange_off_channel() {
+        NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
+        appRow.allowBubbles = true;
+        NotificationChannel channel =
+                new NotificationChannel(DEFAULT_CHANNEL_ID, "a", IMPORTANCE_HIGH);
+        channel.setAllowBubbles(true);
+        mController.onResume(appRow, channel, null, null);
+
+        RestrictedSwitchPreference pref = new RestrictedSwitchPreference(mContext);
+        when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(pref);
+        mController.displayPreference(mScreen);
+        mController.updateState(pref);
+
+        mController.onPreferenceChange(pref, false);
+        verify(mBackend, times(1)).updateChannel(any(), anyInt(), any());
+        assertFalse(channel.canBubble());
+    }
+
+    @Test
+    public void testOnPreferenceChange_on_app() {
+        NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
+        appRow.allowBubbles = false;
+        mController.onResume(appRow, null, null, null);
+
+        RestrictedSwitchPreference pref = new RestrictedSwitchPreference(mContext);
+        when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(pref);
+        mController.displayPreference(mScreen);
+        mController.updateState(pref);
+
+        mController.onPreferenceChange(pref, true);
+
+        assertTrue(appRow.allowBubbles);
+        verify(mBackend, times(1)).setAllowBubbles(any(), anyInt(), eq(true));
+    }
+
+    @Test
+    public void testOnPreferenceChange_off_app() {
+        NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
+        appRow.allowBubbles = true;
+        mController.onResume(appRow, null, null, null);
+
+        RestrictedSwitchPreference pref = new RestrictedSwitchPreference(mContext);
+        when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(pref);
+        mController.displayPreference(mScreen);
+        mController.updateState(pref);
+
+        mController.onPreferenceChange(pref, false);
+
+        assertFalse(appRow.allowBubbles);
+        verify(mBackend, times(1)).setAllowBubbles(any(), anyInt(), eq(false));
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/notification/SilentStatusBarPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/SilentStatusBarPreferenceControllerTest.java
index 8a43a1e..9dd8ff9 100644
--- a/tests/robotests/src/com/android/settings/notification/SilentStatusBarPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/SilentStatusBarPreferenceControllerTest.java
@@ -48,7 +48,6 @@
     @Mock
     private PreferenceScreen mScreen;
 
-    private FakeFeatureFactory mFeatureFactory;
     private Context mContext;
     private SilentStatusBarPreferenceController mController;
     private Preference mPreference;
@@ -57,8 +56,8 @@
     public void setUp() {
         MockitoAnnotations.initMocks(this);
         mContext = RuntimeEnvironment.application;
-        mFeatureFactory = FakeFeatureFactory.setupForTest();
         mController = new SilentStatusBarPreferenceController(mContext);
+        mController.setBackend(mBackend);
         mPreference = new Preference(mContext);
         mPreference.setKey(mController.getPreferenceKey());
         when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
@@ -83,7 +82,7 @@
         when(mBackend.shouldHideSilentStatusBarIcons(any())).thenReturn(false);
         assertThat(mController.isChecked()).isFalse();
     }
-/**
+
     @Test
     public void isChecked_settingIsOn_true() {
         when(mBackend.shouldHideSilentStatusBarIcons(any())).thenReturn(true);
@@ -93,18 +92,13 @@
     @Test
     public void onPreferenceChange_on() {
         mController.onPreferenceChange(mPreference, true);
-
-        assertThat(mController.isChecked()).isTrue();
         verify(mBackend).setHideSilentStatusIcons(true);
     }
 
     @Test
     public void onPreferenceChange_off() {
         mController.onPreferenceChange(mPreference, false);
-
-        assertThat(mController.isChecked()).isFalse();
         verify(mBackend).setHideSilentStatusIcons(false);
     }
-    **/
 }
 
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/testutils/shadow/ShadowDeviceConfig.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowDeviceConfig.java
index d46e755..dfd0988 100644
--- a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowDeviceConfig.java
+++ b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowDeviceConfig.java
@@ -19,21 +19,32 @@
 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 String configValue;
+    private static Map<String, String> sPropertyMaps = new HashMap<>();
+
+    @Resetter
+    public static void reset() {
+        sPropertyMaps.clear();
+    }
 
     @Implementation
-    protected static boolean setProperty(
-        String namespace, String name, String value, boolean makeDefault) {
-        configValue = value;
+    public static boolean setProperty(
+            String namespace, String name, String value, boolean makeDefault) {
+        sPropertyMaps.put(name, value);
         return true;
     }
 
     @Implementation
-    protected static String getProperty(String ns, String key) { return configValue; }
+    public static String getProperty(String namespace, String name) {
+        return sPropertyMaps.get(name);
+    }
 }
 
 
diff --git a/tests/robotests/src/com/android/settings/widget/RoundedHomepageIconTest.java b/tests/robotests/src/com/android/settings/widget/AdaptiveHomepageIconTest.java
similarity index 83%
rename from tests/robotests/src/com/android/settings/widget/RoundedHomepageIconTest.java
rename to tests/robotests/src/com/android/settings/widget/AdaptiveHomepageIconTest.java
index 21ba907..32690a3 100644
--- a/tests/robotests/src/com/android/settings/widget/RoundedHomepageIconTest.java
+++ b/tests/robotests/src/com/android/settings/widget/AdaptiveHomepageIconTest.java
@@ -37,9 +37,9 @@
 import android.os.Bundle;
 
 import com.android.settings.R;
+import com.android.settings.homepage.AdaptiveIconShapeDrawable;
 import com.android.settingslib.drawer.CategoryKey;
 import com.android.settingslib.drawer.Tile;
-import com.android.settingslib.testutils.DrawableTestHelper;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -48,7 +48,7 @@
 import org.robolectric.RuntimeEnvironment;
 
 @RunWith(RobolectricTestRunner.class)
-public class RoundedHomepageIconTest {
+public class AdaptiveHomepageIconTest {
 
     private Context mContext;
     private ActivityInfo mActivityInfo;
@@ -64,18 +64,17 @@
 
     @Test
     public void createIcon_shouldSetBackgroundAndInset() {
-        final RoundedHomepageIcon icon =
-                new RoundedHomepageIcon(mContext, new ColorDrawable(Color.BLACK));
+        final AdaptiveHomepageIcon icon =
+                new AdaptiveHomepageIcon(mContext, new ColorDrawable(Color.BLACK));
 
         assertThat(icon.getNumberOfLayers()).isEqualTo(2);
-        DrawableTestHelper.assertDrawableResId(icon.getDrawable(0),
-                R.drawable.ic_homepage_generic_background);
+        assertThat(icon.getDrawable(0)).isInstanceOf(AdaptiveIconShapeDrawable.class);
     }
 
     @Test
     public void setBackgroundColor_shouldUpdateColorFilter() {
-        final RoundedHomepageIcon icon =
-                spy(new RoundedHomepageIcon(mContext, new ColorDrawable(Color.BLACK)));
+        final AdaptiveHomepageIcon icon =
+                spy(new AdaptiveHomepageIcon(mContext, new ColorDrawable(Color.BLACK)));
         final ShapeDrawable background = mock(ShapeDrawable.class);
         when(icon.getDrawable(0)).thenReturn(background);
 
@@ -90,8 +89,8 @@
         mActivityInfo.metaData.putInt(META_DATA_PREFERENCE_ICON_BACKGROUND_ARGB, 0xff0000);
         doReturn(Icon.createWithResource(mContext, R.drawable.ic_settings))
                 .when(tile).getIcon(mContext);
-        final RoundedHomepageIcon icon =
-                new RoundedHomepageIcon(mContext, new ColorDrawable(Color.BLACK));
+        final AdaptiveHomepageIcon icon =
+                new AdaptiveHomepageIcon(mContext, new ColorDrawable(Color.BLACK));
 
         icon.setBackgroundColor(mContext, tile);
         assertThat(icon.mBackgroundColor).isEqualTo(0xff0000);
@@ -105,8 +104,8 @@
         doReturn(Icon.createWithResource(mContext, R.drawable.ic_settings))
                 .when(tile).getIcon(mContext);
 
-        final RoundedHomepageIcon icon =
-                new RoundedHomepageIcon(mContext, new ColorDrawable(Color.BLACK));
+        final AdaptiveHomepageIcon icon =
+                new AdaptiveHomepageIcon(mContext, new ColorDrawable(Color.BLACK));
         icon.setBackgroundColor(mContext, tile);
 
         assertThat(icon.mBackgroundColor)
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