Merge "Address API council comments."
diff --git a/Android.mk b/Android.mk
index e385b34..906cfc7 100644
--- a/Android.mk
+++ b/Android.mk
@@ -47,6 +47,7 @@
     guava \
     jsr305 \
     settings-contextual-card-protos-lite \
+    settings-log-bridge-protos-lite \
     contextualcards \
     settings-logtags \
     zxing-core-1.7
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 4166d6f..cea4835 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1381,7 +1381,7 @@
         <activity android:name=".accessibility.AccessibilitySettingsForSetupWizardActivity"
                 android:icon="@drawable/ic_accessibility_suggestion"
                 android:label="@string/vision_settings_title"
-                android:theme="@style/SetupWizardAccessibilityTheme">
+                android:theme="@style/GlifTheme.Light">
             <intent-filter android:priority="1">
                 <action android:name="android.settings.ACCESSIBILITY_SETTINGS_FOR_SUW" />
                 <category android:name="android.intent.category.DEFAULT" />
@@ -3042,9 +3042,8 @@
         <activity android:name=".panel.SettingsPanelActivity"
             android:label="@string/settings_panel_title"
             android:theme="@style/Theme.BottomDialog"
+            android:documentLaunchMode="always"
             android:excludeFromRecents="true"
-            android:launchMode="singleTop"
-            android:taskAffinity=".panel.SettingsPanelActivity"
             android:exported="true">
                  <intent-filter>
                      <action android:name="android.settings.panel.action.INTERNET_CONNECTIVITY" />
diff --git a/protos/Android.bp b/protos/Android.bp
index 533dbca..5184218 100644
--- a/protos/Android.bp
+++ b/protos/Android.bp
@@ -5,4 +5,13 @@
         type: "lite",
     },
     srcs: ["contextual_card_list.proto"],
+}
+
+java_library_static {
+    name: "settings-log-bridge-protos-lite",
+    host_supported: true,
+    proto: {
+        type: "lite",
+    },
+    srcs: ["settings_log_bridge.proto"],
 }
\ No newline at end of file
diff --git a/protos/settings_log_bridge.proto b/protos/settings_log_bridge.proto
new file mode 100644
index 0000000..7b28e0d
--- /dev/null
+++ b/protos/settings_log_bridge.proto
@@ -0,0 +1,37 @@
+syntax = "proto2";
+
+package com.android.settings.intelligence;
+option java_outer_classname = "LogProto";
+
+message SettingsLog {
+  /**
+   * Where this SettingsUIChange event comes from. For example, if
+   * it's a PAGE_VISIBLE event, where the page is opened from.
+   */
+  optional int32 attribution = 1;
+
+  /**
+   * What the UI action is.
+   */
+  optional int32 action = 2;
+
+  /**
+   * Where the action is happening
+   */
+  optional int32 page_id = 3;
+
+  /**
+   * What preference changed in this event.
+   */
+  optional string changed_preference_key = 4;
+
+  /**
+   * The new value of the changed preference.
+   */
+  optional int32 changed_preference_int_value = 5;
+
+  /**
+   * The timestamp of a log event
+   */
+  optional string timestamp = 6;
+}
diff --git a/res/drawable/ic_cellular_1_bar.xml b/res/drawable/ic_cellular_1_bar.xml
new file mode 100644
index 0000000..b3d2624
--- /dev/null
+++ b/res/drawable/ic_cellular_1_bar.xml
@@ -0,0 +1,29 @@
+<!--
+  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.
+  -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="48dp"
+    android:height="48dp"
+    android:viewportWidth="48"
+    android:viewportHeight="48"
+    android:tint="?android:attr/colorControlNormal">
+  <path
+      android:pathData="M4,44h40V4z"
+      android:fillColor="#000000"
+      android:fillAlpha=".3"/>
+  <path
+      android:pathData="M24,24L4,44h20z"
+      android:fillColor="#000000"/>
+</vector>
diff --git a/res/drawable/ic_color_inversion.xml b/res/drawable/ic_color_inversion.xml
index aa59f5a..5d20d05 100644
--- a/res/drawable/ic_color_inversion.xml
+++ b/res/drawable/ic_color_inversion.xml
@@ -13,8 +13,8 @@
     See the License for the specific language governing permissions and
     limitations under the License.
 -->
-<vector android:height="192dp" android:viewportHeight="192.0"
-    android:viewportWidth="192.0" android:width="192dp"
+<vector android:height="32dp" android:viewportHeight="192.0"
+    android:viewportWidth="192.0" android:width="32dp"
     xmlns:aapt="http://schemas.android.com/aapt" xmlns:android="http://schemas.android.com/apk/res/android">
     <path android:fillColor="#546E7A" android:pathData="M37.2,173.6l-28.5,-90c-1.7,-5.8 0.3,-12 5,-15.6l73.6,-57.1c5.2,-4 12.5,-4 17.6,0.1L178.6,70c4.6,3.7 6.5,9.9 4.8,15.6l-28.5,88.2c-1.9,6.1 -7.4,10.2 -13.7,10.2H50.8C44.5,183.9 39,179.7 37.2,173.6z"/>
     <path android:fillAlpha="0.2" android:fillColor="#263238"
diff --git a/res/drawable/ic_daltonizer.xml b/res/drawable/ic_daltonizer.xml
index 04e397d..38cce69 100644
--- a/res/drawable/ic_daltonizer.xml
+++ b/res/drawable/ic_daltonizer.xml
@@ -13,8 +13,8 @@
     See the License for the specific language governing permissions and
     limitations under the License.
 -->
-<vector android:height="192dp" android:viewportHeight="192.0"
-    android:viewportWidth="192.0" android:width="192dp"
+<vector android:height="32dp" android:viewportHeight="192.0"
+    android:viewportWidth="192.0" android:width="32dp"
     xmlns:aapt="http://schemas.android.com/aapt" xmlns:android="http://schemas.android.com/apk/res/android">
     <path android:fillColor="#00BCD4" android:pathData="M37.1,173.5l-28.5,-90c-1.7,-5.8 0.3,-12 5,-15.6l73.6,-57.1c5.2,-4 12.5,-4 17.6,0.1l73.8,58.9c4.6,3.7 6.5,9.9 4.8,15.6l-28.5,88.2c-1.9,6.1 -7.4,10.2 -13.7,10.2H50.8C44.5,183.8 39,179.6 37.1,173.5z"/>
     <path android:fillAlpha="0.2" android:fillColor="#263238"
diff --git a/res/drawable/ic_settings_aod.xml b/res/drawable/ic_settings_aod.xml
index 8d91349..b238e3a 100644
--- a/res/drawable/ic_settings_aod.xml
+++ b/res/drawable/ic_settings_aod.xml
@@ -18,7 +18,8 @@
         android:width="24dp"
         android:height="24dp"
         android:viewportWidth="24"
-        android:viewportHeight="24">
+        android:viewportHeight="24"
+        android:tint="?android:attr/colorControlNormal">
 
     <path
         android:fillColor="#000000"
diff --git a/res/drawable/ic_settings_camera.xml b/res/drawable/ic_settings_camera.xml
index 5309270..3c85532 100644
--- a/res/drawable/ic_settings_camera.xml
+++ b/res/drawable/ic_settings_camera.xml
@@ -20,7 +20,8 @@
     android:height="24dp"
     android:viewportWidth="48"
     android:viewportHeight="48"
-    android:autoMirrored="true">
+    android:autoMirrored="true"
+    android:tint="?android:attr/colorControlNormal">
 
     <path android:fillColor="#000000"
           android:pathData="M18.8 21l9.53-16.51C26.94 4.18 25.49 4 24 4c-4.8 0-9.19 1.69-12.64
diff --git a/res/drawable/ic_settings_disable.xml b/res/drawable/ic_settings_disable.xml
new file mode 100644
index 0000000..d0edf4a
--- /dev/null
+++ b/res/drawable/ic_settings_disable.xml
@@ -0,0 +1,25 @@
+<!--
+  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.
+  -->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+  <path
+      android:fillColor="#FF000000"
+      android:pathData="M12,2c-1.78,0 -3.44,0.46 -4.89,1.28l1.48,1.48C9.63,4.28 10.78,4 12,4c4.41,0 8,3.59 8,8c0,1.22 -0.28,2.37 -0.76,3.41l1.48,1.48C21.54,15.44 22,13.78 22,12C22,6.48 17.52,2 12,2zM18.12,17.13L6.87,5.87L3.31,2.31L1.89,3.72l2.19,2.19C2.77,7.59 2,9.71 2,12c0,5.52 4.48,10 10,10c2.29,0 4.41,-0.77 6.09,-2.08l2.19,2.19l1.41,-1.41L18.12,17.13zM12,20c-4.41,0 -8,-3.59 -8,-8c0,-1.74 0.56,-3.35 1.51,-4.66l11.15,11.15C15.35,19.44 13.74,20 12,20zM8.59,4.76L7.11,3.28"/>
+</vector>
diff --git a/res/drawable/ic_settings_enable.xml b/res/drawable/ic_settings_enable.xml
new file mode 100644
index 0000000..560daef
--- /dev/null
+++ b/res/drawable/ic_settings_enable.xml
@@ -0,0 +1,25 @@
+<!--
+  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.
+  -->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+  <path
+      android:fillColor="#FF000000"
+      android:pathData="M15.59,10.09L13,12.67V2h-2v10.67l-2.59,-2.58L7,11.5l5,5l5,-5L15.59,10.09zM15,2.46v2.13c2.93,1.19 5,4.06 5,7.41c0,4.41 -3.59,8 -8,8s-8,-3.59 -8,-8c0,-3.35 2.07,-6.22 5,-7.41V2.46C4.94,3.74 2,7.53 2,12c0,5.52 4.48,10 10,10s10,-4.48 10,-10C22,7.53 19.06,3.74 15,2.46z"/>
+</vector>
diff --git a/res/drawable/ic_settings_phone_idle.xml b/res/drawable/ic_settings_phone_idle.xml
new file mode 100644
index 0000000..7bb6c31
--- /dev/null
+++ b/res/drawable/ic_settings_phone_idle.xml
@@ -0,0 +1,25 @@
+<!--
+  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.
+  -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="48dp"
+    android:height="48dp"
+    android:viewportWidth="48"
+    android:viewportHeight="48"
+    android:tint="?android:attr/colorControlNormal">
+  <path
+      android:pathData="M14,48h4v-4h-4v4zM22,48h4v-4h-4v4zM26,4h-4v20h4L26,4zM33.13,8.87l-2.89,2.89C33.69,13.87 36,17.66 36,22c0,6.63 -5.37,12 -12,12s-12,-5.37 -12,-12c0,-4.34 2.31,-8.13 5.76,-10.24l-2.89,-2.89C10.72,11.76 8,16.56 8,22c0,8.84 7.16,16 16,16s16,-7.16 16,-16c0,-5.44 -2.72,-10.24 -6.87,-13.13zM30,48h4v-4h-4v4z"
+      android:fillColor="#000000"/>
+</vector>
diff --git a/res/drawable/ic_settings_voice_calls.xml b/res/drawable/ic_settings_voice_calls.xml
new file mode 100644
index 0000000..b455f0a
--- /dev/null
+++ b/res/drawable/ic_settings_voice_calls.xml
@@ -0,0 +1,25 @@
+<!--
+  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.
+  -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="48dp"
+    android:height="48dp"
+    android:viewportWidth="48"
+    android:viewportHeight="48"
+    android:tint="?android:attr/colorControlNormal">
+  <path
+      android:pathData="M40,31c-2.49,0 -4.89,-0.4 -7.14,-1.14 -0.69,-0.22 -1.48,-0.06 -2.03,0.49l-4.4,4.41c-5.67,-2.88 -10.29,-7.51 -13.18,-13.17l4.4,-4.41c0.55,-0.55 0.71,-1.34 0.49,-2.03C17.4,12.9 17,10.49 17,8c0,-1.11 -0.89,-2 -2,-2L8,6c-1.11,0 -2,0.89 -2,2 0,18.78 15.22,34 34,34 1.11,0 2,-0.89 2,-2v-7c0,-1.11 -0.89,-2 -2,-2zM38,24h4c0,-9.94 -8.06,-18 -18,-18v4c7.73,0 14,6.27 14,14zM30,24h4c0,-5.52 -4.48,-10 -10,-10v4c3.31,0 6,2.69 6,6z"
+      android:fillColor="#000000"/>
+</vector>
diff --git a/res/layout-land/choose_lock_pattern.xml b/res/layout-land/choose_lock_pattern.xml
index 1cc4352..5b06f0d 100644
--- a/res/layout-land/choose_lock_pattern.xml
+++ b/res/layout-land/choose_lock_pattern.xml
@@ -44,7 +44,7 @@
             android:orientation="vertical">
 
             <ImageView
-                android:id="@+id/suc_layout_icon"
+                android:id="@+id/sud_layout_icon"
                 style="@style/SudGlifIcon"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
diff --git a/res/layout-land/confirm_lock_pattern_normal.xml b/res/layout-land/confirm_lock_pattern_normal.xml
index 21c9b1e..8bb713f 100644
--- a/res/layout-land/confirm_lock_pattern_normal.xml
+++ b/res/layout-land/confirm_lock_pattern_normal.xml
@@ -40,7 +40,7 @@
                 android:paddingBottom="24dp">
 
                 <ImageView
-                    android:id="@+id/suc_layout_icon"
+                    android:id="@+id/sud_layout_icon"
                     style="@style/SudGlifIcon"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
diff --git a/res/layout-land/fingerprint_enroll_enrolling.xml b/res/layout-land/fingerprint_enroll_enrolling.xml
index ba2c420..734f8a3 100644
--- a/res/layout-land/fingerprint_enroll_enrolling.xml
+++ b/res/layout-land/fingerprint_enroll_enrolling.xml
@@ -49,7 +49,7 @@
                 android:orientation="vertical">
 
                 <ImageView
-                    android:id="@+id/suc_layout_icon"
+                    android:id="@+id/sud_layout_icon"
                     style="@style/SudGlifIcon"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
diff --git a/res/layout-land/fingerprint_enroll_find_sensor.xml b/res/layout-land/fingerprint_enroll_find_sensor.xml
index 28d982e..6d8794a 100644
--- a/res/layout-land/fingerprint_enroll_find_sensor.xml
+++ b/res/layout-land/fingerprint_enroll_find_sensor.xml
@@ -55,7 +55,7 @@
                     android:clipToPadding="false">
 
                     <ImageView
-                        android:id="@+id/suc_layout_icon"
+                        android:id="@+id/sud_layout_icon"
                         style="@style/SudGlifIcon"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
diff --git a/res/layout-land/fingerprint_enroll_finish.xml b/res/layout-land/fingerprint_enroll_finish.xml
index 7d292c6..e80176d 100644
--- a/res/layout-land/fingerprint_enroll_finish.xml
+++ b/res/layout-land/fingerprint_enroll_finish.xml
@@ -45,7 +45,7 @@
                 android:orientation="vertical">
 
                 <ImageView
-                    android:id="@+id/suc_layout_icon"
+                    android:id="@+id/sud_layout_icon"
                     style="@style/SudGlifIcon"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
diff --git a/res/layout/choose_lock_pattern_common.xml b/res/layout/choose_lock_pattern_common.xml
index 2ebcd9b..5d3cbca 100644
--- a/res/layout/choose_lock_pattern_common.xml
+++ b/res/layout/choose_lock_pattern_common.xml
@@ -41,7 +41,7 @@
             android:orientation="vertical">
 
             <ImageView
-                android:id="@+id/suc_layout_icon"
+                android:id="@+id/sud_layout_icon"
                 style="@style/SudGlifIcon"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
diff --git a/res/layout/confirm_lock_pattern_normal_base.xml b/res/layout/confirm_lock_pattern_normal_base.xml
index a08d516..03d3367 100644
--- a/res/layout/confirm_lock_pattern_normal_base.xml
+++ b/res/layout/confirm_lock_pattern_normal_base.xml
@@ -33,7 +33,7 @@
             android:orientation="vertical">
 
             <ImageView
-                android:id="@+id/suc_layout_icon"
+                android:id="@+id/sud_layout_icon"
                 style="@style/SudGlifIcon"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
