Merge "Separate personal/work tab in LocationSettings"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 4cdfa25..3f66cb8 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1185,7 +1185,7 @@
         <activity
             android:name="Settings$LocationSettingsActivity"
             android:label="@string/location_settings_title"
-            android:icon="@drawable/ic_homepage_location"
+            android:icon="@drawable/ic_settings_location"
             android:configChanges="orientation|keyboardHidden|screenSize">
             <intent-filter android:priority="1">
                 <action android:name="android.settings.LOCATION_SOURCE_SETTINGS" />
@@ -2623,7 +2623,7 @@
             android:launchMode="singleTop"
             android:taskAffinity=".wifi.NetworkRequestDialogActivity"
             android:exported="true"
-            android:permission="android.permission.MAINLINE_WIFI_STACK">
+            android:permission="android.permission.NETWORK_SETTINGS">
             <intent-filter>
                 <action android:name="com.android.settings.wifi.action.NETWORK_REQUEST" />
                 <category android:name="android.intent.category.DEFAULT" />
diff --git a/res/layout/bluetooth_audio_bit_per_sample_dialog.xml b/res/layout/bluetooth_audio_bit_per_sample_dialog.xml
new file mode 100644
index 0000000..f0a5dc5
--- /dev/null
+++ b/res/layout/bluetooth_audio_bit_per_sample_dialog.xml
@@ -0,0 +1,58 @@
+<?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:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical"
+        android:padding="8dp">
+
+        <RadioGroup
+            android:id="@+id/bluetooth_audio_bit_per_sample_radio_group"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="@dimen/developer_option_dialog_margin_start">
+
+            <include
+                android:id="@+id/bluetooth_audio_bit_per_sample_default"
+                layout="@layout/preference_widget_dialog_radiobutton"/>
+
+            <include
+                android:id="@+id/bluetooth_audio_bit_per_sample_16"
+                layout="@layout/preference_widget_dialog_radiobutton"/>
+
+            <include
+                android:id="@+id/bluetooth_audio_bit_per_sample_24"
+                layout="@layout/preference_widget_dialog_radiobutton"/>
+
+            <include
+                android:id="@+id/bluetooth_audio_bit_per_sample_32"
+                layout="@layout/preference_widget_dialog_radiobutton"/>
+        </RadioGroup>
+
+        <include
+            android:id="@+id/bluetooth_audio_codec_help_info"
+            layout="@layout/preference_widget_dialog_summary"/>
+
+    </LinearLayout>
+
+</ScrollView>
+
diff --git a/res/layout/bluetooth_audio_quality_dialog.xml b/res/layout/bluetooth_audio_quality_dialog.xml
new file mode 100644
index 0000000..c3c1977
--- /dev/null
+++ b/res/layout/bluetooth_audio_quality_dialog.xml
@@ -0,0 +1,59 @@
+<?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:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical"
+        android:padding="8dp">
+
+        <RadioGroup
+            android:id="@+id/bluetooth_audio_quality_radio_group"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="@dimen/developer_option_dialog_margin_start">
+
+            <include
+                android:id="@+id/bluetooth_audio_quality_default"
+                layout="@layout/preference_widget_dialog_radiobutton"/>
+
+            <include
+                android:id="@+id/bluetooth_audio_quality_optimized_quality"
+                layout="@layout/preference_widget_dialog_radiobutton"/>
+
+            <include
+                android:id="@+id/bluetooth_audio_quality_optimized_connection"
+                layout="@layout/preference_widget_dialog_radiobutton"/>
+
+            <include
+                android:id="@+id/bluetooth_audio_quality_best_effort"
+                layout="@layout/preference_widget_dialog_radiobutton"/>
+
+        </RadioGroup>
+
+        <include
+            android:id="@+id/bluetooth_audio_codec_help_info"
+            layout="@layout/preference_widget_dialog_summary"/>
+
+    </LinearLayout>
+
+</ScrollView>
+
diff --git a/res/layout/dark_ui_activation_button.xml b/res/layout/dark_ui_activation_button.xml
new file mode 100644
index 0000000..5f9eefc
--- /dev/null
+++ b/res/layout/dark_ui_activation_button.xml
@@ -0,0 +1,40 @@
+<?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/listPreferredItemHeight">
+
+    <Button
+        android:id="@+id/dark_ui_turn_on_button"
+        style="@style/ActionPrimaryButton"
+        android:layout_marginStart="@dimen/screen_margin_sides"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_vertical" />
+
+    <Button
+        android:id="@+id/dark_ui_turn_off_button"
+        style="@style/ActionSecondaryButton"
+        android:layout_marginStart="@dimen/screen_margin_sides"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_vertical" />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/night_display_activation_button.xml b/res/layout/night_display_activation_button.xml
index df160ec..8765ff7 100644
--- a/res/layout/night_display_activation_button.xml
+++ b/res/layout/night_display_activation_button.xml
@@ -24,6 +24,7 @@
     <Button
         android:id="@+id/night_display_turn_on_button"
         style="@style/ActionPrimaryButton"
+        android:focusableInTouchMode="true"
         android:layout_marginStart="@dimen/screen_margin_sides"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
@@ -32,6 +33,7 @@
     <Button
         android:id="@+id/night_display_turn_off_button"
         style="@style/ActionSecondaryButton"
+        android:focusableInTouchMode="true"
         android:layout_marginStart="@dimen/screen_margin_sides"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
diff --git a/res/layout/zen_mode_settings_button.xml b/res/layout/zen_mode_settings_button.xml
index 7bd9b47..2146e28 100644
--- a/res/layout/zen_mode_settings_button.xml
+++ b/res/layout/zen_mode_settings_button.xml
@@ -24,6 +24,7 @@
     <Button
         android:id="@+id/zen_mode_settings_turn_on_button"
         style="@style/ActionPrimaryButton"
+        android:focusableInTouchMode="true"
         android:layout_marginStart="@dimen/screen_margin_sides"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
@@ -33,6 +34,7 @@
     <Button
         android:id="@+id/zen_mode_settings_turn_off_button"
         style="@style/ActionSecondaryButton"
+        android:focusableInTouchMode="true"
         android:layout_marginStart="@dimen/screen_margin_sides"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index ba5f9e3..068ba8c 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -100,6 +100,14 @@
         <item>1800000</item>
     </string-array>
 
+    <!-- Dark theme scheduling preferences  [CHAR LIMIT=NONE] -->
+    <string-array name="dark_ui_scheduler_preference_titles">
+        <!-- 1: None -->
+        <item>@string/dark_ui_auto_mode_never</item>
+        <!-- 2: Auto -->
+        <item>@string/dark_ui_auto_mode_auto</item>
+    </string-array>
+
     <!-- Security settings.  The delay after screen is turned off until device locks.
          These are shown in a list dialog. -->
     <string-array name="lock_after_timeout_entries">
diff --git a/res/values/config.xml b/res/values/config.xml
index 4a02b97..35cc420 100755
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -425,4 +425,7 @@
     <string-array name="config_panel_keep_observe_uri" translatable="false">
         <item>content://com.android.settings.slices/intent/media_output_indicator</item>
     </string-array>
+
+    <!-- Uri to query non-public Slice Uris. -->
+    <string name="config_non_public_slice_query_uri" translatable="false"></string>
 </resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index cf19906..f29ed2f 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -95,8 +95,6 @@
     <!-- Description for the button that makes interface elements larger. [CHAR_LIMIT=NONE] -->
     <string name="font_size_make_larger_desc">Make larger</string>
 
-    <!-- Sample text for font size preview. -->
-    <string name="font_size_preview_text">Servez à ce monsieur une bière et des kiwis.</string>
     <string name="font_size_preview_text_headline">Sample text</string>
     <string name="font_size_preview_text_title"
             translation_description="Title text in sample text used to illustrate how the currently selected font size will appear to the user. NOTE: Translate manually. No not adopt any copyrighted material for translation.">
@@ -2764,6 +2762,40 @@
     <!-- Night display slice screen, subtitle of intensity setting when night light is off. [CHAR LIMIT=30] -->
     <string name="night_display_not_currently_on">Night Light not currently on</string>
 
+    <!--    Dark ui screen-->
+    <!-- Display settings screen, activation button action for manual mode. [CHAR LIMIT=40] -->
+    <string name="dark_ui_activation_on_manual">Turn on now</string>
+    <!-- Display settings screen, deactivation button action for manual mode. [CHAR LIMIT=40] -->
+    <string name="dark_ui_activation_off_manual">Turn off now</string>
+    <!-- Display settings screen, activation button action for sunset-to-sunrise schedule [CHAR LIMIT=40] -->
+    <string name="dark_ui_activation_on_auto">Turn on until sunrise</string>
+    <!-- Display settings screen, deactivation button action for sunset-to-sunrise schedule [CHAR LIMIT=40] -->
+    <string name="dark_ui_activation_off_auto">Turn off until sunset</string>
+    <!-- Dark UI screen, setting option name to enable Dark UI [CHAR LIMIT=30] -->
+    <string name="dark_ui_title">Dark Mode</string>
+    <!-- Dark UI screen, setting option name to configure whether Dark UI turn on/off automatically. [CHAR LIMIT=30] -->
+    <string name="dark_ui_auto_mode_title">Schedule</string>
+    <!-- Dark UI screen, setting option value for Dark UI to *never* turn on/off automatically. [CHAR LIMIT=30] -->
+    <string name="dark_ui_auto_mode_never">None</string>
+    <!-- Dark UIscreen, setting option value for Dark UI to turn on/off automatically at sunset/sunrise. [CHAR LIMIT=32] -->
+    <string name="dark_ui_auto_mode_auto">Turns on from sunset to sunrise</string>
+    <!-- Dark UIscreen, setting option name controlling the current activation status. [CHAR LIMIT=30] -->
+    <string name="dark_ui_status_title">Status</string>
+    <!-- Display settings screen, summary format of Dark UI when off. [CHAR LIMIT=NONE] -->
+    <string name="dark_ui_summary_off">Off / <xliff:g name="auto_mode_summary" example="Never turn on automatically">%1$s</xliff:g></string>
+    <!-- Display settings screen, summary of Dark UI when off and will *never* turn on automatically. [CHAR LIMIT=NONE] -->
+    <string name="dark_ui_summary_off_auto_mode_never">Will never turn on automatically</string>
+    <!-- Display settings screen, summary of Dark UI when off and will turn on automatically at sunset. [CHAR LIMIT=NONE] -->
+    <string name="dark_ui_summary_off_auto_mode_auto">Will turn on automatically at sunset</string>
+    <!-- Display settings screen, summary format of Dark UI when on. [CHAR LIMIT=NONE] -->
+    <string name="dark_ui_summary_on">On / <xliff:g name="auto_mode_summary" example="Never turn off automatically">%1$s</xliff:g></string>
+    <!-- Display settings screen, summary of Dark UI when on and will *never* turn off automatically. [CHAR LIMIT=NONE] -->
+    <string name="dark_ui_summary_on_auto_mode_never">Will never turn off automatically</string>
+    <!-- Display settings screen, summary of Dark UI when on and will turn off automatically at sunrise. [CHAR LIMIT=NONE] -->
+    <string name="dark_ui_summary_on_auto_mode_auto">Will turn off automatically at sunrise</string>
+    <!-- Dark theme screen, description of Dark theme feature. [CHAR LIMIT=NONE] -->
+    <string name="dark_ui_text">Dark theme uses true black to help keep your battery alive longer. Dark theme schedules wait to turn on until your screen is off.</string>
+
     <!-- Sound & display settings screen, setting option name to change screen timeout -->
     <string name="screen_timeout">Screen timeout</string>
     <!-- Sound & display settings screen, setting option name to change screen timeout [CHAR LIMIT=30] -->
@@ -6883,6 +6915,7 @@
     <string name="help_url_connected_devices" translatable="false"></string>
     <string name="help_url_apps_and_notifications" translatable="false"></string>
     <string name="help_url_night_display" translatable="false"></string>
+    <string name="help_url_dark_theme" translatable="false"></string>
     <string name="help_url_screen_saver" translatable="false"></string>
     <string name="help_url_pickup_gesture" translatable="false"></string>
     <string name="help_url_storage_dashboard" translatable="false"></string>
@@ -10558,6 +10591,17 @@
         <item>@string/game_driver_app_preference_system</item>
     </string-array>
 
+    <!-- Title for App Compatibility Changes dashboard where developers can configure per-app overrides for compatibility changes [CHAR LIMIT=50] -->
+    <string name="platform_compat_dashboard_title">App Compatibility Changes</string>
+    <!-- Summary for App Compatibility Changes dashboard [CHAR LIMIT=NONE] -->
+    <string name="platform_compat_dashboard_summary">Modify app compatibility change overrides</string>
+    <!-- Title for default enabled app compat changes category [CHAR LIMIT=50] -->
+    <string name="platform_compat_default_enabled_title">Default enabled changes</string>
+    <!-- Title for default disabled app compat changes category [CHAR LIMIT=50] -->
+    <string name="platform_compat_default_disabled_title">Default disabled changes</string>
+    <!-- Title for target SDK gated app compat changes category [CHAR LIMIT=50] -->
+    <string name="platform_compat_target_sdk_title">Enabled after SDK <xliff:g id="number" example="29">%d</xliff:g></string>
+
     <!-- Slices Strings -->
 
     <!-- Summary text on a card explaining that a setting does not exist / is not supported on the device [CHAR_LIMIT=NONE]-->
diff --git a/res/xml/dark_mode_settings.xml b/res/xml/dark_mode_settings.xml
new file mode 100644
index 0000000..9247a0c
--- /dev/null
+++ b/res/xml/dark_mode_settings.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<PreferenceScreen
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:settings="http://schemas.android.com/apk/res-auto"
+    android:title="@string/dark_ui_mode"
+    android:key="dark_ui_mode_screen"
+    settings:keywords="@string/keywords_dark_ui_mode">
+
+    <DropDownPreference
+        android:key="dark_ui_auto_mode"
+        android:title="@string/dark_ui_auto_mode_title"
+        android:summary="%s"
+        android:entries="@array/dark_ui_scheduler_preference_titles"
+        android:entryValues="@array/dark_ui_scheduler_preference_titles"
+        settings:controller="com.android.settings.display.darkmode.DarkModeScheduleSelectorController"
+        settings:keywords="@string/keywords_dark_ui_mode"/>
+
+    <com.android.settingslib.widget.LayoutPreference
+        android:key="dark_ui_activated"
+        android:title="@string/dark_ui_title"
+        android:selectable="false"
+        android:layout="@layout/dark_ui_activation_button"
+        settings:allowDividerBelow="true"
+        settings:controller="com.android.settings.display.darkmode.DarkModeActivationPreferenceController"
+        settings:keywords="@string/keywords_dark_ui_mode"/>
+
+    <com.android.settingslib.widget.FooterPreference
+            android:key="dark_ui_footer"
+            android:title="@string/dark_ui_text"
+            android:selectable="false"
+            settings:searchable="false"
+            settings:allowDividerAbove="true"/>
+
+</PreferenceScreen>
\ No newline at end of file
diff --git a/res/xml/dark_ui_settings.xml b/res/xml/dark_ui_settings.xml
index 1f11eba..8932670 100644
--- a/res/xml/dark_ui_settings.xml
+++ b/res/xml/dark_ui_settings.xml
@@ -21,4 +21,4 @@
     android:key="dark_ui_mode_screen"
     settings:staticPreferenceLocation="append"
     settings:keywords="@string/keywords_dark_ui_mode">
-</PreferenceScreen >
+</PreferenceScreen >
\ No newline at end of file
diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml
index fb1e0ba..65a454e 100644
--- a/res/xml/development_settings.xml
+++ b/res/xml/development_settings.xml
@@ -215,6 +215,13 @@
             android:fragment="com.android.settings.development.gamedriver.GameDriverDashboard"
             settings:searchable="false" />
 
+        <Preference
+            android:key="platform_compat_dashboard"
+            android:title="@string/platform_compat_dashboard_title"
+            android:summary="@string/platform_compat_dashboard_summary"
+            android:fragment="com.android.settings.development.compat.PlatformCompatDashboard"
+            />
+
     </PreferenceCategory>
 
     <PreferenceCategory
diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml
index c45e6a2..9bc6710 100644
--- a/res/xml/display_settings.xml
+++ b/res/xml/display_settings.xml
@@ -31,6 +31,15 @@
         <intent android:action="com.android.intent.action.SHOW_BRIGHTNESS_DIALOG" />
     </com.android.settingslib.RestrictedPreference>
 
+    <com.android.settings.display.darkmode.DarkModePreference
+        android:key="dark_ui_mode"
+        android:title="@string/dark_ui_mode"
+        android:fragment="com.android.settings.display.darkmode.DarkModeSettingsFragment"
+        android:widgetLayout="@null"
+        settings:widgetLayout="@null"
+        settings:controller="com.android.settings.display.DarkUIPreferenceController"
+        settings:searchable="false"/>
+
     <com.android.settings.display.NightDisplayPreference
         android:key="night_display"
         android:title="@string/night_display_title"
@@ -54,13 +63,6 @@
         settings:controller="com.android.settings.display.WallpaperPreferenceController">
     </com.android.settingslib.RestrictedPreference>
 
-
-    <SwitchPreference
-        android:key="dark_ui_mode"
-        android:title="@string/dark_ui_mode"
-        settings:keywords="@string/keywords_dark_ui_mode"
-        settings:controller="com.android.settings.display.DarkUIPreferenceController"/>
-
     <!-- Cross-listed item, if you change this, also change it in power_usage_summary.xml -->
     <com.android.settings.display.TimeoutListPreference
         android:key="screen_timeout"
diff --git a/res/xml/location_recent_requests_see_all.xml b/res/xml/location_recent_requests_see_all.xml
index 492bc96..5bfb0ac 100644
--- a/res/xml/location_recent_requests_see_all.xml
+++ b/res/xml/location_recent_requests_see_all.xml
@@ -14,9 +14,7 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:settings="http://schemas.android.com/apk/res-auto"
     android:title="@string/location_category_recent_location_requests"
-    android:key="recent_location_requests_see_all">
-    <PreferenceCategory
-        android:key="all_recent_location_requests"
-        settings:controller="com.android.settings.location.RecentLocationRequestSeeAllPreferenceController"/>
+    android:key="all_recent_location_requests"
+    settings:controller="com.android.settings.location.RecentLocationRequestSeeAllPreferenceController">
 
 </PreferenceScreen>
diff --git a/res/xml/platform_compat_settings.xml b/res/xml/platform_compat_settings.xml
new file mode 100644
index 0000000..bee2324
--- /dev/null
+++ b/res/xml/platform_compat_settings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright 2019 The Android Open Source Project
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<PreferenceScreen
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:settings="http://schemas.android.com/apk/res-auto"
+    android:key="platform_compat_dashboard"
+    android:title="@string/platform_compat_dashboard_title">
+</PreferenceScreen>
diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java
index 29ac8b6..6b23b29 100644
--- a/src/com/android/settings/DisplaySettings.java
+++ b/src/com/android/settings/DisplaySettings.java
@@ -23,7 +23,6 @@
 import com.android.settings.dashboard.DashboardFragment;
 import com.android.settings.display.BrightnessLevelPreferenceController;
 import com.android.settings.display.CameraGesturePreferenceController;
-import com.android.settings.display.DarkUIPreferenceController;
 import com.android.settings.display.LiftToWakePreferenceController;
 import com.android.settings.display.NightDisplayPreferenceController;
 import com.android.settings.display.NightModePreferenceController;
@@ -65,7 +64,6 @@
     @Override
     public void onCreate(Bundle icicle) {
         super.onCreate(icicle);
-        use(DarkUIPreferenceController.class).setParentFragment(this);
     }
 
     @Override
diff --git a/src/com/android/settings/dashboard/ControllerFutureTask.java b/src/com/android/settings/dashboard/ControllerFutureTask.java
new file mode 100644
index 0000000..84d11fd
--- /dev/null
+++ b/src/com/android/settings/dashboard/ControllerFutureTask.java
@@ -0,0 +1,36 @@
+/*
+ * 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.dashboard;
+
+import com.android.settingslib.core.AbstractPreferenceController;
+
+import java.util.concurrent.FutureTask;
+
+/**
+ *  {@link FutureTask} of the Controller.
+ */
+public class ControllerFutureTask extends FutureTask<Void> {
+    private final AbstractPreferenceController mController;
+
+    public ControllerFutureTask(ControllerTask task, Void result) {
+        super(task, result);
+        mController = task.getController();
+    }
+
+    AbstractPreferenceController getController() {
+        return mController;
+    }
+}
diff --git a/src/com/android/settings/dashboard/ControllerTask.java b/src/com/android/settings/dashboard/ControllerTask.java
new file mode 100644
index 0000000..c62e738
--- /dev/null
+++ b/src/com/android/settings/dashboard/ControllerTask.java
@@ -0,0 +1,90 @@
+/*
+ * 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.dashboard;
+
+import android.app.settings.SettingsEnums;
+import android.os.SystemClock;
+import android.text.TextUtils;
+import android.util.Log;
+
+import androidx.preference.Preference;
+import androidx.preference.PreferenceScreen;
+
+import com.android.settingslib.core.AbstractPreferenceController;
+import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
+import com.android.settingslib.utils.ThreadUtils;
+
+/**
+ * A {@link Runnable} controller task. This task handle the visibility of the controller in the
+ * background. Also handle the state updating in the main thread.
+ */
+public class ControllerTask implements Runnable {
+    private static final String TAG = "ControllerTask";
+    private static final int CONTROLLER_UPDATESTATE_TIME_THRESHOLD = 50;
+
+    private final AbstractPreferenceController mController;
+    private final PreferenceScreen mScreen;
+    private final int mMetricsCategory;
+    private final MetricsFeatureProvider mMetricsFeature;
+
+    public ControllerTask(AbstractPreferenceController controller, PreferenceScreen screen,
+            MetricsFeatureProvider metricsFeature, int metricsCategory) {
+        mController = controller;
+        mScreen = screen;
+        mMetricsFeature = metricsFeature;
+        mMetricsCategory = metricsCategory;
+    }
+
+    @Override
+    public void run() {
+        if (!mController.isAvailable()) {
+            return;
+        }
+
+        final String key = mController.getPreferenceKey();
+        if (TextUtils.isEmpty(key)) {
+            Log.d(TAG, String.format("Preference key is %s in Controller %s",
+                    key, mController.getClass().getSimpleName()));
+            return;
+        }
+
+        final Preference preference = mScreen.findPreference(key);
+        if (preference == null) {
+            Log.d(TAG, String.format("Cannot find preference with key %s in Controller %s",
+                    key, mController.getClass().getSimpleName()));
+            return;
+        }
+        ThreadUtils.postOnMainThread(() -> {
+            final long t = SystemClock.elapsedRealtime();
+            mController.updateState(preference);
+            final int elapsedTime = (int) (SystemClock.elapsedRealtime() - t);
+            if (elapsedTime > CONTROLLER_UPDATESTATE_TIME_THRESHOLD) {
+                Log.w(TAG, "The updateState took " + elapsedTime + " ms in Controller "
+                        + mController.getClass().getSimpleName());
+                if (mMetricsFeature != null) {
+                    mMetricsFeature.action(SettingsEnums.PAGE_UNKNOWN,
+                            SettingsEnums.ACTION_CONTROLLER_UPDATE_STATE, mMetricsCategory,
+                            mController.getClass().getSimpleName(), elapsedTime);
+                }
+            }
+        });
+    }
+
+    AbstractPreferenceController getController() {
+        return mController;
+    }
+}
diff --git a/src/com/android/settings/dashboard/DashboardFragment.java b/src/com/android/settings/dashboard/DashboardFragment.java
index 50630fe..f51b5cf 100644
--- a/src/com/android/settings/dashboard/DashboardFragment.java
+++ b/src/com/android/settings/dashboard/DashboardFragment.java
@@ -22,6 +22,7 @@
 import android.os.Bundle;
 import android.text.TextUtils;
 import android.util.ArrayMap;
+import android.util.FeatureFlagUtils;
 import android.util.Log;
 
 import androidx.annotation.CallSuper;
@@ -35,6 +36,7 @@
 import com.android.settings.R;
 import com.android.settings.SettingsPreferenceFragment;
 import com.android.settings.core.BasePreferenceController;
+import com.android.settings.core.FeatureFlags;
 import com.android.settings.core.PreferenceControllerListHelper;
 import com.android.settings.core.SettingsBaseActivity;
 import com.android.settings.overlay.FeatureFactory;
@@ -46,6 +48,7 @@
 import com.android.settingslib.drawer.ProviderTile;
 import com.android.settingslib.drawer.Tile;
 import com.android.settingslib.search.Indexable;
+import com.android.settingslib.utils.ThreadUtils;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -53,6 +56,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
+import java.util.concurrent.ExecutionException;
 
 /**
  * Base fragment for dashboard style UI containing a list of static and dynamic setting items.
@@ -306,9 +310,22 @@
     }
 
     /**
+     * @return {@code true} if the underlying controllers should be executed in parallel.
+     * Override this function to enable/disable the behavior.
+     */
+    protected boolean isParalleledControllers() {
+        return false;
+    }
+
+    /**
      * Update state of each preference managed by PreferenceController.
      */
     protected void updatePreferenceStates() {
+        if (isParalleledControllers() && FeatureFlagUtils.isEnabled(getContext(),
+                FeatureFlags.CONTROLLER_ENHANCEMENT)) {
+            updatePreferenceStatesInParallel();
+            return;
+        }
         final PreferenceScreen screen = getPreferenceScreen();
         Collection<List<AbstractPreferenceController>> controllerLists =
                 mPreferenceControllers.values();
@@ -337,6 +354,34 @@
     }
 
     /**
+     * Use parallel method to update state of each preference managed by PreferenceController.
+     */
+    @VisibleForTesting
+    void updatePreferenceStatesInParallel() {
+        final PreferenceScreen screen = getPreferenceScreen();
+        final Collection<List<AbstractPreferenceController>> controllerLists =
+                mPreferenceControllers.values();
+        final List<ControllerFutureTask> taskList = new ArrayList<>();
+        for (List<AbstractPreferenceController> controllerList : controllerLists) {
+            for (AbstractPreferenceController controller : controllerList) {
+                final ControllerFutureTask task = new ControllerFutureTask(
+                        new ControllerTask(controller, screen, mMetricsFeatureProvider,
+                                getMetricsCategory()), null /* result */);
+                taskList.add(task);
+                ThreadUtils.postOnBackgroundThread(task);
+            }
+        }
+
+        for (ControllerFutureTask task : taskList) {
+            try {
+                task.get();
+            } catch (InterruptedException | ExecutionException e) {
+                Log.w(TAG, task.getController().getPreferenceKey() + " " + e.getMessage());
+            }
+        }
+    }
+
+    /**
      * Refresh all preference items, including both static prefs from xml, and dynamic items from
      * DashboardCategory.
      */
diff --git a/src/com/android/settings/dashboard/profileselector/ProfileSelectFragment.java b/src/com/android/settings/dashboard/profileselector/ProfileSelectFragment.java
index b8d4be1..aee7982 100644
--- a/src/com/android/settings/dashboard/profileselector/ProfileSelectFragment.java
+++ b/src/com/android/settings/dashboard/profileselector/ProfileSelectFragment.java
@@ -27,9 +27,11 @@
 
 import androidx.fragment.app.Fragment;
 import androidx.fragment.app.FragmentStatePagerAdapter;
+import androidx.recyclerview.widget.RecyclerView;
 import androidx.viewpager.widget.ViewPager;
 
 import com.android.settings.R;
+import com.android.settings.Utils;
 import com.android.settings.dashboard.DashboardFragment;
 
 import com.google.android.material.tabs.TabLayout;
@@ -90,6 +92,10 @@
         listContainer.setLayoutParams(new LinearLayout.LayoutParams(
                 ViewGroup.LayoutParams.MATCH_PARENT,
                 ViewGroup.LayoutParams.WRAP_CONTENT));
+
+        final RecyclerView recyclerView = getListView();
+        recyclerView.setOverScrollMode(View.OVER_SCROLL_NEVER);
+        Utils.setActionBarShadowAnimation(getActivity(), getSettingsLifecycle(), recyclerView);
         return mContentView;
     }
 
diff --git a/src/com/android/settings/datetime/DatePreferenceController.java b/src/com/android/settings/datetime/DatePreferenceController.java
index 1704bd6..ace24f6 100644
--- a/src/com/android/settings/datetime/DatePreferenceController.java
+++ b/src/com/android/settings/datetime/DatePreferenceController.java
@@ -17,8 +17,9 @@
 package com.android.settings.datetime;
 
 import android.app.Activity;
-import android.app.AlarmManager;
 import android.app.DatePickerDialog;
+import android.app.timedetector.ManualTimeSuggestion;
+import android.app.timedetector.TimeDetector;
 import android.content.Context;
 import android.text.TextUtils;
 import android.text.format.DateFormat;
@@ -119,7 +120,10 @@
         long when = Math.max(c.getTimeInMillis(), DatePreferenceHost.MIN_DATE);
 
         if (when / 1000 < Integer.MAX_VALUE) {
-            ((AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE)).setTime(when);
+            TimeDetector timeDetector = mContext.getSystemService(TimeDetector.class);
+            ManualTimeSuggestion manualTimeSuggestion =
+                    TimeDetector.createManualTimeSuggestion(when, "Settings: Set date");
+            timeDetector.suggestManualTime(manualTimeSuggestion);
         }
     }
 }
diff --git a/src/com/android/settings/datetime/TimePreferenceController.java b/src/com/android/settings/datetime/TimePreferenceController.java
index 3ca26bc..582234e 100644
--- a/src/com/android/settings/datetime/TimePreferenceController.java
+++ b/src/com/android/settings/datetime/TimePreferenceController.java
@@ -17,8 +17,9 @@
 package com.android.settings.datetime;
 
 import android.app.Activity;
-import android.app.AlarmManager;
 import android.app.TimePickerDialog;
+import android.app.timedetector.ManualTimeSuggestion;
+import android.app.timedetector.TimeDetector;
 import android.content.Context;
 import android.text.TextUtils;
 import android.text.format.DateFormat;
@@ -117,7 +118,10 @@
         long when = Math.max(c.getTimeInMillis(), TimePreferenceHost.MIN_DATE);
 
         if (when / 1000 < Integer.MAX_VALUE) {
-            ((AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE)).setTime(when);
+            TimeDetector timeDetector = mContext.getSystemService(TimeDetector.class);
+            ManualTimeSuggestion manualTimeSuggestion =
+                    TimeDetector.createManualTimeSuggestion(when, "Settings: Set time");
+            timeDetector.suggestManualTime(manualTimeSuggestion);
         }
     }
 }
diff --git a/src/com/android/settings/development/DevelopmentOptionsActivityRequestCodes.java b/src/com/android/settings/development/DevelopmentOptionsActivityRequestCodes.java
index 564f2c3..0d91fdd 100644
--- a/src/com/android/settings/development/DevelopmentOptionsActivityRequestCodes.java
+++ b/src/com/android/settings/development/DevelopmentOptionsActivityRequestCodes.java
@@ -31,4 +31,6 @@
     int REQUEST_CODE_ANGLE_DRIVER_PKGS = 4;
 
     int REQUEST_CODE_ANGLE_DRIVER_VALUES = 5;
+
+    int REQUEST_COMPAT_CHANGE_APP = 6;
 }
diff --git a/src/com/android/settings/development/VerifyAppsOverUsbPreferenceController.java b/src/com/android/settings/development/VerifyAppsOverUsbPreferenceController.java
index 20b8f1f..56d49da 100644
--- a/src/com/android/settings/development/VerifyAppsOverUsbPreferenceController.java
+++ b/src/com/android/settings/development/VerifyAppsOverUsbPreferenceController.java
@@ -146,19 +146,11 @@
                 == AdbPreferenceController.ADB_SETTING_OFF) {
             return false;
         }
-        if (Settings.Global.getInt(cr, Settings.Global.PACKAGE_VERIFIER_ENABLE, SETTING_VALUE_ON)
-                == SETTING_VALUE_OFF) {
-            return false;
-        } else {
-            final Intent verification = new Intent(Intent.ACTION_PACKAGE_NEEDS_VERIFICATION);
-            verification.setType(PACKAGE_MIME_TYPE);
-            verification.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
-            final List<ResolveInfo> receivers = mPackageManager.queryBroadcastReceivers(
-                    verification, 0 /* flags */);
-            if (receivers.size() == 0) {
-                return false;
-            }
-        }
-        return true;
+        final Intent verification = new Intent(Intent.ACTION_PACKAGE_NEEDS_VERIFICATION);
+        verification.setType(PACKAGE_MIME_TYPE);
+        verification.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
+        final List<ResolveInfo> receivers = mPackageManager.queryBroadcastReceivers(
+                verification, 0 /* flags */);
+        return !receivers.isEmpty();
     }
 }