diff --git a/res/layout/encryption_interstitial.xml b/res/layout/encryption_interstitial.xml
index 3e227cb1..a2305f8 100644
--- a/res/layout/encryption_interstitial.xml
+++ b/res/layout/encryption_interstitial.xml
@@ -17,7 +17,6 @@
 
 <com.google.android.setupdesign.GlifLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:icon="@drawable/ic_lock">
diff --git a/res/layout/face_enroll_enrolling.xml b/res/layout/face_enroll_enrolling.xml
index e7af493..7e1863b 100644
--- a/res/layout/face_enroll_enrolling.xml
+++ b/res/layout/face_enroll_enrolling.xml
@@ -17,7 +17,6 @@
 
 <com.google.android.setupdesign.GlifLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/setup_wizard_layout"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
diff --git a/res/layout/face_enroll_finish.xml b/res/layout/face_enroll_finish.xml
index 62176a7..d3c0479 100644
--- a/res/layout/face_enroll_finish.xml
+++ b/res/layout/face_enroll_finish.xml
@@ -17,7 +17,6 @@
 
 <com.google.android.setupdesign.GlifLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/setup_wizard_layout"
     style="?attr/face_layout_theme"
     android:layout_width="match_parent"
diff --git a/res/layout/fingerprint_enroll_enrolling_base.xml b/res/layout/fingerprint_enroll_enrolling_base.xml
index 3a476fa..eed6fab 100644
--- a/res/layout/fingerprint_enroll_enrolling_base.xml
+++ b/res/layout/fingerprint_enroll_enrolling_base.xml
@@ -17,7 +17,6 @@
 
 <com.google.android.setupdesign.GlifLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/setup_wizard_layout"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
diff --git a/res/layout/fingerprint_enroll_find_sensor_base.xml b/res/layout/fingerprint_enroll_find_sensor_base.xml
index c03ac5a..2bef539 100644
--- a/res/layout/fingerprint_enroll_find_sensor_base.xml
+++ b/res/layout/fingerprint_enroll_find_sensor_base.xml
@@ -17,7 +17,6 @@
 
 <com.google.android.setupdesign.GlifLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/setup_wizard_layout"
     style="?attr/fingerprint_layout_theme"
     android:layout_width="match_parent"
diff --git a/res/layout/fingerprint_enroll_finish_base.xml b/res/layout/fingerprint_enroll_finish_base.xml
index 2fa5da6..d85c56c 100644
--- a/res/layout/fingerprint_enroll_finish_base.xml
+++ b/res/layout/fingerprint_enroll_finish_base.xml
@@ -17,7 +17,6 @@
 
 <com.google.android.setupdesign.GlifLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/setup_wizard_layout"
     style="?attr/fingerprint_layout_theme"
     android:layout_width="match_parent"
diff --git a/res/layout/fingerprint_enroll_introduction.xml b/res/layout/fingerprint_enroll_introduction.xml
index 4ee7057..47d2f02 100644
--- a/res/layout/fingerprint_enroll_introduction.xml
+++ b/res/layout/fingerprint_enroll_introduction.xml
@@ -17,7 +17,6 @@
 
 <com.google.android.setupdesign.GlifLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
     style="?attr/fingerprint_layout_theme"
     android:id="@+id/setup_wizard_layout"
     android:layout_width="match_parent"
diff --git a/res/layout/storage_wizard_generic.xml b/res/layout/storage_wizard_generic.xml
index 2b96101..e7881d3 100644
--- a/res/layout/storage_wizard_generic.xml
+++ b/res/layout/storage_wizard_generic.xml
@@ -16,7 +16,6 @@
 
 <com.google.android.setupdesign.GlifLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/setup_wizard_layout"
     android:layout_width="match_parent"
     android:layout_height="match_parent">
diff --git a/res/layout/storage_wizard_init.xml b/res/layout/storage_wizard_init.xml
index d02e871..8d9870f 100644
--- a/res/layout/storage_wizard_init.xml
+++ b/res/layout/storage_wizard_init.xml
@@ -16,7 +16,6 @@
 
 <com.google.android.setupdesign.GlifLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/setup_wizard_layout"
     android:layout_width="match_parent"
     android:layout_height="match_parent">
diff --git a/res/layout/storage_wizard_progress.xml b/res/layout/storage_wizard_progress.xml
index cf5bc43..577ec3c 100644
--- a/res/layout/storage_wizard_progress.xml
+++ b/res/layout/storage_wizard_progress.xml
@@ -16,7 +16,6 @@
 
 <com.google.android.setupdesign.GlifLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/setup_wizard_layout"
     android:layout_width="match_parent"
     android:layout_height="match_parent">
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 25a85e8..11281c2 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -7428,7 +7428,7 @@
     <string name="zen_mode_behavior_settings_title">Exceptions</string>
 
     <!-- Do not disturb: Title for the dnd duration setting (user can specify how long dnd will last when toggling dnd on from qs or settings) [CHAR LIMIT=30] -->
-    <string name="zen_mode_duration_settings_title">Duration</string>
+    <string name="zen_mode_duration_settings_title">Default duration</string>
 
     <!-- Do not disturb: Instructions indicating what types of sounds can bypass DND. [CHAR LIMIT=52] -->
     <string name="zen_mode_behavior_allow_title">Allow sounds and vibrations from</string>
@@ -10924,7 +10924,7 @@
     <!-- Title for the top level Privacy Settings [CHAR LIMIT=30]-->
     <string name="privacy_dashboard_title">Privacy</string>
     <!-- Summary for the top level Privacy Settings [CHAR LIMIT=NONE]-->
-    <string name="privacy_dashboard_summary">Permissions, web activity, personal data</string>
+    <string name="privacy_dashboard_summary">Permissions, account activity, personal data</string>
 
     <!-- Label for button in contextual card for users to remove the card [CHAR LIMIT=30] -->
     <string name="contextual_card_dismiss_remove">Remove</string>
@@ -10955,17 +10955,15 @@
     <string name="permission_bar_chart_empty_text">0 apps used permissions</string>
 
     <!-- Text for permission bar chart title in Privacy page.  [CHAR LIMIT=NONE] -->
-    <string name="permission_bar_chart_title">Most-used permissions in last 24 hours</string>
-    <!-- Text for permission bar chart title in Privacy page.  [CHAR LIMIT=NONE] -->
-    <string name="permission_bar_chart_title_v2">In last 24 hr, apps on this device accessed</string>
+    <string name="permission_bar_chart_title">Permission usage in last 24 hours</string>
 
     <!-- Text for permission bar chart details in Privacy page.  [CHAR LIMIT=NONE] -->
-    <string name="permission_bar_chart_details">View Permissions Dashboard</string>
+    <string name="permission_bar_chart_details">See all in Dashboard</string>
 
-    <!-- Text for permission bar chart details in Privacy page.  [CHAR LIMIT=NONE] -->
-    <string name="permission_bar_chart_details_v2">See all permission usage in Dashboard</string>
-    <!-- Text for permission bar chart details in Privacy page.  [CHAR LIMIT=NONE] -->
-    <string name="permission_bar_chart_details_v3">+ <xliff:g id="permissionCount" example="3">%1$d</xliff:g> other permissions</string>
+    <plurals name="permission_bar_chart_label">
+        <item quantity="one">1 app</item>
+        <item quantity="other"><xliff:g id="number" example="7">%s</xliff:g> apps</item>
+    </plurals>
 
     <!-- Title for the accessibility usage preference in the Privacy page.  [CHAR LIMIT=NONE] -->
     <string name="accessibility_usage_title">Accessibility usage</string>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 8fde9a0..02db995 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -533,4 +533,9 @@
         <item name="android:paddingEnd">8dp</item>
     </style>
 
+    <style name="SetupWizardPartnerResource">
+        <!-- Disable to use partner overlay theme for outside setupwizard flow. -->
+        <item name="sucUsePartnerResource">false</item>
+    </style>
+
 </resources>
diff --git a/res/xml/dark_ui_settings.xml b/res/xml/dark_ui_settings.xml
new file mode 100644
index 0000000..1f11eba
--- /dev/null
+++ b/res/xml/dark_ui_settings.xml
@@ -0,0 +1,24 @@
+<?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:staticPreferenceLocation="append"
+    settings:keywords="@string/keywords_dark_ui_mode">
+</PreferenceScreen >
diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml
index a9af2d4..908529e 100644
--- a/res/xml/development_settings.xml
+++ b/res/xml/development_settings.xml
@@ -36,6 +36,10 @@
             android:dialogTitle="@*android:string/bugreport_title" />
 
         <Preference
+            android:key="system_server_heap_dump"
+            android:title="@string/capture_system_heap_dump_title" />
+
+        <Preference
             android:key="local_backup_password"
             android:title="@string/local_backup_password_title"
             android:summary="@string/local_backup_password_summary_none"
@@ -151,6 +155,11 @@
             android:title="@string/bugreport_in_power"
             android:summary="@string/bugreport_in_power_summary" />
 
+        <SwitchPreference
+            android:key="automatic_system_server_heap_dumps"
+            android:title="@string/automatic_system_heap_dump_title"
+            android:summary="@string/automatic_system_heap_dump_summary" />
+
         <Preference android:key="mock_location_app"
                     android:title="@string/mock_location_app" />
 
diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml
index c4c39e2..940e6de 100644
--- a/res/xml/display_settings.xml
+++ b/res/xml/display_settings.xml
@@ -58,14 +58,13 @@
             android:targetClass="@string/config_wallpaper_picker_class" />
     </com.android.settingslib.RestrictedPreference>
 
-    <ListPreference
+
+    <Preference
         android:key="dark_ui_mode"
+        android:fragment="com.android.settings.display.DarkUISettings"
         android:title="@string/dark_ui_mode"
-        android:dialogTitle="@string/dark_ui_mode_title"
-        android:entries="@array/dark_ui_mode_entries"
-        android:entryValues="@array/dark_ui_mode_values"
-        settings:keywords="@string/keywords_dark_ui_mode"
-        settings:controller="com.android.settings.display.DarkUIPreferenceController" />
+        settings:searchable="false"
+        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
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index 001e65b..92a0f73 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -27,6 +27,7 @@
 import android.content.pm.ActivityInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.res.Resources.Theme;
 import android.os.AsyncTask;
 import android.os.Bundle;
 import android.os.UserHandle;
@@ -334,6 +335,12 @@
     }
 
     @Override
+    protected void onApplyThemeResource(Theme theme, int resid, boolean first) {
+        theme.applyStyle(R.style.SetupWizardPartnerResource, true);
+        super.onApplyThemeResource(theme, resid, first);
+    }
+
+    @Override
     protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
         super.onActivityResult(requestCode, resultCode, data);
         final List<Fragment> fragments = getSupportFragmentManager().getFragments();
diff --git a/src/com/android/settings/accessibility/AccessibilitySettings.java b/src/com/android/settings/accessibility/AccessibilitySettings.java
index b9b9538..4ba605f 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettings.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettings.java
@@ -18,6 +18,8 @@
 
 import static android.os.Vibrator.VibrationIntensity;
 
+import static com.android.settingslib.TwoTargetPreference.ICON_SIZE_MEDIUM;
+
 import android.accessibilityservice.AccessibilityServiceInfo;
 import android.app.admin.DevicePolicyManager;
 import android.app.settings.SettingsEnums;
@@ -594,6 +596,7 @@
             preference.setKey(componentName.flattenToString());
 
             preference.setTitle(title);
+            preference.setIconSize(ICON_SIZE_MEDIUM);
             Utils.setSafeIcon(preference, icon);
             final boolean serviceEnabled = enabledServices.contains(componentName);
             String description = info.loadDescription(getPackageManager());
diff --git a/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizard.java b/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizard.java
index 46a6371..16f5fcd 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizard.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizard.java
@@ -23,13 +23,19 @@
 import android.content.pm.ServiceInfo;
 import android.os.Bundle;
 import android.text.TextUtils;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
 import android.view.accessibility.AccessibilityManager;
 
 import androidx.preference.Preference;
+import androidx.recyclerview.widget.RecyclerView;
 
 import com.android.settings.R;
 import com.android.settings.SettingsPreferenceFragment;
 