diff --git a/src/com/android/settings/development/compat/PlatformCompatDashboard.java b/src/com/android/settings/development/compat/PlatformCompatDashboard.java
new file mode 100644
index 0000000..dab45f2
--- /dev/null
+++ b/src/com/android/settings/development/compat/PlatformCompatDashboard.java
@@ -0,0 +1,276 @@
+/*
+ * Copyright 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.compat;
+
+import static com.android.settings.development.DevelopmentOptionsActivityRequestCodes.REQUEST_COMPAT_CHANGE_APP;
+
+import android.app.Activity;
+import android.app.settings.SettingsEnums;
+import android.compat.Compatibility.ChangeConfig;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.util.ArraySet;
+
+import androidx.annotation.VisibleForTesting;
+import androidx.preference.Preference;
+import androidx.preference.Preference.OnPreferenceChangeListener;
+import androidx.preference.PreferenceCategory;
+import androidx.preference.SwitchPreference;
+
+import com.android.internal.compat.CompatibilityChangeConfig;
+import com.android.internal.compat.CompatibilityChangeInfo;
+import com.android.internal.compat.IPlatformCompat;
+import com.android.settings.R;
+import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.development.AppPicker;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+
+/**
+ * Dashboard for Platform Compat preferences.
+ */
+public class PlatformCompatDashboard extends DashboardFragment {
+    private static final String TAG = "PlatformCompatDashboard";
+    private static final String COMPAT_APP = "compat_app";
+
+    private IPlatformCompat mPlatformCompat;
+
+    private CompatibilityChangeInfo[] mChanges;
+
+    @VisibleForTesting
+    String mSelectedApp;
+
+    @Override
+    public int getMetricsCategory() {
+        return SettingsEnums.SETTINGS_PLATFORM_COMPAT_DASHBOARD;
+    }
+
+    @Override
+    protected String getLogTag() {
+        return TAG;
+    }
+
+    @Override
+    protected int getPreferenceScreenResId() {
+        return R.xml.platform_compat_settings;
+    }
+
+    @Override
+    public int getHelpResource() {
+        return 0;
+    }
+
+    IPlatformCompat getPlatformCompat() {
+        if (mPlatformCompat == null) {
+            mPlatformCompat = IPlatformCompat.Stub
+                    .asInterface(ServiceManager.getService(Context.PLATFORM_COMPAT_SERVICE));
+        }
+        return mPlatformCompat;
+    }
+
+    @Override
+    public void onActivityCreated(Bundle savedInstanceState) {
+        super.onActivityCreated(savedInstanceState);
+        try {
+            mChanges = getPlatformCompat().listAllChanges();
+        } catch (RemoteException e) {
+            throw new RuntimeException("Could not list changes!", e);
+        }
+        startAppPicker();
+    }
+
+    @Override
+    public void onSaveInstanceState(Bundle outState) {
+        super.onSaveInstanceState(outState);
+        outState.putString(COMPAT_APP, mSelectedApp);
+    }
+
+    @Override
+    public void onActivityResult(int requestCode, int resultCode, Intent data) {
+        if (requestCode == REQUEST_COMPAT_CHANGE_APP) {
+            if (resultCode == Activity.RESULT_OK) {
+                mSelectedApp = data.getAction();
+                addPreferences();
+            }
+            return;
+        }
+        super.onActivityResult(requestCode, resultCode, data);
+    }
+
+    private void addPreferences() {
+        getPreferenceScreen().removeAll();
+        getPreferenceScreen().addPreference(
+                createAppPreference(getApplicationInfo().loadIcon(getPackageManager())));
+        // Differentiate compatibility changes into default enabled, default disabled and enabled
+        // after target sdk.
+        final CompatibilityChangeConfig configMappings = getAppChangeMappings();
+        final List<CompatibilityChangeInfo> enabledChanges = new ArrayList<>();
+        final List<CompatibilityChangeInfo> disabledChanges = new ArrayList<>();
+        final Map<Integer, List<CompatibilityChangeInfo>> targetSdkChanges = new TreeMap<>();
+        for (CompatibilityChangeInfo change : mChanges) {
+            if (change.getEnableAfterTargetSdk() != 0) {
+                List<CompatibilityChangeInfo> sdkChanges;
+                if (!targetSdkChanges.containsKey(change.getEnableAfterTargetSdk())) {
+                    sdkChanges = new ArrayList<>();
+                    targetSdkChanges.put(change.getEnableAfterTargetSdk(), sdkChanges);
+                } else {
+                    sdkChanges = targetSdkChanges.get(change.getEnableAfterTargetSdk());
+                }
+                sdkChanges.add(change);
+            } else if (change.getDisabled()) {
+                disabledChanges.add(change);
+            } else {
+                enabledChanges.add(change);
+            }
+        }
+        createChangeCategoryPreference(enabledChanges, configMappings,
+                getString(R.string.platform_compat_default_enabled_title));
+        createChangeCategoryPreference(disabledChanges, configMappings,
+                getString(R.string.platform_compat_default_disabled_title));
+        for (Integer sdk : targetSdkChanges.keySet()) {
+            createChangeCategoryPreference(targetSdkChanges.get(sdk), configMappings,
+                    getString(R.string.platform_compat_target_sdk_title, sdk));
+        }
+    }
+
+    private CompatibilityChangeConfig getAppChangeMappings() {
+        try {
+            final ApplicationInfo applicationInfo = getApplicationInfo();
+            return getPlatformCompat().getAppConfig(applicationInfo);
+        } catch (RemoteException e) {
+            throw new RuntimeException("Could not get app config!", e);
+        }
+    }
+
+    /**
+     * Create a {@link Preference} for a changeId.
+     *
+     * <p>The {@link Preference} is a toggle switch that can enable or disable the given change for
+     * the currently selected app.</p>
+     */
+    Preference createPreferenceForChange(Context context, CompatibilityChangeInfo change,
+            CompatibilityChangeConfig configMappings) {
+        final boolean currentValue = configMappings.isChangeEnabled(change.getId());
+        final SwitchPreference item = new SwitchPreference(context);
+        final String changeName =
+                change.getName() != null ? change.getName() : "Change_" + change.getId();
+        item.setSummary(changeName);
+        item.setKey(changeName);
+        item.setEnabled(true);
+        item.setChecked(currentValue);
+        item.setOnPreferenceChangeListener(
+                new CompatChangePreferenceChangeListener(change.getId()));
+        return item;
+    }
+
+    /**
+     * Get {@link ApplicationInfo} for the currently selected app.
+     *
+     * @return an {@link ApplicationInfo} instance.
+     */
+    ApplicationInfo getApplicationInfo() {
+        try {
+            return getPackageManager().getApplicationInfo(mSelectedApp, 0);
+        } catch (PackageManager.NameNotFoundException e) {
+            throw new RuntimeException("Could not get ApplicationInfo for selected app!", e);
+        }
+    }
+
+    /**
+     * Create a {@link Preference} for the selected app.
+     *
+     * <p>The {@link Preference} contains the icon, package name and target SDK for the selected
+     * app. Selecting this preference will also re-trigger the app selection dialog.</p>
+     */
+    Preference createAppPreference(Drawable icon) {
+        final ApplicationInfo applicationInfo = getApplicationInfo();
+        final Preference appPreference = new Preference(getPreferenceScreen().getContext());
+        appPreference.setIcon(icon);
+        appPreference.setSummary(mSelectedApp
+                + " SDK "
+                + applicationInfo.targetSdkVersion);
+        appPreference.setKey(mSelectedApp);
+        appPreference.setOnPreferenceClickListener(
+                preference -> {
+                    startAppPicker();
+                    return true;
+                });
+        return appPreference;
+    }
+
+    PreferenceCategory createChangeCategoryPreference(List<CompatibilityChangeInfo> changes,
+            CompatibilityChangeConfig configMappings, String title) {
+        final PreferenceCategory category =
+                new PreferenceCategory(getPreferenceScreen().getContext());
+        category.setTitle(title);
+        getPreferenceScreen().addPreference(category);
+        addChangePreferencesToCategory(changes, category, configMappings);
+        return category;
+    }
+
+    private void addChangePreferencesToCategory(List<CompatibilityChangeInfo> changes,
+            PreferenceCategory category, CompatibilityChangeConfig configMappings) {
+        for (CompatibilityChangeInfo change : changes) {
+            final Preference preference = createPreferenceForChange(getPreferenceScreen().getContext(),
+                    change, configMappings);
+            category.addPreference(preference);
+        }
+    }
+
+    private void startAppPicker() {
+        final Intent intent = new Intent(getContext(), AppPicker.class);
+        startActivityForResult(intent, REQUEST_COMPAT_CHANGE_APP);
+    }
+
+    private class CompatChangePreferenceChangeListener implements OnPreferenceChangeListener {
+        private final long changeId;
+
+        CompatChangePreferenceChangeListener(long changeId) {
+            this.changeId = changeId;
+        }
+
+        @Override
+        public boolean onPreferenceChange(Preference preference, Object newValue) {
+            try {
+                final ArraySet<Long> enabled = new ArraySet<>();
+                final ArraySet<Long> disabled = new ArraySet<>();
+                if ((Boolean) newValue) {
+                    enabled.add(changeId);
+                } else {
+                    disabled.add(changeId);
+                }
+                final CompatibilityChangeConfig overrides =
+                        new CompatibilityChangeConfig(new ChangeConfig(enabled, disabled));
+                getPlatformCompat().setOverrides(overrides, mSelectedApp);
+            } catch (RemoteException e) {
+                e.printStackTrace();
+                return false;
+            }
+            return true;
+        }
+    }
+}
diff --git a/src/com/android/settings/display/DarkUIPreferenceController.java b/src/com/android/settings/display/DarkUIPreferenceController.java
index b85511d..7e550d7 100644
--- a/src/com/android/settings/display/DarkUIPreferenceController.java
+++ b/src/com/android/settings/display/DarkUIPreferenceController.java
@@ -21,6 +21,7 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.content.res.Configuration;
 import android.os.PowerManager;
 import android.provider.Settings;
 
@@ -28,10 +29,10 @@
 import androidx.fragment.app.Fragment;
 import androidx.preference.Preference;
 import androidx.preference.PreferenceScreen;
-import androidx.preference.SwitchPreference;
 
 import com.android.settings.R;
 import com.android.settings.core.TogglePreferenceController;
+import com.android.settings.display.darkmode.DarkModePreference;
 import com.android.settingslib.core.lifecycle.LifecycleObserver;
 import com.android.settingslib.core.lifecycle.events.OnStart;
 import com.android.settingslib.core.lifecycle.events.OnStop;
@@ -44,7 +45,7 @@
     public static final int DIALOG_SEEN = 1;
 
     @VisibleForTesting
-    SwitchPreference mPreference;
+    Preference mPreference;
 
     private UiModeManager mUiModeManager;
     private PowerManager mPowerManager;
@@ -68,7 +69,8 @@
 
     @Override
     public boolean isChecked() {
-        return mUiModeManager.getNightMode() == UiModeManager.MODE_NIGHT_YES;
+         return (mContext.getResources().getConfiguration().uiMode
+                 & Configuration.UI_MODE_NIGHT_YES) != 0;
     }
 
     @Override
@@ -92,10 +94,7 @@
             showDarkModeDialog();
             return false;
         }
-        mUiModeManager.setNightMode(isChecked
-                ? UiModeManager.MODE_NIGHT_YES
-                : UiModeManager.MODE_NIGHT_NO);
-        return true;
+        return mUiModeManager.setNightModeActivated(isChecked);
     }
 
     private void showDarkModeDialog() {
@@ -113,12 +112,10 @@
         boolean isBatterySaver = isPowerSaveMode();
         mPreference.setEnabled(!isBatterySaver);
         if (isBatterySaver) {
-            int stringId = mUiModeManager.getNightMode() == UiModeManager.MODE_NIGHT_YES
+            int stringId = isChecked()
                     ? R.string.dark_ui_mode_disabled_summary_dark_theme_on
                     : R.string.dark_ui_mode_disabled_summary_dark_theme_off;
             mPreference.setSummary(mContext.getString(stringId));
-        } else {
-            mPreference.setSummary(null);
         }
     }
 
@@ -127,22 +124,17 @@
         return mPowerManager.isPowerSaveMode();
     }
 
-
-    @VisibleForTesting
-    void setUiModeManager(UiModeManager uiModeManager) {
-        mUiModeManager = uiModeManager;
-    }
-
-    public void setParentFragment(Fragment fragment) {
-        mFragment = fragment;
-    }
-
     @Override
     public void onStart() {
         mContext.registerReceiver(mReceiver,
                 new IntentFilter(PowerManager.ACTION_POWER_SAVE_MODE_CHANGED));
     }
 
+    // used by AccessibilitySettings
+    public void setParentFragment(Fragment fragment) {
+        mFragment = fragment;
+    }
+
     @Override
     public void onStop() {
         mContext.unregisterReceiver(mReceiver);
diff --git a/src/com/android/settings/display/NightDisplayActivationPreferenceController.java b/src/com/android/settings/display/NightDisplayActivationPreferenceController.java
index 5bb70fc..df81ee7 100644
--- a/src/com/android/settings/display/NightDisplayActivationPreferenceController.java
+++ b/src/com/android/settings/display/NightDisplayActivationPreferenceController.java
@@ -126,10 +126,12 @@
             mTurnOnButton.setVisibility(View.GONE);
             mTurnOffButton.setVisibility(View.VISIBLE);
             mTurnOffButton.setText(buttonText);
+            mTurnOffButton.requestFocus();
         } else {
             mTurnOnButton.setVisibility(View.VISIBLE);
             mTurnOffButton.setVisibility(View.GONE);
             mTurnOnButton.setText(buttonText);
+            mTurnOnButton.requestFocus();
         }
     }
 }