+import com.google.android.setupdesign.GlifPreferenceLayout;
+
 import java.util.List;
 
 /**
@@ -64,6 +70,23 @@
     }
 
     @Override
+    public void onViewCreated(View view, Bundle savedInstanceState) {
+        super.onViewCreated(view, savedInstanceState);
+
+        GlifPreferenceLayout layout = (GlifPreferenceLayout) view;
+        layout.setDividerInsets(Integer.MAX_VALUE, 0);
+
+        layout.setHeaderText(R.string.vision_settings_title);
+    }
+
+    @Override
+    public RecyclerView onCreateRecyclerView(LayoutInflater inflater, ViewGroup parent,
+        Bundle savedInstanceState) {
+        GlifPreferenceLayout layout = (GlifPreferenceLayout) parent;
+        return layout.onCreateRecyclerView(inflater, parent, savedInstanceState);
+    }
+
+    @Override
     public void onCreate(Bundle icicle) {
         super.onCreate(icicle);
         addPreferencesFromResource(R.xml.accessibility_settings_for_setup_wizard);
diff --git a/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizardActivity.java b/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizardActivity.java
index 9512f01..fc68d2c 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizardActivity.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizardActivity.java
@@ -34,14 +34,6 @@
     private static final String SAVE_KEY_TITLE = "activity_title";
 
     @Override
-    protected void onCreate(Bundle savedState) {
-        super.onCreate(savedState);
-
-        // Finish configuring the content view.
-        getActionBar().setDisplayHomeAsUpEnabled(true);
-    }
-
-    @Override
     protected void onSaveInstanceState(Bundle savedState) {
         savedState.putCharSequence(SAVE_KEY_TITLE, getTitle());
         super.onSaveInstanceState(savedState);
diff --git a/src/com/android/settings/applications/appinfo/AppButtonsPreferenceController.java b/src/com/android/settings/applications/appinfo/AppButtonsPreferenceController.java
index e118ed6..d9ddc2f 100644
--- a/src/com/android/settings/applications/appinfo/AppButtonsPreferenceController.java
+++ b/src/com/android/settings/applications/appinfo/AppButtonsPreferenceController.java
@@ -560,15 +560,15 @@
                 || isSystemPackage(mActivity.getResources(), mPm, mPackageInfo)) {
             // Disable button for core system applications.
             mButtonsPref.setButton2Text(R.string.disable_text)
-                    .setButton2Icon(R.drawable.ic_settings_delete);
+                    .setButton2Icon(R.drawable.ic_settings_disable);
         } else if (mAppEntry.info.enabled && !isDisabledUntilUsed()) {
             mButtonsPref.setButton2Text(R.string.disable_text)
-                    .setButton2Icon(R.drawable.ic_settings_delete);
+                    .setButton2Icon(R.drawable.ic_settings_disable);
             disableable = !mApplicationFeatureProvider.getKeepEnabledPackages()
                     .contains(mAppEntry.info.packageName);
         } else {
             mButtonsPref.setButton2Text(R.string.enable_text)
-                    .setButton2Icon(R.drawable.ic_settings_install);
+                    .setButton2Icon(R.drawable.ic_settings_enable);
             disableable = true;
         }
 
diff --git a/src/com/android/settings/biometrics/BiometricEnrollBase.java b/src/com/android/settings/biometrics/BiometricEnrollBase.java
index 9c9f4fa..a961921 100644
--- a/src/com/android/settings/biometrics/BiometricEnrollBase.java
+++ b/src/com/android/settings/biometrics/BiometricEnrollBase.java
@@ -21,6 +21,7 @@
 import android.annotation.Nullable;
 import android.content.Intent;
 import android.content.res.Resources;
+import android.content.res.Resources.Theme;
 import android.graphics.Color;
 import android.os.Bundle;
 import android.os.UserHandle;
@@ -97,6 +98,7 @@
     @Override
     protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
         resid = SetupWizardUtils.getTheme(getIntent());
+        theme.applyStyle(R.style.SetupWizardPartnerResource, true);
         super.onApplyThemeResource(theme, resid, first);
     }
 
diff --git a/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java b/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java
index 2c4db1f..1d2d793 100644
--- a/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java
+++ b/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java
@@ -62,6 +62,7 @@
     @VisibleForTesting
     final Map<String, Bitmap> mIconCache;
     private CachedBluetoothDevice mCachedDevice;
+    private BluetoothDevice mBluetoothDevice;
     @VisibleForTesting
     BluetoothAdapter mBluetoothAdapter;
     @VisibleForTesting
@@ -102,6 +103,9 @@
 
     @Override
     public void onStart() {
+        if (!isAvailable()) {
+            return;
+        }
         mCachedDevice.registerCallback(this::onDeviceAttributesChanged);
         mBluetoothAdapter.registerMetadataListener(mCachedDevice.getDevice(), mMetadataListener,
                 mHandler);
@@ -109,6 +113,9 @@
 
     @Override
     public void onStop() {
+        if (!isAvailable()) {
+            return;
+        }
         mCachedDevice.unregisterCallback(this::onDeviceAttributesChanged);
         mBluetoothAdapter.unregisterMetadataListener(mCachedDevice.getDevice());
 
@@ -123,6 +130,7 @@
 
     public void init(CachedBluetoothDevice cachedBluetoothDevice) {
         mCachedDevice = cachedBluetoothDevice;
+        mBluetoothDevice = mCachedDevice.getDevice();
     }
 
     @VisibleForTesting
diff --git a/src/com/android/settings/core/HideNonSystemOverlayMixin.java b/src/com/android/settings/core/HideNonSystemOverlayMixin.java
index 59cef3b..4b8975d 100644
--- a/src/com/android/settings/core/HideNonSystemOverlayMixin.java
+++ b/src/com/android/settings/core/HideNonSystemOverlayMixin.java
@@ -22,9 +22,11 @@
 import static androidx.lifecycle.Lifecycle.Event.ON_STOP;
 
 import android.app.Activity;
+import android.os.Build;
 import android.view.Window;
 import android.view.WindowManager;
 
+import androidx.annotation.VisibleForTesting;
 import androidx.lifecycle.LifecycleObserver;
 import androidx.lifecycle.OnLifecycleEvent;
 
@@ -41,9 +43,14 @@
         mActivity = activity;
     }
 
+    @VisibleForTesting
+    boolean isEnabled() {
+        return !Build.IS_DEBUGGABLE;
+    }
+
     @OnLifecycleEvent(ON_START)
     public void onStart() {
-        if (mActivity == null) {
+        if (mActivity == null || !isEnabled()) {
             return;
         }
         mActivity.getWindow().addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
@@ -53,7 +60,7 @@
 
     @OnLifecycleEvent(ON_STOP)
     public void onStop() {
-        if (mActivity == null) {
+        if (mActivity == null || !isEnabled()) {
             return;
         }
         final Window window = mActivity.getWindow();
diff --git a/src/com/android/settings/core/instrumentation/SettingsIntelligenceLogWriter.java b/src/com/android/settings/core/instrumentation/SettingsIntelligenceLogWriter.java
new file mode 100644
index 0000000..9498732
--- /dev/null
+++ b/src/com/android/settings/core/instrumentation/SettingsIntelligenceLogWriter.java
@@ -0,0 +1,190 @@
+/*
+ * 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.core.instrumentation;
+
+import android.app.settings.SettingsEnums;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Handler;
+import android.os.HandlerThread;
+import android.os.Looper;
+import android.os.Process;
+import android.os.UserHandle;
+import android.text.TextUtils;
+import android.text.format.DateUtils;
+import android.util.Log;
+import android.util.Pair;
+
+import androidx.annotation.VisibleForTesting;
+
+import com.android.settings.R;
+import com.android.settings.intelligence.LogProto.SettingsLog;
+import com.android.settings.overlay.FeatureFactory;
+import com.android.settingslib.core.instrumentation.LogWriter;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
+import java.util.LinkedList;
+import java.util.List;
+
+public class SettingsIntelligenceLogWriter implements LogWriter {
+    private static final String TAG = "IntelligenceLogWriter";
+
+    private static final String LOG = "logs";
+    private static final long MESSAGE_DELAY = DateUtils.MINUTE_IN_MILLIS; // 1 minute
+
+    private List<SettingsLog> mSettingsLogList;
+    private SendLogHandler mLogHandler;
+
+    public SettingsIntelligenceLogWriter() {
+        mSettingsLogList = new LinkedList<>();
+        final HandlerThread workerThread = new HandlerThread("SettingsIntelligenceLogWriter",
+                Process.THREAD_PRIORITY_BACKGROUND);
+        workerThread.start();
+        mLogHandler = new SendLogHandler(workerThread.getLooper());
+    }
+
+    @Override
+    public void visible(Context context, int attribution, int pageId) {
+        action(attribution /* attribution */,
+                SettingsEnums.PAGE_VISIBLE /* action */,
+                pageId /* pageId */,
+                "" /* changedPreferenceKey */,
+                0 /* changedPreferenceIntValue */);
+    }
+
+    @Override
+    public void hidden(Context context, int pageId) {
+        action(SettingsEnums.PAGE_UNKNOWN /* attribution */,
+                SettingsEnums.PAGE_HIDE /* action */,
+                pageId /* pageId */,
+                "" /* changedPreferenceKey */,
+                0 /* changedPreferenceIntValue */);
+    }
+
+    @Override
+    public void action(Context context, int action, Pair<Integer, Object>... taggedData) {
+        action(SettingsEnums.PAGE_UNKNOWN /* attribution */,
+                action,
+                SettingsEnums.PAGE_UNKNOWN /* pageId */,
+                "" /* changedPreferenceKey */,
+                0 /* changedPreferenceIntValue */);
+    }
+
+    @Override
+    public void action(Context context, int action, int value) {
+        action(SettingsEnums.PAGE_UNKNOWN /* attribution */,
+                action,
+                SettingsEnums.PAGE_UNKNOWN /* pageId */,
+                "" /* changedPreferenceKey */,
+                value /* changedPreferenceIntValue */);
+    }
+
+    @Override
+    public void action(Context context, int action, boolean value) {
+        action(SettingsEnums.PAGE_UNKNOWN /* attribution */,
+                action,
+                SettingsEnums.PAGE_UNKNOWN /* pageId */,
+                "" /* changedPreferenceKey */,
+                value ? 1 : 0 /* changedPreferenceIntValue */);
+    }
+
+    @Override
+    public void action(Context context, int action, String pkg) {
+        action(SettingsEnums.PAGE_UNKNOWN /* attribution */,
+                action,
+                SettingsEnums.PAGE_UNKNOWN /* pageId */,
+                pkg /* changedPreferenceKey */,
+                1 /* changedPreferenceIntValue */);
+    }
+
+    @Override
+    public void action(int attribution, int action, int pageId, String key, int value) {
+        final ZonedDateTime now = ZonedDateTime.now(ZoneId.systemDefault());
+        final SettingsLog settingsLog = SettingsLog.newBuilder()
+                .setAttribution(attribution)
+                .setAction(action)
+                .setPageId(pageId)
+                .setChangedPreferenceKey(key != null ? key : "")
+                .setChangedPreferenceIntValue(value)
+                .setTimestamp(now.toString())
+                .build();
+        mLogHandler.post(() -> {
+            mSettingsLogList.add(settingsLog);
+        });
+        mLogHandler.scheduleSendLog();
+    }
+
+    @VisibleForTesting
+    static byte[] serialize(List<SettingsLog> settingsLogs) {
+        final int size = settingsLogs.size();
+        final ByteArrayOutputStream bout = new ByteArrayOutputStream();
+        final DataOutputStream output = new DataOutputStream(bout);
+        // Data is "size, length, bytearray, length, bytearray ..."
+        try {
+            output.writeInt(size);
+            for (SettingsLog settingsLog : settingsLogs) {
+                final byte[] data = settingsLog.toByteArray();
+                output.writeInt(data.length);
+                output.write(data);
+            }
+            return bout.toByteArray();
+        } catch (Exception e) {
+            Log.e(TAG, "serialize error", e);
+            return null;
+        } finally {
+            try {
+                output.close();
+            } catch (Exception e) {
+                Log.e(TAG, "close error", e);
+            }
+        }
+    }
+
+    private class SendLogHandler extends Handler {
+
+        public SendLogHandler(Looper looper) {
+            super(looper);
+        }
+
+        public void scheduleSendLog() {
+            removeCallbacks(mSendLogsRunnable);
+            postDelayed(mSendLogsRunnable, MESSAGE_DELAY);
+        }
+    }
+
+    private final Runnable mSendLogsRunnable = () -> {
+        final Context context = FeatureFactory.getAppContext();
+        if (context == null) {
+            Log.e(TAG, "context is null");
+            return;
+        }
+        final String action = context.getString(R.string
+                .config_settingsintelligence_log_action);
+        if (!TextUtils.isEmpty(action) && !mSettingsLogList.isEmpty()) {
+            final Intent intent = new Intent();
+            intent.setPackage(context.getString(R.string
+                    .config_settingsintelligence_package_name));
+            intent.setAction(action);
+            intent.putExtra(LOG, serialize(mSettingsLogList));
+            context.sendBroadcastAsUser(intent, UserHandle.CURRENT);
+            mSettingsLogList.clear();
+        }
+    };
+}
diff --git a/src/com/android/settings/core/instrumentation/SettingsMetricsFeatureProvider.java b/src/com/android/settings/core/instrumentation/SettingsMetricsFeatureProvider.java
index 93a5163..ec05757 100644
--- a/src/com/android/settings/core/instrumentation/SettingsMetricsFeatureProvider.java
+++ b/src/com/android/settings/core/instrumentation/SettingsMetricsFeatureProvider.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.core.instrumentation;
 
+import android.content.Context;
+
 import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
 
 public class SettingsMetricsFeatureProvider extends MetricsFeatureProvider {
@@ -23,5 +25,6 @@
     protected void installLogWriters() {
         super.installLogWriters();
         mLoggerWriters.add(new StatsLogWriter());
+        mLoggerWriters.add(new SettingsIntelligenceLogWriter());
     }
 }
diff --git a/src/com/android/settings/development/AutomaticSystemServerHeapDumpPreferenceController.java b/src/com/android/settings/development/AutomaticSystemServerHeapDumpPreferenceController.java
new file mode 100644
index 0000000..aa76bb8
--- /dev/null
+++ b/src/com/android/settings/development/AutomaticSystemServerHeapDumpPreferenceController.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.development;
+
+import android.content.Context;
+import android.os.Build;
+import android.os.UserManager;
+import android.provider.Settings;
+
+import androidx.preference.Preference;
+import androidx.preference.SwitchPreference;
+
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.development.DeveloperOptionsPreferenceController;
+
+public class AutomaticSystemServerHeapDumpPreferenceController extends
+        DeveloperOptionsPreferenceController implements Preference.OnPreferenceChangeListener,
+        PreferenceControllerMixin {
+
+    private static final String KEY_AUTOMATIC_SYSTEM_SERVER_HEAP_DUMPS =
+            "automatic_system_server_heap_dumps";
+
+    private static final int SETTING_VALUE_OFF = 0;
+    private static final int SETTING_VALUE_ON = 1;
+
+    private final UserManager mUserManager;
+    private final boolean mIsConfigEnabled;
+
+    public AutomaticSystemServerHeapDumpPreferenceController(Context context) {
+        super(context);
+        mIsConfigEnabled = context.getResources().getBoolean(
+                com.android.internal.R.bool.config_debugEnableAutomaticSystemServerHeapDumps);
+        mUserManager = context.getSystemService(UserManager.class);
+    }
+
+    @Override
+    public boolean isAvailable() {
+        return Build.IS_DEBUGGABLE && mIsConfigEnabled
+                && !mUserManager.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES);
+    }
+
+    @Override
+    public String getPreferenceKey() {
+        return KEY_AUTOMATIC_SYSTEM_SERVER_HEAP_DUMPS;
+    }
+
+    @Override
+    public boolean onPreferenceChange(Preference preference, Object newValue) {
+        final boolean isEnabled = (Boolean) newValue;
+        Settings.Secure.putInt(mContext.getContentResolver(),
+                Settings.Global.ENABLE_AUTOMATIC_SYSTEM_SERVER_HEAP_DUMPS,
+                isEnabled ? SETTING_VALUE_ON : SETTING_VALUE_OFF);
+        return true;
+    }
+
+    @Override
+    public void updateState(Preference preference) {
+        final int mode = Settings.Secure.getInt(mContext.getContentResolver(),
+                Settings.Global.ENABLE_AUTOMATIC_SYSTEM_SERVER_HEAP_DUMPS, SETTING_VALUE_ON);
+        ((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
+    }
+
+    @Override
+    protected void onDeveloperOptionsSwitchDisabled() {
+        super.onDeveloperOptionsSwitchDisabled();
+        Settings.Secure.putInt(mContext.getContentResolver(),
+                Settings.Global.ENABLE_AUTOMATIC_SYSTEM_SERVER_HEAP_DUMPS, SETTING_VALUE_OFF);
+        ((SwitchPreference) mPreference).setChecked(false);
+    }
+}
diff --git a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
index adc23a8..e9fc759 100644
--- a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
+++ b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
@@ -404,6 +404,7 @@
         final List<AbstractPreferenceController> controllers = new ArrayList<>();
         controllers.add(new MemoryUsagePreferenceController(context));
         controllers.add(new BugReportPreferenceController(context));
+        controllers.add(new SystemServerHeapDumpPreferenceController(context));
         controllers.add(new LocalBackupPasswordPreferenceController(context));
         controllers.add(new StayAwakePreferenceController(context, lifecycle));
         controllers.add(new HdcpCheckingPreferenceController(context));
@@ -418,6 +419,7 @@
         controllers.add(new ClearAdbKeysPreferenceController(context, fragment));
         controllers.add(new LocalTerminalPreferenceController(context));
         controllers.add(new BugReportInPowerPreferenceController(context));
+        controllers.add(new AutomaticSystemServerHeapDumpPreferenceController(context));
         controllers.add(new MockLocationAppPreferenceController(context, fragment));
         controllers.add(new DebugViewAttributesPreferenceController(context));
         controllers.add(new SelectDebugAppPreferenceController(context, fragment));
diff --git a/src/com/android/settings/development/SystemServerHeapDumpPreferenceController.java b/src/com/android/settings/development/SystemServerHeapDumpPreferenceController.java
new file mode 100644
index 0000000..599162e
--- /dev/null
+++ b/src/com/android/settings/development/SystemServerHeapDumpPreferenceController.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.development;
+
+import android.app.ActivityManager;
+import android.content.Context;
+import android.os.Build;
+import android.os.Handler;
+import android.os.RemoteException;
+import android.os.UserManager;
+import android.util.Log;
+import android.widget.Toast;
+
+import androidx.preference.Preference;
+
+import com.android.settings.R;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.development.DeveloperOptionsPreferenceController;
+
+public class SystemServerHeapDumpPreferenceController extends DeveloperOptionsPreferenceController
+        implements PreferenceControllerMixin {
+
+    private static final String KEY_SYSTEM_SERVER_HEAP_DUMP = "system_server_heap_dump";
+
+    /** How long to keep the preference disabled before re-enabling. */
+    private static final long ENABLE_TIMEOUT_MILLIS = 5000L;
+
+    private final UserManager mUserManager;
+
+    private Handler mHandler;
+
+    public SystemServerHeapDumpPreferenceController(Context context) {
+        super(context);
+
+        mUserManager = context.getSystemService(UserManager.class);
+        mHandler = new Handler();
+    }
+
+    @Override
+    public boolean isAvailable() {
+        return Build.IS_DEBUGGABLE
+                && !mUserManager.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES);
+    }
+
+    @Override
+    public String getPreferenceKey() {
+        return KEY_SYSTEM_SERVER_HEAP_DUMP;
+    }
+
+    @Override
+    public boolean handlePreferenceTreeClick(Preference preference) {
+        if (!KEY_SYSTEM_SERVER_HEAP_DUMP.equals(preference.getKey())) {
+            return false;
+        }
+        try {
+            // Temporarily disable the preference so the user doesn't start two dumps in a row.
+            preference.setEnabled(false);
+            Toast.makeText(mContext, R.string.capturing_system_heap_dump_message,
+                    Toast.LENGTH_SHORT).show();
+            ActivityManager.getService().requestSystemServerHeapDump();
+            mHandler.postDelayed(() -> preference.setEnabled(true), ENABLE_TIMEOUT_MILLIS);
+            return true;
+        } catch (RemoteException e) {
+            Log.e(TAG, "error taking system heap dump", e);
+            Toast.makeText(mContext, R.string.error_capturing_system_heap_dump_message,
+                    Toast.LENGTH_SHORT).show();
+        }
+        return false;
+    }
+}
diff --git a/src/com/android/settings/development/featureflags/FeatureFlagsPreferenceController.java b/src/com/android/settings/development/featureflags/FeatureFlagsPreferenceController.java
index 638c7c1..94636e9 100644
--- a/src/com/android/settings/development/featureflags/FeatureFlagsPreferenceController.java
+++ b/src/com/android/settings/development/featureflags/FeatureFlagsPreferenceController.java
@@ -17,6 +17,7 @@
 package com.android.settings.development.featureflags;
 
 import android.content.Context;
+import android.os.Build;
 import android.util.FeatureFlagUtils;
 
 import androidx.preference.PreferenceGroup;
@@ -39,7 +40,7 @@
 
     @Override
     public int getAvailabilityStatus() {
-        return AVAILABLE;
+        return Build.IS_DEBUGGABLE ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
     }
 
     @Override
diff --git a/src/com/android/settings/deviceinfo/StorageWizardBase.java b/src/com/android/settings/deviceinfo/StorageWizardBase.java
index 48cdeeb..3873389 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardBase.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardBase.java
@@ -24,6 +24,7 @@
 import android.annotation.LayoutRes;
 import android.annotation.NonNull;
 import android.content.Intent;
+import android.content.res.Resources.Theme;
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.os.SystemClock;
@@ -123,6 +124,12 @@
         super.onDestroy();
     }
 
+    @Override
+    protected void onApplyThemeResource(Theme theme, int resid, boolean first) {
+        theme.applyStyle(R.style.SetupWizardPartnerResource, true);
+        super.onApplyThemeResource(theme, resid, first);
+    }
+
     protected FooterButton getBackButton() {
         return mBack;
     }
diff --git a/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceController.java b/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceController.java
index e2f4fae..174cb8c 100644
--- a/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceController.java
@@ -17,11 +17,16 @@
 package com.android.settings.deviceinfo.firmwareversion;
 
 import android.content.Context;
+import android.content.Intent;
 import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
 import android.text.TextUtils;
 import android.util.FeatureFlagUtils;
 import android.util.Log;
 
+import androidx.annotation.VisibleForTesting;
+import androidx.preference.Preference;
+
 import com.android.settings.core.BasePreferenceController;
 import com.android.settings.core.FeatureFlags;
 
@@ -29,6 +34,9 @@
 
     private static final String TAG = "MainlineModuleControl";
 
+    @VisibleForTesting
+    static final Intent MODULE_UPDATE_INTENT =
+            new Intent("android.settings.MODULE_UPDATE_SETTINGS");
     private final PackageManager mPackageManager;
 
     private String mModuleVersion;
@@ -66,6 +74,20 @@
     }
 
     @Override
+    public void updateState(Preference preference) {
+        super.updateState(preference);
+
+        // Confirm MODULE_UPDATE_INTENT is handleable, and set it to Preference.
+        final ResolveInfo resolved =
+                mPackageManager.resolveActivity(MODULE_UPDATE_INTENT, 0 /* flags */);
+        if (resolved != null) {
+            preference.setIntent(MODULE_UPDATE_INTENT);
+        } else {
+            preference.setIntent(null);
+        }
+    }
+
+    @Override
     public CharSequence getSummary() {
         return mModuleVersion;
     }
diff --git a/src/com/android/settings/display/DarkUIPreferenceController.java b/src/com/android/settings/display/DarkUIPreferenceController.java
index 21af603..7d8fd56 100644
--- a/src/com/android/settings/display/DarkUIPreferenceController.java
+++ b/src/com/android/settings/display/DarkUIPreferenceController.java
@@ -27,8 +27,7 @@
 import com.android.settings.R;
 import com.android.settings.core.BasePreferenceController;
 
-public class DarkUIPreferenceController extends BasePreferenceController
-        implements Preference.OnPreferenceChangeListener {
+public class DarkUIPreferenceController extends BasePreferenceController {
 
     private UiModeManager mUiModeManager;
 
@@ -48,58 +47,8 @@
     }
 
     @Override
-    public void displayPreference(PreferenceScreen screen) {
-        super.displayPreference(screen);
-        int value = mUiModeManager.getNightMode();
-        ListPreference preference = screen.findPreference(getPreferenceKey());
-        preference.setValue(modeToString(value));
-    }
-
-    @Override
-    public boolean onPreferenceChange(Preference preference, Object newValue) {
-        mUiModeManager.setNightMode(modeToInt((String) newValue));
-        refreshSummary(preference);
-        return true;
-    }
-
-    @Override
     public CharSequence getSummary() {
-        return modeToDescription(mUiModeManager.getNightMode());
-    }
-
-    private String modeToDescription(int mode) {
-        String[] values = mContext.getResources().getStringArray(R.array.dark_ui_mode_entries);
-        switch (mode) {
-            case UiModeManager.MODE_NIGHT_YES:
-                return values[0];
-            case UiModeManager.MODE_NIGHT_NO:
-            case UiModeManager.MODE_NIGHT_AUTO:
-            default:
-                return values[1];
-
-        }
-    }
-
-    private String modeToString(int mode) {
-        switch (mode) {
-            case UiModeManager.MODE_NIGHT_YES:
-                return "yes";
-            case UiModeManager.MODE_NIGHT_NO:
-            case UiModeManager.MODE_NIGHT_AUTO:
-            default:
-                return "no";
-
-        }
-    }
-
-    private int modeToInt(String mode) {
-        switch (mode) {
-            case "yes":
-                return UiModeManager.MODE_NIGHT_YES;
-            case "no":
-            case "auto":
-            default:
-                return UiModeManager.MODE_NIGHT_NO;
-        }
+        return DarkUISettingsRadioButtonsController.modeToDescription(
+                mContext, mUiModeManager.getNightMode());
     }
 }
diff --git a/src/com/android/settings/display/DarkUISettings.java b/src/com/android/settings/display/DarkUISettings.java
new file mode 100644
index 0000000..50fd386
--- /dev/null
+++ b/src/com/android/settings/display/DarkUISettings.java
@@ -0,0 +1,145 @@
+/*
+ * 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;
+
+import android.app.UiModeManager;
+import android.app.settings.SettingsEnums;
+import android.content.Context;
+import android.graphics.drawable.Drawable;
+import android.provider.SearchIndexableResource;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceScreen;
+import com.android.settings.R;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settings.search.Indexable;
+import com.android.settings.widget.RadioButtonPickerFragment;
+import com.android.settingslib.search.SearchIndexable;
+import com.android.settingslib.widget.CandidateInfo;
+import com.android.settingslib.widget.FooterPreference;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * The screen for selecting the dark theme preference for this device. Automatically updates
+ * the associated footer view with any needed information.
+ */
+@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
+public class DarkUISettings extends RadioButtonPickerFragment implements Indexable {
+
+  private DarkUISettingsRadioButtonsController mController;
+  private Preference mFooter;
+
+  @Override
+  protected int getPreferenceScreenResId() {
+      return R.xml.dark_ui_settings;
+  }
+
+  @Override
+  public void onAttach(Context context) {
+      super.onAttach(context);
+      // TODO(b/128686189): add illustration once it is ready
+      setIllustration(0, 0);
+      mFooter = new FooterPreference(context);
+      mFooter.setIcon(android.R.color.transparent);
+      mController = new DarkUISettingsRadioButtonsController(context, mFooter);
+  }
+
+  @Override
+  protected List<? extends CandidateInfo> getCandidates() {
+      final Context context = getContext();
+      final List<CandidateInfo> candidates = new ArrayList<>();
+      candidates.add(new DarkUISettingsCandidateInfo(
+              DarkUISettingsRadioButtonsController.modeToDescription(
+                      context, UiModeManager.MODE_NIGHT_YES),
+              /* summary */ null,
+              DarkUISettingsRadioButtonsController.KEY_DARK,
+              /* enabled */ true));
+      candidates.add(new DarkUISettingsCandidateInfo(
+              DarkUISettingsRadioButtonsController.modeToDescription(
+                      context, UiModeManager.MODE_NIGHT_NO),
+              /* summary */ null,
+              DarkUISettingsRadioButtonsController.KEY_LIGHT,
+              /* enabled */ true));
+      return candidates;
+  }
+
+  @Override
+  protected void addStaticPreferences(PreferenceScreen screen) {
+      screen.addPreference(mFooter);
+  }
+
+  @Override
+  protected String getDefaultKey() {
+      return mController.getDefaultKey();
+  }
+
+  @Override
+  protected boolean setDefaultKey(String key) {
+      return mController.setDefaultKey(key);
+  }
+
+  @Override
+  public int getMetricsCategory() {
+      return SettingsEnums.DARK_UI_SETTINGS;
+  }
+
+  static class DarkUISettingsCandidateInfo extends CandidateInfo {
+
+      private final CharSequence mLabel;
+      private final CharSequence mSummary;
+      private final String mKey;
+
+      DarkUISettingsCandidateInfo(CharSequence label, CharSequence summary, String key,
+              boolean enabled) {
+          super(enabled);
+          mLabel = label;
+          mKey = key;
+          mSummary = summary;
+      }
+
+      @Override
+      public CharSequence loadLabel() {
+          return mLabel;
+      }
+
+      @Override
+      public Drawable loadIcon() {
+          return null;
+      }
+
+      @Override
+      public String getKey() {
+          return mKey;
+      }
+
+      public CharSequence getSummary() {
+          return mSummary;
+      }
+  }
+
+  public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+      new BaseSearchIndexProvider() {
+        @Override
+        public List<SearchIndexableResource> getXmlResourcesToIndex(
+            Context context, boolean enabled) {
+          final SearchIndexableResource sir = new SearchIndexableResource(context);
+          sir.xmlResId = R.xml.dark_ui_settings;
+          return Arrays.asList(sir);
+        }
+      };
+}
diff --git a/src/com/android/settings/display/DarkUISettingsRadioButtonsController.java b/src/com/android/settings/display/DarkUISettingsRadioButtonsController.java
new file mode 100644
index 0000000..0fca306
--- /dev/null
+++ b/src/com/android/settings/display/DarkUISettingsRadioButtonsController.java
@@ -0,0 +1,86 @@
+/*
+ * 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;
+
+import android.app.UiModeManager;
+import android.content.Context;
+import androidx.preference.Preference;
+import com.android.settings.R;
+import androidx.annotation.VisibleForTesting;
+
+public class DarkUISettingsRadioButtonsController {
+
+    public static final String KEY_DARK = "key_dark_ui_settings_dark";
+    public static final String KEY_LIGHT = "key_dark_ui_settings_light";
+
+    @VisibleForTesting
+    UiModeManager mManager;
+
+    private Preference mFooter;
+
+    public DarkUISettingsRadioButtonsController(Context context, Preference footer) {
+        mManager = context.getSystemService(UiModeManager.class);
+        mFooter = footer;
+    }
+
+    public String getDefaultKey() {
+        final int mode = mManager.getNightMode();
+        updateFooter();
+        return mode == UiModeManager.MODE_NIGHT_YES ? KEY_DARK : KEY_LIGHT;
+    }
+
+    public boolean setDefaultKey(String key) {
+        switch(key) {
+            case KEY_DARK:
+                mManager.setNightMode(UiModeManager.MODE_NIGHT_YES);
+                break;
+            case KEY_LIGHT:
+                mManager.setNightMode(UiModeManager.MODE_NIGHT_NO);
+                break;
+            default:
+                throw new IllegalStateException(
+                        "Not a valid key for " + this.getClass().getSimpleName() + ": " + key);
+        }
+        updateFooter();
+        return true;
+    }
+
+    public void updateFooter() {
+        final int mode = mManager.getNightMode();
+        switch (mode) {
+            case UiModeManager.MODE_NIGHT_YES:
+                mFooter.setSummary(R.string.dark_ui_settings_dark_summary);
+                break;
+            case UiModeManager.MODE_NIGHT_NO:
+            case UiModeManager.MODE_NIGHT_AUTO:
+            default:
+                mFooter.setSummary(R.string.dark_ui_settings_light_summary);
+        }
+    }
+
+    public static String modeToDescription(Context context, int mode) {
+        final String[] values = context.getResources().getStringArray(R.array.dark_ui_mode_entries);
+        switch (mode) {
+            case UiModeManager.MODE_NIGHT_YES:
+                return values[0];
+            case UiModeManager.MODE_NIGHT_NO:
+            case UiModeManager.MODE_NIGHT_AUTO:
+            default:
+                return values[1];
+        }
+    }
+}
diff --git a/src/com/android/settings/fuelgauge/BatteryEntry.java b/src/com/android/settings/fuelgauge/BatteryEntry.java
index c91cc8f..38ae2b2 100644
--- a/src/com/android/settings/fuelgauge/BatteryEntry.java
+++ b/src/com/android/settings/fuelgauge/BatteryEntry.java
@@ -145,7 +145,7 @@
                 break;
             case CELL:
                 name = context.getResources().getString(R.string.power_cell);
-                iconId = R.drawable.ic_settings_cell_standby;
+                iconId = R.drawable.ic_cellular_1_bar;
                 break;
             case PHONE:
                 name = context.getResources().getString(R.string.power_phone);
@@ -199,11 +199,11 @@
             } break;
             case UNACCOUNTED:
                 name = context.getResources().getString(R.string.power_unaccounted);
-                iconId = R.drawable.ic_power_system;
+                iconId = R.drawable.ic_android;
                 break;
             case OVERCOUNTED:
                 name = context.getResources().getString(R.string.power_overcounted);
-                iconId = R.drawable.ic_power_system;
+                iconId = R.drawable.ic_android;
                 break;
             case CAMERA:
                 name = context.getResources().getString(R.string.power_camera);
diff --git a/src/com/android/settings/homepage/contextualcards/ContextualCardsAdapter.java b/src/com/android/settings/homepage/contextualcards/ContextualCardsAdapter.java
index 241834d..d6df380 100644
--- a/src/com/android/settings/homepage/contextualcards/ContextualCardsAdapter.java
+++ b/src/com/android/settings/homepage/contextualcards/ContextualCardsAdapter.java
@@ -28,6 +28,7 @@
 import androidx.recyclerview.widget.RecyclerView;
 
 import com.android.settings.homepage.contextualcards.conditional.ConditionContextualCardRenderer;
+import com.android.settings.homepage.contextualcards.slices.SwipeDismissalDelegate.DismissalItemTouchHelperListener;
 import com.android.settings.homepage.contextualcards.slices.SliceContextualCardRenderer;
 
 import java.util.ArrayList;
@@ -35,7 +36,7 @@
 import java.util.Map;
 
 public class ContextualCardsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
-        implements ContextualCardUpdateListener {
+        implements ContextualCardUpdateListener, DismissalItemTouchHelperListener {
     static final int SPAN_COUNT = 2;
 
     private static final String TAG = "ContextualCardsAdapter";
@@ -136,4 +137,9 @@
 
         //TODO(b/119465242): flickering conditional cards after collapsing/expanding
     }
+
+    @Override
+    public void onSwiped(int position) {
+
+    }
 }
diff --git a/src/com/android/settings/homepage/contextualcards/ContextualCardsFragment.java b/src/com/android/settings/homepage/contextualcards/ContextualCardsFragment.java
index bd25866..0cf553c 100644
--- a/src/com/android/settings/homepage/contextualcards/ContextualCardsFragment.java
+++ b/src/com/android/settings/homepage/contextualcards/ContextualCardsFragment.java
@@ -27,9 +27,11 @@
 
 import androidx.loader.app.LoaderManager;
 import androidx.recyclerview.widget.GridLayoutManager;
+import androidx.recyclerview.widget.ItemTouchHelper;
 
 import com.android.settings.R;
 import com.android.settings.core.InstrumentedFragment;
+import com.android.settings.homepage.contextualcards.slices.SwipeDismissalDelegate;
 import com.android.settings.overlay.FeatureFactory;
 
 public class ContextualCardsFragment extends InstrumentedFragment implements
@@ -41,6 +43,7 @@
     private GridLayoutManager mLayoutManager;
     private ContextualCardsAdapter mContextualCardsAdapter;
     private ContextualCardManager mContextualCardManager;
+    private ItemTouchHelper mItemTouchHelper;
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
@@ -63,16 +66,20 @@
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
             Bundle savedInstanceState) {
+        final Context context = getContext();
         final View rootView = inflater.inflate(R.layout.settings_homepage, container, false);
         mCardsContainer = rootView.findViewById(R.id.card_container);
         mLayoutManager = new GridLayoutManager(getActivity(), SPAN_COUNT,
                 GridLayoutManager.VERTICAL, false /* reverseLayout */);
         mCardsContainer.setLayoutManager(mLayoutManager);