diff --git a/src/com/android/settings/display/darkmode/DarkModeActivationPreferenceController.java b/src/com/android/settings/display/darkmode/DarkModeActivationPreferenceController.java
new file mode 100644
index 0000000..98d4b14
--- /dev/null
+++ b/src/com/android/settings/display/darkmode/DarkModeActivationPreferenceController.java
@@ -0,0 +1,115 @@
+/*
+ * 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.display.darkmode;
+
+import android.app.UiModeManager;
+import android.content.Context;
+import android.content.res.Configuration;
+import android.view.View;
+import android.widget.Button;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceScreen;
+import com.android.settings.R;
+import com.android.settings.core.BasePreferenceController;
+import com.android.settingslib.widget.LayoutPreference;
+
+/**
+ * Controller for activate/deactivate night mode button
+ */
+public class DarkModeActivationPreferenceController extends BasePreferenceController {
+    private final UiModeManager mUiModeManager;
+    private Button mTurnOffButton;
+    private Button mTurnOnButton;
+
+    public DarkModeActivationPreferenceController(Context context,
+            String preferenceKey) {
+        super(context, preferenceKey);
+
+        mUiModeManager = context.getSystemService(UiModeManager.class);
+    }
+
+    @Override
+    public final void updateState(Preference preference) {
+        final boolean active = (mContext.getResources().getConfiguration().uiMode
+                & Configuration.UI_MODE_NIGHT_YES) != 0;
+        updateNightMode(active);
+    }
+
+    private void updateNightMode(boolean active) {
+        final int autoMode = mUiModeManager.getNightMode();
+        String buttonText;
+
+        if (autoMode == UiModeManager.MODE_NIGHT_AUTO) {
+            buttonText = mContext.getString(active
+                    ? R.string.dark_ui_activation_off_auto
+                    : R.string.dark_ui_activation_on_auto);
+        } else {
+            buttonText = mContext.getString(active
+                    ? R.string.dark_ui_activation_off_manual
+                    : R.string.dark_ui_activation_on_manual);
+        }
+        if (active) {
+            mTurnOnButton.setVisibility(View.GONE);
+            mTurnOffButton.setVisibility(View.VISIBLE);
+            mTurnOffButton.setText(buttonText);
+        } else {
+            mTurnOnButton.setVisibility(View.VISIBLE);
+            mTurnOffButton.setVisibility(View.GONE);
+            mTurnOnButton.setText(buttonText);
+        }
+    }
+
+    @Override
+    public CharSequence getSummary() {
+        final boolean isActivated = (mContext.getResources().getConfiguration().uiMode
+                & Configuration.UI_MODE_NIGHT_YES) != 0;
+        final int autoMode = mUiModeManager.getNightMode();
+        if (autoMode == UiModeManager.MODE_NIGHT_AUTO) {
+            return mContext.getString(isActivated
+                    ? R.string.dark_ui_summary_on_auto_mode_auto
+                    : R.string.dark_ui_summary_off_auto_mode_auto);
+        } else {
+            return mContext.getString(isActivated
+                    ? R.string.dark_ui_summary_on_auto_mode_never
+                    : R.string.dark_ui_summary_off_auto_mode_never);
+        }
+    }
+
+    private final View.OnClickListener mListener = new View.OnClickListener() {
+        @Override
+        public void onClick(View v) {
+            final boolean active = (mContext.getResources().getConfiguration().uiMode
+                    & Configuration.UI_MODE_NIGHT_YES) != 0;
+            mUiModeManager.setNightModeActivated(!active);
+            updateNightMode(!active);
+        }
+    };
+
+    @Override
+    public void displayPreference(PreferenceScreen screen) {
+        super.displayPreference(screen);
+
+        final LayoutPreference preference = screen.findPreference(getPreferenceKey());
+        mTurnOnButton = preference.findViewById(R.id.dark_ui_turn_on_button);
+        mTurnOnButton.setOnClickListener(mListener);
+        mTurnOffButton = preference.findViewById(R.id.dark_ui_turn_off_button);
+        mTurnOffButton.setOnClickListener(mListener);
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return AVAILABLE;
+    }
+}
diff --git a/src/com/android/settings/display/darkmode/DarkModeObserver.java b/src/com/android/settings/display/darkmode/DarkModeObserver.java
new file mode 100644
index 0000000..1c076f7
--- /dev/null
+++ b/src/com/android/settings/display/darkmode/DarkModeObserver.java
@@ -0,0 +1,80 @@
+/*
+ * 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.display.darkmode;
+
+import android.content.Context;
+import android.database.ContentObserver;
+import android.net.Uri;
+import android.os.Handler;
+import android.os.Looper;
+import android.provider.Settings;
+import com.android.internal.annotations.VisibleForTesting;
+
+/**
+ * Observes changes for dark night settings*/
+public class DarkModeObserver {
+    private ContentObserver mContentObserver;
+    private Runnable mCallback;
+    private Context mContext;
+
+    public DarkModeObserver(Context context) {
+        mContext = context;
+        mContentObserver = new ContentObserver(new Handler(Looper.getMainLooper())) {
+            @Override
+            public void onChange(boolean selfChange, Uri uri) {
+                super.onChange(selfChange, uri);
+                final String setting = uri == null ? null : uri.getLastPathSegment();
+                if (setting != null && mCallback != null) {
+                    switch (setting) {
+                        case Settings.Secure.UI_NIGHT_MODE:
+                            mCallback.run();
+                            break;
+                        default:
+                    }
+                }
+            }
+        };
+    }
+
+    /**
+     * subscribe callback when night mode changed in the database
+     *
+     * @param callback the callback that gets triggered when subscribed
+     */
+    public void subscribe(Runnable callback) {
+        callback.run();
+        mCallback = callback;
+        final Uri uri = Settings.Secure.getUriFor(Settings.Secure.UI_NIGHT_MODE);
+        mContext.getContentResolver().registerContentObserver(uri, false, mContentObserver);
+    }
+
+    /**
+     * unsubscribe from dark ui database changes
+     */
+    public void unsubscribe() {
+        mContext.getContentResolver().unregisterContentObserver(mContentObserver);
+        mCallback = null;
+    }
+
+    @VisibleForTesting
+    protected void setContentObserver(ContentObserver co) {
+        mContentObserver = co;
+    }
+
+    @VisibleForTesting
+    protected ContentObserver getContentObserver() {
+        return mContentObserver;
+    }
+}
diff --git a/src/com/android/settings/display/darkmode/DarkModePreference.java b/src/com/android/settings/display/darkmode/DarkModePreference.java
new file mode 100644
index 0000000..2a8909f
--- /dev/null
+++ b/src/com/android/settings/display/darkmode/DarkModePreference.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package com.android.settings.display.darkmode;
+
+import android.app.UiModeManager;
+import android.content.Context;
+import android.content.res.Configuration;
+import android.util.AttributeSet;
+import com.android.settings.R;
+import com.android.settings.widget.MasterSwitchPreference;
+
+/**
+ * component for the display settings dark ui summary*/
+public class DarkModePreference extends MasterSwitchPreference {
+
+    private UiModeManager mUiModeManager;
+    private DarkModeObserver mDarkModeObserver;
+    private Runnable mCallback;
+
+    public DarkModePreference(Context context, AttributeSet attrs) {
+        super(context, attrs);
+        mDarkModeObserver = new DarkModeObserver(context);
+        mUiModeManager = context.getSystemService(UiModeManager.class);
+        mCallback = () -> {
+            updateSummary();
+        };
+        mDarkModeObserver.subscribe(mCallback);
+    }
+
+    @Override
+    public void onAttached() {
+        super.onAttached();
+        mDarkModeObserver.subscribe(mCallback);
+    }
+
+    @Override
+    public void onDetached() {
+        super.onDetached();
+        mDarkModeObserver.unsubscribe();
+    }
+
+    private void updateSummary() {
+        final boolean active = (getContext().getResources().getConfiguration().uiMode
+                & Configuration.UI_MODE_NIGHT_YES) != 0;
+        final boolean auto = mUiModeManager.getNightMode() == UiModeManager.MODE_NIGHT_AUTO;
+
+        String detail;
+        if (active) {
+            detail = getContext().getString(auto
+                    ? R.string.dark_ui_summary_on_auto_mode_auto
+                    : R.string.dark_ui_summary_on_auto_mode_never);
+        } else {
+            detail = getContext().getString(auto
+                    ? R.string.dark_ui_summary_off_auto_mode_auto
+                    : R.string.dark_ui_summary_off_auto_mode_never);
+        }
+        String summary = getContext().getString(active
+                ? R.string.dark_ui_summary_on
+                : R.string.dark_ui_summary_off, detail);
+
+        setSummary(summary);
+    }
+}
diff --git a/src/com/android/settings/display/darkmode/DarkModeScheduleSelectorController.java b/src/com/android/settings/display/darkmode/DarkModeScheduleSelectorController.java
new file mode 100644
index 0000000..ab7ea92
--- /dev/null
+++ b/src/com/android/settings/display/darkmode/DarkModeScheduleSelectorController.java
@@ -0,0 +1,82 @@
+/*
+ * 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.display.darkmode;
+
+import android.app.UiModeManager;
+import android.content.Context;
+import android.content.res.Configuration;
+import androidx.preference.DropDownPreference;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceScreen;
+import com.android.settings.R;
+import com.android.settings.core.BasePreferenceController;
+
+/**
+ * Controller for the dark ui option dropdown
+ */
+public class DarkModeScheduleSelectorController extends BasePreferenceController
+        implements Preference.OnPreferenceChangeListener {
+
+    private final UiModeManager mUiModeManager;
+    private boolean mPreferenceSet = false;
+    private DropDownPreference mPreference;
+    private String mCurrentMode;
+
+    public DarkModeScheduleSelectorController(Context context, String key) {
+        super(context, key);
+        mUiModeManager = context.getSystemService(UiModeManager.class);
+    }
+
+    @Override
+    public void displayPreference(PreferenceScreen screen) {
+        super.displayPreference(screen);
+
+        mPreference = screen.findPreference(getPreferenceKey());
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return BasePreferenceController.AVAILABLE;
+    }
+
+    @Override
+    public final void updateState(Preference preference) {
+        mCurrentMode =
+                mUiModeManager.getNightMode() == UiModeManager.MODE_NIGHT_AUTO
+                ? mContext.getString(R.string.dark_ui_auto_mode_auto)
+                : mContext.getString(R.string.dark_ui_auto_mode_never);
+        mPreference.setValue(mCurrentMode);
+    }
+    @Override
+    public final boolean onPreferenceChange(Preference preference, Object newValue) {
+        String newMode = (String) newValue;
+        if (newMode == mCurrentMode) {
+            return false;
+        }
+        mCurrentMode = newMode;
+        if (mCurrentMode == mContext.getString(R.string.dark_ui_auto_mode_never)) {
+            boolean active = (mContext.getResources().getConfiguration().uiMode
+                    & Configuration.UI_MODE_NIGHT_YES) != 0;
+            int mode = active ? UiModeManager.MODE_NIGHT_YES
+                    : UiModeManager.MODE_NIGHT_NO;
+            mUiModeManager.setNightMode(mode);
+
+        } else if (mCurrentMode ==
+                mContext.getString(R.string.dark_ui_auto_mode_auto)) {
+            mUiModeManager.setNightMode(UiModeManager.MODE_NIGHT_AUTO);
+        }
+        return true;
+    }
+}
diff --git a/src/com/android/settings/display/darkmode/DarkModeSettingsFragment.java b/src/com/android/settings/display/darkmode/DarkModeSettingsFragment.java
new file mode 100644
index 0000000..6293316
--- /dev/null
+++ b/src/com/android/settings/display/darkmode/DarkModeSettingsFragment.java
@@ -0,0 +1,81 @@
+/*
+ * 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.display.darkmode;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.app.settings.SettingsEnums;
+import com.android.settings.R;
+import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.search.SearchIndexable;
+
+/**
+ * Settings screen for Dark UI Mode
+ */
+@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
+public class DarkModeSettingsFragment extends DashboardFragment {
+
+    private static final String TAG = "DarkModeSettingsFragment";
+    private DarkModeObserver mContentObserver;
+    private Runnable mCallback = () -> {
+        updatePreferenceStates();
+    };
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        final Context context = getContext();
+        mContentObserver = new DarkModeObserver(context);
+    }
+
+    @Override
+    public void onStart() {
+        super.onStart();
+        // Listen for changes only while visible.
+        mContentObserver.subscribe(mCallback);
+    }
+
+    @Override
+    public void onStop() {
+        super.onStop();
+        // Stop listening for state changes.
+        mContentObserver.unsubscribe();
+    }
+
+    @Override
+    protected int getPreferenceScreenResId() {
+        return R.xml.dark_mode_settings;
+    }
+
+    @Override
+    public int getHelpResource() {
+        return R.string.help_url_dark_theme;
+    }
+
+    @Override
+    protected String getLogTag() {
+        return TAG;
+    }
+
+    @Override
+    public int getMetricsCategory() {
+        return SettingsEnums.DARK_UI_SETTINGS;
+    }
+
+    public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+            new BaseSearchIndexProvider(R.xml.dark_mode_settings);
+}
diff --git a/src/com/android/settings/location/RecentLocationRequestSeeAllPreferenceController.java b/src/com/android/settings/location/RecentLocationRequestSeeAllPreferenceController.java
index 012cb8b..4ed9d13 100644
--- a/src/com/android/settings/location/RecentLocationRequestSeeAllPreferenceController.java
+++ b/src/com/android/settings/location/RecentLocationRequestSeeAllPreferenceController.java
@@ -19,7 +19,6 @@
 
 import androidx.annotation.VisibleForTesting;
 import androidx.preference.Preference;
-import androidx.preference.PreferenceCategory;
 import androidx.preference.PreferenceScreen;
 
 import com.android.settings.R;
@@ -32,7 +31,7 @@
 public class RecentLocationRequestSeeAllPreferenceController
         extends LocationBasePreferenceController {
 
-    private PreferenceCategory mCategoryAllRecentLocationRequests;
+    private PreferenceScreen mCategoryAllRecentLocationRequests;
     private RecentLocationApps mRecentLocationApps;
     private boolean mShowSystem = false;
     private Preference mPreference;
diff --git a/src/com/android/settings/notification/ZenModeButtonPreferenceController.java b/src/com/android/settings/notification/ZenModeButtonPreferenceController.java
index 3a9bcb7..a8d03ea 100644
--- a/src/com/android/settings/notification/ZenModeButtonPreferenceController.java
+++ b/src/com/android/settings/notification/ZenModeButtonPreferenceController.java
@@ -63,6 +63,7 @@
         if (null == mZenButtonOn) {
             mZenButtonOn = ((LayoutPreference) preference)
                     .findViewById(R.id.zen_mode_settings_turn_on_button);
+            mZenButtonOn.setFocusableInTouchMode(true);
             updateZenButtonOnClickListener();
         }
 
@@ -86,12 +87,14 @@
             case Settings.Global.ZEN_MODE_NO_INTERRUPTIONS:
                 mZenButtonOff.setVisibility(View.VISIBLE);
                 mZenButtonOn.setVisibility(View.GONE);
+                mZenButtonOff.requestFocus();
                 break;
             case Settings.Global.ZEN_MODE_OFF:
             default:
                 mZenButtonOff.setVisibility(View.GONE);
                 updateZenButtonOnClickListener();
                 mZenButtonOn.setVisibility(View.VISIBLE);
+                mZenButtonOn.requestFocus();
         }
     }
 
diff --git a/src/com/android/settings/search/SettingsSearchIndexablesProvider.java b/src/com/android/settings/search/SettingsSearchIndexablesProvider.java
index d504d9b..237e58f 100644
--- a/src/com/android/settings/search/SettingsSearchIndexablesProvider.java
+++ b/src/com/android/settings/search/SettingsSearchIndexablesProvider.java
@@ -61,10 +61,12 @@
 import androidx.annotation.Nullable;
 import androidx.slice.SliceViewManager;
 
+import com.android.settings.R;
 import com.android.settings.SettingsActivity;
 import com.android.settings.dashboard.DashboardFeatureProvider;
 import com.android.settings.overlay.FeatureFactory;
 import com.android.settings.slices.SettingsSliceProvider;
+import com.android.settingslib.drawer.ActivityTile;
 import com.android.settingslib.drawer.DashboardCategory;
 import com.android.settingslib.drawer.Tile;
 import com.android.settingslib.search.Indexable;