-        mContextualCardsAdapter = new ContextualCardsAdapter(getContext(),
-                this /* lifecycleOwner */, mContextualCardManager);
+        mContextualCardsAdapter = new ContextualCardsAdapter(context, this /* lifecycleOwner */,
+                mContextualCardManager);
         mCardsContainer.setAdapter(mContextualCardsAdapter);
         mContextualCardManager.setListener(mContextualCardsAdapter);
         mCardsContainer.setListener(this);
+        mItemTouchHelper = new ItemTouchHelper(
+                new SwipeDismissalDelegate(context, mContextualCardsAdapter));
+        mItemTouchHelper.attachToRecyclerView(mCardsContainer);
 
         return rootView;
     }
diff --git a/src/com/android/settings/homepage/contextualcards/conditional/GrayscaleConditionController.java b/src/com/android/settings/homepage/contextualcards/conditional/GrayscaleConditionController.java
index 664707d..341e061 100644
--- a/src/com/android/settings/homepage/contextualcards/conditional/GrayscaleConditionController.java
+++ b/src/com/android/settings/homepage/contextualcards/conditional/GrayscaleConditionController.java
@@ -16,9 +16,12 @@
 
 package com.android.settings.homepage.contextualcards.conditional;
 
+import android.Manifest;
 import android.app.settings.SettingsEnums;
+import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
+import android.content.IntentFilter;
 import android.hardware.display.ColorDisplayManager;
 import android.util.Log;
 
@@ -32,10 +35,15 @@
     static final int ID = Objects.hash("GrayscaleConditionController");
 
     private static final String TAG = "GrayscaleCondition";
+    private static final String ACTION_GRAYSCALE_CHANGED =
+            "android.settings.action.GRAYSCALE_CHANGED";
+    private static final IntentFilter GRAYSCALE_CHANGED_FILTER = new IntentFilter(
+            ACTION_GRAYSCALE_CHANGED);
 
     private final Context mAppContext;
     private final ConditionManager mConditionManager;
     private final ColorDisplayManager mColorDisplayManager;
+    private final Receiver mReceiver;
 
     private Intent mIntent;
 
@@ -43,6 +51,7 @@
         mAppContext = appContext;
         mConditionManager = conditionManager;
         mColorDisplayManager = mAppContext.getSystemService(ColorDisplayManager.class);
+        mReceiver = new Receiver();
     }
 
     @Override
@@ -72,6 +81,7 @@
     public void onActionClick() {
         // Turn off grayscale
         mColorDisplayManager.setSaturationLevel(100 /* staturationLevel */);
+        sendBroadcast();
         mConditionManager.onConditionChanged();
     }
 
@@ -93,11 +103,27 @@
 
     @Override
     public void startMonitoringStateChange() {
-
+        mAppContext.registerReceiver(mReceiver, GRAYSCALE_CHANGED_FILTER,
+                Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS, null /* scheduler */);
     }
 
     @Override
     public void stopMonitoringStateChange() {
+        mAppContext.unregisterReceiver(mReceiver);
+    }
 
+    private void sendBroadcast() {
+        final Intent intent = new Intent();
+        intent.setAction(ACTION_GRAYSCALE_CHANGED);
+        mAppContext.sendBroadcast(intent, Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS);
+    }
+
+    public class Receiver extends BroadcastReceiver {
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            if (ACTION_GRAYSCALE_CHANGED.equals(intent.getAction())) {
+                mConditionManager.onConditionChanged();
+            }
+        }
     }
 }
diff --git a/src/com/android/settings/homepage/contextualcards/slices/SwipeDismissalDelegate.java b/src/com/android/settings/homepage/contextualcards/slices/SwipeDismissalDelegate.java
new file mode 100644
index 0000000..a4186b0
--- /dev/null
+++ b/src/com/android/settings/homepage/contextualcards/slices/SwipeDismissalDelegate.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.homepage.contextualcards.slices;
+
+import android.content.Context;
+import android.graphics.Canvas;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.ItemTouchHelper;
+import androidx.recyclerview.widget.RecyclerView;
+
+public class SwipeDismissalDelegate extends ItemTouchHelper.Callback {
+
+    private static final String TAG = "DismissItemTouchHelper";
+
+    public interface DismissalItemTouchHelperListener {
+        void onSwiped(int position);
+    }
+
+    private final Context mContext;
+    private final DismissalItemTouchHelperListener mListener;
+
+    public SwipeDismissalDelegate(Context context, DismissalItemTouchHelperListener listener) {
+        mContext = context;
+        mListener = listener;
+    }
+
+    @Override
+    public int getMovementFlags(@NonNull RecyclerView recyclerView,
+            @NonNull RecyclerView.ViewHolder viewHolder) {
+        return 0;
+    }
+
+    @Override
+    public boolean onMove(@NonNull RecyclerView recyclerView,
+            @NonNull RecyclerView.ViewHolder viewHolder,
+            @NonNull RecyclerView.ViewHolder target) {
+        return false;
+    }
+
+    @Override
+    public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int direction) {
+        mListener.onSwiped(viewHolder.getAdapterPosition());
+    }
+
+    @Override
+    public void onChildDraw(@NonNull Canvas c, @NonNull RecyclerView recyclerView,
+            @NonNull RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState,
+            boolean isCurrentlyActive) {
+        super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive);
+    }
+}
\ No newline at end of file
diff --git a/src/com/android/settings/inputmethod/UserDictionaryListPreferenceController.java b/src/com/android/settings/inputmethod/UserDictionaryListPreferenceController.java
index 4a409e1..9343493 100644
--- a/src/com/android/settings/inputmethod/UserDictionaryListPreferenceController.java
+++ b/src/com/android/settings/inputmethod/UserDictionaryListPreferenceController.java
@@ -174,7 +174,10 @@
             mScreen.addPreference(createUserDictionaryPreference(null));
         } else {
             for (String locale : localeSet) {
-                mScreen.addPreference(createUserDictionaryPreference(locale));
+                final Preference pref = createUserDictionaryPreference(locale);
+                if (mScreen.findPreference(pref.getKey()) == null) {
+                    mScreen.addPreference(pref);
+                }
             }
         }
     }
diff --git a/src/com/android/settings/password/ChooseLockPattern.java b/src/com/android/settings/password/ChooseLockPattern.java
index d89ad30..e0974fe 100644
--- a/src/com/android/settings/password/ChooseLockPattern.java
+++ b/src/com/android/settings/password/ChooseLockPattern.java
@@ -479,7 +479,7 @@
                     R.layout.choose_lock_pattern, container, false);
             layout.setHeaderText(getActivity().getTitle());
             if (getResources().getBoolean(R.bool.config_lock_pattern_minimal_ui)) {
-                View iconView = layout.findViewById(R.id.suc_layout_icon);
+                View iconView = layout.findViewById(R.id.sud_layout_icon);
                 if (iconView != null) {
                     iconView.setVisibility(View.GONE);
                 }
diff --git a/src/com/android/settings/privacy/PermissionBarChartPreferenceController.java b/src/com/android/settings/privacy/PermissionBarChartPreferenceController.java
index 7c55b51..b47ad9c 100644
--- a/src/com/android/settings/privacy/PermissionBarChartPreferenceController.java
+++ b/src/com/android/settings/privacy/PermissionBarChartPreferenceController.java
@@ -163,12 +163,13 @@
 
         for (int index = 0; index < barViewInfos.length; index++) {
             final RuntimePermissionUsageInfo permissionGroupInfo = usageInfos.get(index);
+            final int count = permissionGroupInfo.getAppAccessCount();
+            final CharSequence permLabel = getPermissionGroupLabel(permissionGroupInfo.getName());
 
             barViewInfos[index] = new BarViewInfo(
-                    getPermissionGroupIcon(permissionGroupInfo.getName()),
-                    permissionGroupInfo.getAppAccessCount(),
-                    R.string.storage_detail_apps,
-                    getPermissionGroupLabel(permissionGroupInfo.getName()));
+                    getPermissionGroupIcon(permissionGroupInfo.getName()), count, permLabel,
+                    mContext.getResources().getQuantityString(R.plurals.permission_bar_chart_label,
+                            count, count), permLabel);
 
             // Set the click listener for each bar view.
             // The listener will navigate user to permission usage app.
diff --git a/src/com/android/settings/widget/RadioButtonPickerFragment.java b/src/com/android/settings/widget/RadioButtonPickerFragment.java
index 591cd21..8861c94 100644
--- a/src/com/android/settings/widget/RadioButtonPickerFragment.java
+++ b/src/com/android/settings/widget/RadioButtonPickerFragment.java
@@ -58,6 +58,9 @@
 
     protected UserManager mUserManager;
     protected int mUserId;
+    private int mIllustrationId;
+    private int mIllustrationPreviewId;
+    private VideoPreference mVideoPreference;
 
     @Override
     public void onAttach(Context context) {
@@ -164,6 +167,9 @@
         final String systemDefaultKey = getSystemDefaultKey();
         final PreferenceScreen screen = getPreferenceScreen();
         screen.removeAll();
+        if (mIllustrationId != 0) {
+            addIllustration(screen);
+        }
         if (!mAppendStaticPreferences) {
             addStaticPreferences(screen);
         }
@@ -241,6 +247,23 @@
         }
     }
 
+    /**
+     * Allows you to set an illustration at the top of this screen. Set the illustration id to 0
+     * if you want to remove the illustration.
+     * @param illustrationId The res id for the raw of the illustration.
+     * @param previewId The res id for the drawable of the illustration
+     */
+    protected void setIllustration(int illustrationId, int previewId) {
+        mIllustrationId = illustrationId;
+        mIllustrationPreviewId = previewId;
+    }
+
+    private void addIllustration(PreferenceScreen screen) {
+        mVideoPreference = new VideoPreference(getContext());
+        mVideoPreference.setVideo(mIllustrationId, mIllustrationPreviewId);
+        screen.addPreference(mVideoPreference);
+    }
+
     protected abstract List<? extends CandidateInfo> getCandidates();
 
     protected abstract String getDefaultKey();
diff --git a/src/com/android/settings/widget/VideoPreference.java b/src/com/android/settings/widget/VideoPreference.java
index fd215d8..2d88673 100644
--- a/src/com/android/settings/widget/VideoPreference.java
+++ b/src/com/android/settings/widget/VideoPreference.java
@@ -55,22 +55,41 @@
     private int mPreviewResource;
     private boolean mViewVisible;
     private Surface mSurface;
+    private int mAnimationId;
+
+    public VideoPreference(Context context) {
+        super(context);
+        mContext = context;
+        initialize(context, null);
+    }
 
     public VideoPreference(Context context, AttributeSet attrs) {
         super(context, attrs);
         mContext = context;
+        initialize(context, attrs);
+    }
+
+    private void initialize(Context context, AttributeSet attrs) {
         TypedArray attributes = context.getTheme().obtainStyledAttributes(
                 attrs,
-                com.android.settings.R.styleable.VideoPreference,
+                R.styleable.VideoPreference,
                 0, 0);
         try {
-            int animation = attributes.getResourceId(R.styleable.VideoPreference_animation, 0);
+            // if these are already set that means they were set dynamically and don't need
+            // to be loaded from xml
+            mAnimationId = mAnimationId == 0
+                ? attributes.getResourceId(R.styleable.VideoPreference_animation, 0)
+                : mAnimationId;
             mVideoPath = new Uri.Builder().scheme(ContentResolver.SCHEME_ANDROID_RESOURCE)
                     .authority(context.getPackageName())
-                    .appendPath(String.valueOf(animation))
+                    .appendPath(String.valueOf(mAnimationId))
                     .build();
-            mPreviewResource = attributes.getResourceId(
-                    R.styleable.VideoPreference_preview, 0);
+            mPreviewResource = mPreviewResource == 0
+                ? attributes.getResourceId(R.styleable.VideoPreference_preview, 0)
+                : mPreviewResource;
+            if (mPreviewResource == 0 && mAnimationId == 0) {
+                return;
+            }
             initMediaPlayer();
             if (mMediaPlayer != null && mMediaPlayer.getDuration() > 0) {
                 setVisible(true);
@@ -103,20 +122,9 @@
 
         imageView.setImageResource(mPreviewResource);
         layout.setAspectRatio(mAspectRadio);
+        updateViewStates(imageView, playButton);
 
-        video.setOnClickListener(v -> {
-            if (mMediaPlayer != null) {
-                if (mMediaPlayer.isPlaying()) {
-                    mMediaPlayer.pause();
-                    playButton.setVisibility(View.VISIBLE);
-                    mVideoPaused = true;
-                } else {
-                    mMediaPlayer.start();
-                    playButton.setVisibility(View.GONE);
-                    mVideoPaused = false;
-                }
-            }
-        });
+        video.setOnClickListener(v -> updateViewStates(imageView, playButton));
 
         video.setSurfaceTextureListener(new TextureView.SurfaceTextureListener() {
             @Override
@@ -161,6 +169,23 @@
         });
     }
 
+    @VisibleForTesting
+    void updateViewStates(ImageView imageView, ImageView playButton) {
+        if (mMediaPlayer != null) {
+            if (mMediaPlayer.isPlaying()) {
+                mMediaPlayer.pause();
+                playButton.setVisibility(View.VISIBLE);
+                imageView.setVisibility(View.VISIBLE);
+                mVideoPaused = true;
+            } else {
+                imageView.setVisibility(View.GONE);
+                playButton.setVisibility(View.GONE);
+                mMediaPlayer.start();
+                mVideoPaused = false;
+            }
+        }
+    }
+
     @Override
     public void onDetached() {
         releaseMediaPlayer();
@@ -178,6 +203,20 @@
         releaseMediaPlayer();
     }
 
+    /**
+     * Sets the video for this preference. If a previous video was set this one will override it
+     * and properly release any resources and re-initialize the preference to play the new video.
+     *
+     * @param videoId The raw res id of the video
+     * @param previewId The drawable res id of the preview image to use if the video fails to load.
+     */
+    public void setVideo(int videoId, int previewId) {
+        mAnimationId = videoId;
+        mPreviewResource = previewId;
+        releaseMediaPlayer();
+        initialize(mContext, null);
+    }
+
     private void initMediaPlayer() {
         if (mMediaPlayer == null) {
             mMediaPlayer = MediaPlayer.create(mContext, mVideoPath);
diff --git a/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java b/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
index 5fc350b..955525d 100644
--- a/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
+++ b/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
@@ -41,6 +41,7 @@
 import android.net.wifi.WifiConfiguration;
 import android.net.wifi.WifiInfo;
 import android.net.wifi.WifiManager;
+import android.os.CountDownTimer;
 import android.os.Handler;
 import android.text.TextUtils;
 import android.util.FeatureFlagUtils;
@@ -84,6 +85,7 @@
 import java.net.Inet6Address;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
+import java.time.Duration;
 import java.util.StringJoiner;
 import java.util.stream.Collectors;
 
@@ -127,6 +129,19 @@
     @VisibleForTesting
     static final String KEY_IPV6_ADDRESSES_PREF = "ipv6_addresses";
 
+    private static final int STATE_NONE = 1;
+    private static final int STATE_ENABLE_WIFI = 2;
+    private static final int STATE_ENABLE_WIFI_FAILED = 3;
+    private static final int STATE_CONNECTING = 4;
+    private static final int STATE_CONNECTED = 5;
+    private static final int STATE_FAILED = 6;
+    private static final int STATE_NOT_IN_RANGE = 7;
+    private static final int STATE_DISCONNECTED = 8;
+    private static final long TIMEOUT = Duration.ofSeconds(10).toMillis();
+
+    // Be static to avoid too much object not be reset.
+    private static CountDownTimer mTimer;
+
     private AccessPoint mAccessPoint;
     private final ConnectivityManager mConnectivityManager;
     private final Fragment mFragment;
@@ -143,6 +158,9 @@
     private final WifiTracker mWifiTracker;
     private final MetricsFeatureProvider mMetricsFeatureProvider;
     private boolean mIsOutOfRange;
+    private boolean mConnected;
+    private int mConnectingState;
+    private WifiManager.ActionListener mConnectListener;
 
     // UI elements - in order of appearance
     private ActionButtonsPreference mButtonsPref;
@@ -182,7 +200,7 @@
                     // fall through
                 case WifiManager.NETWORK_STATE_CHANGED_ACTION:
                 case WifiManager.RSSI_CHANGED_ACTION:
-                    updateNetworkInfo();
+                    refreshPage();
                     break;
             }
         }
@@ -197,7 +215,7 @@
         public void onLinkPropertiesChanged(Network network, LinkProperties lp) {
             if (network.equals(mNetwork) && !lp.equals(mLinkProperties)) {
                 mLinkProperties = lp;
-                updateIpLayerInfo();
+                refreshIpLayerInfo();
             }
         }
 
@@ -224,12 +242,17 @@
                 }
                 mNetworkCapabilities = nc;
                 refreshButtons();
-                updateIpLayerInfo();
+                refreshIpLayerInfo();
             }
         }
 
         @Override
         public void onLost(Network network) {
+            // If support detail page for saved network, should update as disconnect but not exit.
+            if (SavedAccessPointsWifiSettings.usingDetailsFragment(mContext)) {
+                return;
+            }
+
             if (network.equals(mNetwork)) {
                 exitActivity();
             }
@@ -240,13 +263,23 @@
         /** Called when the state of Wifi has changed. */
         public void onWifiStateChanged(int state) {
             Log.d(TAG, "onWifiStateChanged(" + state + ")");
-            // Do nothing.
+            if (mConnectingState == STATE_ENABLE_WIFI && state == WifiManager.WIFI_STATE_ENABLED) {
+                updateConnectingState(STATE_CONNECTING);
+            }
         }
 
         /** Called when the connection state of wifi has changed. */
         public void onConnectedChanged() {
-            Log.d(TAG, "onConnectedChanged");
-            // Do nothing.
+            updateAccessPointFromScannedList();
+            if (mConnected != mAccessPoint.isActive()) {
+                Log.d(TAG, "Connection state changed!");
+                mConnected = mAccessPoint.isActive();
+                if (mAccessPoint.isActive()) {
+                    updateConnectingState(STATE_CONNECTED);
+                } else {
+                    updateConnectingState(STATE_DISCONNECTED);
+                }
+            }
         }
 
         /**
@@ -254,8 +287,7 @@
          * {@link WifiTracker#getAccessPoints()} should be called to get the updated list.
          */
         public void onAccessPointsChanged() {
-            Log.d(TAG, "onAccessPointsChanged");
-            updateNetworkInfo();
+            refreshPage();
         }
     };
 
@@ -314,6 +346,19 @@
         } else {
             mWifiTracker = null;
         }
+        mConnected = mAccessPoint.isActive();
+        mConnectingState = STATE_NONE;
+        mConnectListener = new WifiManager.ActionListener() {
+            @Override
+            public void onSuccess() {
+                // Do nothing
+            }
+
+            @Override
+            public void onFailure(int reason) {
+                updateConnectingState(STATE_FAILED);
+            }
+        };
     }
 
     @Override
@@ -339,10 +384,14 @@
                 .setButton1OnClickListener(view -> forgetNetwork())
                 .setButton2Text(R.string.wifi_sign_in_button_text)
                 .setButton2OnClickListener(view -> signIntoNetwork())
-                .setButton3Text(R.string.share)
-                .setButton3Icon(R.drawable.ic_qrcode_24dp)
-                .setButton3OnClickListener(view -> shareNetwork())
-                .setButton3Visible(WifiDppUtils.isSupportConfiguratorQrCodeGenerator(mAccessPoint));
+                .setButton3Text(R.string.wifi_connect)
+                .setButton3Icon(R.drawable.ic_settings_wireless)
+                .setButton3OnClickListener(view -> connectNetwork())
+                .setButton3Enabled(true)
+                .setButton4Text(R.string.share)
+                .setButton4Icon(R.drawable.ic_qrcode_24dp)
+                .setButton4OnClickListener(view -> shareNetwork())
+                .setButton4Visible(WifiDppUtils.isSupportConfiguratorQrCodeGenerator(mAccessPoint));
 
         mSignalStrengthPref = screen.findPreference(KEY_SIGNAL_STRENGTH_PREF);
         mTxLinkSpeedPref = screen.findPreference(KEY_TX_LINK_SPEED);
@@ -397,14 +446,18 @@
         }
     }
 
+    private void updateNetworkInfo() {
+        mNetwork = mWifiManager.getCurrentNetwork();
+        mLinkProperties = mConnectivityManager.getLinkProperties(mNetwork);
+        mNetworkCapabilities = mConnectivityManager.getNetworkCapabilities(mNetwork);
+    }
+
     @Override
     public void onResume() {
         // Ensure mNetwork is set before any callbacks above are delivered, since our
         // NetworkCallback only looks at changes to mNetwork.
-        mNetwork = mWifiManager.getCurrentNetwork();
-        mLinkProperties = mConnectivityManager.getLinkProperties(mNetwork);
-        mNetworkCapabilities = mConnectivityManager.getNetworkCapabilities(mNetwork);
         updateNetworkInfo();
+        refreshPage();
         mContext.registerReceiver(mReceiver, mFilter);
         mConnectivityManager.registerNetworkCallback(mNetworkRequest, mNetworkCallback,
                 mHandler);
@@ -421,11 +474,13 @@
         mConnectivityManager.unregisterNetworkCallback(mNetworkCallback);
     }
 
-    private void updateNetworkInfo() {
+    private void refreshPage() {
         if(!updateAccessPoint()) {
             return;
         }
 
+        Log.d(TAG, "Update UI!");
+
         // refresh header
         refreshEntityHeader();
 
@@ -441,26 +496,37 @@
         // Receive Link Speed Pref
         refreshRxSpeed();
         // IP related information
-        updateIpLayerInfo();
+        refreshIpLayerInfo();
         // MAC Address Pref
         refreshMacAddress();
-
     }
 
     private boolean updateAccessPoint() {
         boolean changed = false;
         if (mWifiTracker != null) {
+            // remember mIsOutOfRange as old before updated
+            boolean oldState = mIsOutOfRange;
             updateAccessPointFromScannedList();
             // refresh UI if signal level changed for disconnect network.
             changed = mRssiSignalLevel != mAccessPoint.getLevel();
+            changed |= oldState != mIsOutOfRange;
         }
 
         if (mAccessPoint.isActive()) {
-            // No need to fetch LinkProperties and NetworkCapabilities, they are updated by the
-            // callbacks. mNetwork doesn't change except in onResume.
+            // Sometimes {@link WifiManager#getCurrentNetwork()} return null after connected,
+            // refresh it if needed.
+            if (mNetwork == null) {
+                updateNetworkInfo();
+            }
             mNetworkInfo = mConnectivityManager.getNetworkInfo(mNetwork);
             mWifiInfo = mWifiManager.getConnectionInfo();
             if (mNetwork == null || mNetworkInfo == null || mWifiInfo == null) {
+                // Once connected, can't get mNetworkInfo immediately, return false and wait for
+                // next time to update UI.
+                if (SavedAccessPointsWifiSettings.usingDetailsFragment(mContext)) {
+                    return false;
+                }
+
                 exitActivity();
                 return false;
             }
@@ -474,6 +540,8 @@
     }
 
     private void updateAccessPointFromScannedList() {
+        if (mWifiTracker == null) return;
+
         mIsOutOfRange = true;
 
         if (mAccessPoint.getConfig() == null) {
@@ -484,7 +552,7 @@
             if (ap.getConfig() != null
                     && mAccessPoint.matches(ap.getConfig())) {
                 mAccessPoint = ap;
-                mIsOutOfRange = false;
+                mIsOutOfRange = !mAccessPoint.isReachable();
                 return;
             }
         }
@@ -543,6 +611,11 @@
             band = mContext.getResources().getString(R.string.wifi_band_5ghz);
         } else {
             Log.e(TAG, "Unexpected frequency " + frequency);
+            // Connecting state is unstable, make it disappeared if unexpected
+            if (mConnectingState == STATE_CONNECTING) {
+                mFrequencyPref.setVisible(false);
+            }
+            return;
         }
         mFrequencyPref.setSummary(band);
         mFrequencyPref.setVisible(true);
@@ -616,12 +689,21 @@
     private void refreshButtons() {
         mButtonsPref.setButton1Visible(canForgetNetwork());
         mButtonsPref.setButton2Visible(canSignIntoNetwork());
-        mButtonsPref.setButton3Visible(canShareNetwork());
-        mButtonsPref.setVisible(
-                canSignIntoNetwork() || canForgetNetwork() || canShareNetwork());
+        mButtonsPref.setButton3Visible(canConnectNetwork());
+        mButtonsPref.setButton4Visible(canShareNetwork());
+        mButtonsPref.setVisible(canSignIntoNetwork()
+                || canForgetNetwork()
+                || canShareNetwork()
+                || canConnectNetwork());
     }
 
-    private void updateIpLayerInfo() {
+    private boolean canConnectNetwork() {
+        // Display connect button for disconnected AP even not in the range.
+        return SavedAccessPointsWifiSettings.usingDetailsFragment(mContext)
+                && !mAccessPoint.isActive();
+    }
+
+    private void refreshIpLayerInfo() {
         // Hide IP layer info if not a connected network.
         if (!mAccessPoint.isActive() || mNetwork == null || mLinkProperties == null) {
             mIpAddressPref.setVisible(false);
@@ -823,4 +905,169 @@
     private boolean usingDataUsageHeader(Context context) {
         return FeatureFlagUtils.isEnabled(context, FeatureFlags.WIFI_DETAILS_DATAUSAGE_HEADER);
     }
+
+    private void connectNetwork() {
+        final Activity activity = mFragment.getActivity();
+        // error handling, connected/saved network should have mWifiConfig.
+        if (mWifiConfig == null) {
+            Toast.makeText(activity,
+                    R.string.wifi_failed_connect_message,
+                    Toast.LENGTH_SHORT).show();
+            return;
+        }
+
+        // init state before connect
+        mConnectingState = STATE_NONE;
+
+        if (mWifiManager.isWifiEnabled()) {
+            updateConnectingState(STATE_CONNECTING);
+        } else {
+            // Enable Wi-Fi automatically to connect AP
+            updateConnectingState(STATE_ENABLE_WIFI);
+        }
+    }
+
+    private void updateConnectingState(int state) {
+        final Activity activity = mFragment.getActivity();
+        Log.d(TAG, "updateConnectingState from " + mConnectingState + " to " + state);
+        switch (mConnectingState) {
+            case STATE_NONE:
+            case STATE_ENABLE_WIFI:
+                if (state == STATE_ENABLE_WIFI) {
+                    Log.d(TAG, "Turn on Wi-Fi automatically!");
+                    updateConnectedButton(STATE_ENABLE_WIFI);
+                    Toast.makeText(activity,
+                            R.string.wifi_turned_on_message,
+                            Toast.LENGTH_SHORT).show();
+                    mWifiManager.setWifiEnabled(true);
+                    // start timer for error handling
+                    startTimer();
+                } else if (state == STATE_CONNECTING) {
+                    Log.d(TAG, "connecting...");
+                    updateConnectedButton(STATE_CONNECTING);
+                    mWifiManager.connect(mWifiConfig.networkId, mConnectListener);
+                    // start timer for error handling since framework didn't call back if failed
+                    startTimer();
+                } else if (state == STATE_ENABLE_WIFI_FAILED) {
+                    Log.e(TAG, "Wi-Fi failed to enable network!");
+                    stopTimer();
+                    // reset state
+                    state = STATE_NONE;
+                    Toast.makeText(activity,
+                            R.string.wifi_failed_connect_message,
+                            Toast.LENGTH_SHORT).show();
+                    updateConnectedButton(STATE_ENABLE_WIFI_FAILED);
+                }
+                // Do not break here for disconnected event.
+            case STATE_CONNECTED:
+                if (state == STATE_DISCONNECTED) {
+                    Log.d(TAG, "disconnected");
+                    // reset state
+                    state = STATE_NONE;
+                    updateConnectedButton(STATE_DISCONNECTED);
+                    refreshPage();
+                    // clear for getting MAC Address from saved configuration
+                    mWifiInfo = null;
+                }
+                break;
+            case STATE_CONNECTING:
+                if (state == STATE_CONNECTED) {
+                    Log.d(TAG, "connected");
+                    stopTimer();
+                    updateConnectedButton(STATE_CONNECTED);
+                    Toast.makeText(activity,
+                            mContext.getString(R.string.wifi_connected_to_message,
+                                    mAccessPoint.getTitle()),
+                            Toast.LENGTH_SHORT).show();
+
+                    updateNetworkInfo();
+                    refreshPage();
+                } else if (state == STATE_NOT_IN_RANGE) {
+                    Log.d(TAG, "AP not in range");
+                    stopTimer();
+                    // reset state
+                    state = STATE_NONE;
+                    Toast.makeText(activity,
+                            R.string.wifi_not_in_range_message,
+                            Toast.LENGTH_SHORT).show();
+                    updateConnectedButton(STATE_NOT_IN_RANGE);
+                } else if (state == STATE_FAILED) {
+                    Log.d(TAG, "failed");
+                    stopTimer();
+                    // reset state
+                    state = STATE_NONE;
+                    Toast.makeText(activity,
+                            R.string.wifi_failed_connect_message,
+                            Toast.LENGTH_SHORT).show();
+                    updateConnectedButton(STATE_FAILED);
+                }
+                break;
+            default:
+                Log.e(TAG, "Invalid state : " + mConnectingState);
+                // don't update invalid state
+                return;
+        }
+
+        mConnectingState = state;
+    }
+
+    private void updateConnectedButton(int state) {
+        switch (state) {
+            case STATE_ENABLE_WIFI:
+            case STATE_CONNECTING:
+                mButtonsPref.setButton3Text(R.string.wifi_connecting)
+                        .setButton3Enabled(false);
+                break;
+            case STATE_CONNECTED:
+                mButtonsPref.setButton3Visible(false);
+                break;
+            case STATE_DISCONNECTED:
+            case STATE_NOT_IN_RANGE:
+            case STATE_FAILED:
+            case STATE_ENABLE_WIFI_FAILED:
+                mButtonsPref.setButton3Text(R.string.wifi_connect)
+                        .setButton3Icon(R.drawable.ic_settings_wireless)
+                        .setButton3Enabled(true)
+                        .setButton3Visible(true);
+                break;
+            default:
+                Log.e(TAG, "Invalid connect button state : " + state);
+                break;
+        }
+    }
+
+    private void startTimer() {
+        if (mTimer != null) {
+            stopTimer();
+        }
+
+        mTimer = new CountDownTimer(TIMEOUT, TIMEOUT + 1) {
+            @Override
+            public void onTick(long millisUntilFinished) {
+                // Do nothing
+            }
+            @Override
+            public void onFinish() {
+                Log.e(TAG, "Timeout for state:" + mConnectingState);
+                if (mConnectingState == STATE_ENABLE_WIFI) {
+                    updateConnectingState(STATE_ENABLE_WIFI_FAILED);
+                } else if (mConnectingState == STATE_CONNECTING) {
+                    updateAccessPointFromScannedList();
+                    if (mIsOutOfRange) {
+                        updateConnectingState(STATE_NOT_IN_RANGE);
+                    } else {
+                        updateConnectingState(STATE_FAILED);
+                    }
+                }
+            }
+        };
+        mTimer.start();
+    }
+
+    private void stopTimer() {
+        if (mTimer == null) return;
+
+        mTimer.cancel();
+        mTimer = null;
+    }
 }
diff --git a/src/com/android/settings/wifi/dpp/WifiNetworkListFragment.java b/src/com/android/settings/wifi/dpp/WifiNetworkListFragment.java
index 84f1c36..2bf411a 100644
--- a/src/com/android/settings/wifi/dpp/WifiNetworkListFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiNetworkListFragment.java
@@ -34,7 +34,6 @@
 import com.android.settings.SettingsPreferenceFragment;
 import com.android.settings.core.SubSettingLauncher;
 import com.android.settings.wifi.AddNetworkFragment;
-import com.android.settings.wifi.savedaccesspoints.SavedNetworkComparator;
 import com.android.settingslib.wifi.AccessPoint;
 import com.android.settingslib.wifi.AccessPointPreference;
 import com.android.settingslib.wifi.WifiSavedConfigUtils;
@@ -43,6 +42,7 @@
 
 import java.util.Collections;
 import java.util.List;
+import java.util.stream.Collectors;
 
 public class WifiNetworkListFragment extends SettingsPreferenceFragment implements
         WifiTracker.WifiListener, AccessPoint.AccessPointListener {
@@ -282,27 +282,38 @@
             return;
         }
 
-        // TODO(b/128942314): Lists reachable AccessPoints on top of the list
-        final List<AccessPoint> savedAccessPoints =
+        List<AccessPoint> savedAccessPoints =
                 WifiSavedConfigUtils.getAllConfigs(getContext(), mWifiManager);
-        Collections.sort(savedAccessPoints, SavedNetworkComparator.INSTANCE);
+
+        savedAccessPoints = savedAccessPoints.stream()
+                .filter(accessPoint -> isValidForDppConfiguration(accessPoint))
+                .map(accessPoint -> getScannedAccessPointIfAvailable(accessPoint))
+                .sorted((ap1, ap2) -> {
+                    // orders reachable Wi-Fi networks on top
+                    if (ap1.isReachable() && !ap2.isReachable()) {
+                        return -1;
+                    } else if (!ap1.isReachable() && ap2.isReachable()) {
+                        return 1;
+                    }
+
+                    String ap1Title = nullToEmpty(ap1.getTitle());
+                    String ap2Title = nullToEmpty(ap2.getTitle());
+
+                    return ap1Title.compareToIgnoreCase(ap2Title);
+                }).collect(Collectors.toList());
 
         int index = 0;
         mAccessPointsPreferenceCategory.removeAll();
         for (AccessPoint savedAccessPoint : savedAccessPoints) {
-            if (isValidForDppConfiguration(savedAccessPoint)) {
-                // Replaces with an AccessPoint from scanned result for signal information
-                savedAccessPoint = getScannedAccessPointIfAvailable(savedAccessPoint);
-                final AccessPointPreference preference =
-                        createAccessPointPreference(savedAccessPoint);
+            final AccessPointPreference preference =
+                    createAccessPointPreference(savedAccessPoint);
 
-                preference.setOrder(index++);
-                preference.setEnabled(savedAccessPoint.isReachable());
-                savedAccessPoint.setListener(this);
+            preference.setOrder(index++);
+            preference.setEnabled(savedAccessPoint.isReachable());
+            savedAccessPoint.setListener(this);
 
-                preference.refresh();
-                mAccessPointsPreferenceCategory.addPreference(preference);
-            }
+            preference.refresh();
+            mAccessPointsPreferenceCategory.addPreference(preference);
         }
         mAddPreference.setOrder(index);
         mAccessPointsPreferenceCategory.addPreference(mAddPreference);
@@ -312,6 +323,11 @@
         }
     }
 
+    private String nullToEmpty(String string) {
+        return (string == null) ? "" : string;
+    }
+
+    // Replaces with an AccessPoint from scanned result for signal information
     private AccessPoint getScannedAccessPointIfAvailable(AccessPoint savedAccessPoint) {
         final List<AccessPoint> scannedAccessPoints = mWifiTracker.getAccessPoints();
         final WifiConfiguration savedWifiConfiguration = savedAccessPoint.getConfig();
diff --git a/src/com/android/settings/wifi/qrcode/QrDecorateView.java b/src/com/android/settings/wifi/qrcode/QrDecorateView.java
index 2be1eab..5df0cd0 100644
--- a/src/com/android/settings/wifi/qrcode/QrDecorateView.java
+++ b/src/com/android/settings/wifi/qrcode/QrDecorateView.java
@@ -46,6 +46,7 @@
     final private Paint mBackgroundPaint;
 
     final private float mRadius;
+    final private float mInnerRidus;
 
     private Bitmap mMaskBitmap;
     private Canvas mMaskCanvas;
@@ -73,6 +74,9 @@
         mFocused = false;
         mRadius = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, CORNER_RADIUS,
                 getResources().getDisplayMetrics());
+        // Inner radius needs to minus stroke width for keeping the width of border consistent.
+        mInnerRidus = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
+                CORNER_RADIUS - CORNER_STROKE_WIDTH, getResources().getDisplayMetrics());
 
         mCornerColor = context.getResources().getColor(R.color.qr_corner_line_color);
         mFocusedCornerColor = context.getResources().getColor(R.color.qr_focused_corner_line_color);
@@ -111,7 +115,7 @@
         // Draw outer corner.
         mMaskCanvas.drawRoundRect(mOuterFrame, mRadius, mRadius, mStrokePaint);
         // Draw inner transparent corner.
-        mMaskCanvas.drawRoundRect(mInnerFrame, mRadius, mRadius, mTransparentPaint);
+        mMaskCanvas.drawRoundRect(mInnerFrame, mInnerRidus, mInnerRidus, mTransparentPaint);
 
         canvas.drawBitmap(mMaskBitmap, 0, 0, mBackgroundPaint);
         super.onDraw(canvas);
@@ -123,7 +127,7 @@
         final float cornerLineLength = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
                 CORNER_LINE_LENGTH, getResources().getDisplayMetrics()) / 2;
         final float strokeWidth = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