@@ -215,11 +217,13 @@
     public Cursor querySliceUriPairs() {
         final SliceViewManager manager = SliceViewManager.getInstance(getContext());
         final MatrixCursor cursor = new MatrixCursor(SLICE_URI_PAIRS_COLUMNS);
-        final Uri baseUri =
-                new Uri.Builder()
+        final String queryUri = getContext().getString(R.string.config_non_public_slice_query_uri);
+        final Uri baseUri = !TextUtils.isEmpty(queryUri) ? Uri.parse(queryUri)
+                : new Uri.Builder()
                         .scheme(ContentResolver.SCHEME_CONTENT)
                         .authority(SettingsSliceProvider.SLICE_AUTHORITY)
                         .build();
+
         final Uri platformBaseUri =
                 new Uri.Builder()
                         .scheme(ContentResolver.SCHEME_CONTENT)
@@ -375,13 +379,19 @@
         final String currentPackageName = context.getPackageName();
         for (DashboardCategory category : dashboardFeatureProvider.getAllCategories()) {
             for (Tile tile : category.getTiles()) {
-                if (currentPackageName.equals(tile.getPackageName())) {
+                if (currentPackageName.equals(tile.getPackageName())
+                        && tile instanceof ActivityTile) {
+                    // Skip Settings injected items because they should be indexed in the sub-pages.
                     continue;
                 }
                 final SearchIndexableRaw raw = new SearchIndexableRaw(context);
+                final CharSequence title = tile.getTitle(context);
+                raw.title = TextUtils.isEmpty(title) ? null : title.toString();
+                if (TextUtils.isEmpty(raw.title)) {
+                    continue;
+                }
                 raw.key = dashboardFeatureProvider.getDashboardKeyForTile(tile);
-                raw.title = tile.getTitle(context).toString();
-                CharSequence summary = tile.getSummary(context);
+                final CharSequence summary = tile.getSummary(context);
                 raw.summaryOn = TextUtils.isEmpty(summary) ? null : summary.toString();
                 raw.summaryOff = raw.summaryOn;
                 raw.className = CATEGORY_KEY_TO_PARENT_MAP.get(tile.getCategory());
diff --git a/src/com/android/settings/slices/SettingsSliceProvider.java b/src/com/android/settings/slices/SettingsSliceProvider.java
index 8a6496f..d908881 100644
--- a/src/com/android/settings/slices/SettingsSliceProvider.java
+++ b/src/com/android/settings/slices/SettingsSliceProvider.java
@@ -20,10 +20,13 @@
 
 import android.app.PendingIntent;
 import android.app.slice.SliceManager;
+import android.content.ContentResolver;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.content.pm.PackageManager;
 import android.net.Uri;
+import android.os.Binder;
 import android.os.StrictMode;
 import android.provider.Settings;
 import android.provider.SettingsSlicesContract;
@@ -265,16 +268,29 @@
     @Override
     public Collection<Uri> onGetSliceDescendants(Uri uri) {
         final List<Uri> descendants = new ArrayList<>();
-        final Pair<Boolean, String> pathData = SliceBuilderUtils.getPathData(uri);
+        Uri finalUri = uri;
+
+        if (isPrivateSlicesNeeded(finalUri)) {
+            descendants.addAll(
+                    mSlicesDatabaseAccessor.getSliceUris(finalUri.getAuthority(),
+                            false /* isPublicSlice */));
+            Log.d(TAG, "provide " + descendants.size() + " non-public slices");
+            finalUri = new Uri.Builder()
+                    .scheme(ContentResolver.SCHEME_CONTENT)
+                    .authority(finalUri.getAuthority())
+                    .build();
+        }
+
+        final Pair<Boolean, String> pathData = SliceBuilderUtils.getPathData(finalUri);
 
         if (pathData != null) {
             // Uri has a full path and will not have any descendants.
-            descendants.add(uri);
+            descendants.add(finalUri);
             return descendants;
         }
 
-        final String authority = uri.getAuthority();
-        final String path = uri.getPath();
+        final String authority = finalUri.getAuthority();
+        final String path = finalUri.getPath();
         final boolean isPathEmpty = path.isEmpty();
 
         // Path is anything but empty, "action", or "intent". Return empty list.
@@ -286,7 +302,7 @@
         }
 
         // Add all descendants from db with matching authority.
-        descendants.addAll(mSlicesDatabaseAccessor.getSliceUris(authority));
+        descendants.addAll(mSlicesDatabaseAccessor.getSliceUris(authority, true /*isPublicSlice*/));
 
         if (isPathEmpty && TextUtils.isEmpty(authority)) {
             // No path nor authority. Return all possible Uris by adding all special slice uri
@@ -404,6 +420,24 @@
         return set;
     }
 
+    @VisibleForTesting
+    boolean isPrivateSlicesNeeded(Uri uri) {
+        final String queryUri = getContext().getString(R.string.config_non_public_slice_query_uri);
+
+        if (!TextUtils.isEmpty(queryUri) && TextUtils.equals(uri.toString(), queryUri)) {
+            // check if the calling package is eligible for private slices
+            final int callingUid = Binder.getCallingUid();
+            final boolean hasPermission = getContext().checkPermission(
+                    android.Manifest.permission.READ_SEARCH_INDEXABLES, Binder.getCallingPid(),
+                    callingUid) == PackageManager.PERMISSION_GRANTED;
+            final String callingPackage = getContext().getPackageManager()
+                    .getPackagesForUid(callingUid)[0];
+            return hasPermission && TextUtils.equals(callingPackage,
+                    getContext().getString(R.string.config_settingsintelligence_package_name));
+        }
+        return false;
+    }
+
     private void startBackgroundWorker(Sliceable sliceable, Uri uri) {
         final Class workerClass = sliceable.getBackgroundWorkerClass();
         if (workerClass == null) {
diff --git a/src/com/android/settings/slices/SlicesDatabaseAccessor.java b/src/com/android/settings/slices/SlicesDatabaseAccessor.java
index 4ae9a4c..e31715d 100644
--- a/src/com/android/settings/slices/SlicesDatabaseAccessor.java
+++ b/src/com/android/settings/slices/SlicesDatabaseAccessor.java
@@ -88,16 +88,18 @@
     }
 
     /**
-     * @return a list of Slice {@link Uri}s matching {@param authority}.
+     * @return a list of Slice {@link Uri}s based on their visibility {@param isPublicSlice } and
+     * {@param authority}.
      */
-    public List<Uri> getSliceUris(String authority) {
+    public List<Uri> getSliceUris(String authority, boolean isPublicSlice) {
         verifyIndexing();
         final List<Uri> uris = new ArrayList<>();
+        final String whereClause = IndexColumns.PUBLIC_SLICE + (isPublicSlice ? "=1" : "=0");
         final SQLiteDatabase database = mHelper.getReadableDatabase();
         final String[] columns = new String[]{IndexColumns.SLICE_URI};
-        try (final Cursor resultCursor = database.query(TABLE_SLICES_INDEX, columns,
-                null /* where */, null /* selection */, null /* groupBy */, null /* having */,
-                null /* orderBy */)) {
+        try (Cursor resultCursor = database.query(TABLE_SLICES_INDEX, columns,
+                whereClause /* where */, null /* selection */, null /* groupBy */,
+                null /* having */, null /* orderBy */)) {
             if (!resultCursor.moveToFirst()) {
                 return uris;
             }
diff --git a/src/com/android/settings/widget/VideoPreferenceController.java b/src/com/android/settings/widget/VideoPreferenceController.java
index 5f30fe4..4d7fc40 100644
--- a/src/com/android/settings/widget/VideoPreferenceController.java
+++ b/src/com/android/settings/widget/VideoPreferenceController.java
@@ -36,7 +36,7 @@
 
     @Override
     public int getAvailabilityStatus() {
-        return mVideoPreference.isAnimationAvailable() ?
+        return mVideoPreference != null && mVideoPreference.isAnimationAvailable() ?
                 AVAILABLE_UNSEARCHABLE : UNSUPPORTED_ON_DEVICE;
     }
 
diff --git a/src/com/android/settings/wifi/calling/WifiCallingSettingsForSub.java b/src/com/android/settings/wifi/calling/WifiCallingSettingsForSub.java
index 11be7c3..8447fcf 100644
--- a/src/com/android/settings/wifi/calling/WifiCallingSettingsForSub.java
+++ b/src/com/android/settings/wifi/calling/WifiCallingSettingsForSub.java
@@ -116,8 +116,9 @@
             final boolean isNonTtyOrTtyOnVolteEnabled = mImsManager.isNonTtyOrTtyOnVolteEnabled();
             final boolean isWfcEnabled = mSwitchBar.isChecked()
                     && isNonTtyOrTtyOnVolteEnabled;
-
-            mSwitchBar.setEnabled((state == TelephonyManager.CALL_STATE_IDLE)
+            boolean isCallStateIdle =
+                    mTelephonyManager.getCallState() == TelephonyManager.CALL_STATE_IDLE;
+            mSwitchBar.setEnabled(isCallStateIdle
                     && isNonTtyOrTtyOnVolteEnabled);
 
             boolean isWfcModeEditable = true;
@@ -138,13 +139,13 @@
             final Preference pref = getPreferenceScreen().findPreference(BUTTON_WFC_MODE);
             if (pref != null) {
                 pref.setEnabled(isWfcEnabled && isWfcModeEditable
-                        && (state == TelephonyManager.CALL_STATE_IDLE));
+                        && isCallStateIdle);
             }
             final Preference pref_roam =
                     getPreferenceScreen().findPreference(BUTTON_WFC_ROAMING_MODE);
             if (pref_roam != null) {
                 pref_roam.setEnabled(isWfcEnabled && isWfcRoamingModeEditable
-                        && (state == TelephonyManager.CALL_STATE_IDLE));
+                        && isCallStateIdle);
             }
         }
     };
@@ -271,8 +272,7 @@
         mImsManager = getImsManager();
         mImsMmTelManager = getImsMmTelManager();
 
-        mTelephonyManager = ((TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE))
-                .createForSubscriptionId(mSubId);
+        mTelephonyManager = ((TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE));
 
         mButtonWfcMode = findPreference(BUTTON_WFC_MODE);
         mButtonWfcMode.setOnPreferenceChangeListener(this);
@@ -406,9 +406,7 @@
         if (mValidListener) {
             mValidListener = false;
 
-            final TelephonyManager tm = (TelephonyManager)
-                    getSystemService(Context.TELEPHONY_SERVICE);
-            tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
+            mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
 
             mSwitchBar.removeOnSwitchChangeListener(this);
         }
diff --git a/tests/robotests/Android.bp b/tests/robotests/Android.bp
index 653f074..a825c32 100644
--- a/tests/robotests/Android.bp
+++ b/tests/robotests/Android.bp
@@ -62,7 +62,7 @@
 
     static_libs: [
         "SettingsLib-robo-testutils",
-	"app-compat-annotations",
+	"android-support-annotations",
     ],
 
     java_resource_dirs: ["config", "resources"],
diff --git a/tests/robotests/assets/grandfather_not_implementing_index_provider b/tests/robotests/assets/grandfather_not_implementing_index_provider
index 7b80645..db4b1e9 100644
--- a/tests/robotests/assets/grandfather_not_implementing_index_provider
+++ b/tests/robotests/assets/grandfather_not_implementing_index_provider
@@ -37,6 +37,7 @@
 com.android.settings.datausage.DataUsageList
 com.android.settings.datausage.DataUsageSummary
 com.android.settings.datetime.timezone.TimeZoneSettings
+com.android.settings.development.compat.PlatformCompatDashboard
 com.android.settings.deviceinfo.PrivateVolumeSettings
 com.android.settings.deviceinfo.PublicVolumeSettings
 com.android.settings.deviceinfo.StorageProfileFragment
diff --git a/tests/robotests/res/values-mcc999/config.xml b/tests/robotests/res/values-mcc999/config.xml
index 679062b..dc638a5 100644
--- a/tests/robotests/res/values-mcc999/config.xml
+++ b/tests/robotests/res/values-mcc999/config.xml
@@ -94,4 +94,7 @@
         <item>injected_tile_key</item>
         <item>injected_tile_key2</item>
     </string-array>
+
+    <!-- Uri to query non-public Slice Uris. -->
+    <string name="config_non_public_slice_query_uri" translatable="false">content://com.android.settings.slices/test</string>
 </resources>
diff --git a/tests/robotests/src/com/android/settings/dashboard/ControllerFutureTaskTest.java b/tests/robotests/src/com/android/settings/dashboard/ControllerFutureTaskTest.java
new file mode 100644
index 0000000..c66f2b5
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/dashboard/ControllerFutureTaskTest.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.settings.dashboard;
+
+import static com.android.settingslib.core.instrumentation.Instrumentable.METRICS_CATEGORY_UNKNOWN;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+
+import androidx.preference.PreferenceManager;
+import androidx.preference.PreferenceScreen;
+
+import com.android.settings.core.BasePreferenceController;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public class ControllerFutureTaskTest {
+    private static final String KEY = "my_key";
+
+    private Context mContext;
+    private TestPreferenceController mTestController;
+    private PreferenceScreen mScreen;
+
+    @Before
+    public void setUp() {
+        mContext = RuntimeEnvironment.application;
+        mTestController = new TestPreferenceController(mContext, KEY);
+        final PreferenceManager preferenceManager = new PreferenceManager(mContext);
+        mScreen = preferenceManager.createPreferenceScreen(mContext);
+    }
+
+    @Test
+    public void getController_addTask_checkControllerKey() {
+        final ControllerFutureTask futureTask = new ControllerFutureTask(
+                new ControllerTask(mTestController, mScreen, null /* metricsFeature */,
+                        METRICS_CATEGORY_UNKNOWN), null /* result */);
+
+        assertThat(futureTask.getController().getPreferenceKey()).isEqualTo(KEY);
+    }
+
+
+    static class TestPreferenceController extends BasePreferenceController {
+        TestPreferenceController(Context context, String preferenceKey) {
+            super(context, preferenceKey);
+        }
+
+        @Override
+        public int getAvailabilityStatus() {
+            return AVAILABLE;
+        }
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/dashboard/ControllerTaskTest.java b/tests/robotests/src/com/android/settings/dashboard/ControllerTaskTest.java
new file mode 100644
index 0000000..17ab79c
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/dashboard/ControllerTaskTest.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.dashboard;
+
+import static com.android.settingslib.core.instrumentation.Instrumentable.METRICS_CATEGORY_UNKNOWN;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+
+import android.content.Context;
+
+import androidx.preference.Preference;
+import androidx.preference.PreferenceManager;
+import androidx.preference.PreferenceScreen;
+
+import com.android.settingslib.core.AbstractPreferenceController;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public class ControllerTaskTest {
+    private static final String KEY = "my_key";
+
+    private Context mContext;
+    private PreferenceScreen mScreen;
+    private TestPreferenceController mTestController;
+    private ControllerTask mControllerTask;
+
+    @Before
+    public void setUp() {
+        mContext = RuntimeEnvironment.application;
+        final PreferenceManager preferenceManager = new PreferenceManager(mContext);
+        mScreen = preferenceManager.createPreferenceScreen(mContext);
+        mTestController = spy(new TestPreferenceController(mContext));
+        mControllerTask = new ControllerTask(mTestController, mScreen, null /* metricsFeature */,
+                METRICS_CATEGORY_UNKNOWN);
+    }
+
+    @Test
+    public void doRun_controlNotAvailable_noRunUpdateState() {
+        mTestController.setAvailable(false);
+
+        mControllerTask.run();
+
+        verify(mTestController, never()).updateState(any(Preference.class));
+    }
+
+    @Test
+    public void doRun_emptyKey_noRunUpdateState() {
+        mTestController.setKey("");
+
+        mControllerTask.run();
+
+        verify(mTestController, never()).updateState(any(Preference.class));
+    }
+
+    @Test
+    public void doRun_preferenceNotExist_noRunUpdateState() {
+        mTestController.setKey(KEY);
+
+        mControllerTask.run();
+
+        verify(mTestController, never()).updateState(any(Preference.class));
+    }
+
+    @Test
+    public void doRun_executeUpdateState() {
+        mTestController.setKey(KEY);
+        final Preference preference = new Preference(mContext);
+        preference.setKey(KEY);
+        mScreen.addPreference(preference);
+
+        mControllerTask.run();
+
+        verify(mTestController).updateState(any(Preference.class));
+    }
+
+    static class TestPreferenceController extends AbstractPreferenceController {
+        private boolean mAvailable;
+        private String mKey;
+
+        TestPreferenceController(Context context) {
+            super(context);
+            mAvailable = true;
+        }
+
+        @Override
+        public boolean isAvailable() {
+            return mAvailable;
+        }
+
+        @Override
+        public String getPreferenceKey() {
+            return mKey;
+        }
+
+        void setAvailable(boolean available) {
+            mAvailable = available;
+        }
+
+        void setKey(String key) {
+            mKey = key;
+        }
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentTest.java b/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentTest.java
index 42b600a..e70578e 100644
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentTest.java
@@ -37,6 +37,7 @@
 import android.content.pm.ProviderInfo;
 import android.net.Uri;
 import android.os.Bundle;
+import android.util.FeatureFlagUtils;
 
 import androidx.preference.Preference;
 import androidx.preference.PreferenceFragmentCompat;
@@ -45,6 +46,7 @@
 import androidx.preference.SwitchPreference;
 
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
+import com.android.settings.core.FeatureFlags;
 import com.android.settings.core.PreferenceControllerMixin;
 import com.android.settings.slices.BlockingSlicePrefController;
 import com.android.settings.testutils.FakeFeatureFactory;
@@ -333,7 +335,38 @@
         assertThat(pref).isInstanceOf(MasterSwitchPreference.class);
     }
 
-    private static class TestPreferenceController extends AbstractPreferenceController
+    @Test
+    public void isFeatureFlagAndIsParalleled_runParalleledUpdatePreferenceStates() {
+        FeatureFlagUtils.setEnabled(mContext, FeatureFlags.CONTROLLER_ENHANCEMENT, true);
+        final TestFragment testFragment = spy(new TestFragment(RuntimeEnvironment.application));
+
+        testFragment.updatePreferenceStates();
+
+        verify(testFragment).updatePreferenceStatesInParallel();
+    }
+
+    @Test
+    public void notFeatureFlagAndIsParalleled_notRunParalleledUpdatePreferenceStates() {
+        FeatureFlagUtils.setEnabled(mContext, FeatureFlags.CONTROLLER_ENHANCEMENT, false);
+        final TestFragment testFragment = spy(new TestFragment(RuntimeEnvironment.application));
+
+        testFragment.updatePreferenceStates();
+
+        verify(testFragment, never()).updatePreferenceStatesInParallel();
+    }
+
+    @Test
+    public void isFeatureFlagAndNotParalleled_notRunParalleledUpdatePreferenceStates() {
+        FeatureFlagUtils.setEnabled(mContext, FeatureFlags.CONTROLLER_ENHANCEMENT, true);
+        final TestFragment testFragment = spy(new TestFragment(RuntimeEnvironment.application));
+        testFragment.setUsingControllerEnhancement(false);
+
+        testFragment.updatePreferenceStates();
+
+        verify(testFragment, never()).updatePreferenceStatesInParallel();
+    }
+
+    public static class TestPreferenceController extends AbstractPreferenceController
             implements PreferenceControllerMixin {
 
         private TestPreferenceController(Context context) {
@@ -362,19 +395,21 @@
 
     private static class TestFragment extends DashboardFragment {
 
-        public final PreferenceScreen mScreen;
-
         private final PreferenceManager mPreferenceManager;
         private final Context mContext;
         private final List<AbstractPreferenceController> mControllers;
         private final ContentResolver mContentResolver;
 
+        public final PreferenceScreen mScreen;
+        private boolean mIsParalleled;
+
         public TestFragment(Context context) {
             mContext = context;
             mPreferenceManager = mock(PreferenceManager.class);
             mScreen = mock(PreferenceScreen.class);
             mContentResolver = mock(ContentResolver.class);
             mControllers = new ArrayList<>();
+            mIsParalleled = true;
 
             when(mPreferenceManager.getContext()).thenReturn(mContext);
             ReflectionHelpers.setField(
@@ -420,6 +455,14 @@
         protected ContentResolver getContentResolver() {
             return mContentResolver;
         }
+
+        protected boolean isParalleledControllers() {
+            return mIsParalleled;
+        }
+
+        public void setUsingControllerEnhancement(boolean isParalleled) {
+            mIsParalleled = isParalleled;
+        }
     }
 
     private static class TestDynamicDataObserver extends DynamicDataObserver {
diff --git a/tests/robotests/src/com/android/settings/datetime/DatePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/datetime/DatePreferenceControllerTest.java
index e0770aa..f4d4666 100644
--- a/tests/robotests/src/com/android/settings/datetime/DatePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/datetime/DatePreferenceControllerTest.java
@@ -21,7 +21,7 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import android.app.AlarmManager;
+import android.app.timedetector.TimeDetector;
 import android.content.Context;
 
 import com.android.settingslib.RestrictedPreference;
@@ -40,7 +40,7 @@
     @Mock
     private Context mContext;
     @Mock
-    private AlarmManager mAlarmManager;
+    private TimeDetector mTimeDetector;
     @Mock
     private DatePreferenceController.DatePreferenceHost mHost;
     @Mock
@@ -52,7 +52,7 @@
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
-        when(mContext.getSystemService(Context.ALARM_SERVICE)).thenReturn(mAlarmManager);
+        when(mContext.getSystemService(TimeDetector.class)).thenReturn(mTimeDetector);
         mPreference = new RestrictedPreference(RuntimeEnvironment.application);
         mController = new DatePreferenceController(mContext, mHost, mAutoTimePreferenceController);
     }
diff --git a/tests/robotests/src/com/android/settings/development/VerifyAppsOverUsbPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/VerifyAppsOverUsbPreferenceControllerTest.java
index f0961f1..87b9126 100644
--- a/tests/robotests/src/com/android/settings/development/VerifyAppsOverUsbPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/VerifyAppsOverUsbPreferenceControllerTest.java
@@ -130,17 +130,6 @@
     }
 
     @Test
-    public void updateState_verifierOff_preferenceShouldNotBeChecked() {
-        setupVerifyBroadcastReceivers(true);
-        setupEnforcedAdmin(null);
-        mGlobals.set(Global.ADB_ENABLED, 1 /* setting enabled */)
-                .set(Global.PACKAGE_VERIFIER_INCLUDE_ADB, 1 /* setting enabled */)
-                .set(Global.PACKAGE_VERIFIER_ENABLE, 0 /* setting disabled */);
-        mController.updateState(mPreference);
-        verify(mPreference).setChecked(false);
-    }
-
-    @Test
     public void updateState_noBroadcastReceivers_preferenceShouldNotBeChecked() {
         setupVerifyBroadcastReceivers(false);
         setupEnforcedAdmin(null);
@@ -196,4 +185,4 @@
 
         assertThat(mode).isEqualTo(VerifyAppsOverUsbPreferenceController.SETTING_VALUE_OFF);
     }
-}
\ No newline at end of file
+}
diff --git a/tests/robotests/src/com/android/settings/development/compat/PlatformCompatDashboardTest.java b/tests/robotests/src/com/android/settings/development/compat/PlatformCompatDashboardTest.java
new file mode 100644
index 0000000..d13b927
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/development/compat/PlatformCompatDashboardTest.java
@@ -0,0 +1,176 @@
+/*
+ * Copyright 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.compat;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import android.compat.Compatibility.ChangeConfig;
+import android.content.Context;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.graphics.drawable.Drawable;
+import android.os.RemoteException;
+
+import androidx.preference.Preference;
+import androidx.preference.PreferenceCategory;
+import androidx.preference.PreferenceManager;
+import androidx.preference.PreferenceScreen;
+import androidx.preference.SwitchPreference;
+
+import com.android.internal.compat.CompatibilityChangeConfig;
+import com.android.internal.compat.CompatibilityChangeInfo;
+import com.android.internal.compat.IPlatformCompat;
+import com.android.settings.R;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+@RunWith(RobolectricTestRunner.class)
+public class PlatformCompatDashboardTest {
+    private PlatformCompatDashboard mDashboard;
+
+    @Mock
+    private IPlatformCompat mPlatformCompat;
+    private PreferenceScreen mPreferenceScreen;
+    @Mock
+    private ApplicationInfo mApplicationInfo;
+    @Mock
+    private PreferenceManager mPreferenceManager;
+
+    private Context mContext;
+    private CompatibilityChangeInfo[] mChanges;
+    private static final String APP_NAME = "foo.bar.baz";
+
+    @Before
+    public void setUp() throws RemoteException, NameNotFoundException {
+        MockitoAnnotations.initMocks(this);
+        mChanges = new CompatibilityChangeInfo[5];
+        mChanges[0] = new CompatibilityChangeInfo(1L, "Default_Enabled", 0, false);
+        mChanges[1] = new CompatibilityChangeInfo(2L, "Default_Disabled", 0, true);
+        mChanges[2] = new CompatibilityChangeInfo(3L, "Enabled_After_SDK_1_1", 1, false);
+        mChanges[3] = new CompatibilityChangeInfo(4L, "Enabled_After_SDK_1_2", 1, false);
+        mChanges[4] = new CompatibilityChangeInfo(5L, "Enabled_After_SDK_2", 2, false);
+        when(mPlatformCompat.listAllChanges()).thenReturn(mChanges);
+        mContext = RuntimeEnvironment.application;
+        mPreferenceManager = new PreferenceManager(mContext);
+        mPreferenceScreen = mPreferenceManager.createPreferenceScreen(mContext);
+        mApplicationInfo.packageName = APP_NAME;
+        mDashboard = spy(new PlatformCompatDashboard());
+        mDashboard.mSelectedApp = APP_NAME;
+        doReturn(mApplicationInfo).when(mDashboard).getApplicationInfo();
+        doReturn(mPlatformCompat).when(mDashboard).getPlatformCompat();
+        doReturn(mPreferenceScreen).when(mDashboard).getPreferenceScreen();
+        doReturn(mPreferenceManager).when(mDashboard).getPreferenceManager();
+    }
+
+    @Test
+    public void getHelpResource_shouldNotHaveHelpResource() {
+        assertThat(mDashboard.getHelpResource()).isEqualTo(0);
+    }
+
+    @Test
+    public void getPreferenceScreenResId_shouldBePlatformCompatSettingsResId() {
+        assertThat(mDashboard.getPreferenceScreenResId())
+                .isEqualTo(R.xml.platform_compat_settings);
+    }
+
+    @Test
+    public void createAppPreference_targetSdkEquals1_summaryReturnsAppNameAndTargetSdk() {
+        mApplicationInfo.targetSdkVersion = 1;
+
+        Preference appPreference = mDashboard.createAppPreference(any(Drawable.class));
+
+        assertThat(appPreference.getSummary()).isEqualTo(APP_NAME + " SDK 1");
+    }
+
+    @Test
+    public void createPreferenceForChange_defaultEnabledChange_createCheckedEntry() {
+        CompatibilityChangeInfo enabledChange = mChanges[0];
+        CompatibilityChangeConfig config = new CompatibilityChangeConfig(
+                new ChangeConfig(new HashSet<Long>(Arrays.asList(enabledChange.getId())),
+                        new HashSet<Long>()));
+
+        Preference enabledPreference = mDashboard.createPreferenceForChange(mContext, enabledChange,
+                config);
+
+        SwitchPreference enabledSwitchPreference = (SwitchPreference) enabledPreference;
+
+        assertThat(enabledPreference.getSummary()).isEqualTo(mChanges[0].getName());
+        assertThat(enabledPreference instanceof SwitchPreference).isTrue();
+        assertThat(enabledSwitchPreference.isChecked()).isTrue();
+    }
+
+    @Test
+    public void createPreferenceForChange_defaultDisabledChange_createUncheckedEntry() {
+        CompatibilityChangeInfo disabledChange = mChanges[1];
+        CompatibilityChangeConfig config = new CompatibilityChangeConfig(
+                new ChangeConfig(new HashSet<Long>(),
+                        new HashSet<Long>(Arrays.asList(disabledChange.getId()))));
+
+        Preference disabledPreference = mDashboard.createPreferenceForChange(mContext,
+                disabledChange, config);
+        
+        assertThat(disabledPreference.getSummary()).isEqualTo(mChanges[1].getName());
+        SwitchPreference disabledSwitchPreference = (SwitchPreference) disabledPreference;
+        assertThat(disabledSwitchPreference.isChecked()).isFalse();
+    }
+
+    @Test
+    public void createChangeCategoryPreference_enabledAndDisabled_hasTitleAndEntries() {
+        Set<Long> enabledChanges = new HashSet<>();
+        enabledChanges.add(mChanges[0].getId());
+        enabledChanges.add(mChanges[1].getId());
+        enabledChanges.add(mChanges[2].getId());
+        Set<Long> disabledChanges = new HashSet<>();
+        disabledChanges.add(mChanges[3].getId());
+        disabledChanges.add(mChanges[4].getId());
+        CompatibilityChangeConfig config = new CompatibilityChangeConfig(
+                new ChangeConfig(enabledChanges, disabledChanges));
+        List<CompatibilityChangeInfo> changesToAdd = new ArrayList<>();
+        for (int i = 0; i < mChanges.length; ++i) {
+            changesToAdd.add(new CompatibilityChangeInfo(mChanges[i].getId(), mChanges[i]
+            .getName(),
+                    mChanges[i].getEnableAfterTargetSdk(), mChanges[i].getDisabled()));
+        }
+
+        PreferenceCategory category = mDashboard.createChangeCategoryPreference(changesToAdd,
+        config, "foo");
+
+        assertThat(category.getTitle()).isEqualTo("foo");
+        assertThat(category.getPreferenceCount()).isEqualTo(mChanges.length);
+        for (int i = 0; i < mChanges.length; ++i) {
+            Preference childPreference = category.getPreference(i);
+            assertThat(childPreference instanceof SwitchPreference).isTrue();
+        }
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/display/DarkUIPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/DarkUIPreferenceControllerTest.java
index 3659803..9924cb4 100644
--- a/tests/robotests/src/com/android/settings/display/DarkUIPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/display/DarkUIPreferenceControllerTest.java
@@ -16,25 +16,9 @@
 
 package com.android.settings.display;
 
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.doReturn;
-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.content.Context;
-import android.os.Handler;
-import android.os.IPowerManager;
-import android.os.PowerManager;
-
 import androidx.fragment.app.Fragment;
-import androidx.preference.PreferenceScreen;
-import androidx.preference.SwitchPreference;
-
-import org.junit.Assert;
+import com.android.settings.display.darkmode.DarkModePreference;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -43,6 +27,10 @@
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
 
+import static com.google.common.truth.Truth.assertThat;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
+
 @RunWith(RobolectricTestRunner.class)
 public class DarkUIPreferenceControllerTest {
 
@@ -57,7 +45,7 @@
         mContext = spy(RuntimeEnvironment.application);
         mController = spy(new DarkUIPreferenceController(mContext, "dark_ui_mode"));
         mController.setParentFragment(mFragment);
-        mController.mPreference = new SwitchPreference(mContext);
+        mController.mPreference = new DarkModePreference(mContext, null /* AttributeSet attrs */);
         mController.onStart();
     }
 
diff --git a/tests/robotests/src/com/android/settings/display/darkmode/DarkModeActivationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/darkmode/DarkModeActivationPreferenceControllerTest.java
new file mode 100644
index 0000000..24cbd07
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/display/darkmode/DarkModeActivationPreferenceControllerTest.java
@@ -0,0 +1,155 @@
+/*
+ * 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.display.darkmode;
+
+import android.app.UiModeManager;
+import android.content.Context;
+import android.content.res.Configuration;
+import android.content.res.Resources;
+import android.view.View;
+import android.widget.Button;
+import androidx.preference.PreferenceScreen;
+import com.android.settings.R;
+import com.android.settingslib.widget.LayoutPreference;
+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 static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.mockito.Mockito.eq;
+
+@RunWith(RobolectricTestRunner.class)
+public class DarkModeActivationPreferenceControllerTest {
+    private DarkModeActivationPreferenceController mController;
+    private String mPreferenceKey = "key";
+    @Mock
+    private LayoutPreference mPreference;
+    @Mock
+    private PreferenceScreen mScreen;
+    @Mock
+    private Resources res;
+    @Mock
+    private Context mContext;
+    @Mock
+    private UiModeManager mService;
+    @Mock
+    private Button mTurnOffButton;
+    @Mock
+    private Button mTurnOnButton;
+
+    private Configuration configNightYes = new Configuration();
+    private Configuration configNightNo = new Configuration();;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mService = mock(UiModeManager.class);
+        when(mContext.getResources()).thenReturn(res);
+        when(mContext.getSystemService(UiModeManager.class)).thenReturn(mService);
+        when(mScreen.findPreference(anyString())).thenReturn(mPreference);
+        when(mPreference.findViewById(
+                eq(R.id.dark_ui_turn_on_button))).thenReturn(mTurnOnButton);
+        when(mPreference.findViewById(
+                eq(R.id.dark_ui_turn_off_button))).thenReturn(mTurnOffButton);
+        when(mService.setNightModeActivated(anyBoolean())).thenReturn(true);
+        when(mContext.getString(
+                R.string.dark_ui_activation_off_auto)).thenReturn("off_auto");
+        when(mContext.getString(
+                R.string.dark_ui_activation_on_auto)).thenReturn("on_auto");
+        when(mContext.getString(
+                R.string.dark_ui_activation_off_manual)).thenReturn("off_manual");
+        when(mContext.getString(
+                R.string.dark_ui_activation_on_manual)).thenReturn("on_manual");
+        when(mContext.getString(
+                R.string.dark_ui_summary_off_auto_mode_auto)).thenReturn("summary_off_auto");
+        when(mContext.getString(
+                R.string.dark_ui_summary_on_auto_mode_auto)).thenReturn("summary_on_auto");
+        when(mContext.getString(
+                R.string.dark_ui_summary_off_auto_mode_never)).thenReturn("summary_off_manual");
+        when(mContext.getString(
+                R.string.dark_ui_summary_on_auto_mode_never)).thenReturn("summary_on_manual");
+        mController = new DarkModeActivationPreferenceController(mContext, mPreferenceKey);
+        mController.displayPreference(mScreen);
+        configNightNo.uiMode = Configuration.UI_MODE_NIGHT_NO;
+        configNightYes.uiMode = Configuration.UI_MODE_NIGHT_YES;
+    }
+
+    @Test
+    public void nightMode_toggleButton_offManual() {
+        when(mService.getNightMode()).thenReturn(UiModeManager.MODE_NIGHT_YES);
+        when(res.getConfiguration()).thenReturn(configNightYes);
+
+        mController.updateState(mPreference);
+
+        verify(mTurnOnButton).setVisibility(eq(View.GONE));
+        verify(mTurnOffButton).setVisibility(eq(View.VISIBLE));
+        verify(mTurnOffButton).setText(eq(mContext.getString(
+                R.string.dark_ui_activation_off_manual)));
+    }
+
+
+    @Test
+    public void nightMode_toggleButton_onAutoWhenModeIsYes() {
+        when(mService.getNightMode()).thenReturn(UiModeManager.MODE_NIGHT_YES);
+        when(res.getConfiguration()).thenReturn(configNightNo);
+
+        mController.updateState(mPreference);
+
+        verify(mTurnOffButton).setVisibility(eq(View.GONE));
+        verify(mTurnOnButton).setVisibility(eq(View.VISIBLE));
+        verify(mTurnOnButton).setText(eq(mContext.getString(
+                R.string.dark_ui_activation_on_manual)));
+    }
+
+    @Test
+    public void nightMode_toggleButton_onAutoWhenModeIsAuto() {
+        when(mService.getNightMode()).thenReturn(UiModeManager.MODE_NIGHT_AUTO);
+        when(res.getConfiguration()).thenReturn(configNightNo);
+
+        mController.updateState(mPreference);
+
+        verify(mTurnOffButton).setVisibility(eq(View.GONE));
+        verify(mTurnOnButton).setVisibility(eq(View.VISIBLE));
+        verify(mTurnOnButton).setText(eq(mContext.getString(
+                R.string.dark_ui_activation_on_auto)));
+    }
+
+    @Test
+    public void nightModeSummary_buttonText_onManual() {
+        when(mService.getNightMode()).thenReturn(UiModeManager.MODE_NIGHT_NO);
+        when(res.getConfiguration()).thenReturn(configNightYes);
+
+        assertEquals(mController.getSummary(), mContext.getString(
+                R.string.dark_ui_summary_on_auto_mode_never));
+    }
+
+    @Test
+    public void nightModeSummary_buttonText_offAuto() {
+        when(mService.getNightMode()).thenReturn(UiModeManager.MODE_NIGHT_AUTO);
+        when(res.getConfiguration()).thenReturn(configNightNo);
+
+        assertEquals(mController.getSummary(), mContext.getString(
+                R.string.dark_ui_summary_off_auto_mode_auto));
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/display/darkmode/DarkModeObserverTest.java b/tests/robotests/src/com/android/settings/display/darkmode/DarkModeObserverTest.java
new file mode 100644
index 0000000..dfa8ba1
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/display/darkmode/DarkModeObserverTest.java
@@ -0,0 +1,66 @@
+/*
+ * 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.display.darkmode;
+
+import android.content.Context;
+import android.database.ContentObserver;
+import android.net.Uri;
+import android.provider.Settings;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+
+
+@RunWith(RobolectricTestRunner.class)
+public class DarkModeObserverTest {
+    private Context mContext;
+    private ContentObserver mContentObserver;
+    private DarkModeObserver mDarkModeObserver;
+    private Runnable mCallback;
+    private Uri mUri = Settings.Secure.getUriFor(Settings.Secure.UI_NIGHT_MODE);
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mContext = spy(RuntimeEnvironment.application);
+        mDarkModeObserver = new DarkModeObserver(mContext);
+        mContentObserver = mDarkModeObserver.getContentObserver();
+        mCallback = mock(Runnable.class);
+    }
+
+    @Test
+    public void callbackTest_subscribedCallbackCalled() {
+        mDarkModeObserver.subscribe(mCallback);
+        mContentObserver.onChange(false, mUri);
+        Mockito.verify(mCallback, times(2)).run();
+    }
+
+    @Test
+    public void callbackTest_unsubscribedCallNotbackCalled() {
+        mDarkModeObserver.subscribe(mCallback);
+        mContentObserver.onChange(false, mUri);
+        mDarkModeObserver.unsubscribe();
+        mContentObserver.onChange(false, mUri);
+        Mockito.verify(mCallback, times(2)).run();
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/display/darkmode/DarkModeScheduleSelectorControllerTest.java b/tests/robotests/src/com/android/settings/display/darkmode/DarkModeScheduleSelectorControllerTest.java
new file mode 100644
index 0000000..a844fec
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/display/darkmode/DarkModeScheduleSelectorControllerTest.java
@@ -0,0 +1,90 @@
+/*
+ * 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.display.darkmode;
+
+import android.app.UiModeManager;
+import android.content.Context;
+import androidx.preference.DropDownPreference;
+import androidx.preference.PreferenceScreen;
+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 com.android.settings.R;
+
+import static junit.framework.TestCase.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+@RunWith(RobolectricTestRunner.class)
+public class DarkModeScheduleSelectorControllerTest {
+    private DarkModeScheduleSelectorController mController;
+    private String mPreferenceKey = "key";
+    @Mock
+    private DropDownPreference mPreference;
+    @Mock
+    private PreferenceScreen mScreen;
+    private Context mContext;
+    @Mock
+    private UiModeManager mService;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mContext = spy(RuntimeEnvironment.application);
+        when(mContext.getSystemService(UiModeManager.class)).thenReturn(mService);
+        when(mContext.getString(R.string.dark_ui_auto_mode_never)).thenReturn("never");
+        when(mContext.getString(R.string.dark_ui_auto_mode_auto)).thenReturn("auto");
+        mPreference = spy(new DropDownPreference(mContext));
+        when(mScreen.findPreference(anyString())).thenReturn(mPreference);
+        when(mService.setNightModeActivated(anyBoolean())).thenReturn(true);
+        mController = new DarkModeScheduleSelectorController(mContext, mPreferenceKey);
+    }
+
+    @Test
+    public void nightMode_preferenceChange_preferenceChangeTrueWhenChangedOnly() {
+        when(mService.getNightMode()).thenReturn(UiModeManager.MODE_NIGHT_YES);
+        mController.displayPreference(mScreen);
+        boolean changed = mController
+                .onPreferenceChange(mScreen, mContext.getString(R.string.dark_ui_auto_mode_auto));
+        assertTrue(changed);
+        changed = mController
+                .onPreferenceChange(mScreen, mContext.getString(R.string.dark_ui_auto_mode_auto));
+        assertFalse(changed);
+    }
+
+    @Test
+    public void nightMode_updateStateNone_dropDownValueChangedToNone() {
+        when(mService.getNightMode()).thenReturn(UiModeManager.MODE_NIGHT_YES);
+        mController.displayPreference(mScreen);
+        mController.updateState(mPreference);
+        verify(mPreference).setValue(mContext.getString(R.string.dark_ui_auto_mode_never));
+    }
+
+    @Test
+    public void nightMode_updateStateNone_dropDownValueChangedToAuto() {
+        when(mService.getNightMode()).thenReturn(UiModeManager.MODE_NIGHT_AUTO);
+        mController.displayPreference(mScreen);
+        mController.updateState(mPreference);
+        verify(mPreference).setValue(mContext.getString(R.string.dark_ui_auto_mode_auto));
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/network/telephony/MobileNetworkActivityTest.java b/tests/robotests/src/com/android/settings/network/telephony/MobileNetworkActivityTest.java
index bddc91f..c4f1948 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/MobileNetworkActivityTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/MobileNetworkActivityTest.java
@@ -42,7 +42,6 @@
 
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -122,7 +121,6 @@
     }
 
     @Test
-    @Ignore
     public void updateBottomNavigationViewV2_oneSubscription_shouldNotCrash() {
         mSubscriptionManager.setActiveSubscriptionInfos(mSubscriptionInfo1);
 
@@ -132,7 +130,6 @@
     }
 
     @Test
-    @Ignore
     public void updateBottomNavigationViewV2_twoSubscription_shouldNotCrash() {
         mSubscriptionManager.setActiveSubscriptionInfos(mSubscriptionInfo1, mSubscriptionInfo2);
 
@@ -142,7 +139,6 @@
     }
 
     @Test
-    @Ignore
     public void switchFragment_switchBetweenTwoSubscriptions() {
         mSubscriptionManager.setActiveSubscriptionInfos(mSubscriptionInfo1, mSubscriptionInfo2);
 
@@ -158,7 +154,6 @@
     }
 
     @Test
-    @Ignore
     public void switchFragment_subscriptionsUpdate_notifyByIntent() {
         mSubscriptionManager.setActiveSubscriptionInfos(mSubscriptionInfo1, mSubscriptionInfo2);
 
@@ -186,7 +181,6 @@
     }
 
     @Test
-    @Ignore
     public void onSaveInstanceState_saveCurrentSubId() {
         mSubscriptionManager.setActiveSubscriptionInfos(mSubscriptionInfo1, mSubscriptionInfo2);
 
diff --git a/tests/robotests/src/com/android/settings/slices/SettingsSliceProviderTest.java b/tests/robotests/src/com/android/settings/slices/SettingsSliceProviderTest.java
index ab4ece2..a969420 100644
--- a/tests/robotests/src/com/android/settings/slices/SettingsSliceProviderTest.java
+++ b/tests/robotests/src/com/android/settings/slices/SettingsSliceProviderTest.java
@@ -18,10 +18,13 @@
 package com.android.settings.slices;
 
 import static android.content.ContentResolver.SCHEME_CONTENT;
+import static android.content.pm.PackageManager.PERMISSION_DENIED;
+import static android.content.pm.PackageManager.PERMISSION_GRANTED;
 
 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;
@@ -66,12 +69,15 @@
 import org.robolectric.Robolectric;
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
+import org.robolectric.Shadows;
 import org.robolectric.annotation.Config;
 import org.robolectric.annotation.Implementation;
 import org.robolectric.annotation.Implements;
 import org.robolectric.annotation.Resetter;
 import org.robolectric.shadow.api.Shadow;
 import org.robolectric.shadows.ShadowAccessibilityManager;
+import org.robolectric.shadows.ShadowBinder;
+import org.robolectric.shadows.ShadowPackageManager;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -110,6 +116,7 @@
 
     private Context mContext;
     private SettingsSliceProvider mProvider;
+    private ShadowPackageManager mPackageManager;
     @Mock
     private SliceManager mManager;
 
@@ -146,6 +153,8 @@
         doReturn(mManager).when(mContext).getSystemService(SliceManager.class);
         when(mManager.getPinnedSlices()).thenReturn(Collections.emptyList());
 
+        mPackageManager = Shadows.shadowOf(mContext.getPackageManager());
+
         SliceProvider.setSpecs(SliceLiveData.SUPPORTED_SPECS);
     }
 
@@ -284,7 +293,8 @@
     @Test
     public void getDescendantUris_invalidPath_returnsEmpty() {
         final String key = "platform_key";
-        SliceTestUtils.insertSliceToDb(mContext, key, true /* isPlatformSlice */);
+        SliceTestUtils.insertSliceToDb(mContext, key, true /* isPlatformSlice */,
+                null /* customizedUnavailableSliceSubtitle */, true /* isPublicSlice */);
         final Uri uri = new Uri.Builder()
                 .scheme(SCHEME_CONTENT)
                 .authority(SettingsSlicesContract.AUTHORITY)
@@ -299,7 +309,8 @@
 
     @Test
     public void getDescendantUris_platformSlice_doesNotReturnOEMSlice() {
-        SliceTestUtils.insertSliceToDb(mContext, "oem_key", false /* isPlatformSlice */);
+        SliceTestUtils.insertSliceToDb(mContext, "oem_key", false /* isPlatformSlice */,
+                null /* customizedUnavailableSliceSubtitle */, true /* isPublicSlice */);
         final Uri uri = new Uri.Builder()
                 .scheme(SCHEME_CONTENT)
                 .authority(SettingsSlicesContract.AUTHORITY)
@@ -313,7 +324,8 @@
 
     @Test
     public void getDescendantUris_oemSlice_doesNotReturnPlatformSlice() {
-        SliceTestUtils.insertSliceToDb(mContext, "platform_key", true /* isPlatformSlice */);
+        SliceTestUtils.insertSliceToDb(mContext, "platform_key", true /* isPlatformSlice */,
+                null /* customizedUnavailableSliceSubtitle */, true /* isPublicSlice */);
         final Uri uri = new Uri.Builder()
                 .scheme(SCHEME_CONTENT)
                 .authority(SettingsSliceProvider.SLICE_AUTHORITY)
@@ -328,7 +340,8 @@
     @Test
     public void getDescendantUris_oemSlice_returnsOEMUriDescendant() {
         final String key = "oem_key";
-        SliceTestUtils.insertSliceToDb(mContext, key, false /* isPlatformSlice */);
+        SliceTestUtils.insertSliceToDb(mContext, key, false /* isPlatformSlice */,
+                null /* customizedUnavailableSliceSubtitle */, true /* isPublicSlice */);
         final Uri uri = new Uri.Builder()
                 .scheme(SCHEME_CONTENT)
                 .authority(SettingsSliceProvider.SLICE_AUTHORITY)
@@ -351,7 +364,8 @@
     @Test
     public void getDescendantUris_oemSliceNoPath_returnsOEMUriDescendant() {
         final String key = "oem_key";
-        SliceTestUtils.insertSliceToDb(mContext, key, false /* isPlatformSlice */);
+        SliceTestUtils.insertSliceToDb(mContext, key, false /* isPlatformSlice */,
+                null /* customizedUnavailableSliceSubtitle */, true /* isPublicSlice */);
         final Uri uri = new Uri.Builder()
                 .scheme(SCHEME_CONTENT)
                 .authority(SettingsSliceProvider.SLICE_AUTHORITY)
@@ -371,9 +385,31 @@
     }
 
     @Test
+    public void getDescendantUris_oemSliceNoPath_notContainPrivateUri() {
+        final String key = "oem_key";
+        SliceTestUtils.insertSliceToDb(mContext, key, false /* isPlatformSlice */,
+                null /* customizedUnavailableSliceSubtitle */, false /* isPublicSlice */);
+        final Uri uri = new Uri.Builder()
+                .scheme(SCHEME_CONTENT)
+                .authority(SettingsSliceProvider.SLICE_AUTHORITY)
+                .build();
+        final Uri expectedUri = new Uri.Builder()
+                .scheme(SCHEME_CONTENT)
+                .authority(SettingsSliceProvider.SLICE_AUTHORITY)
+                .appendPath(SettingsSlicesContract.PATH_SETTING_ACTION)
+                .appendPath(key)
+                .build();
+
+        final Collection<Uri> descendants = mProvider.onGetSliceDescendants(uri);
+
+        assertThat(descendants).doesNotContain(expectedUri);
+    }
+
+    @Test
     public void getDescendantUris_platformSlice_returnsPlatformUriDescendant() {
         final String key = "platform_key";
-        SliceTestUtils.insertSliceToDb(mContext, key, true /* isPlatformSlice */);
+        SliceTestUtils.insertSliceToDb(mContext, key, true /* isPlatformSlice */,
+                null /* customizedUnavailableSliceSubtitle */, true /* isPublicSlice */);
         final Uri uri = new Uri.Builder()
                 .scheme(SCHEME_CONTENT)
                 .authority(SettingsSlicesContract.AUTHORITY)
@@ -396,7 +432,8 @@
     @Test
     public void getDescendantUris_platformSliceNoPath_returnsPlatformUriDescendant() {
         final String key = "platform_key";
-        SliceTestUtils.insertSliceToDb(mContext, key, true /* isPlatformSlice */);
+        SliceTestUtils.insertSliceToDb(mContext, key, true /* isPlatformSlice */,
+                null /* customizedUnavailableSliceSubtitle */, true /* isPublicSlice */);
         final Uri uri = new Uri.Builder()
                 .scheme(SCHEME_CONTENT)
                 .authority(SettingsSlicesContract.AUTHORITY)
@@ -419,8 +456,10 @@
     public void getDescendantUris_noAuthorityNorPath_returnsAllUris() {
         final String platformKey = "platform_key";
         final String oemKey = "oemKey";
-        SliceTestUtils.insertSliceToDb(mContext, platformKey, true /* isPlatformSlice */);
-        SliceTestUtils.insertSliceToDb(mContext, oemKey, false /* isPlatformSlice */);
+        SliceTestUtils.insertSliceToDb(mContext, platformKey, true /* isPlatformSlice */,
+                null /* customizedUnavailableSliceSubtitle */, true /* isPublicSlice */);
+        SliceTestUtils.insertSliceToDb(mContext, oemKey, false /* isPlatformSlice */,
+                null /* customizedUnavailableSliceSubtitle */, true /* isPublicSlice */);
         final Uri uri = new Uri.Builder()
                 .scheme(SCHEME_CONTENT)
                 .build();
@@ -446,6 +485,48 @@
     }
 
     @Test
+    @Config(qualifiers = "mcc999")
+    public void getDescendantUris_privateSlicesNeeded_containsPrivateSliceUri() {
+        final String privateKey = "test_private";
+        final Uri specialUri = Uri.parse("content://com.android.settings.slices/test");
+        doReturn(true).when(mProvider).isPrivateSlicesNeeded(specialUri);
+        SliceTestUtils.insertSliceToDb(mContext, privateKey /* key */, false /* isPlatformSlice */,
+                null /* customizedUnavailableSliceSubtitle */, false /* isPublicSlice */);
+        final Collection<Uri> expectedUris = new HashSet<>();
+        expectedUris.addAll(SPECIAL_CASE_OEM_URIS);
+        expectedUris.add(new Uri.Builder()
+                .scheme(SCHEME_CONTENT)
+                .authority(SettingsSliceProvider.SLICE_AUTHORITY)
+                .appendPath(SettingsSlicesContract.PATH_SETTING_ACTION)
+                .appendPath(privateKey)
+                .build());
+
+        final Collection<Uri> descendants = mProvider.onGetSliceDescendants(specialUri);
+
+        assertThat(descendants).containsExactlyElementsIn(expectedUris);
+    }
+
+    @Test
+    @Config(qualifiers = "mcc999")
+    public void getDescendantUris_privateSlicesNotNeeded_notContainPrivateSliceUri() {
+        final Uri specialUri = Uri.parse("content://com.android.settings.slices/test");
+        doReturn(false).when(mProvider).isPrivateSlicesNeeded(specialUri);
+        SliceTestUtils.insertSliceToDb(mContext,
+                "test_private" /* key */, false /* isPlatformSlice */,
+                null /* customizedUnavailableSliceSubtitle */, false /* isPublicSlice */);
+        final Uri expectedUri = new Uri.Builder()
+                .scheme(SCHEME_CONTENT)
+                .authority(SettingsSliceProvider.SLICE_AUTHORITY)
+                .appendPath(SettingsSlicesContract.PATH_SETTING_ACTION)
+                .appendPath("test_private")
+                .build();
+
+        final Collection<Uri> descendants = mProvider.onGetSliceDescendants(specialUri);
+
+        assertThat(descendants).doesNotContain(expectedUri);
+    }
+
+    @Test
     public void onCreatePermissionRequest_returnsSettingIntent() {
         final PendingIntent pendingIntent = mProvider.onCreatePermissionRequest(
                 CustomSliceRegistry.FLASHLIGHT_SLICE_URI, "com.android.whaaaat");
@@ -531,6 +612,56 @@
                 .grantSlicePermission("com.android.settings.slice_whitelist_package", uris.get(0));
     }
 
+    @Test
+    @Config(qualifiers = "mcc999")
+    public void isPrivateSlicesNeeded_incorrectUri_returnFalse() {
+        final Uri uri = Uri.parse("content://com.android.settings.slices/test123");
+
+        assertThat(mProvider.isPrivateSlicesNeeded(uri)).isFalse();
+    }
+
+    @Test
+    public void isPrivateSlicesNeeded_noUri_returnFalse() {
+        final Uri uri = Uri.parse("content://com.android.settings.slices/test");
+
+        assertThat(mProvider.isPrivateSlicesNeeded(uri)).isFalse();
+    }
+
+    @Test
+    @Config(qualifiers = "mcc999")
+    public void isPrivateSlicesNeeded_correctUriWithPermissionAndIsSI_returnTrue() {
+        final Uri uri = Uri.parse("content://com.android.settings.slices/test");
+        ShadowBinder.setCallingUid(123);
+        doReturn(PERMISSION_GRANTED)
+                .when(mContext).checkPermission(anyString(), anyInt(), anyInt());
+        mPackageManager.setPackagesForUid(123, new String[]{"com.android.settings.intelligence"});
+
+        assertThat(mProvider.isPrivateSlicesNeeded(uri)).isTrue();
+    }
+
+    @Test
+    @Config(qualifiers = "mcc999")
+    public void isPrivateSlicesNeeded_correctUriWithPermissionNotSI_returnFalse() {
+        final Uri uri = Uri.parse("content://com.android.settings.slices/test");
+        ShadowBinder.setCallingUid(123);
+        doReturn(PERMISSION_GRANTED)
+                .when(mContext).checkPermission(anyString(), anyInt(), anyInt());
+        mPackageManager.setPackagesForUid(123, new String[]{"com.android.settings.test"});
+
+        assertThat(mProvider.isPrivateSlicesNeeded(uri)).isFalse();
+    }
+
+    @Test
+    @Config(qualifiers = "mcc999")
+    public void isPrivateSlicesNeeded_correctUriNoPermission_returnFalse() {
+        final Uri uri = Uri.parse("content://com.android.settings.slices/test");
+        ShadowBinder.setCallingUid(123);
+        doReturn(PERMISSION_DENIED).when(mContext).checkPermission(anyString(), anyInt(), anyInt());
+        mPackageManager.setPackagesForUid(123, new String[]{"com.android.settings.intelligence"});
+
+        assertThat(mProvider.isPrivateSlicesNeeded(uri)).isFalse();
+    }
+
     private static SliceData getDummyData() {
         return new SliceData.Builder()
                 .setKey(KEY)
diff --git a/tests/robotests/src/com/android/settings/slices/SliceTestUtils.java b/tests/robotests/src/com/android/settings/slices/SliceTestUtils.java
index 4f5b3a1..1c9164a 100644
--- a/tests/robotests/src/com/android/settings/slices/SliceTestUtils.java
+++ b/tests/robotests/src/com/android/settings/slices/SliceTestUtils.java
@@ -47,6 +47,11 @@
 
     public static void insertSliceToDb(Context context, String key, boolean isPlatformSlice,
             String customizedUnavailableSliceSubtitle) {
+        insertSliceToDb(context, key, isPlatformSlice, customizedUnavailableSliceSubtitle, false);
+    }
+
+    public static void insertSliceToDb(Context context, String key, boolean isPlatformSlice,
+            String customizedUnavailableSliceSubtitle, boolean isPublicSlice) {
         final SQLiteDatabase db = SlicesDatabaseHelper.getInstance(context).getWritableDatabase();
         ContentValues values = new ContentValues();
         values.put(SlicesDatabaseHelper.IndexColumns.KEY, key);
@@ -69,6 +74,7 @@
         values.put(SlicesDatabaseHelper.IndexColumns.SLICE_TYPE, SliceData.SliceType.INTENT);
         values.put(SlicesDatabaseHelper.IndexColumns.UNAVAILABLE_SLICE_SUBTITLE,
                 customizedUnavailableSliceSubtitle);
+        values.put(SlicesDatabaseHelper.IndexColumns.PUBLIC_SLICE, isPublicSlice);
 
         db.replaceOrThrow(SlicesDatabaseHelper.Tables.TABLE_SLICES_INDEX, null, values);
         db.close();
diff --git a/tests/robotests/src/com/android/settings/slices/SlicesDatabaseAccessorTest.java b/tests/robotests/src/com/android/settings/slices/SlicesDatabaseAccessorTest.java
index a28dba8..b4385d8 100644
--- a/tests/robotests/src/com/android/settings/slices/SlicesDatabaseAccessorTest.java
+++ b/tests/robotests/src/com/android/settings/slices/SlicesDatabaseAccessorTest.java
@@ -17,6 +17,8 @@
 
 package com.android.settings.slices;
 
+import static android.content.ContentResolver.SCHEME_CONTENT;
+
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.Mockito.spy;
@@ -168,8 +170,10 @@
     @Test
     public void getDescendantUris_platformSlice_doesNotReturnOEMSlice() {
         final String key = "oem_key";
-        SliceTestUtils.insertSliceToDb(mContext, key, false /* isPlatformSlice */);
-        final List<Uri> keys = mAccessor.getSliceUris(SettingsSlicesContract.AUTHORITY);
+        SliceTestUtils.insertSliceToDb(mContext, key, false /* isPlatformSlice */,
+                null /* customizedUnavailableSliceSubtitle */, true /* isPublicSlice */);
+        final List<Uri> keys = mAccessor.getSliceUris(SettingsSlicesContract.AUTHORITY,
+                true /* isPublicSlice */);
 
         assertThat(keys).isEmpty();
     }
@@ -177,8 +181,10 @@
     @Test
     public void getDescendantUris_oemSlice_doesNotReturnPlatformSlice() {
         final String key = "platform_key";
-        SliceTestUtils.insertSliceToDb(mContext, key, true /* isPlatformSlice */);
-        final List<Uri> keys = mAccessor.getSliceUris(SettingsSliceProvider.SLICE_AUTHORITY);
+        SliceTestUtils.insertSliceToDb(mContext, key, true /* isPlatformSlice */,
+                null /* customizedUnavailableSliceSubtitle */, true /* isPublicSlice */);
+        final List<Uri> keys = mAccessor.getSliceUris(SettingsSliceProvider.SLICE_AUTHORITY,
+                true /* isPublicSlice */);
 
         assertThat(keys).isEmpty();
     }
@@ -186,8 +192,10 @@
     @Test
     public void getDescendantUris_oemSlice_returnsOEMUriDescendant() {
         final String key = "oem_key";
-        SliceTestUtils.insertSliceToDb(mContext, key, false /* isPlatformSlice */);
-        final List<Uri> keys = mAccessor.getSliceUris(SettingsSliceProvider.SLICE_AUTHORITY);
+        SliceTestUtils.insertSliceToDb(mContext, key, false /* isPlatformSlice */,
+                null /* customizedUnavailableSliceSubtitle */, true /* isPublicSlice */);
+        final List<Uri> keys = mAccessor.getSliceUris(SettingsSliceProvider.SLICE_AUTHORITY,
+                true /* isPublicSlice */);
 
         assertThat(keys).containsExactly(
                 Uri.parse("content://com.android.settings.slices/action/oem_key"));
@@ -196,14 +204,52 @@
     @Test
     public void getDescendantUris_platformSlice_returnsPlatformUriDescendant() {
         final String key = "platform_key";
-        SliceTestUtils.insertSliceToDb(mContext, key, true /* isPlatformSlice */);
-        final List<Uri> keys = mAccessor.getSliceUris(SettingsSlicesContract.AUTHORITY);
+        SliceTestUtils.insertSliceToDb(mContext, key, true /* isPlatformSlice */,
+                null /* customizedUnavailableSliceSubtitle */, true /* isPublicSlice */);
+        final List<Uri> keys = mAccessor.getSliceUris(SettingsSlicesContract.AUTHORITY,
+                true /* isPublicSlice */);
 
         assertThat(keys).containsExactly(
                 Uri.parse("content://android.settings.slices/action/platform_key"));
     }
 
     @Test
+    public void getSliceUris_publicSlice_returnPublicUri() {
+        SliceTestUtils.insertSliceToDb(mContext, "test_public", false /* isPlatformSlice */,
+                null /* customizedUnavailableSliceSubtitle */, true /* isPublicSlice */);
+        SliceTestUtils.insertSliceToDb(mContext, "test_private", false /* isPlatformSlice */,
+                null /* customizedUnavailableSliceSubtitle */, false /* isPublicSlice */);
+        final Uri expectedUri = new Uri.Builder()
+                .scheme(SCHEME_CONTENT)
+                .authority(SettingsSliceProvider.SLICE_AUTHORITY)
+                .appendPath(SettingsSlicesContract.PATH_SETTING_ACTION)
+                .appendPath("test_public")
+                .build();
+
+        final List<Uri> uri = mAccessor.getSliceUris(SettingsSliceProvider.SLICE_AUTHORITY, true);
+
+        assertThat(uri).containsExactly(expectedUri);
+    }
+
+    @Test
+    public void getSliceUris_nonPublicSlice_returnNonPublicUri() {
+        SliceTestUtils.insertSliceToDb(mContext, "test_public", false /* isPlatformSlice */,
+                null /* customizedUnavailableSliceSubtitle */, true /* isPublicSlice */);
+        SliceTestUtils.insertSliceToDb(mContext, "test_private", false /* isPlatformSlice */,
+                null /* customizedUnavailableSliceSubtitle */, false /* isPublicSlice */);
+        final Uri expectedUri = new Uri.Builder()
+                .scheme(SCHEME_CONTENT)
+                .authority(SettingsSliceProvider.SLICE_AUTHORITY)
+                .appendPath(SettingsSlicesContract.PATH_SETTING_ACTION)
+                .appendPath("test_private")
+                .build();
+
+        final List<Uri> uri = mAccessor.getSliceUris(SettingsSliceProvider.SLICE_AUTHORITY, false);
+
+        assertThat(uri).containsExactly(expectedUri);
+    }
+
+    @Test
     @Config(qualifiers = "mcc999")
     public void getSliceKeys_indexesDatabase() {
         // Force new indexing
@@ -220,7 +266,8 @@
                         FakeIndexProvider.SEARCH_INDEX_DATA_PROVIDER));
 
         final SlicesDatabaseAccessor accessor = new SlicesDatabaseAccessor(mContext);
-        final List<Uri> keys = accessor.getSliceUris(SettingsSliceProvider.SLICE_AUTHORITY);
+        final List<Uri> keys = accessor.getSliceUris(SettingsSliceProvider.SLICE_AUTHORITY,
+                true /* isPublicSlice */);
 
         assertThat(keys).isNotEmpty();
     }
diff --git a/tests/robotests/src/com/android/settings/wifi/WifiSettings2Test.java b/tests/robotests/src/com/android/settings/wifi/WifiSettings2Test.java
index e64d015..d523866 100644
--- a/tests/robotests/src/com/android/settings/wifi/WifiSettings2Test.java
+++ b/tests/robotests/src/com/android/settings/wifi/WifiSettings2Test.java
@@ -50,7 +50,6 @@
 import com.android.wifitrackerlib.WifiPickerTracker;
 
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -241,9 +240,9 @@
     }
 
     @Test
-    @Ignore
     public void onCreateAdapter_hasStableIdsTrue() {
         final PreferenceScreen preferenceScreen = mock(PreferenceScreen.class);
+        when(preferenceScreen.getContext()).thenReturn(mContext);
 
         RecyclerView.Adapter adapter = mWifiSettings2.onCreateAdapter(preferenceScreen);
 
diff --git a/tests/robotests/src/com/android/settings/wifi/WifiSettingsTest.java b/tests/robotests/src/com/android/settings/wifi/WifiSettingsTest.java
index ee14ca5..2fe7c5c 100644
--- a/tests/robotests/src/com/android/settings/wifi/WifiSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/WifiSettingsTest.java
@@ -57,7 +57,6 @@
 import com.android.settingslib.wifi.WifiTracker;
 
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -296,9 +295,9 @@
     }
 
     @Test
-    @Ignore
     public void onCreateAdapter_hasStableIdsTrue() {
         final PreferenceScreen preferenceScreen = mock(PreferenceScreen.class);
+        when(preferenceScreen.getContext()).thenReturn(mContext);
 
         RecyclerView.Adapter adapter = mWifiSettings.onCreateAdapter(preferenceScreen);
 
diff --git a/tests/robotests/src/com/android/settings/wifi/details/WifiDetailPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/details/WifiDetailPreferenceControllerTest.java
index f0ac336..b990846 100644
--- a/tests/robotests/src/com/android/settings/wifi/details/WifiDetailPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/details/WifiDetailPreferenceControllerTest.java
@@ -22,6 +22,7 @@
 import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.ArgumentMatchers.nullable;
+import static org.mockito.Mockito.atLeastOnce;
 import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.inOrder;
 import static org.mockito.Mockito.mock;
@@ -81,7 +82,6 @@
 import com.android.settingslib.wifi.WifiTrackerFactory;
 
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Answers;
@@ -1859,18 +1859,17 @@
     }
 
     @Test
-    @Ignore
     public void entityHeader_expiredPasspointR1_shouldHandleExpiration() {
-        setUpForDisconnectedNetwork();
         when(mockAccessPoint.isPasspoint()).thenReturn(true);
         when(mockAccessPoint.isPasspointConfigurationR1()).thenReturn(true);
         when(mockAccessPoint.isExpired()).thenReturn(true);
+        setUpForDisconnectedNetwork();
         String expireSummary = mContext.getResources().getString(
                 com.android.settingslib.R.string.wifi_passpoint_expired);
 
         displayAndResume();
 
-        verify(mockButtonsPref).setButton3Visible(false);
+        verify(mockButtonsPref, atLeastOnce()).setButton3Visible(false);
         verify(mockHeaderController).setSummary(expireSummary);
     }
 
diff --git a/tests/robotests/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2Test.java b/tests/robotests/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2Test.java
index 8d15224..5b125e9 100644
--- a/tests/robotests/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2Test.java
+++ b/tests/robotests/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2Test.java
@@ -22,6 +22,7 @@
 import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.ArgumentMatchers.nullable;
+import static org.mockito.Mockito.atLeastOnce;
 import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.inOrder;
 import static org.mockito.Mockito.mock;
@@ -81,7 +82,6 @@
 import com.android.settingslib.wifi.WifiTrackerFactory;
 
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Answers;
@@ -1859,18 +1859,17 @@
     }
 
     @Test
-    @Ignore
     public void entityHeader_expiredPasspointR1_shouldHandleExpiration() {
-        setUpForDisconnectedNetwork();
         when(mMockAccessPoint.isPasspoint()).thenReturn(true);
         when(mMockAccessPoint.isPasspointConfigurationR1()).thenReturn(true);
         when(mMockAccessPoint.isExpired()).thenReturn(true);
+        setUpForDisconnectedNetwork();
         String expireSummary = mContext.getResources().getString(
                 com.android.settingslib.R.string.wifi_passpoint_expired);
 
         displayAndResume();
 
-        verify(mMockButtonsPref).setButton3Visible(false);
+        verify(mMockButtonsPref, atLeastOnce()).setButton3Visible(false);
         verify(mMockHeaderController).setSummary(expireSummary);
     }