-                CORNER_STROKE_WIDTH, getResources().getDisplayMetrics()) / 2;
+                CORNER_STROKE_WIDTH, getResources().getDisplayMetrics());
 
         mOuterFrame = new RectF(centralX - cornerLineLength, centralY - cornerLineLength,
                 centralX + cornerLineLength, centralY + cornerLineLength);
@@ -131,7 +135,7 @@
                 mOuterFrame.right - strokeWidth, mOuterFrame.bottom - strokeWidth);
     }
 
-    // Draws green lines if focued. Otherwise, draws white lines.
+    // Draws green lines if focused. Otherwise, draws white lines.
     public void setFocused(boolean focused) {
         mFocused = focused;
         invalidate();
diff --git a/tests/robotests/Android.mk b/tests/robotests/Android.mk
index b0733f4..727da06 100644
--- a/tests/robotests/Android.mk
+++ b/tests/robotests/Android.mk
@@ -49,6 +49,7 @@
     guava \
     jsr305 \
     settings-contextual-card-protos-lite \
+    settings-log-bridge-protos-lite \
     contextualcards \
     settings-logtags \
     zxing-core-1.7
diff --git a/tests/robotests/assets/grandfather_invalid_base_preference_controller_constructor b/tests/robotests/assets/grandfather_invalid_base_preference_controller_constructor
index a723842..675108d 100644
--- a/tests/robotests/assets/grandfather_invalid_base_preference_controller_constructor
+++ b/tests/robotests/assets/grandfather_invalid_base_preference_controller_constructor
@@ -10,8 +10,5 @@
 com.android.settings.fuelgauge.RestrictAppPreferenceController
 com.android.settings.fuelgauge.batterysaver.BatterySaverButtonPreferenceController
 com.android.settings.fuelgauge.batterytip.BatteryTipPreferenceController
-com.android.settings.gestures.SystemNavigationEdgeToEdgePreferenceController
-com.android.settings.gestures.SystemNavigationLegacyPreferenceController
-com.android.settings.gestures.SystemNavigationSwipeUpPreferenceController
 com.android.settings.security.VisiblePatternProfilePreferenceController
 com.android.settings.wifi.details.WifiMeteredPreferenceController
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizardActivityTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizardActivityTest.java
new file mode 100644
index 0000000..d6b12c3
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizardActivityTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.accessibility;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Intent;
+
+import androidx.test.filters.SmallTest;
+
+import com.android.settings.R;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.Robolectric;
+import org.robolectric.RobolectricTestRunner;
+
+@RunWith(RobolectricTestRunner.class)
+@SmallTest
+public class AccessibilitySettingsForSetupWizardActivityTest {
+
+  @Test
+  public void createSetupAccessibilityActivity_shouldBeSUWTheme() {
+    final Intent intent = new Intent();
+    AccessibilitySettingsForSetupWizardActivity activity =
+        Robolectric.buildActivity(AccessibilitySettingsForSetupWizardActivity.class, intent).get();
+
+    assertThat(activity.getThemeResId()).isEqualTo(R.style.GlifTheme_Light);
+  }
+}
diff --git a/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java
index 5538155..b961669 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java
@@ -18,6 +18,7 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
+import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
@@ -78,6 +79,7 @@
 
         mContext = RuntimeEnvironment.application;
         mController = new AdvancedBluetoothDetailsHeaderController(mContext, "pref_Key");
+        when(mCachedDevice.getDevice()).thenReturn(mBluetoothDevice);
         mController.init(mCachedDevice);
         mLayoutPreference = new LayoutPreference(mContext,
                 LayoutInflater.from(mContext).inflate(R.layout.advanced_bt_entity_header, null));
@@ -166,7 +168,10 @@
     }
 
     @Test
-    public void onStart_registerCallback() {
+    public void onStart_isAvailable_registerCallback() {
+        when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET))
+                .thenReturn("true");
+
         mController.onStart();
 
         verify(mBluetoothAdapter).registerMetadataListener(mBluetoothDevice,
@@ -174,12 +179,36 @@
     }
 
     @Test
-    public void onStop_unregisterCallback() {
+    public void onStop_isAvailable_unregisterCallback() {
+        when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET))
+                .thenReturn("true");
+
         mController.onStop();
 
         verify(mBluetoothAdapter).unregisterMetadataListener(mBluetoothDevice);
     }
 
+    @Test
+    public void onStart_notAvailable_registerCallback() {
+        when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET))
+                .thenReturn("false");
+
+        mController.onStart();
+
+        verify(mBluetoothAdapter, never()).registerMetadataListener(mBluetoothDevice,
+                mController.mMetadataListener, mController.mHandler);
+    }
+
+    @Test
+    public void onStop_notAvailable_unregisterCallback() {
+        when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET))
+                .thenReturn("false");
+
+        mController.onStop();
+
+        verify(mBluetoothAdapter, never()).unregisterMetadataListener(mBluetoothDevice);
+    }
+
     private void assertBatteryLevel(LinearLayout linearLayout, int batteryLevel) {
         final TextView textView = linearLayout.findViewById(R.id.bt_battery_summary);
         assertThat(textView.getText().toString()).isEqualTo(
diff --git a/tests/robotests/src/com/android/settings/core/BasePreferenceControllerSignatureInspector.java b/tests/robotests/src/com/android/settings/core/BasePreferenceControllerSignatureInspector.java
index 28e394f..2d1dc5c 100644
--- a/tests/robotests/src/com/android/settings/core/BasePreferenceControllerSignatureInspector.java
+++ b/tests/robotests/src/com/android/settings/core/BasePreferenceControllerSignatureInspector.java
@@ -58,12 +58,17 @@
             if (constructors == null || constructors.length == 0) {
                 badClasses.append(c.getName()).append(",");
             }
+
+            boolean hasValidConstructor = false;
             for (Constructor constructor : constructors) {
-                if (!hasValidConstructorSignature(constructor)) {
-                    badClasses.append(className).append(",");
-                    continue;
+                if (hasValidConstructorSignature(constructor)) {
+                    hasValidConstructor = true;
+                    break;
                 }
             }
+            if (!hasValidConstructor) {
+                badClasses.append(className).append(",");
+            }
         }
 
         assertWithMessage("All BasePreferenceController (and subclasses) constructor must either"
diff --git a/tests/robotests/src/com/android/settings/core/HideNonSystemOverlayMixinTest.java b/tests/robotests/src/com/android/settings/core/HideNonSystemOverlayMixinTest.java
index 3f10479..d4f43e2 100644
--- a/tests/robotests/src/com/android/settings/core/HideNonSystemOverlayMixinTest.java
+++ b/tests/robotests/src/com/android/settings/core/HideNonSystemOverlayMixinTest.java
@@ -20,6 +20,7 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
+import android.os.Build;
 import android.os.Bundle;
 import android.view.WindowManager;
 
@@ -33,8 +34,8 @@
 import org.junit.runner.RunWith;
 import org.robolectric.Robolectric;
 import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
 import org.robolectric.android.controller.ActivityController;
+import org.robolectric.util.ReflectionHelpers;
 
 @RunWith(RobolectricTestRunner.class)
 public class HideNonSystemOverlayMixinTest {
@@ -67,6 +68,20 @@
                 .isEqualTo(0);
     }
 
+    @Test
+    public void isEnabled_debug_false() {
+        ReflectionHelpers.setStaticField(Build.class, "IS_DEBUGGABLE", true);
+
+        assertThat(new HideNonSystemOverlayMixin(null).isEnabled()).isFalse();
+    }
+
+    @Test
+    public void isEnabled_user_true() {
+        ReflectionHelpers.setStaticField(Build.class, "IS_DEBUGGABLE", false);
+
+        assertThat(new HideNonSystemOverlayMixin(null).isEnabled()).isTrue();
+    }
+
     public static class TestActivity extends AppCompatActivity {
         @Override
         protected void onCreate(@Nullable Bundle savedInstanceState) {
diff --git a/tests/robotests/src/com/android/settings/core/instrumentation/SettingsIntelligenceLogWriterTest.java b/tests/robotests/src/com/android/settings/core/instrumentation/SettingsIntelligenceLogWriterTest.java
new file mode 100644
index 0000000..30a2594
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/core/instrumentation/SettingsIntelligenceLogWriterTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.core.instrumentation;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.settings.SettingsEnums;
+import android.content.Context;
+
+import com.android.settings.intelligence.LogProto.SettingsLog;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RuntimeEnvironment;
+
+import java.io.ByteArrayInputStream;
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class SettingsIntelligenceLogWriterTest {
+    private Context mContext;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mContext = RuntimeEnvironment.application;
+    }
+
+    @Test
+    public void serialize_hasSizeOne_returnCorrectData() throws IOException {
+        final SettingsLog event = SettingsLog.newBuilder()
+                .setAttribution(SettingsEnums.DASHBOARD_SUMMARY)
+                .setAction(SettingsEnums.ACTION_SET_NEW_PASSWORD)
+                .setPageId(SettingsEnums.SET_NEW_PASSWORD_ACTIVITY)
+                .setChangedPreferenceKey("package")
+                .setChangedPreferenceIntValue(100)
+                .build();
+        List<SettingsLog> events = new ArrayList<>();
+        events.add(event);
+
+        // execute
+        final byte[] data = SettingsIntelligenceLogWriter.serialize(events);
+
+        // parse data
+        final ByteArrayInputStream bin = new ByteArrayInputStream(data);
+        final DataInputStream inputStream = new DataInputStream(bin);
+        final int size = inputStream.readInt();
+        final byte[] change = new byte[inputStream.readInt()];
+        inputStream.read(change);
+        inputStream.close();
+        final SettingsLog settingsLog = SettingsLog.parseFrom(change);
+
+        // assert
+        assertThat(events.size()).isEqualTo(size);
+        assertThat(settingsLog.getAttribution()).isEqualTo(SettingsEnums.DASHBOARD_SUMMARY);
+        assertThat(settingsLog.getAction()).isEqualTo(SettingsEnums.ACTION_SET_NEW_PASSWORD);
+        assertThat(settingsLog.getPageId()).isEqualTo(SettingsEnums.SET_NEW_PASSWORD_ACTIVITY);
+        assertThat(settingsLog.getChangedPreferenceKey()).isEqualTo("package");
+        assertThat(settingsLog.getChangedPreferenceIntValue()).isEqualTo(100);
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/development/featureflags/FeatureFlagPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/featureflags/FeatureFlagPreferenceControllerTest.java
index 2e15967..cf97544 100644
--- a/tests/robotests/src/com/android/settings/development/featureflags/FeatureFlagPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/featureflags/FeatureFlagPreferenceControllerTest.java
@@ -17,6 +17,7 @@
 package com.android.settings.development.featureflags;
 
 import static com.android.settings.core.BasePreferenceController.AVAILABLE;
+import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
 
 import static com.google.common.truth.Truth.assertThat;
 
@@ -26,6 +27,8 @@
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
+import android.os.Build;
+import android.os.SystemProperties;
 
 import androidx.preference.PreferenceCategory;
 import androidx.preference.PreferenceScreen;
@@ -37,6 +40,7 @@
 import org.mockito.MockitoAnnotations;
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
+import org.robolectric.util.ReflectionHelpers;
 
 @RunWith(RobolectricTestRunner.class)
 public class FeatureFlagPreferenceControllerTest {
@@ -59,10 +63,18 @@
     }
 
     @Test
-    public void getAvailability_available() {
+    public void getAvailability_debug_available() {
+        ReflectionHelpers.setStaticField(Build.class, "IS_DEBUGGABLE", true);
         assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
     }
 
+
+    @Test
+    public void getAvailability_user_unavailable() {
+        ReflectionHelpers.setStaticField(Build.class, "IS_DEBUGGABLE", false);
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
+    }
+
     @Test
     public void onStart_shouldRefreshFeatureFlags() {
         mController.onStart();
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceControllerTest.java
index 2761b2f..f391aac 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceControllerTest.java
@@ -18,6 +18,7 @@
 
 import static com.android.settings.core.BasePreferenceController.AVAILABLE;
 import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
+import static com.android.settings.deviceinfo.firmwareversion.MainlineModuleVersionPreferenceController.MODULE_UPDATE_INTENT;
 
 import static com.google.common.truth.Truth.assertThat;
 
@@ -29,8 +30,11 @@
 import android.content.Context;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
 import android.util.FeatureFlagUtils;
 
+import androidx.preference.Preference;
+
 import com.android.settings.core.FeatureFlags;
 
 import org.junit.Before;
@@ -48,11 +52,13 @@
     private PackageManager mPackageManager;
 
     private Context mContext;
+    private Preference mPreference;
 
     @Before
     public void setup() {
         MockitoAnnotations.initMocks(this);
         mContext = spy(RuntimeEnvironment.application);
+        mPreference = new Preference(mContext);
         when(mContext.getPackageManager()).thenReturn(mPackageManager);
 
         FeatureFlagUtils.setEnabled(mContext, FeatureFlags.MAINLINE_MODULE, true);
@@ -82,7 +88,6 @@
 
     @Test
     public void getAvailabilityStatus_noMainlineModulePackageInfo_unavailable() throws Exception {
-
         final String provider = "test.provider";
         when(mContext.getString(
                 com.android.internal.R.string.config_defaultModuleMetadataProvider))
@@ -98,6 +103,43 @@
 
     @Test
     public void getAvailabilityStatus_hasMainlineModulePackageInfo_available() throws Exception {
+        setupModulePackage();
+
+        final MainlineModuleVersionPreferenceController controller =
+                new MainlineModuleVersionPreferenceController(mContext, "key");
+
+        assertThat(controller.getAvailabilityStatus()).isEqualTo(AVAILABLE);
+    }
+
+    @Test
+    public void updateStates_canHandleIntent_setIntentToPreference() throws Exception {
+        setupModulePackage();
+        when(mPackageManager.resolveActivity(MODULE_UPDATE_INTENT, 0))
+                .thenReturn(new ResolveInfo());
+
+        final MainlineModuleVersionPreferenceController controller =
+                new MainlineModuleVersionPreferenceController(mContext, "key");
+
+        controller.updateState(mPreference);
+
+        assertThat(mPreference.getIntent()).isEqualTo(MODULE_UPDATE_INTENT);
+    }
+
+    @Test
+    public void updateStates_cannotHandleIntent_setNullToPreference() throws Exception {
+        setupModulePackage();
+        when(mPackageManager.resolveActivity(MODULE_UPDATE_INTENT, 0))
+                .thenReturn(null);
+
+        final MainlineModuleVersionPreferenceController controller =
+                new MainlineModuleVersionPreferenceController(mContext, "key");
+
+        controller.updateState(mPreference);
+
+        assertThat(mPreference.getIntent()).isNull();
+    }
+
+    private void setupModulePackage() throws Exception {
         final String provider = "test.provider";
         final String version = "test version 123";
         final PackageInfo info = new PackageInfo();
@@ -106,11 +148,5 @@
                 com.android.internal.R.string.config_defaultModuleMetadataProvider))
                 .thenReturn(provider);
         when(mPackageManager.getPackageInfo(eq(provider), anyInt())).thenReturn(info);
-
-        final MainlineModuleVersionPreferenceController controller =
-                new MainlineModuleVersionPreferenceController(mContext, "key");
-
-        assertThat(controller.getAvailabilityStatus()).isEqualTo(AVAILABLE);
     }
-
 }
diff --git a/tests/robotests/src/com/android/settings/display/DarkUIPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/DarkUIPreferenceControllerTest.java
deleted file mode 100644
index c8f847b..0000000
--- a/tests/robotests/src/com/android/settings/display/DarkUIPreferenceControllerTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.settings.display;
-
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.app.UiModeManager;
-import android.content.Context;
-
-import androidx.preference.ListPreference;
-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;
-
-@RunWith(RobolectricTestRunner.class)
-public class DarkUIPreferenceControllerTest {
-
-    private Context mContext;
-    @Mock
-    private ListPreference mPreference;
-    @Mock
-    private PreferenceScreen mPreferenceScreen;
-    @Mock
-    private UiModeManager mUiModeManager;
-    private DarkUIPreferenceController mController;
-
-    @Before
-    public void setup() {
-        MockitoAnnotations.initMocks(this);
-        mContext = RuntimeEnvironment.application;
-        mController = new DarkUIPreferenceController(mContext, "dark_ui_mode");
-        mController.setUiModeManager(mUiModeManager);
-        when(mPreferenceScreen.findPreference(mController.getPreferenceKey()))
-            .thenReturn(mPreference);
-        mController.displayPreference(mPreferenceScreen);
-    }
-
-    @Test
-    public void onPreferenceChanged_setAuto() {
-        // Auto was deprecated, it should default to NO.
-        mController.onPreferenceChange(mPreference, "auto");
-        verify(mUiModeManager).setNightMode(eq(UiModeManager.MODE_NIGHT_NO));
-    }
-
-    @Test
-    public void onPreferenceChanged_setNightMode() {
-        mController.onPreferenceChange(mPreference, "yes");
-        verify(mUiModeManager).setNightMode(eq(UiModeManager.MODE_NIGHT_YES));
-    }
-
-    @Test
-    public void onPreferenceChanged_setDayMode() {
-        mController.onPreferenceChange(mPreference, "no");
-        verify(mUiModeManager).setNightMode(eq(UiModeManager.MODE_NIGHT_NO));
-    }
-
-    public int getCurrentMode() {
-        final UiModeManager uiModeManager = mContext.getSystemService(UiModeManager.class);
-        return uiModeManager.getNightMode();
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/display/DarkUISettingsRadioButtonsControllerTest.java b/tests/robotests/src/com/android/settings/display/DarkUISettingsRadioButtonsControllerTest.java
new file mode 100644
index 0000000..76142a4
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/display/DarkUISettingsRadioButtonsControllerTest.java
@@ -0,0 +1,52 @@
+package com.android.settings.display;
+
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
+
+import android.app.UiModeManager;
+import android.content.Context;
+import androidx.preference.Preference;
+import com.android.settings.R;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public class DarkUISettingsRadioButtonsControllerTest {
+
+    @Mock
+    private UiModeManager mUiModeManager;
+    @Mock
+    private Preference mFooter;
+    private Context mContext;
+    private DarkUISettingsRadioButtonsController mController;
+
+    @Before
+    public void setup() {
+        MockitoAnnotations.initMocks(this);
+        mContext = RuntimeEnvironment.application;
+        mController = new DarkUISettingsRadioButtonsController(mContext, mFooter);
+        mController.mManager = mUiModeManager;
+    }
+
+    @Test
+    public void footerUpdatesCorrectly() {
+        doReturn(UiModeManager.MODE_NIGHT_YES).when(mUiModeManager).getNightMode();
+        mController.updateFooter();
+        verify(mFooter).setSummary(eq(R.string.dark_ui_settings_dark_summary));
+
+        doReturn(UiModeManager.MODE_NIGHT_NO).when(mUiModeManager).getNightMode();
+        mController.updateFooter();
+        verify(mFooter).setSummary(eq(R.string.dark_ui_settings_light_summary));
+    }
+
+    public int getCurrentMode() {
+        final UiModeManager uiModeManager = mContext.getSystemService(UiModeManager.class);
+        return uiModeManager.getNightMode();
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/conditional/GrayscaleConditionControllerTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/conditional/GrayscaleConditionControllerTest.java
index 8c24735..2fe4697 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/conditional/GrayscaleConditionControllerTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/conditional/GrayscaleConditionControllerTest.java
@@ -18,11 +18,13 @@
 
 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.verify;
 
 import android.content.Context;
+import android.content.Intent;
 import android.hardware.display.ColorDisplayManager;
 
 import org.junit.Before;
@@ -80,4 +82,11 @@
 
         verify(mConditionManager).onConditionChanged();
     }
+
+    @Test
+    public void onActionClick_shouldSendBroadcast() {
+        mController.onActionClick();
+
+        verify(mContext).sendBroadcast(any(Intent.class), any(String.class));
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/password/ChooseLockPatternTest.java b/tests/robotests/src/com/android/settings/password/ChooseLockPatternTest.java
index 4bc8374..48ebbec 100644
--- a/tests/robotests/src/com/android/settings/password/ChooseLockPatternTest.java
+++ b/tests/robotests/src/com/android/settings/password/ChooseLockPatternTest.java
@@ -32,7 +32,6 @@
 
 import com.google.android.setupdesign.GlifLayout;
 
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.robolectric.Robolectric;
@@ -93,7 +92,6 @@
 
     @Config(qualifiers = "sw400dp")
     @Test
-    @Ignore("b/129342100")
     public void fingerprintExtraSet_shouldDisplayFingerprintIcon() {
         ChooseLockPattern activity = createActivity(true);
         ChooseLockPatternFragment fragment = (ChooseLockPatternFragment)
@@ -109,7 +107,7 @@
         ChooseLockPatternFragment fragment = (ChooseLockPatternFragment)
                 activity.getSupportFragmentManager().findFragmentById(R.id.main_content);
 
-        View iconView = fragment.getView().findViewById(R.id.suc_layout_icon);
+        View iconView = fragment.getView().findViewById(R.id.sud_layout_icon);
         assertThat(iconView.getVisibility()).isEqualTo(View.GONE);
     }
 
diff --git a/tests/robotests/src/com/android/settings/widget/VideoPreferenceTest.java b/tests/robotests/src/com/android/settings/widget/VideoPreferenceTest.java
index 4cd6be4..b53f364 100644
--- a/tests/robotests/src/com/android/settings/widget/VideoPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/widget/VideoPreferenceTest.java
@@ -18,6 +18,10 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.verify;
@@ -29,6 +33,8 @@
 import android.view.LayoutInflater;
 import android.view.TextureView;
 
+import android.view.View;
+import android.widget.ImageView;
 import androidx.preference.PreferenceViewHolder;
 
 import com.android.settings.R;
@@ -45,8 +51,13 @@
 public class VideoPreferenceTest {
     private static final int VIDEO_WIDTH = 100;
     private static final int VIDEO_HEIGHT = 150;
+
     @Mock
     private MediaPlayer mMediaPlayer;
+    @Mock
+    private ImageView fakePreview;
+    @Mock
+    private ImageView fakePlayButton;
     private Context mContext;
     private VideoPreference mVideoPreference;
     private PreferenceViewHolder mPreferenceViewHolder;
@@ -83,8 +94,8 @@
             (TextureView) mPreferenceViewHolder.findViewById(R.id.video_texture_view);
         mVideoPreference.mAnimationAvailable = true;
         mVideoPreference.mVideoReady = true;
-        mVideoPreference.onBindViewHolder(mPreferenceViewHolder);
         mVideoPreference.onViewInvisible();
+        mVideoPreference.onBindViewHolder(mPreferenceViewHolder);
         when(mMediaPlayer.isPlaying()).thenReturn(false);
         final TextureView.SurfaceTextureListener listener = video.getSurfaceTextureListener();
 
@@ -101,4 +112,30 @@
 
         verify(mMediaPlayer).release();
     }
+
+    @Test
+    public void updateViewStates_paused_updatesViews() {
+        when(mMediaPlayer.isPlaying()).thenReturn(true);
+        mVideoPreference.updateViewStates(fakePreview, fakePlayButton);
+        verify(fakePlayButton).setVisibility(eq(View.VISIBLE));
+        verify(fakePreview).setVisibility(eq(View.VISIBLE));
+        verify(mMediaPlayer).pause();
+    }
+
+    @Test
+    public void updateViewStates_playing_updatesViews() {
+        when(mMediaPlayer.isPlaying()).thenReturn(false);
+        mVideoPreference.updateViewStates(fakePreview, fakePlayButton);
+        verify(fakePlayButton).setVisibility(eq(View.GONE));
+        verify(fakePreview).setVisibility(eq(View.GONE));
+        verify(mMediaPlayer).start();
+    }
+
+    @Test
+    public void updateViewStates_noMediaPlayer_skips() {
+        mVideoPreference.mMediaPlayer = null;
+        mVideoPreference.updateViewStates(fakePreview, fakePlayButton);
+        verify(fakePlayButton, never()).setVisibility(anyInt());
+        verify(fakePreview, never()).setVisibility(anyInt());
+    }
 }
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 947d618..0a565cd 100644
--- a/tests/robotests/src/com/android/settings/wifi/details/WifiDetailPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/details/WifiDetailPreferenceControllerTest.java
@@ -53,6 +53,7 @@
 import android.net.wifi.WifiManager;
 import android.os.Handler;
 import android.provider.Settings;
+import android.util.FeatureFlagUtils;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.widget.ImageView;
@@ -77,7 +78,6 @@
 import com.android.settingslib.wifi.AccessPoint;
 
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Answers;
@@ -99,7 +99,6 @@
 
 @RunWith(RobolectricTestRunner.class)
 @Config(shadows = {ShadowDevicePolicyManager.class, ShadowEntityHeaderController.class})
-@Ignore("b/129292549")
 public class WifiDetailPreferenceControllerTest {
 
     private static final int LEVEL = 1;
@@ -274,6 +273,11 @@
         when(mockIconInjector.getIcon(anyInt())).thenReturn(new ColorDrawable());
 
         setupMockedPreferenceScreen();
+
+        // Disable saved network detail page feature for this test
+        FeatureFlagUtils.setEnabled(mContext, FeatureFlags.WIFI_DETAILS_SAVED_SCREEN, false);
+        when(mockAccessPoint.isActive()).thenReturn(true);
+
         mController = newWifiDetailPreferenceController();
     }
 
@@ -948,6 +952,12 @@
         when(pref.setButton3Visible(anyBoolean())).thenReturn(pref);
         when(pref.setButton3OnClickListener(any(View.OnClickListener.class))).thenReturn(pref);
 
+        when(pref.setButton4Text(anyInt())).thenReturn(pref);
+        when(pref.setButton4Icon(anyInt())).thenReturn(pref);
+        when(pref.setButton4Enabled(anyBoolean())).thenReturn(pref);
+        when(pref.setButton4Visible(anyBoolean())).thenReturn(pref);
+        when(pref.setButton4OnClickListener(any(View.OnClickListener.class))).thenReturn(pref);
+
         return pref;
     }
 }