Merge "Add checks on multisim capabilities."
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 70dce8f..a94801f 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -736,7 +736,7 @@
         <activity
             android:name=".notification.ZenSuggestionActivity"
             android:label="@string/zen_mode_settings_title"
-            android:icon="@drawable/ic_do_not_disturb_on_24dp"
+            android:icon="@drawable/ic_suggestion_dnd"
             android:theme="@android:style/Theme.NoDisplay">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -796,7 +796,7 @@
 
         <activity android:name=".wallpaper.WallpaperSuggestionActivity"
                   android:label="@string/wallpaper_settings_title"
-                  android:icon="@drawable/ic_wallpaper"
+                  android:icon="@drawable/ic_suggestion_wallpaper"
                   android:theme="@android:style/Theme.NoDisplay">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -889,7 +889,7 @@
         <activity
             android:name="Settings$NightDisplaySuggestionActivity"
             android:enabled="@*android:bool/config_nightDisplayAvailable"
-            android:icon="@drawable/ic_settings_night_display">
+            android:icon="@drawable/ic_suggestion_night_display">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.android.settings.suggested.category.FIRST_IMPRESSION" />
@@ -1628,7 +1628,7 @@
         </activity>
 
         <activity android:name=".password.ScreenLockSuggestionActivity"
-            android:icon="@drawable/ic_settings_security">
+            android:icon="@drawable/ic_suggestion_security">
             <intent-filter android:priority="1">
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.android.settings.suggested.category.DEFAULT" />
@@ -2635,7 +2635,7 @@
 
         <activity android:name=".wifi.calling.WifiCallingSuggestionActivity"
                   android:label="@string/wifi_calling_settings_title"
-                  android:icon="@drawable/ic_settings_wireless">
+                  android:icon="@drawable/ic_suggestion_wireless">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.android.settings.suggested.category.FIRST_IMPRESSION" />
diff --git a/protos/contextual_card_list.proto b/protos/contextual_card_list.proto
index 37383ba..69c3741 100644
--- a/protos/contextual_card_list.proto
+++ b/protos/contextual_card_list.proto
@@ -18,7 +18,6 @@
     SUGGESTION = 1;
     POSSIBLE = 2;
     IMPORTANT = 3;
-    EXCLUSIVE = 4 [deprecated = true];
     DEFERRED_SETUP = 5;
   }
 
diff --git a/res/drawable/ic_suggestion_dnd.xml b/res/drawable/ic_suggestion_dnd.xml
new file mode 100644
index 0000000..816b148
--- /dev/null
+++ b/res/drawable/ic_suggestion_dnd.xml
@@ -0,0 +1,28 @@
+<!--
+  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.0"
+        android:viewportHeight="24.0"
+        android:tint="?android:attr/colorControlNormal">
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:pathData="M12,2C6.48,2 2,6.48 2,12c0,5.52 4.48,10 10,10c5.52,0 10,-4.48 10,-10C22,6.48 17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8c0,-4.41 3.59,-8 8,-8c4.41,0 8,3.59 8,8C20,16.41 16.41,20 12,20z"/>
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:pathData="M7,11h10v2h-10z"/>
+</vector>
diff --git a/res/drawable/ic_suggestion_night_display.xml b/res/drawable/ic_suggestion_night_display.xml
new file mode 100644
index 0000000..16cb04e
--- /dev/null
+++ b/res/drawable/ic_suggestion_night_display.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:tint="?android:attr/colorControlNormal"
+        android:viewportHeight="24"
+        android:viewportWidth="24">
+    <path
+        android:fillColor="#FF000000"
+        android:pathData="M6.28,4.81c0,0.16 0.01,0.32 0.02,0.48c0.38,6.58 5.83,12.03 12.41,12.41c0.16,0.01 0.32,0.02 0.47,0.02c-1.58,1.2 -3.53,1.88 -5.56,1.88c-0.46,0 -0.93,-0.03 -1.4,-0.1c-3.96,-0.58 -7.13,-3.75 -7.71,-7.71C4.13,9.24 4.8,6.75 6.28,4.81M8.27,0.6c-0.08,0 -0.17,0.02 -0.25,0.07c-3.8,2.2 -6.2,6.56 -5.49,11.4c0.7,4.82 4.59,8.7 9.4,9.4c0.57,0.08 1.13,0.12 1.69,0.12c4.15,0 7.78,-2.26 9.72,-5.62c0.2,-0.35 -0.07,-0.76 -0.44,-0.76c-0.05,0 -0.1,0.01 -0.15,0.02c-1.03,0.31 -2.12,0.48 -3.25,0.48c-0.22,0 -0.44,-0.01 -0.67,-0.02C13.23,15.38 8.62,10.77 8.29,5.17C8.21,3.81 8.38,2.49 8.75,1.26C8.86,0.91 8.59,0.6 8.27,0.6L8.27,0.6z"/>
+</vector>
diff --git a/res/drawable/ic_suggestion_security.xml b/res/drawable/ic_suggestion_security.xml
new file mode 100644
index 0000000..e2d3a90
--- /dev/null
+++ b/res/drawable/ic_suggestion_security.xml
@@ -0,0 +1,28 @@
+<!--
+  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:viewportHeight="24"
+        android:viewportWidth="24"
+        android:tint="?android:attr/colorControlNormal">
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:pathData="M12,15m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0"/>
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:pathData="M18.5,1C16.01,1 14,3.01 14,5.5V8H6c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2V10c0,-1.1 -0.9,-2 -2,-2h-2V5.5C16,4.12 17.12,3 18.5,3C19.88,3 21,4.12 21,5.5V6h2V5.5C23,3.01 20.99,1 18.5,1zM18,10v10H6V10H18z"/>
+</vector>
\ No newline at end of file
diff --git a/res/drawable/ic_suggestion_wallpaper.xml b/res/drawable/ic_suggestion_wallpaper.xml
new file mode 100644
index 0000000..32defce
--- /dev/null
+++ b/res/drawable/ic_suggestion_wallpaper.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"
+        android:tint="?android:attr/colorControlNormal">
+    <path
+        android:fillColor="#FF000000"
+        android:pathData="M9,12.71l2.14,2.58l3,-3.87L18,16.57H6L9,12.71zM5,5h6V3H5C3.9,3 3,3.9 3,5v6h2V5zM19,19h-6v2h6c1.1,0 2,-0.9 2,-2v-6h-2V19zM5,19v-6H3v6c0,1.1 0.9,2 2,2h6v-2H5zM19,5v6h2V5c0,-1.1 -0.9,-2 -2,-2h-6v2H19zM16,9c0.55,0 1,-0.45 1,-1s-0.45,-1 -1,-1c-0.55,0 -1,0.45 -1,1S15.45,9 16,9z"/>
+</vector>
diff --git a/res/drawable/ic_suggestion_wireless.xml b/res/drawable/ic_suggestion_wireless.xml
new file mode 100644
index 0000000..74b4cee
--- /dev/null
+++ b/res/drawable/ic_suggestion_wireless.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="24.0dp"
+        android:height="24.0dp"
+        android:viewportWidth="24.0"
+        android:viewportHeight="24.0"
+        android:tint="?android:attr/colorControlNormal">
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:pathData="M1,9l2,2c4.97,-4.97 13.03,-4.97 18,0l2,-2C16.93,2.93 7.08,2.93 1,9zM9,17l3,3l3,-3C13.35,15.34 10.66,15.34 9,17zM5,13l2,2c2.76,-2.76 7.24,-2.76 10,0l2,-2C15.14,9.14 8.87,9.14 5,13z"/>
+</vector>
diff --git a/res/layout-land/wifi_dpp_qrcode_scanner_fragment.xml b/res/layout-land/wifi_dpp_qrcode_scanner_fragment.xml
index 4eed0f6..0069e93 100644
--- a/res/layout-land/wifi_dpp_qrcode_scanner_fragment.xml
+++ b/res/layout-land/wifi_dpp_qrcode_scanner_fragment.xml
@@ -46,9 +46,14 @@
                     android:layout_height="match_parent"/>
             </com.android.settings.wifi.qrcode.QrPreviewLayout>
 
-            <TextView android:id="@+id/error_message"
+            <TextView
+                android:id="@+id/error_message"
                 android:layout_width="wrap_content"
-                android:layout_height="wrap_content"/>
+                android:layout_height="wrap_content"
+                android:textAlignment="center"
+                android:layout_marginTop="8dp"
+                android:visibility="invisible"
+                android:textColor="?android:attr/colorError"/>
 
         </LinearLayout>
 
diff --git a/res/layout/apps_filter_spinner.xml b/res/layout/apps_filter_spinner.xml
index c9b1e07..50f0fde 100644
--- a/res/layout/apps_filter_spinner.xml
+++ b/res/layout/apps_filter_spinner.xml
@@ -18,7 +18,8 @@
 <RelativeLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content">
+    android:layout_height="wrap_content"
+    android:background="@android:color/transparent">
 
     <com.android.settingslib.widget.settingsspinner.SettingsSpinner
         android:id="@+id/filter_spinner"
diff --git a/res/layout/homepage_slice_half_tile.xml b/res/layout/homepage_slice_half_tile.xml
index 46f3cda..fc99561 100644
--- a/res/layout/homepage_slice_half_tile.xml
+++ b/res/layout/homepage_slice_half_tile.xml
@@ -39,8 +39,7 @@
             <ImageView
                 android:id="@android:id/icon"
                 android:layout_width="@dimen/homepage_card_icon_size"
-                android:layout_height="@dimen/homepage_card_icon_size"
-                android:tint="?android:attr/colorAccent"/>
+                android:layout_height="@dimen/homepage_card_icon_size"/>
 
             <TextView
                 android:id="@android:id/title"
diff --git a/res/layout/manage_applications_apps.xml b/res/layout/manage_applications_apps.xml
index 021a61e..87db820 100644
--- a/res/layout/manage_applications_apps.xml
+++ b/res/layout/manage_applications_apps.xml
@@ -21,57 +21,50 @@
     android:layout_height="match_parent"
     android:orientation="vertical">
 
-    <androidx.core.widget.NestedScrollView
+    <FrameLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:fillViewport="true"
         settings:layout_behavior="com.android.settings.widget.FloatingAppBarScrollingViewBehavior">
 
-        <FrameLayout
-            android:id="@+id/content_container"
+        <LinearLayout
+            android:id="@+id/list_container"
             android:layout_width="match_parent"
-            android:layout_height="match_parent">
+            android:layout_height="match_parent"
+            android:orientation="vertical"
+            android:visibility="gone">
 
-            <LinearLayout
-                android:id="@+id/list_container"
+            <FrameLayout
                 android:layout_width="match_parent"
-                android:layout_height="match_parent"
-                android:orientation="vertical"
-                android:visibility="gone">
+                android:layout_height="match_parent">
 
-                <FrameLayout
+                <androidx.recyclerview.widget.RecyclerView
+                    android:id="@+id/apps_list"
                     android:layout_width="match_parent"
-                    android:layout_height="match_parent">
+                    android:layout_height="match_parent"
+                    android:clipToPadding="false"
+                    settings:fastScrollEnabled="true"
+                    settings:fastScrollHorizontalThumbDrawable="@drawable/thumb_drawable"
+                    settings:fastScrollHorizontalTrackDrawable="@drawable/line_drawable"
+                    settings:fastScrollVerticalThumbDrawable="@drawable/thumb_drawable"
+                    settings:fastScrollVerticalTrackDrawable="@drawable/line_drawable"/>
 
-                    <androidx.recyclerview.widget.RecyclerView
-                        android:id="@+id/apps_list"
-                        android:layout_width="match_parent"
-                        android:layout_height="match_parent"
-                        settings:fastScrollEnabled="true"
-                        settings:fastScrollHorizontalThumbDrawable="@drawable/thumb_drawable"
-                        settings:fastScrollHorizontalTrackDrawable="@drawable/line_drawable"
-                        settings:fastScrollVerticalThumbDrawable="@drawable/thumb_drawable"
-                        settings:fastScrollVerticalTrackDrawable="@drawable/line_drawable"/>
+                <TextView
+                    android:id="@android:id/empty"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:gravity="center"
+                    android:layout_gravity="center"
+                    android:text="@string/no_applications"
+                    android:textAppearance="?android:attr/textAppearanceLarge"
+                    android:visibility="invisible"/>
 
-                    <TextView
-                        android:id="@android:id/empty"
-                        android:layout_width="match_parent"
-                        android:layout_height="match_parent"
-                        android:gravity="center"
-                        android:layout_gravity="center"
-                        android:text="@string/no_applications"
-                        android:textAppearance="?android:attr/textAppearanceLarge"
-                        android:visibility="invisible"/>
+            </FrameLayout>
 
-                </FrameLayout>
+        </LinearLayout>
 
-            </LinearLayout>
+        <include layout="@layout/loading_container"/>
 
-            <include layout="@layout/loading_container"/>
-
-        </FrameLayout>
-
-    </androidx.core.widget.NestedScrollView>
+    </FrameLayout>
 
     <com.google.android.material.appbar.AppBarLayout
         android:layout_width="match_parent"
diff --git a/res/layout/search_bar.xml b/res/layout/search_bar.xml
index 67e742c..64ddb6d 100644
--- a/res/layout/search_bar.xml
+++ b/res/layout/search_bar.xml
@@ -39,10 +39,11 @@
     </Toolbar>
     <ImageView
         android:id="@+id/account_avatar"
-        android:layout_marginStart="@dimen/search_bar_avatar_start_margin"
-        android:layout_marginEnd="@dimen/search_bar_avatar_end_margin"
-        android:layout_width="@dimen/search_bar_avatar_size"
-        android:layout_height="@dimen/search_bar_avatar_size"
-        android:layout_gravity="end|center_vertical"
+        android:paddingEnd="@dimen/search_bar_avatar_end_padding"
+        android:paddingTop="@dimen/search_bar_avatar_top_bottom_padding"
+        android:paddingBottom="@dimen/search_bar_avatar_top_bottom_padding"
+        android:layout_width="@dimen/search_bar_avatar_width"
+        android:layout_height="@dimen/search_bar_height"
+        android:layout_gravity="end"
         android:contentDescription="@string/search_bar_account_avatar_content_description"/>
 </com.google.android.material.card.MaterialCardView>
diff --git a/res/layout/wifi_dialog.xml b/res/layout/wifi_dialog.xml
index df676fc..8ee2fba 100644
--- a/res/layout/wifi_dialog.xml
+++ b/res/layout/wifi_dialog.xml
@@ -56,6 +56,7 @@
                     <EditText android:id="@+id/ssid"
                             android:layout_width="match_parent"
                             android:layout_height="wrap_content"
+                            android:layout_alignParentStart="true"
                             style="@style/wifi_item_edit_content"
                             android:hint="@string/wifi_ssid_hint"
                             android:singleLine="true"
@@ -64,12 +65,11 @@
                         android:id="@+id/ssid_scanner_button"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
-                        android:layout_alignParentRight="true"
+                        android:layout_alignParentEnd="true"
                         android:layout_centerVertical="true"
                         android:layout_margin="5dp"
                         android:background="@null"
                         android:src="@drawable/ic_scan_24dp"
-                        android:visibility="gone"
                         android:contentDescription="@string/wifi_add_network" />
                 </RelativeLayout>
 
@@ -291,6 +291,7 @@
                     <EditText android:id="@+id/password"
                               android:layout_width="match_parent"
                               android:layout_height="wrap_content"
+                              android:layout_alignParentStart="true"
                               style="@style/wifi_item_edit_content"
                               android:singleLine="true"
                               android:password="true" />
@@ -299,12 +300,11 @@
                         android:id="@+id/password_scanner_button"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
-                        android:layout_alignParentRight="true"
+                        android:layout_alignParentEnd="true"
                         android:layout_centerVertical="true"
                         android:layout_margin="5dp"
                         android:background="@null"
                         android:src="@drawable/ic_scan_24dp"
-                        android:visibility="gone"
                         android:contentDescription="@string/wifi_add_network" />
                 </RelativeLayout>
             </LinearLayout>
diff --git a/res/layout/wifi_dpp_qrcode_scanner_fragment.xml b/res/layout/wifi_dpp_qrcode_scanner_fragment.xml
index c5e416b..9bd066b 100644
--- a/res/layout/wifi_dpp_qrcode_scanner_fragment.xml
+++ b/res/layout/wifi_dpp_qrcode_scanner_fragment.xml
@@ -50,8 +50,8 @@
                 android:id="@+id/error_message"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
+                android:textAlignment="center"
                 android:layout_marginTop="8dp"
-                android:text="@string/wifi_dpp_could_not_detect_valid_qr_code"
                 android:visibility="invisible"
                 android:textColor="?android:attr/colorError"/>
 
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 31b89f1..03e40aa 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -1098,6 +1098,17 @@
         <item>zen_mode_from_none</item>
     </string-array>
 
+    <!--String arrays for notification swipe direction -->
+    <string-array name="swipe_direction_titles">
+        <item>@string/swipe_direction_rtl</item>
+        <item>@string/swipe_direction_ltr</item>
+    </string-array>
+
+    <string-array name="swipe_direction_values">
+        <item>1</item>
+        <item>0</item>
+    </string-array>
+
     <string-array name="wifi_metered_entries">
         <item>Detect automatically</item>
         <item>Treat as metered</item>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 963d19f..763d8f5 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -105,9 +105,11 @@
     <dimen name="search_bar_text_size">16dp</dimen>
     <dimen name="search_bar_card_elevation">2dp</dimen>
     <dimen name="search_bar_content_inset">64dp</dimen>
-    <dimen name="search_bar_avatar_size">32dp</dimen>
-    <dimen name="search_bar_avatar_start_margin">4dp</dimen>
-    <dimen name="search_bar_avatar_end_margin">16dp</dimen>
+    <dimen name="search_bar_avatar_end_padding">16dp</dimen>
+    <!-- 32dp (avatar size) + 16 dp (search_bar_avatar_end_padding) -->
+    <dimen name="search_bar_avatar_width">48dp</dimen>
+    <!-- (search_bar_height 48dp - avatar size 32dp) / 2  -->
+    <dimen name="search_bar_avatar_top_bottom_padding">8dp</dimen>
 
     <!-- Dimensions for Wifi Assistant Card -->
     <dimen name="wifi_assistant_padding_top_bottom">16dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 7eb8efe..1b260f8 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -728,7 +728,7 @@
     <string name="date_and_time_settings_title_setup_wizard">Set date and time</string>
     <!-- Main Settings screen setting option summary text for the item to go into the date and time settings. -->
     <string name="date_and_time_settings_summary">Set date, time, time zone, &amp; formats</string>
-    <!-- Date & time setting screen setting check box title if the date and time should be determined automatically [CHAR LIMIT=30] -->
+    <!-- Date & time setting screen setting check box title if the date and time should be determined automatically [CHAR LIMIT=100] -->
     <string name="date_time_auto">Use network-provided time</string>
     <!-- Date & time setting screen setting option text when Automatic time zone check box is selected (that is, when date and time should be determined automatically)
         [CHAR LIMIT=100]  -->
@@ -1859,6 +1859,11 @@
     <!-- This string asks the user whether or not to allow an app to disable WiFi. [CHAR LIMIT=NONE] -->
     <string name="wifi_ask_disable"><xliff:g id="requester" example="FancyApp">%s</xliff:g> wants to turn off Wi-Fi</string>
 
+    <!-- Debugging developer settings: Enable ART verifier for Debuggable Apps [CHAR LIMIT=40] -->
+    <string name="art_verifier_for_debuggable_title">Verify bytecode of debuggable apps</string>
+    <!-- Debugging developer settings: Enable ART verifier for Debuggable Apps [CHAR LIMIT=NONE] -->
+    <string name="art_verifier_for_debuggable_summary">Allow ART to verify bytecode for debuggable apps</string>
+
     <!-- NFC settings -->
     <!-- Used in the 1st-level settings screen to turn on NFC -->
     <string name="nfc_quick_toggle_title">NFC</string>
@@ -2102,6 +2107,8 @@
     <string name="wifi_ip_settings">IP settings</string>
     <!-- Label for the spinner to show Wifi MAC randomization [CHAR LIMIT=25] -->
     <string name="wifi_privacy_settings">Privacy</string>
+    <!-- Summary for Wifi MAC randomization option when it is ephemeral network [CHAR LIMIT=25] -->
+    <string name="wifi_privacy_settings_ephemeral_summary">Randomized MAC</string>
     <!-- Title for the fragment to add a device into the wifi network [CHAR LIMIT=50]  -->
     <string name="wifi_dpp_add_device_to_network">Add a device</string>
     <!-- Hint for the user to center another device's QR code in the below camera window [CHAR LIMIT=120] -->
@@ -2117,7 +2124,19 @@
     <!-- Hint for the user to use another device to scan QR code on screen to join Wi-Fi [CHAR LIMIT=NONE] -->
     <string name="wifi_dpp_scan_qr_code_with_another_device">Scan this QR code with another device to join \u201c<xliff:g id="ssid" example="OfficeWifi">%1$s</xliff:g>\u201d</string>
     <!-- Hint for QR code detection [CHAR LIMIT=NONE]  -->
-    <string name="wifi_dpp_could_not_detect_valid_qr_code">Couldn\u2019t read QR code</string>
+    <string name="wifi_dpp_could_not_detect_valid_qr_code">Couldn\u2019t read QR code. Re-center code and try again</string>
+    <!-- Hint for Wi-Fi DPP handshake failure [CHAR LIMIT=NONE]  -->
+    <string name="wifi_dpp_failure_authentication_or_configuration">Try again. If the issue continues, contact the device manufacturer</string>
+    <!-- Hint for Wi-Fi DPP handshake failure [CHAR LIMIT=NONE]  -->
+    <string name="wifi_dpp_failure_not_compatible">Something went wrong</string>
+    <!-- Hint for Wi-Fi DPP handshake failure [CHAR LIMIT=NONE]  -->
+    <string name="wifi_dpp_failure_timeout">Make sure the device has been plugged in, charged, and turned on</string>
+    <!-- Hint for Wi-Fi DPP handshake failure [CHAR LIMIT=NONE]  -->
+    <string name="wifi_dpp_failure_generic">Make sure the device has been plugged in, charged, and turned on. If the issue continues, contact the device manufacturer</string>
+    <!-- Hint for Wi-Fi DPP handshake failure [CHAR LIMIT=NONE]  -->
+    <string name="wifi_dpp_failure_not_supported">Adding \u201c<xliff:g id="ssid" example="OfficeWifi">%1$s</xliff:g>\u201d isn\u2019t supported by this device</string>
+    <!-- Hint for Wi-Fi connection fail [CHAR LIMIT=NONE]  -->
+    <string name="wifi_dpp_check_connection_try_again">Check connection and try again</string>
     <!-- Title for the fragment choose network [CHAR LIMIT=50]  -->
     <string name="wifi_dpp_choose_network">Choose network</string>
     <!-- Hint for the user to center another device's QR code in the below camera window [CHAR LIMIT=NONE] -->
@@ -7615,6 +7634,15 @@
     <!-- Configure Notifications: Title for the notification bubbles option. [CHAR LIMIT=60] -->
     <string name="notification_bubbles_title">Allow notification bubbles</string>
 
+    <!-- Configure notifications: title for swipe direction [CHAR LIMIT=60] -->
+    <string name="swipe_direction_title">Swipe actions</string>
+
+    <!-- Configure notifications: value for swipe direction [CHAR LIMIT=100] -->
+    <string name="swipe_direction_ltr">Swipe right to dismiss, left to show menu</string>
+
+    <!-- Configure notifications: value for swipe direction [CHAR LIMIT=100] -->
+    <string name="swipe_direction_rtl">Swipe left to dismiss, right to show menu</string>
+
     <!-- Configure Notifications: Title for the pulse notification light option. [CHAR LIMIT=30] -->
     <string name="notification_pulse_title">Blink light</string>
 
@@ -9169,7 +9197,7 @@
     <!-- Title of condition that do not disturb is on [CHAR LIMIT=36] -->
     <string name="condition_zen_title">Do Not Disturb is on</string>
 
-    <!-- Summary of condition that do not disturb is on and all exceptions set to off [CHAR LIMIT=36] -->
+    <!-- Summary of condition that do not disturb is on and all exceptions set to off [CHAR LIMIT=38] -->
     <string name="condition_zen_summary_phone_muted">Phone muted</string>
 
     <!-- Summary of condition that do not disturb is on and some exceptions are allowed [CHAR LIMIT=36] -->
@@ -10560,6 +10588,8 @@
     <string name="network_connection_errorstate_dialog_message">Something came up. The application has cancelled the request to choose a device.</string>
     <!-- Toast message when connection is successful [CHAR LIMIT=30] -->
     <string name="network_connection_connect_successful">Connection successful</string>
+    <!-- Neutral button for Network connection request Dialog [CHAR LIMIT=30] -->
+    <string name="network_connection_request_dialog_showall">Show all</string>
 
     <!-- Summary for bluetooth devices count in Bluetooth devices slice. [CHAR LIMIT=NONE] -->
     <plurals name="show_bluetooth_devices">
@@ -10628,7 +10658,7 @@
     <string name="permission_bar_chart_title">Most-used permissions in last 24 hours</string>
 
     <!-- Text for permission bar chart details in Privacy page.  [CHAR LIMIT=NONE] -->
-    <string name="permission_bar_chart_details">See all usage</string>
+    <string name="permission_bar_chart_details">View Permissions Dashboard</string>
 
     <!-- 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/xml/configure_notification_settings.xml b/res/xml/configure_notification_settings.xml
index 8df1197..803d12b 100644
--- a/res/xml/configure_notification_settings.xml
+++ b/res/xml/configure_notification_settings.xml
@@ -19,58 +19,71 @@
                   android:title="@string/configure_notification_settings"
                   android:key="configure_notification_settings">
 
-    <!-- When device is locked -->
-    <com.android.settings.RestrictedListPreference
-        android:key="lock_screen_notifications"
-        android:title="@string/lock_screen_notifications_title"
-        android:summary="@string/summary_placeholder"
-        settings:searchable="false"/>
-
     <SwitchPreference
         android:key="hide_silent_icons"
         android:title="@string/hide_silent_icons_title"
         android:summary="@string/hide_silent_icons_summary"
         settings:controller="com.android.settings.notification.SilentStatusBarPreferenceController" />
 
-    <!-- Notification badging -->
-    <SwitchPreference
-        android:key="notification_badging"
-        android:title="@string/notification_badging_title"
-        settings:controller="com.android.settings.notification.BadgingNotificationPreferenceController"/>
+    <PreferenceCategory
+        android:key="configure_notifications_advanced"
+        android:order="15"
+        settings:initialExpandedChildrenCount="0">
 
-    <!-- Notification bubbles -->
-    <SwitchPreference
-        android:key="notification_bubbles"
-        android:title="@string/notification_bubbles_title"
-        settings:controller="com.android.settings.notification.BubbleNotificationPreferenceController"/>
+        <com.android.settings.RestrictedListPreference
+            android:key="swipe"
+            android:title="@string/swipe_direction_title"
+            android:entries="@array/swipe_direction_titles"
+            android:entryValues="@array/swipe_direction_values"
+            settings:controller="com.android.settings.notification.SwipeDirectionPreferenceController"/>
 
-    <!-- Pulse notification light -->
-    <SwitchPreference
-        android:key="notification_pulse"
-        android:title="@string/notification_pulse_title"
-        settings:controller="com.android.settings.notification.PulseNotificationPreferenceController"/>
+        <!-- When device is locked -->
+        <com.android.settings.RestrictedListPreference
+            android:key="lock_screen_notifications"
+            android:title="@string/lock_screen_notifications_title"
+            android:summary="@string/summary_placeholder"
+            settings:searchable="false"/>
 
-    <!-- Default notification ringtone -->
-    <com.android.settings.DefaultRingtonePreference
-        android:key="notification_default_ringtone"
-        android:title="@string/notification_ringtone_title"
-        android:dialogTitle="@string/notification_ringtone_title"
-        android:summary="@string/summary_placeholder"
-        android:ringtoneType="notification"/>
+        <!-- Notification badging -->
+        <SwitchPreference
+            android:key="notification_badging"
+            android:title="@string/notification_badging_title"
+            settings:controller="com.android.settings.notification.BadgingNotificationPreferenceController"/>
 
-    <Preference
-        android:key="gesture_swipe_down_fingerprint_notifications"
-        android:title="@string/fingerprint_swipe_for_notifications_title"
-        android:fragment="com.android.settings.gestures.SwipeToNotificationSettings"
-        settings:controller="com.android.settings.gestures.SwipeToNotificationPreferenceController"/>
+        <!-- Notification bubbles -->
+        <SwitchPreference
+            android:key="notification_bubbles"
+            android:title="@string/notification_bubbles_title"
+            settings:controller="com.android.settings.notification.BubbleNotificationPreferenceController"/>
 
-    <com.android.settingslib.RestrictedPreference
-        android:key="zen_mode_notifications"
-        android:title="@string/zen_mode_settings_title"
-        settings:useAdminDisabledSummary="true"
-        android:fragment="com.android.settings.notification.ZenModeSettings"
-        settings:controller="com.android.settings.notification.ZenModePreferenceController"
-        settings:allowDividerAbove="false"/>
+        <!-- Pulse notification light -->
+        <SwitchPreference
+            android:key="notification_pulse"
+            android:title="@string/notification_pulse_title"
+            settings:controller="com.android.settings.notification.PulseNotificationPreferenceController"/>
+
+        <!-- Default notification ringtone -->
+        <com.android.settings.DefaultRingtonePreference
+            android:key="notification_default_ringtone"
+            android:title="@string/notification_ringtone_title"
+            android:dialogTitle="@string/notification_ringtone_title"
+            android:summary="@string/summary_placeholder"
+            android:ringtoneType="notification"/>
+
+        <Preference
+            android:key="gesture_swipe_down_fingerprint_notifications"
+            android:title="@string/fingerprint_swipe_for_notifications_title"
+            android:fragment="com.android.settings.gestures.SwipeToNotificationSettings"
+            settings:controller="com.android.settings.gestures.SwipeToNotificationPreferenceController"/>
+
+        <com.android.settingslib.RestrictedPreference
+            android:key="zen_mode_notifications"
+            android:title="@string/zen_mode_settings_title"
+            settings:useAdminDisabledSummary="true"
+            android:fragment="com.android.settings.notification.ZenModeSettings"
+            settings:controller="com.android.settings.notification.ZenModePreferenceController"
+            settings:allowDividerAbove="false"/>
+    </PreferenceCategory>
 
     <!-- Empty category to draw divider -->
     <PreferenceCategory
diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml
index d9b592c..032f622 100644
--- a/res/xml/development_settings.xml
+++ b/res/xml/development_settings.xml
@@ -175,6 +175,11 @@
             android:title="@string/verify_apps_over_usb_title"
             android:summary="@string/verify_apps_over_usb_summary" />
 
+        <SwitchPreference
+            android:key="art_verifier_for_debuggable"
+            android:title="@string/art_verifier_for_debuggable_title"
+            android:summary="@string/art_verifier_for_debuggable_summary" />
+
         <ListPreference
             android:key="select_logd_size"
             android:title="@string/select_logd_size_title"
diff --git a/src/com/android/settings/SmsDefaultDialog.java b/src/com/android/settings/SmsDefaultDialog.java
index c25961d..e856897 100644
--- a/src/com/android/settings/SmsDefaultDialog.java
+++ b/src/com/android/settings/SmsDefaultDialog.java
@@ -67,6 +67,7 @@
     protected void onStart() {
         super.onStart();
         getWindow().addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
+        android.util.EventLog.writeEvent(0x534e4554, "120484087", -1, "");
     }
 
     @Override
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 65cfdf6..37643b3 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -89,6 +89,7 @@
 import android.widget.TabWidget;
 
 import androidx.annotation.StringRes;
+import androidx.core.graphics.drawable.IconCompat;
 import androidx.fragment.app.Fragment;
 import androidx.preference.Preference;
 import androidx.preference.PreferenceGroup;
@@ -950,24 +951,30 @@
             bitmap = Bitmap.createScaledBitmap(((BitmapDrawable) original).getBitmap(), width,
                     height, false);
         } else {
-            bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
-            final Canvas canvas = new Canvas(bitmap);
-            original.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
-            original.draw(canvas);
+            bitmap = createBitmap(original, width, height);
         }
         return new BitmapDrawable(null, bitmap);
     }
 
     /**
-     * Converts the {@link Drawable} to a {@link Bitmap}.
+     * Create an Icon pointing to a drawable.
      */
-    public static Bitmap drawableToBitmap(Drawable drawable) {
+    public static IconCompat createIconWithDrawable(Drawable drawable) {
+        Bitmap bitmap;
         if (drawable instanceof BitmapDrawable) {
-            return ((BitmapDrawable)drawable).getBitmap();
+            bitmap = ((BitmapDrawable)drawable).getBitmap();
+        } else {
+            final int width = drawable.getIntrinsicWidth();
+            final int height = drawable.getIntrinsicHeight();
+            bitmap = createBitmap(drawable,
+                    width > 0 ? width : 1,
+                    height > 0 ? height : 1);
         }
+        return IconCompat.createWithBitmap(bitmap);
+    }
 
-        final Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(),
-                drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
+    private static Bitmap createBitmap(Drawable drawable, int width, int height) {
+        final Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
         final Canvas canvas = new Canvas(bitmap);
         drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
         drawable.draw(canvas);
diff --git a/src/com/android/settings/accounts/AccountSyncSettings.java b/src/com/android/settings/accounts/AccountSyncSettings.java
index 0032989..ec74cd8 100644
--- a/src/com/android/settings/accounts/AccountSyncSettings.java
+++ b/src/com/android/settings/accounts/AccountSyncSettings.java
@@ -97,6 +97,7 @@
     public void onCreate(Bundle icicle) {
         super.onCreate(icicle);
         addPreferencesFromResource(R.xml.account_sync_settings);
+        getPreferenceScreen().setOrderingAsAdded(false);
         setAccessibilityTitle();
     }
 
@@ -127,6 +128,7 @@
                 .setLabel(mAccount.name)
                 .setSummary(getLabelForType(mAccount.type))
                 .done(activity, getPrefContext());
+        pref.setOrder(0);
         getPreferenceScreen().addPreference(pref);
     }
 
diff --git a/src/com/android/settings/applications/defaultapps/DefaultBrowserPreferenceController.java b/src/com/android/settings/applications/defaultapps/DefaultBrowserPreferenceController.java
index 24b4dcd..6cd72f7 100644
--- a/src/com/android/settings/applications/defaultapps/DefaultBrowserPreferenceController.java
+++ b/src/com/android/settings/applications/defaultapps/DefaultBrowserPreferenceController.java
@@ -45,7 +45,8 @@
     static final Intent BROWSE_PROBE = new Intent()
             .setAction(Intent.ACTION_VIEW)
             .addCategory(Intent.CATEGORY_BROWSABLE)
-            .setData(Uri.parse("http:"));
+            .setData(Uri.parse("http:"))
+            .addFlags(Intent.FLAG_IGNORE_EPHEMERAL);
 
     public DefaultBrowserPreferenceController(Context context) {
         super(context);
@@ -112,11 +113,13 @@
         final List<ResolveInfo> candidates = new ArrayList<>();
         // Resolve that intent and check that the handleAllWebDataURI boolean is set
         final List<ResolveInfo> list = packageManager.queryIntentActivitiesAsUser(
-            BROWSE_PROBE, 0 /* flags */, userId);
+            BROWSE_PROBE, PackageManager.MATCH_ALL, userId);
         if (list != null) {
             final Set<String> addedPackages = new ArraySet<>();
             for (ResolveInfo info : list) {
-                if (info.activityInfo == null || !info.handleAllWebDataURI) {
+                if (!info.handleAllWebDataURI || info.activityInfo == null
+                        || !info.activityInfo.enabled
+                        || !info.activityInfo.applicationInfo.enabled) {
                     continue;
                 }
                 final String packageName = info.activityInfo.packageName;
diff --git a/src/com/android/settings/applications/defaultapps/DefaultEmergencyPicker.java b/src/com/android/settings/applications/defaultapps/DefaultEmergencyPicker.java
index 5a1effd..f088967 100644
--- a/src/com/android/settings/applications/defaultapps/DefaultEmergencyPicker.java
+++ b/src/com/android/settings/applications/defaultapps/DefaultEmergencyPicker.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.applications.defaultapps;
 
+import android.app.role.RoleManager;
+import android.app.role.RoleManagerCallback;
 import android.app.settings.SettingsEnums;
 import android.content.ContentResolver;
 import android.content.Context;
@@ -23,9 +25,13 @@
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
+import android.os.AsyncTask;
+import android.os.Process;
 import android.provider.Settings;
 import android.text.TextUtils;
+import android.util.Log;
 
+import com.android.internal.util.CollectionUtils;
 import com.android.settings.R;
 import com.android.settings.Utils;
 import com.android.settingslib.applications.DefaultAppInfo;
@@ -35,7 +41,7 @@
 import java.util.List;
 
 public class DefaultEmergencyPicker extends DefaultAppPickerFragment {
-
+    private static final String TAG = "DefaultEmergencyPicker";
     @Override
     public int getMetricsCategory() {
         return SettingsEnums.DEFAULT_EMERGENCY_APP_PICKER;
@@ -85,20 +91,27 @@
 
     @Override
     protected String getDefaultKey() {
-        return Settings.Secure.getString(getContext().getContentResolver(),
-                Settings.Secure.EMERGENCY_ASSISTANCE_APPLICATION);
+        RoleManager roleManager = getContext().getSystemService(RoleManager.class);
+        return CollectionUtils.firstOrNull(roleManager.getRoleHolders(RoleManager.ROLE_EMERGENCY));
     }
 
     @Override
     protected boolean setDefaultKey(String key) {
-        final ContentResolver contentResolver = getContext().getContentResolver();
-        final String previousValue = Settings.Secure.getString(contentResolver,
-                Settings.Secure.EMERGENCY_ASSISTANCE_APPLICATION);
+        final String previousValue = getDefaultKey();
 
         if (!TextUtils.isEmpty(key) && !TextUtils.equals(key, previousValue)) {
-            Settings.Secure.putString(contentResolver,
-                    Settings.Secure.EMERGENCY_ASSISTANCE_APPLICATION,
-                    key);
+            getContext().getSystemService(RoleManager.class)
+                      .addRoleHolderAsUser(
+                              RoleManager.ROLE_EMERGENCY, key, 0, Process.myUserHandle(),
+                              AsyncTask.THREAD_POOL_EXECUTOR, new RoleManagerCallback() {
+                                  @Override
+                                  public void onSuccess() {}
+
+                                  @Override
+                                  public void onFailure() {
+                                      Log.e(TAG, "Failed to set emergency default app.");
+                                  }
+                              });
             return true;
         }
         return false;
diff --git a/src/com/android/settings/applications/defaultapps/DefaultEmergencyPreferenceController.java b/src/com/android/settings/applications/defaultapps/DefaultEmergencyPreferenceController.java
index e601a66..425b216 100644
--- a/src/com/android/settings/applications/defaultapps/DefaultEmergencyPreferenceController.java
+++ b/src/com/android/settings/applications/defaultapps/DefaultEmergencyPreferenceController.java
@@ -16,12 +16,14 @@
 
 package com.android.settings.applications.defaultapps;
 
+import android.app.role.RoleManager;
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.ResolveInfo;
 import android.provider.Settings;
 import android.telephony.TelephonyManager;
 
+import com.android.internal.util.CollectionUtils;
 import com.android.settingslib.applications.DefaultAppInfo;
 
 import java.util.List;
@@ -69,8 +71,9 @@
     }
 
     public static boolean isEmergencyDefault(String pkg, Context context) {
-        String defaultPackage = Settings.Secure.getString(context.getContentResolver(),
-                Settings.Secure.EMERGENCY_ASSISTANCE_APPLICATION);
+      String defaultPackage = CollectionUtils.firstOrNull(
+              context.getSystemService(RoleManager.class)
+                        .getRoleHolders(RoleManager.ROLE_EMERGENCY));
         return defaultPackage != null && defaultPackage.equals(pkg);
     }
 }
diff --git a/src/com/android/settings/applications/manageapplications/ManageApplications.java b/src/com/android/settings/applications/manageapplications/ManageApplications.java
index 816b44a..a9de206 100644
--- a/src/com/android/settings/applications/manageapplications/ManageApplications.java
+++ b/src/com/android/settings/applications/manageapplications/ManageApplications.java
@@ -186,7 +186,6 @@
 
     private View mLoadingContainer;
     private View mListContainer;
-    private RecyclerView mRecyclerView;
     private SearchView mSearchView;
 
     // Size resource used for packages whose size computation failed for some reason
@@ -220,7 +219,7 @@
     @VisibleForTesting
     FilterSpinnerAdapter mFilterAdapter;
     @VisibleForTesting
-    View mContentContainer;
+    RecyclerView mRecyclerView;
 
     private View mRootView;
     private Spinner mFilterSpinner;
@@ -330,7 +329,6 @@
             Bundle savedInstanceState) {
         mRootView = inflater.inflate(R.layout.manage_applications_apps, null);
         mLoadingContainer = mRootView.findViewById(R.id.loading_container);
-        mContentContainer = mRootView.findViewById(R.id.content_container);
         mListContainer = mRootView.findViewById(R.id.list_container);
         if (mListContainer != null) {
             // Create adapter and list view here
@@ -861,14 +859,14 @@
             // overlapped by floating filter.
             if (hasFilter) {
                 mManageApplications.mSpinnerHeader.setVisibility(View.VISIBLE);
-                mManageApplications.mContentContainer.setPadding(0 /* left */,
+                mManageApplications.mRecyclerView.setPadding(0 /* left */,
                         mContext.getResources().getDimensionPixelSize(
                                 R.dimen.app_bar_height) /* top */,
                         0 /* right */,
                         0 /* bottom */);
             } else {
                 mManageApplications.mSpinnerHeader.setVisibility(View.GONE);
-                mManageApplications.mContentContainer.setPadding(0 /* left */, 0 /* top */,
+                mManageApplications.mRecyclerView.setPadding(0 /* left */, 0 /* top */,
                         0 /* right */,
                         0 /* bottom */);
             }
diff --git a/src/com/android/settings/core/BasePreferenceController.java b/src/com/android/settings/core/BasePreferenceController.java
index 1c85009..324b509 100644
--- a/src/com/android/settings/core/BasePreferenceController.java
+++ b/src/com/android/settings/core/BasePreferenceController.java
@@ -15,7 +15,6 @@
 
 import android.annotation.IntDef;
 import android.content.Context;
-import android.content.IntentFilter;
 import android.text.TextUtils;
 import android.util.Log;
 
@@ -24,6 +23,7 @@
 
 import com.android.settings.search.SearchIndexableRaw;
 import com.android.settings.slices.SliceData;
+import com.android.settings.slices.Sliceable;
 import com.android.settingslib.core.AbstractPreferenceController;
 
 import java.lang.annotation.Retention;
@@ -37,7 +37,8 @@
  * for Slices. The abstract classes that inherit from this class will act as the direct interfaces
  * for each type when plugging into Slices.
  */
-public abstract class BasePreferenceController extends AbstractPreferenceController {
+public abstract class BasePreferenceController extends AbstractPreferenceController implements
+        Sliceable {
 
     private static final String TAG = "SettingsPrefController";
 
@@ -119,7 +120,7 @@
             final Class<?> clazz = Class.forName(controllerName);
             final Constructor<?> preferenceConstructor =
                     clazz.getConstructor(Context.class, String.class);
-            final Object[] params = new Object[] {context, key};
+            final Object[] params = new Object[]{context, key};
             return (BasePreferenceController) preferenceConstructor.newInstance(params);
         } catch (ClassNotFoundException | NoSuchMethodException | InstantiationException |
                 IllegalArgumentException | InvocationTargetException | IllegalAccessException e) {
@@ -137,7 +138,7 @@
         try {
             final Class<?> clazz = Class.forName(controllerName);
             final Constructor<?> preferenceConstructor = clazz.getConstructor(Context.class);
-            final Object[] params = new Object[] {context};
+            final Object[] params = new Object[]{context};
             return (BasePreferenceController) preferenceConstructor.newInstance(params);
         } catch (ClassNotFoundException | NoSuchMethodException | InstantiationException |
                 IllegalArgumentException | InvocationTargetException | IllegalAccessException e) {
@@ -227,41 +228,6 @@
     }
 
     /**
-     * @return an {@link IntentFilter} that includes all broadcasts which can affect the state of
-     * this Setting.
-     */
-    public IntentFilter getIntentFilter() {
-        return null;
-    }
-
-    /**
-     * Determines if the controller should be used as a Slice.
-     * <p>
-     *     Important criteria for a Slice are:
-     *     - Must be secure
-     *     - Must not be a privacy leak
-     *     - Must be understandable as a stand-alone Setting.
-     * <p>
-     *     This does not guarantee the setting is available. {@link #isAvailable()} should sill be
-     *     called.
-     *
-     * @return {@code true} if the controller should be used externally as a Slice.
-     */
-    public boolean isSliceable() {
-        return false;
-    }
-
-    /**
-     * @return {@code true} if the setting update asynchronously.
-     * <p>
-     * For example, a Wifi controller would return true, because it needs to update the radio
-     * and wait for it to turn on.
-     */
-    public boolean hasAsyncUpdate() {
-        return false;
-    }
-
-    /**
      * Updates non-indexable keys for search provider.
      *
      * Called by SearchIndexProvider#getNonIndexableKeys
@@ -293,6 +259,7 @@
 
     /**
      * Set {@link UiBlockListener}
+     *
      * @param uiBlockListener listener to set
      */
     public void setUiBlockListener(UiBlockListener uiBlockListener) {
@@ -306,6 +273,7 @@
         /**
          * To notify client that UI related background work is finished.
          * (i.e. Slice is fully loaded.)
+         *
          * @param controller Controller that contains background work
          */
         void onBlockerWorkFinished(BasePreferenceController controller);
@@ -321,5 +289,6 @@
      *
      * This music be used in {@link BasePreferenceController}
      */
-    public interface UiBlocker {}
+    public interface UiBlocker {
+    }
 }
\ No newline at end of file
diff --git a/src/com/android/settings/core/FeatureFlags.java b/src/com/android/settings/core/FeatureFlags.java
index d1c2fd5..78fdfe7 100644
--- a/src/com/android/settings/core/FeatureFlags.java
+++ b/src/com/android/settings/core/FeatureFlags.java
@@ -26,7 +26,6 @@
     public static final String MOBILE_NETWORK_V2 = "settings_mobile_network_v2";
     public static final String WIFI_MAC_RANDOMIZATION = "settings_wifi_mac_randomization";
     public static final String NETWORK_INTERNET_V2 = "settings_network_and_internet_v2";
-    public static final String WIFI_SHARING = "settings_wifi_sharing";
     public static final String SLICE_INJECTION = "settings_slice_injection";
     public static final String MAINLINE_MODULE = "settings_mainline_module";
 }
diff --git a/src/com/android/settings/development/ArtVerifierPreferenceController.java b/src/com/android/settings/development/ArtVerifierPreferenceController.java
new file mode 100644
index 0000000..4b2f030
--- /dev/null
+++ b/src/com/android/settings/development/ArtVerifierPreferenceController.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.development;
+
+import android.content.Context;
+import android.provider.Settings;
+
+import androidx.annotation.VisibleForTesting;
+import androidx.preference.Preference;
+import androidx.preference.SwitchPreference;
+
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.development.DeveloperOptionsPreferenceController;
+
+public class ArtVerifierPreferenceController extends DeveloperOptionsPreferenceController
+        implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
+
+    private static final String ART_VERIFIER_FOR_DEBUGGABLE = "art_verifier_for_debuggable";
+
+    @VisibleForTesting
+    static final int SETTING_VALUE_ON = 1;
+    @VisibleForTesting
+    static final int SETTING_VALUE_OFF = 0;
+
+    public ArtVerifierPreferenceController(Context context) {
+        super(context);
+    }
+
+    @Override
+    public String getPreferenceKey() {
+        return ART_VERIFIER_FOR_DEBUGGABLE;
+    }
+
+    @Override
+    public boolean onPreferenceChange(Preference preference, Object newValue) {
+        final boolean isEnabled = (Boolean) newValue;
+        Settings.Global.putInt(mContext.getContentResolver(),
+                Settings.Global.ART_VERIFIER_VERIFY_DEBUGGABLE,
+                isEnabled ? SETTING_VALUE_ON : SETTING_VALUE_OFF);
+        return true;
+    }
+
+    @Override
+    public void updateState(Preference preference) {
+        final int verifyDebuggable = Settings.Global.getInt(
+                mContext.getContentResolver(),
+                Settings.Global.ART_VERIFIER_VERIFY_DEBUGGABLE, SETTING_VALUE_ON);
+        ((SwitchPreference) mPreference).setChecked(verifyDebuggable != SETTING_VALUE_OFF);
+    }
+
+    @Override
+    protected void onDeveloperOptionsSwitchDisabled() {
+        super.onDeveloperOptionsSwitchDisabled();
+        Settings.Global.putInt(mContext.getContentResolver(),
+                Settings.Global.ART_VERIFIER_VERIFY_DEBUGGABLE, SETTING_VALUE_ON);
+        ((SwitchPreference) mPreference).setChecked(true);
+    }
+}
diff --git a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
index 78520c6..adc23a8 100644
--- a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
+++ b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
@@ -424,6 +424,7 @@
         controllers.add(new WaitForDebuggerPreferenceController(context));
         controllers.add(new EnableGpuDebugLayersPreferenceController(context));
         controllers.add(new VerifyAppsOverUsbPreferenceController(context));
+        controllers.add(new ArtVerifierPreferenceController(context));
         controllers.add(new LogdSizePreferenceController(context));
         controllers.add(new LogPersistPreferenceController(context, fragment, lifecycle));
         controllers.add(new CameraLaserSensorPreferenceController(context));
diff --git a/src/com/android/settings/development/OemUnlockPreferenceController.java b/src/com/android/settings/development/OemUnlockPreferenceController.java
index 2a397f1..f12d835 100644
--- a/src/com/android/settings/development/OemUnlockPreferenceController.java
+++ b/src/com/android/settings/development/OemUnlockPreferenceController.java
@@ -21,11 +21,13 @@
 import android.app.Activity;
 import android.content.Context;
 import android.content.Intent;
+import android.content.pm.PackageManager;
 import android.content.res.Resources;
 import android.os.UserHandle;
 import android.os.UserManager;
 import android.service.oemlock.OemLockManager;
 import android.telephony.TelephonyManager;
+import android.util.Log;
 
 import androidx.annotation.VisibleForTesting;
 import androidx.preference.Preference;
@@ -41,6 +43,7 @@
         Preference.OnPreferenceChangeListener, PreferenceControllerMixin, OnActivityResultListener {
 
     private static final String PREFERENCE_KEY = "oem_unlock_enable";
+    private static final String TAG = "OemUnlockPreferenceController";
 
     private final OemLockManager mOemLockManager;
     private final UserManager mUserManager;
@@ -52,7 +55,16 @@
     public OemUnlockPreferenceController(Context context, Activity activity,
             DevelopmentSettingsDashboardFragment fragment) {
         super(context);
-        mOemLockManager = (OemLockManager) context.getSystemService(Context.OEM_LOCK_SERVICE);
+
+        if (context.getPackageManager().hasSystemFeature(PackageManager
+                    .FEATURE_TELEPHONY_CARRIERLOCK)) {
+            mOemLockManager = (OemLockManager) context.getSystemService(Context.OEM_LOCK_SERVICE);
+        } else {
+            mOemLockManager = null;
+            Log.i(TAG, "Missing FEATURE_TELEPHONY_CARRIERLOCK, OemUnlock Preference" +
+                    " Controller disabled.");
+        }
+
         mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
         mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
         mFragment = fragment;
diff --git a/src/com/android/settings/homepage/contextualcards/ContextualCardLoader.java b/src/com/android/settings/homepage/contextualcards/ContextualCardLoader.java
index 7a0eb0f..b9b2a1c 100644
--- a/src/com/android/settings/homepage/contextualcards/ContextualCardLoader.java
+++ b/src/com/android/settings/homepage/contextualcards/ContextualCardLoader.java
@@ -16,20 +16,13 @@
 
 package com.android.settings.homepage.contextualcards;
 
-import static android.app.slice.Slice.HINT_ERROR;
-
-import static androidx.slice.widget.SliceLiveData.SUPPORTED_SPECS;
-
 import static com.android.settings.slices.CustomSliceRegistry.BLUETOOTH_DEVICES_SLICE_URI;
 import static com.android.settings.slices.CustomSliceRegistry.CONTEXTUAL_WIFI_SLICE_URI;
 import static com.android.settings.slices.CustomSliceRegistry.NOTIFICATION_CHANNEL_SLICE_URI;
 
-import android.content.ContentProviderClient;
-import android.content.ContentResolver;
 import android.content.Context;
 import android.database.ContentObserver;
 import android.database.Cursor;
-import android.net.Uri;
 import android.os.Handler;
 import android.os.Looper;
 import android.text.format.DateUtils;
@@ -37,7 +30,6 @@
 
 import androidx.annotation.NonNull;
 import androidx.annotation.VisibleForTesting;
-import androidx.slice.Slice;
 
 import com.android.settings.R;
 import com.android.settings.overlay.FeatureFactory;
@@ -45,7 +37,12 @@
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.stream.Collectors;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
 
 public class ContextualCardLoader extends AsyncLoaderCompat<List<ContextualCard>> {
 
@@ -55,7 +52,9 @@
     static final long CARD_CONTENT_LOADER_TIMEOUT_MS = DateUtils.SECOND_IN_MILLIS * 3;
 
     private static final String TAG = "ContextualCardLoader";
+    private static final long ELIGIBILITY_CHECKER_TIMEOUT_MS = 250;
 
+    private final ExecutorService mExecutorService;
     private final ContentObserver mObserver = new ContentObserver(
             new Handler(Looper.getMainLooper())) {
         @Override
@@ -71,6 +70,7 @@
     ContextualCardLoader(Context context) {
         super(context);
         mContext = context.getApplicationContext();
+        mExecutorService = Executors.newCachedThreadPool();
     }
 
     @Override
@@ -169,43 +169,27 @@
 
     @VisibleForTesting
     List<ContextualCard> filterEligibleCards(List<ContextualCard> candidates) {
-        return candidates.stream().filter(card -> isCardEligibleToDisplay(card))
-                .collect(Collectors.toList());
-    }
+        final List<ContextualCard> cards = new ArrayList<>();
+        final List<Future<ContextualCard>> eligibleCards = new ArrayList<>();
 
-    @VisibleForTesting
-    boolean isCardEligibleToDisplay(ContextualCard card) {
-        final long startTime = System.currentTimeMillis();
-        if (card.isCustomCard()) {
-            return true;
+        for (ContextualCard card : candidates) {
+            final EligibleCardChecker future = new EligibleCardChecker(mContext, card);
+            eligibleCards.add(mExecutorService.submit(future));
         }
-
-        final Uri uri = card.getSliceUri();
-
-        if (!ContentResolver.SCHEME_CONTENT.equals(uri.getScheme())) {
-            return false;
+        // Collect future and eligible cards
+        for (Future<ContextualCard> cardFuture : eligibleCards) {
+            try {
+                //TODO(b/124492762): Log latency and timeout occurrence.
+                final ContextualCard card = cardFuture.get(ELIGIBILITY_CHECKER_TIMEOUT_MS,
+                        TimeUnit.MILLISECONDS);
+                if (card != null) {
+                    cards.add(card);
+                }
+            } catch (ExecutionException | InterruptedException | TimeoutException e) {
+                Log.w(TAG, "Failed to get eligible state for card, likely timeout. Skipping", e);
+            }
         }
-
-        //check if the uri has a provider associated with.
-        final ContentProviderClient provider =
-                mContext.getContentResolver().acquireContentProviderClient(uri);
-        if (provider == null) {
-            return false;
-        }
-        //release contentProviderClient to prevent from memory leak.
-        provider.release();
-
-        final Slice slice = Slice.bindSlice(mContext, uri, SUPPORTED_SPECS);
-        //TODO(b/123668403): remove the log here once we do the change with FutureTask
-        final long bindTime = System.currentTimeMillis() - startTime;
-        Log.d(TAG, "Binding time for " + uri + " = " + bindTime);
-
-        if (slice == null || slice.hasHint(HINT_ERROR)) {
-            Log.w(TAG, "Failed to bind slice, not eligible for display " + uri);
-            return false;
-        }
-
-        return true;
+        return cards;
     }
 
     private int getNumberOfLargeCard(List<ContextualCard> cards) {
diff --git a/src/com/android/settings/homepage/contextualcards/EligibleCardChecker.java b/src/com/android/settings/homepage/contextualcards/EligibleCardChecker.java
new file mode 100644
index 0000000..5423ce3
--- /dev/null
+++ b/src/com/android/settings/homepage/contextualcards/EligibleCardChecker.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.homepage.contextualcards;
+
+import static android.app.slice.Slice.HINT_ERROR;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.net.Uri;
+import android.util.Log;
+
+import androidx.annotation.VisibleForTesting;
+import androidx.slice.Slice;
+import androidx.slice.SliceViewManager;
+
+import java.util.concurrent.Callable;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+public class EligibleCardChecker implements Callable<ContextualCard> {
+
+    private static final String TAG = "EligibleCardChecker";
+    private static final long LATCH_TIMEOUT_MS = 200;
+
+    private final Context mContext;
+    private final ContextualCard mCard;
+
+    EligibleCardChecker(Context context, ContextualCard card) {
+        mContext = context;
+        mCard = card;
+    }
+
+    @Override
+    public ContextualCard call() throws Exception {
+        return isCardEligibleToDisplay(mCard) ? mCard : null;
+    }
+
+    @VisibleForTesting
+    boolean isCardEligibleToDisplay(ContextualCard card) {
+        if (card.isCustomCard()) {
+            return true;
+        }
+
+        final Uri uri = card.getSliceUri();
+        if (!ContentResolver.SCHEME_CONTENT.equals(uri.getScheme())) {
+            return false;
+        }
+
+        final Slice slice = bindSlice(uri);
+        if (slice == null || slice.hasHint(HINT_ERROR)) {
+            Log.w(TAG, "Failed to bind slice, not eligible for display " + uri);
+            return false;
+        }
+        return true;
+    }
+
+    @VisibleForTesting
+    Slice bindSlice(Uri uri) {
+        final SliceViewManager manager = SliceViewManager.getInstance(mContext);
+        final Slice[] returnSlice = new Slice[1];
+        final CountDownLatch latch = new CountDownLatch(1);
+        final SliceViewManager.SliceCallback callback =
+                new SliceViewManager.SliceCallback() {
+                    @Override
+                    public void onSliceUpdated(Slice slice) {
+                        try {
+                            // We are just making sure the existence of the slice, so ignore
+                            // slice loading state here.
+                            returnSlice[0] = slice;
+                            latch.countDown();
+                        } catch (Exception e) {
+                            Log.w(TAG, uri + " cannot be indexed", e);
+                        } finally {
+                            manager.unregisterSliceCallback(uri, this);
+                        }
+                    }
+                };
+        // Register a callback until we get a loaded slice.
+        manager.registerSliceCallback(uri, callback);
+        // Trigger the binding.
+        callback.onSliceUpdated(manager.bindSlice(uri));
+        try {
+            latch.await(LATCH_TIMEOUT_MS, TimeUnit.MILLISECONDS);
+        } catch (InterruptedException e) {
+            Log.w(TAG, "Error waiting for slice binding for uri" + uri, e);
+            manager.unregisterSliceCallback(uri, callback);
+        }
+        return returnSlice[0];
+    }
+}
diff --git a/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSlice.java b/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSlice.java
index 5673948..95412a8 100644
--- a/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSlice.java
+++ b/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSlice.java
@@ -37,7 +37,6 @@
 import com.android.settings.SubSettings;
 import com.android.settings.Utils;
 import com.android.settings.bluetooth.BluetoothDeviceDetailsFragment;
-import com.android.settings.bluetooth.BluetoothPairingDetail;
 import com.android.settings.connecteddevice.ConnectedDeviceDashboardFragment;
 import com.android.settings.core.SubSettingLauncher;
 import com.android.settings.slices.CustomSliceRegistry;
@@ -127,11 +126,6 @@
             listBuilder.addRow(rows.get(i));
         }
 
-        // Add "Pair new device" if need.
-        if (rows.size() < DEFAULT_EXPANDED_ROW_COUNT) {
-            listBuilder.addRow(getPairNewDeviceRowBuilder());
-        }
-
         return listBuilder.build();
     }
 
@@ -220,7 +214,7 @@
                 .getBtClassDrawableWithDescription(mContext, device);
 
         if (pair.first != null) {
-            return IconCompat.createWithBitmap(Utils.drawableToBitmap(pair.first));
+            return Utils.createIconWithDrawable(pair.first);
         } else {
             return IconCompat.createWithResource(mContext,
                 com.android.internal.R.drawable.ic_settings_bluetooth);
@@ -268,26 +262,4 @@
         return mContext.getResources().getQuantityString(R.plurals.show_bluetooth_devices,
                 deviceCount, deviceCount);
     }
-
-    private ListBuilder.RowBuilder getPairNewDeviceRowBuilder() {
-        final CharSequence title = mContext.getText(R.string.bluetooth_pairing_pref_title);
-        final IconCompat icon = IconCompat.createWithResource(mContext, R.drawable.ic_menu_add);
-        final SliceAction sliceAction = SliceAction.createDeeplink(
-                getPairNewDeviceIntent(), icon, ListBuilder.ICON_IMAGE, title);
-
-        return new ListBuilder.RowBuilder()
-                .setTitleItem(icon, ListBuilder.ICON_IMAGE)
-                .setTitle(title)
-                .setPrimaryAction(sliceAction);
-    }
-
-    private PendingIntent getPairNewDeviceIntent() {
-        final Intent intent = new SubSettingLauncher(mContext)
-                .setDestination(BluetoothPairingDetail.class.getName())
-                .setTitleRes(R.string.bluetooth_pairing_page_title)
-                .setSourceMetricsCategory(SettingsEnums.BLUETOOTH_PAIRING)
-                .toIntent();
-
-        return PendingIntent.getActivity(mContext, 0  /* requestCode */, intent, 0  /* flags */);
-    }
 }
diff --git a/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSlice.java b/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSlice.java
index 692dc0a..c2c2ece 100644
--- a/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSlice.java
+++ b/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSlice.java
@@ -30,9 +30,6 @@
 import android.content.Intent;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.os.Bundle;
@@ -243,7 +240,7 @@
             return null;
         }
 
-        return IconCompat.createWithBitmap(Utils.drawableToBitmap(drawable));
+        return Utils.createIconWithDrawable(drawable);
     }
 
     @VisibleForTesting
diff --git a/src/com/android/settings/inputmethod/UserDictionaryListPreferenceController.java b/src/com/android/settings/inputmethod/UserDictionaryListPreferenceController.java
index 4be70d5..4a409e1 100644
--- a/src/com/android/settings/inputmethod/UserDictionaryListPreferenceController.java
+++ b/src/com/android/settings/inputmethod/UserDictionaryListPreferenceController.java
@@ -79,7 +79,7 @@
     @NonNull
     public static TreeSet<String> getUserDictionaryLocalesSet(Context context) {
         final Cursor cursor = context.getContentResolver().query(
-                UserDictionary.Words.CONTENT_URI, new String[] {UserDictionary.Words.LOCALE},
+                UserDictionary.Words.CONTENT_URI, new String[]{UserDictionary.Words.LOCALE},
                 null, null, null);
         final TreeSet<String> localeSet = new TreeSet<>();
         if (cursor == null) {
@@ -124,14 +124,14 @@
         // enabled subtypes. If we already have the locale-without-country version of the system
         // locale, we don't add the system locale to avoid confusion even though it's technically
         // correct to add it.
-        if (!localeSet.contains(Locale.getDefault().getLanguage().toString())) {
+        if (!localeSet.contains(Locale.getDefault().getLanguage())) {
             localeSet.add(Locale.getDefault().toString());
         }
 
         return localeSet;
     }
 
-    @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
+    @VisibleForTesting
     TreeSet<String> getUserDictLocalesSet(Context context) {
         return getUserDictionaryLocalesSet(context);
     }
@@ -140,7 +140,6 @@
      * Creates the entries that allow the user to go into the user dictionary for each locale.
      */
     private void createUserDictSettings() {
-
         final TreeSet<String> localeSet = getUserDictLocalesSet(mContext);
         final int prefCount = mScreen.getPreferenceCount();
         String prefKey;
@@ -160,8 +159,8 @@
         if (prefCount > 0) {
             for (int i = prefCount - 1; i >= 0; i--) {
                 prefKey = mScreen.getPreference(i).getKey();
-                if (KEY_ALL_LANGUAGE.equals(prefKey)) {
-                    prefKey = "";
+                if (TextUtils.isEmpty(prefKey) || TextUtils.equals(KEY_ALL_LANGUAGE, prefKey)) {
+                    continue;
                 }
                 if (!localeSet.isEmpty() && localeSet.contains(prefKey)) {
                     localeSet.remove(prefKey);
diff --git a/src/com/android/settings/media/MediaOutputSlice.java b/src/com/android/settings/media/MediaOutputSlice.java
index 5c5eb88..d52b441 100644
--- a/src/com/android/settings/media/MediaOutputSlice.java
+++ b/src/com/android/settings/media/MediaOutputSlice.java
@@ -23,8 +23,6 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.PackageManager;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.os.UserHandle;
@@ -87,7 +85,7 @@
 
         final Drawable drawable =
                 Utils.getBadgedIcon(mIconDrawableFactory, pm, mPackageName, UserHandle.myUserId());
-        final IconCompat icon = IconCompat.createWithBitmap(getBitmapFromDrawable(drawable));
+        final IconCompat icon = Utils.createIconWithDrawable(drawable);
 
         @ColorInt final int color = Utils.getColorAccentDefaultColor(mContext);
         final SliceAction primarySliceAction = SliceAction.createDeeplink(getPrimaryAction(), icon,
@@ -134,17 +132,6 @@
         return PendingIntent.getActivity(mContext, 0  /* requestCode */, intent, 0  /* flags */);
     }
 
-    private Bitmap getBitmapFromDrawable(Drawable drawable) {
-        final Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(),
-                drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
-        final Canvas canvas = new Canvas(bitmap);
-
-        drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
-        drawable.draw(canvas);
-
-        return bitmap;
-    }
-
     private ListBuilder.RowBuilder getMediaDeviceRow(MediaDevice device) {
         final String title = device.getName();
         final PendingIntent broadcastAction =
diff --git a/src/com/android/settings/network/telephony/MobileDataPreferenceController.java b/src/com/android/settings/network/telephony/MobileDataPreferenceController.java
index f678e08..de54879 100644
--- a/src/com/android/settings/network/telephony/MobileDataPreferenceController.java
+++ b/src/com/android/settings/network/telephony/MobileDataPreferenceController.java
@@ -22,21 +22,21 @@
 import android.os.Handler;
 import android.os.Looper;
 import android.provider.Settings;
+import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
 import android.text.TextUtils;
 
+import com.android.settingslib.core.lifecycle.LifecycleObserver;
+import com.android.settingslib.core.lifecycle.events.OnStart;
+import com.android.settingslib.core.lifecycle.events.OnStop;
+
 import androidx.annotation.VisibleForTesting;
 import androidx.fragment.app.FragmentManager;
 import androidx.preference.Preference;
 import androidx.preference.PreferenceScreen;
 import androidx.preference.SwitchPreference;
 
-import com.android.settings.core.TogglePreferenceController;
-import com.android.settingslib.core.lifecycle.LifecycleObserver;
-import com.android.settingslib.core.lifecycle.events.OnStart;
-import com.android.settingslib.core.lifecycle.events.OnStop;
-
 /**
  * Preference controller for "Mobile data"
  */
@@ -115,8 +115,18 @@
 
     @Override
     public boolean isChecked() {
-        return mTelephonyManager.isDataEnabled()
-                && mSubId == SubscriptionManager.getDefaultDataSubscriptionId();
+        return mTelephonyManager.isDataEnabled();
+    }
+
+    @Override
+    public void updateState(Preference preference) {
+        super.updateState(preference);
+        preference.setEnabled(!isOpportunistic());
+    }
+
+    private boolean isOpportunistic() {
+        SubscriptionInfo info = mSubscriptionManager.getActiveSubscriptionInfo(mSubId);
+        return info != null && info.isOpportunistic();
     }
 
     public static Uri getObservableUri(int subId) {
diff --git a/src/com/android/settings/notification/SwipeDirectionPreferenceController.java b/src/com/android/settings/notification/SwipeDirectionPreferenceController.java
new file mode 100644
index 0000000..0d122d7
--- /dev/null
+++ b/src/com/android/settings/notification/SwipeDirectionPreferenceController.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.notification;
+
+import android.content.Context;
+import android.provider.Settings;
+
+import com.android.settings.R;
+import com.android.settings.core.BasePreferenceController;
+
+import androidx.preference.ListPreference;
+import androidx.preference.Preference;
+
+public class SwipeDirectionPreferenceController extends BasePreferenceController
+        implements Preference.OnPreferenceChangeListener {
+
+    public SwipeDirectionPreferenceController(Context context, String key) {
+        super(context, key);
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return AVAILABLE;
+    }
+
+    @Override
+    public void updateState(Preference pref) {
+        ((ListPreference) pref).setValue(String.valueOf(Settings.Secure.getInt(
+                mContext.getContentResolver(),
+                Settings.Secure.NOTIFICATION_DISMISS_RTL,
+                1)));
+        super.updateState(pref);
+    }
+
+    @Override
+    public boolean onPreferenceChange(Preference preference, Object newValue) {
+        Settings.Secure.putInt(mContext.getContentResolver(),
+                Settings.Secure.NOTIFICATION_DISMISS_RTL,
+                Integer.valueOf((String) newValue));
+        refreshSummary(preference);
+        return true;
+    }
+
+    @Override
+    public CharSequence getSummary() {
+        int value = Settings.Secure.getInt(mContext.getContentResolver(),
+                Settings.Secure.NOTIFICATION_DISMISS_RTL, 1);
+        String[] values = mContext.getResources().getStringArray(R.array.swipe_direction_values);
+        String[] titles = mContext.getResources().getStringArray(R.array.swipe_direction_titles);
+        if (values == null) {
+            return null;
+        }
+        for (int i = 0; i < values.length; i++) {
+            int valueAt = Integer.parseInt(values[i]);
+            if (value == valueAt) {
+                return titles[i];
+            }
+        }
+        return null;
+    }
+}
diff --git a/src/com/android/settings/privacy/PermissionBarChartPreferenceController.java b/src/com/android/settings/privacy/PermissionBarChartPreferenceController.java
index 82464c9..2c6368e 100644
--- a/src/com/android/settings/privacy/PermissionBarChartPreferenceController.java
+++ b/src/com/android/settings/privacy/PermissionBarChartPreferenceController.java
@@ -31,28 +31,29 @@
 import android.view.View;
 
 import androidx.annotation.NonNull;
-import androidx.preference.Preference;
 import androidx.preference.PreferenceScreen;
 
 import com.android.settings.R;
 import com.android.settings.core.BasePreferenceController;
+import com.android.settingslib.Utils;
+import com.android.settingslib.core.lifecycle.LifecycleObserver;
+import com.android.settingslib.core.lifecycle.events.OnStart;
 import com.android.settingslib.widget.BarChartInfo;
 import com.android.settingslib.widget.BarChartPreference;
 import com.android.settingslib.widget.BarViewInfo;
-import com.android.settingslib.Utils;
 
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.List;
-import java.util.concurrent.Executors;
 
 
 public class PermissionBarChartPreferenceController extends BasePreferenceController implements
-        PermissionControllerManager.OnPermissionUsageResultCallback {
+        PermissionControllerManager.OnPermissionUsageResultCallback, LifecycleObserver, OnStart {
 
     private static final String TAG = "BarChartPreferenceCtl";
 
     private PackageManager mPackageManager;
+    private PrivacyDashboardFragment mParent;
     private BarChartPreference mBarChartPreference;
     private List<RuntimePermissionUsageInfo> mOldUsageInfos;
 
@@ -62,6 +63,10 @@
         mPackageManager = context.getPackageManager();
     }
 
+    public void setFragment(PrivacyDashboardFragment fragment) {
+        mParent = fragment;
+    }
+
     @Override
     public int getAvailabilityStatus() {
         return Boolean.parseBoolean(
@@ -90,7 +95,13 @@
     }
 
     @Override
-    public void updateState(Preference preference) {
+    public void onStart() {
+        if (!isAvailable()) {
+            return;
+        }
+
+        mBarChartPreference.updateLoadingState(true /* isLoading */);
+        mParent.setLoadingEnabled(true /* enabled */);
         retrievePermissionUsageData();
     }
 
@@ -104,6 +115,9 @@
             mBarChartPreference.setBarViewInfos(createBarViews(usageInfos));
             mOldUsageInfos = usageInfos;
         }
+
+        mBarChartPreference.updateLoadingState(false /* isLoading */);
+        mParent.setLoadingEnabled(false /* enabled */);
     }
 
     private void retrievePermissionUsageData() {
diff --git a/src/com/android/settings/privacy/PrivacyDashboardFragment.java b/src/com/android/settings/privacy/PrivacyDashboardFragment.java
index 5823407..be6701e 100644
--- a/src/com/android/settings/privacy/PrivacyDashboardFragment.java
+++ b/src/com/android/settings/privacy/PrivacyDashboardFragment.java
@@ -48,6 +48,11 @@
     private static final String KEY_NOTIFICATION_WORK_PROFILE_NOTIFICATIONS =
             "privacy_lock_screen_work_profile_notifications";
 
+    @VisibleForTesting
+    View mProgressHeader;
+    @VisibleForTesting
+    View mProgressAnimation;
+
     @Override
     public int getMetricsCategory() {
         return SettingsEnums.TOP_LEVEL_PRIVACY;
@@ -74,9 +79,16 @@
     }
 
     @Override
+    public void onAttach(Context context) {
+        super.onAttach(context);
+        use(PermissionBarChartPreferenceController.class).setFragment(this /* fragment */);
+    }
+
+    @Override
     public void onViewCreated(View view, Bundle savedInstanceState) {
         super.onViewCreated(view, savedInstanceState);
         styleActionBar();
+        initLoadingBar();
     }
 
     @VisibleForTesting
@@ -97,6 +109,21 @@
         }
     }
 
+    @VisibleForTesting
+    void initLoadingBar() {
+        mProgressHeader = setPinnedHeaderView(R.layout.progress_header);
+        mProgressAnimation = mProgressHeader.findViewById(R.id.progress_bar_animation);
+        setLoadingEnabled(false);
+    }
+
+    @VisibleForTesting
+    void setLoadingEnabled(boolean enabled) {
+        if (mProgressHeader != null && mProgressAnimation != null) {
+            mProgressHeader.setVisibility(enabled ? View.VISIBLE : View.INVISIBLE);
+            mProgressAnimation.setVisibility(enabled ? View.VISIBLE : View.INVISIBLE);
+        }
+    }
+
     private static List<AbstractPreferenceController> buildPreferenceControllers(
             Context context, Lifecycle lifecycle) {
         final List<AbstractPreferenceController> controllers = new ArrayList<>();
diff --git a/src/com/android/settings/slices/CustomSliceable.java b/src/com/android/settings/slices/CustomSliceable.java
index 220cdc8..d32e266 100644
--- a/src/com/android/settings/slices/CustomSliceable.java
+++ b/src/com/android/settings/slices/CustomSliceable.java
@@ -52,7 +52,7 @@
  * <p>
  *     If you implement this interface, you should add your Slice to {@link CustomSliceManager}.
  */
-public interface CustomSliceable {
+public interface CustomSliceable extends Sliceable {
 
     /**
      * @return an complete instance of the {@link Slice}.
@@ -79,17 +79,6 @@
     Intent getIntent();
 
     /**
-     * Settings Slices which can represent components that are updatable by the framework should
-     * listen to changes matched to the {@link IntentFilter} returned here.
-     *
-     * @return an {@link IntentFilter} for updates related to the {@link Slice} returned by
-     * {@link #getSlice()}.
-     */
-    default IntentFilter getIntentFilter() {
-        return null;
-    }
-
-    /**
      * Settings Slices which require background work, such as updating lists should implement a
      * {@link SliceBackgroundWorker} and return it here. An example of background work is updating
      * a list of Wifi networks available in the area.
@@ -116,12 +105,16 @@
                 PendingIntent.FLAG_CANCEL_CURRENT);
     }
 
+    @Override
+    default boolean isSliceable() {
+        return true;
+    }
+
     /**
      * Build an instance of a {@link CustomSliceable} which has a {@link Context}-only constructor.
      */
     static CustomSliceable createInstance(Context context, Class<CustomSliceable> sliceableClass) {
         try {
-            //final Class<CustomSliceable> clazz = Class.forName(sliceableClassName);
             final Constructor<CustomSliceable> sliceable =
                     sliceableClass.getConstructor(Context.class);
             final Object[] params = new Object[]{context};
diff --git a/src/com/android/settings/slices/SettingsSliceProvider.java b/src/com/android/settings/slices/SettingsSliceProvider.java
index f229486..5c662e5 100644
--- a/src/com/android/settings/slices/SettingsSliceProvider.java
+++ b/src/com/android/settings/slices/SettingsSliceProvider.java
@@ -411,9 +411,7 @@
 
     @VisibleForTesting
     void loadSliceInBackground(Uri uri) {
-        ThreadUtils.postOnBackgroundThread(() -> {
-            loadSlice(uri);
-        });
+        ThreadUtils.postOnBackgroundThread(() -> loadSlice(uri));
     }
 
     /**
diff --git a/src/com/android/settings/slices/Sliceable.java b/src/com/android/settings/slices/Sliceable.java
new file mode 100644
index 0000000..ddec2e1
--- /dev/null
+++ b/src/com/android/settings/slices/Sliceable.java
@@ -0,0 +1,58 @@
+/*
+ * 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.slices;
+
+import android.content.IntentFilter;
+
+/**
+ * A collection of API making a PreferenceController "sliceable"
+ */
+public interface Sliceable {
+    /**
+     * @return an {@link IntentFilter} that includes all broadcasts which can affect the state of
+     * this Setting.
+     */
+    default IntentFilter getIntentFilter() {
+        return null;
+    }
+
+    /**
+     * Determines if the controller should be used as a Slice.
+     * <p>
+     * Important criteria for a Slice are:
+     * - Must be secure
+     * - Must not be a privacy leak
+     * - Must be understandable as a stand-alone Setting.
+     * <p>
+     * This does not guarantee the setting is available.
+     *
+     * @return {@code true} if the controller should be used externally as a Slice.
+     */
+    default boolean isSliceable() {
+        return false;
+    }
+
+    /**
+     * @return {@code true} if the setting update asynchronously.
+     * <p>
+     * For example, a Wifi controller would return true, because it needs to update the radio
+     * and wait for it to turn on.
+     */
+    default boolean hasAsyncUpdate() {
+        return false;
+    }
+}
diff --git a/src/com/android/settings/wifi/AddNetworkFragment.java b/src/com/android/settings/wifi/AddNetworkFragment.java
index e4d0fb1..1a64e2f 100644
--- a/src/com/android/settings/wifi/AddNetworkFragment.java
+++ b/src/com/android/settings/wifi/AddNetworkFragment.java
@@ -40,6 +40,7 @@
     final static int SUBMIT_BUTTON_ID = android.R.id.button1;
     @VisibleForTesting
     final static int CANCEL_BUTTON_ID = android.R.id.button2;
+    final static int SCANNER_BUTTON_ID = R.id.ssid_scanner_button;
 
     private WifiConfigController mUIController;
     private Button mSubmitBtn;
@@ -60,24 +61,15 @@
             Bundle savedInstanceState) {
         final View rootView = inflater.inflate(R.layout.wifi_add_network_view, container, false);
 
+        rootView.findViewById(android.R.id.button3).setVisibility(View.GONE);
         mSubmitBtn = rootView.findViewById(SUBMIT_BUTTON_ID);
         mCancelBtn = rootView.findViewById(CANCEL_BUTTON_ID);
+        final ImageButton scannerButton = rootView.findViewById(SCANNER_BUTTON_ID);
         mSubmitBtn.setOnClickListener(this);
         mCancelBtn.setOnClickListener(this);
+        scannerButton.setOnClickListener(this);
         mUIController = new WifiConfigController(this, rootView, null, getMode());
 
-        if (WifiDppUtils.isSharingNetworkEnabled(getContext())) {
-            final ImageButton scannerButton = rootView.findViewById(R.id.ssid_scanner_button);
-            if (scannerButton != null) {
-                scannerButton.setVisibility(View.VISIBLE);
-                scannerButton.setOnClickListener((View v) -> {
-                    // Launch QR code scanner to join a network.
-                    getContext().startActivity(
-                            WifiDppUtils.getEnrolleeQrCodeScannerIntent(/* ssid */ null));
-                });
-            }
-        }
-
         return rootView;
     }
 
@@ -96,6 +88,11 @@
             case CANCEL_BUTTON_ID:
                 handleCancelAction();
                 break;
+            case SCANNER_BUTTON_ID:
+                // Launch QR code scanner to join a network.
+                getContext().startActivity(
+                        WifiDppUtils.getEnrolleeQrCodeScannerIntent(/* ssid */ null));
+                break;
         }
     }
 
diff --git a/src/com/android/settings/wifi/NetworkRequestDialogFragment.java b/src/com/android/settings/wifi/NetworkRequestDialogFragment.java
index d1df7f0..ba29e3a 100644
--- a/src/com/android/settings/wifi/NetworkRequestDialogFragment.java
+++ b/src/com/android/settings/wifi/NetworkRequestDialogFragment.java
@@ -37,6 +37,7 @@
 import android.view.ViewGroup;
 import android.widget.ArrayAdapter;
 import android.widget.BaseAdapter;
+import android.widget.Button;
 import android.widget.ProgressBar;
 import android.widget.TextView;
 import android.widget.Toast;
@@ -69,8 +70,12 @@
     /** Message sent to us to stop scanning wifi and pop up timeout dialog. */
     private static final int MESSAGE_STOP_SCAN_WIFI_LIST = 0;
 
-    /** Spec defines there should be 5 wifi ap on the list at most. */
+    /**
+     * Spec defines there should be 5 wifi ap on the list at most or just show all if {@code
+     * mShowLimitedItem} is false.
+     */
     private static final int MAX_NUMBER_LIST_ITEM = 5;
+    private boolean mShowLimitedItem = true;
 
     /** Delayed time to stop scanning wifi. */
     private static final int DELAY_TIME_STOP_SCAN_MS = 30 * 1000;
@@ -110,13 +115,29 @@
         final AlertDialog.Builder builder = new AlertDialog.Builder(context)
                 .setCustomTitle(customTitle)
                 .setAdapter(mDialogAdapter, this)
-                .setPositiveButton(R.string.cancel, (dialog, which) -> getActivity().finish());
+                .setPositiveButton(R.string.cancel, (dialog, which) -> getActivity().finish())
+                // Do nothings, will replace the onClickListener to avoid auto closing dialog.
+                .setNeutralButton(R.string.network_connection_request_dialog_showall,
+                        null /* OnClickListener */);
 
         // Clicking list item is to connect wifi ap.
         final AlertDialog dialog = builder.create();
         dialog.getListView()
                 .setOnItemClickListener(
                         (parent, view, position, id) -> this.onClick(dialog, position));
+
+        dialog.setOnShowListener((dialogInterface) -> {
+            // Replace NeutralButton onClickListener to avoid closing dialog
+            final Button neutralBtn = dialog.getButton(AlertDialog.BUTTON_NEUTRAL);
+            neutralBtn.setVisibility(View.GONE);
+            neutralBtn.setOnClickListener(v -> {
+                mShowLimitedItem = false;
+                renewAccessPointList(null /* List<ScanResult> */);
+                notifyAdapterRefresh();
+                neutralBtn.setVisibility(View.GONE);
+            });
+        });
+
         return dialog;
     }
 
@@ -202,6 +223,18 @@
         }
     }
 
+    private void showNeutralButton() {
+        final AlertDialog alertDialog = (AlertDialog) getDialog();
+        if (alertDialog == null) {
+            return;
+        }
+
+        final Button neutralBtn = alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL);
+        if (neutralBtn != null) {
+            neutralBtn.setVisibility(View.VISIBLE);
+        }
+    }
+
     @Override
     public void onResume() {
         super.onResume();
@@ -394,6 +427,10 @@
                     mAccessPointKeys.add(key);
                 }
             }
+
+            if (mShowLimitedItem && (mAccessPointKeys.size() > MAX_NUMBER_LIST_ITEM)) {
+                showNeutralButton();
+            }
         }
 
         /**
@@ -414,7 +451,7 @@
 
                     count++;
                     // Limits how many count of items could show.
-                    if (count >= MAX_NUMBER_LIST_ITEM) {
+                    if (mShowLimitedItem && count >= MAX_NUMBER_LIST_ITEM) {
                         break;
                     }
                 }
diff --git a/src/com/android/settings/wifi/WifiDialog.java b/src/com/android/settings/wifi/WifiDialog.java
index 9420c4c..7d5f3b3 100644
--- a/src/com/android/settings/wifi/WifiDialog.java
+++ b/src/com/android/settings/wifi/WifiDialog.java
@@ -80,20 +80,17 @@
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         mView = getLayoutInflater().inflate(R.layout.wifi_dialog, /* root */ null);
-        if (WifiDppUtils.isSharingNetworkEnabled(getContext())) {
-            final ImageButton scannerButton = mView.findViewById(R.id.password_scanner_button);
-            if (scannerButton != null) {
-                scannerButton.setVisibility(View.VISIBLE);
-                scannerButton.setOnClickListener((View v) -> {
-                    String ssid = null;
-                    if (mAccessPoint != null) {
-                        ssid = mAccessPoint.getSsidStr();
-                    }
-                    // Launch QR code scanner to join a network.
-                    getContext().startActivity(
-                            WifiDppUtils.getEnrolleeQrCodeScannerIntent(ssid));
-                });
-            }
+        final ImageButton scannerButton = mView.findViewById(R.id.password_scanner_button);
+        if (scannerButton != null) {
+            scannerButton.setOnClickListener((View v) -> {
+                String ssid = null;
+                if (mAccessPoint != null) {
+                    ssid = mAccessPoint.getSsidStr();
+                }
+                // Launch QR code scanner to join a network.
+                getContext().startActivity(
+                        WifiDppUtils.getEnrolleeQrCodeScannerIntent(ssid));
+            });
         }
         setView(mView);
         mController = new WifiConfigController(this, mView, mAccessPoint, mMode);
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index 2e12bce..4ca9f86 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -239,14 +239,12 @@
         mAddPreference = new ButtonPreference(prefContext);
         mAddPreference.setIcon(R.drawable.ic_menu_add);
         mAddPreference.setTitle(R.string.wifi_add_network);
-        if (WifiDppUtils.isSharingNetworkEnabled(getContext())) {
-            mAddPreference.setButtonIcon(R.drawable.ic_scan_24dp);
-            mAddPreference.setButtonOnClickListener((View v) -> {
-                // Launch QR code scanner to join a network.
-                getContext().startActivity(
-                        WifiDppUtils.getEnrolleeQrCodeScannerIntent(/* ssid */ null));
-            });
-        }
+        mAddPreference.setButtonIcon(R.drawable.ic_scan_24dp);
+        mAddPreference.setButtonOnClickListener((View v) -> {
+            // Launch QR code scanner to join a network.
+            getContext().startActivity(
+                    WifiDppUtils.getEnrolleeQrCodeScannerIntent(/* ssid */ null));
+        });
         mStatusMessagePreference = (LinkablePreference) findPreference(PREF_KEY_STATUS_MESSAGE);
 
         mUserBadgeCache = new AccessPointPreference.UserBadgeCache(getPackageManager());
diff --git a/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java b/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
index 2efd4fc..7be441a 100644
--- a/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
+++ b/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
@@ -27,6 +27,9 @@
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.graphics.drawable.Drawable;
+import android.hardware.biometrics.BiometricPrompt;
+import android.os.CancellationSignal;
+import android.os.Looper;
 import android.net.ConnectivityManager;
 import android.net.ConnectivityManager.NetworkCallback;
 import android.net.LinkAddress;
@@ -534,8 +537,7 @@
      * Returns whether the user can share the network represented by this preference with QR code.
      */
     private boolean canShareNetwork() {
-        return mAccessPoint.getConfig() != null && FeatureFlagUtils.isEnabled(mContext,
-                FeatureFlags.WIFI_SHARING);
+        return mAccessPoint.getConfig() != null;
     }
 
     /**
@@ -579,21 +581,43 @@
         if (keyguardManager.isKeyguardSecure()) {
             // Show authentication screen to confirm credentials (pin, pattern or password) for
             // the current user of the device.
+            final String title = mContext.getString(
+                    R.string.lockpassword_confirm_your_pattern_header);
             final String description = String.format(
                     mContext.getString(R.string.wifi_sharing_message),
                     mAccessPoint.getSsidStr());
-            final Intent intent = keyguardManager.createConfirmDeviceCredentialIntent(
-                    mContext.getString(R.string.lockpassword_confirm_your_pattern_header),
-                    description);
-            if (intent != null) {
-                mFragment.startActivityForResult(intent,
-                        WifiNetworkDetailsFragment.REQUEST_CODE_CONFIRM_DEVICE_CREDENTIALS);
+
+            final BiometricPrompt.Builder builder = new BiometricPrompt.Builder(mContext)
+                    .setTitle(title)
+                    .setDescription(description);
+
+            if (keyguardManager.isDeviceSecure()) {
+                builder.setAllowDeviceCredential(true);
             }
+
+            final BiometricPrompt bp = builder.build();
+            final Handler handler = new Handler(Looper.getMainLooper());
+            bp.authenticate(new CancellationSignal(),
+                    runnable -> handler.post(runnable),
+                    mAuthenticationCallback);
         } else {
             launchWifiDppConfiguratorActivity();
         }
     }
 
+    private BiometricPrompt.AuthenticationCallback mAuthenticationCallback =
+            new BiometricPrompt.AuthenticationCallback() {
+        @Override
+        public void onAuthenticationSucceeded(BiometricPrompt.AuthenticationResult result) {
+            launchWifiDppConfiguratorActivity();
+        }
+
+        @Override
+        public void onAuthenticationError(int errorCode, CharSequence errString) {
+            //Do nothing
+        }
+    };
+
     /**
      * Sign in to the captive portal found on this wifi network associated with this preference.
      */
diff --git a/src/com/android/settings/wifi/details/WifiNetworkDetailsFragment.java b/src/com/android/settings/wifi/details/WifiNetworkDetailsFragment.java
index ec43b0f..ab470bf 100644
--- a/src/com/android/settings/wifi/details/WifiNetworkDetailsFragment.java
+++ b/src/com/android/settings/wifi/details/WifiNetworkDetailsFragment.java
@@ -17,11 +17,9 @@
 
 import static com.android.settings.wifi.WifiSettings.WIFI_DIALOG_ID;
 
-import android.app.Activity;
 import android.app.Dialog;
 import android.app.settings.SettingsEnums;
 import android.content.Context;
-import android.content.Intent;
 import android.net.ConnectivityManager;
 import android.net.wifi.WifiManager;
 import android.os.Bundle;
@@ -53,8 +51,6 @@
 
     private static final String TAG = "WifiNetworkDetailsFrg";
 
-    public static final int REQUEST_CODE_CONFIRM_DEVICE_CREDENTIALS = 1;
-
     private AccessPoint mAccessPoint;
     private WifiDetailPreferenceController mWifiDetailPreferenceController;
 
@@ -141,18 +137,9 @@
         WifiPrivacyPreferenceController preferenceController = new WifiPrivacyPreferenceController(
                 context);
         preferenceController.setWifiConfiguration(mAccessPoint.getConfig());
+        preferenceController.setIsEphemeral(mAccessPoint.isEphemeral());
         controllers.add(preferenceController);
 
         return controllers;
     }
-
-    @Override
-    public void onActivityResult(int requestCode, int resultCode, Intent data) {
-        super.onActivityResult(requestCode, resultCode, data);
-
-        if (requestCode == REQUEST_CODE_CONFIRM_DEVICE_CREDENTIALS
-                && resultCode == Activity.RESULT_OK) {
-            mWifiDetailPreferenceController.launchWifiDppConfiguratorActivity();
-        }
-    }
 }
diff --git a/src/com/android/settings/wifi/details/WifiPrivacyPreferenceController.java b/src/com/android/settings/wifi/details/WifiPrivacyPreferenceController.java
index a20adc9..b79f2d4 100644
--- a/src/com/android/settings/wifi/details/WifiPrivacyPreferenceController.java
+++ b/src/com/android/settings/wifi/details/WifiPrivacyPreferenceController.java
@@ -25,6 +25,7 @@
 import androidx.preference.DropDownPreference;
 import androidx.preference.Preference;
 
+import com.android.settings.R;
 import com.android.settings.core.BasePreferenceController;
 import com.android.settings.core.FeatureFlags;
 import com.android.settingslib.core.AbstractPreferenceController;
@@ -39,6 +40,7 @@
     private static final String KEY_WIFI_PRIVACY = "privacy";
     private WifiConfiguration mWifiConfiguration;
     private WifiManager mWifiManager;
+    private boolean mIsEphemeral = false;
 
     public WifiPrivacyPreferenceController(Context context) {
         super(context, KEY_WIFI_PRIVACY);
@@ -50,6 +52,10 @@
         mWifiConfiguration = wifiConfiguration;
     }
 
+    public void setIsEphemeral(boolean isEphemeral) {
+        mIsEphemeral = isEphemeral;
+    }
+
     @Override
     public int getAvailabilityStatus() {
         return FeatureFlagUtils.isEnabled(mContext, FeatureFlags.WIFI_MAC_RANDOMIZATION)
@@ -62,6 +68,12 @@
         final int randomizationLevel = getRandomizationValue();
         dropDownPreference.setValue(Integer.toString(randomizationLevel));
         updateSummary(dropDownPreference, randomizationLevel);
+
+        // Makes preference not selectable, when this is a ephemeral network.
+        if (mIsEphemeral) {
+            preference.setSelectable(false);
+            dropDownPreference.setSummary(R.string.wifi_privacy_settings_ephemeral_summary);
+        }
     }
 
     @Override
diff --git a/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java b/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java
index 4523def..536924d 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java
@@ -20,6 +20,8 @@
 import android.app.Activity;
 import android.app.settings.SettingsEnums;
 import android.content.Context;
+import android.content.pm.ActivityInfo;
+import android.net.wifi.EasyConnectStatusCallback;
 import android.net.wifi.WifiManager;
 import android.os.Bundle;
 import android.text.TextUtils;
@@ -30,6 +32,8 @@
 import android.widget.Button;
 import android.widget.ImageView;
 
+import androidx.lifecycle.ViewModelProviders;
+
 import com.android.settings.R;
 
 import java.util.concurrent.Executor;
@@ -46,7 +50,12 @@
     private Button mButtonLeft;
     private Button mButtonRight;
 
-    private class EasyConnectStatusCallback extends android.net.wifi.EasyConnectStatusCallback {
+    private int mLatestStatusCode = WifiDppUtils.EASY_CONNECT_EVENT_FAILURE_NONE;
+
+    // Key for Bundle usage
+    private static final String KEY_LATEST_ERROR_CODE = "key_latest_error_code";
+
+    private class EasyConnectConfiguratorStatusCallback extends EasyConnectStatusCallback {
         @Override
         public void onEnrolleeSuccess(int newNetworkId) {
             // Do nothing
@@ -54,32 +63,14 @@
 
         @Override
         public void onConfiguratorSuccess(int code) {
-            // Update success UI.
-            setHeaderIconImageResource(R.drawable.ic_devices_check_circle_green);
-            mTitle.setText(R.string.wifi_dpp_wifi_shared_with_device);
-            mSummary.setVisibility(View.INVISIBLE);
-            mWifiApPictureView.setImageResource(R.drawable.wifi_dpp_success);
-            mChooseDifferentNetwork.setVisibility(View.INVISIBLE);
-            mButtonLeft.setText(R.string.wifi_dpp_add_another_device);
-            mButtonLeft.setOnClickListener(v -> getFragmentManager().popBackStack());
-            mButtonRight.setText(R.string.done);
-            mButtonRight.setOnClickListener(v -> {
-                final Activity activity = getActivity();
-                activity.setResult(Activity.RESULT_OK);
-                activity.finish();
-            });
+            showSuccessUi(/* isConfigurationChange */ false);
         }
 
         @Override
         public void onFailure(int code) {
-            Log.d(TAG, "EasyConnectStatusCallback.onFailure " + code);
+            Log.d(TAG, "EasyConnectConfiguratorStatusCallback.onFailure " + code);
 
-            // Update fail UI.
-            mTitle.setText(R.string.wifi_dpp_could_not_add_device);
-            mSummary.setVisibility(View.INVISIBLE);
-            mWifiApPictureView.setImageResource(R.drawable.wifi_dpp_error);
-            mChooseDifferentNetwork.setVisibility(View.INVISIBLE);
-            mButtonRight.setText(R.string.retry);
+            showErrorUi(code, /* isConfigurationChange */ false);
         }
 
         @Override
@@ -88,12 +79,145 @@
         }
     }
 
+    private void showSuccessUi(boolean isConfigurationChange) {
+        setHeaderIconImageResource(R.drawable.ic_devices_check_circle_green);
+        mTitle.setText(R.string.wifi_dpp_wifi_shared_with_device);
+        mSummary.setVisibility(View.INVISIBLE);
+        mWifiApPictureView.setImageResource(R.drawable.wifi_dpp_success);
+        mChooseDifferentNetwork.setVisibility(View.INVISIBLE);
+        mButtonLeft.setText(R.string.wifi_dpp_add_another_device);
+        mButtonLeft.setOnClickListener(v -> getFragmentManager().popBackStack());
+        mButtonRight.setText(R.string.done);
+        mButtonRight.setOnClickListener(v -> {
+            final Activity activity = getActivity();
+            activity.setResult(Activity.RESULT_OK);
+            activity.finish();
+        });
+
+        if (!isConfigurationChange) {
+            mLatestStatusCode = WifiDppUtils.EASY_CONNECT_EVENT_SUCCESS;
+        }
+    }
+
+    private void showErrorUi(int code, boolean isConfigurationChange) {
+        switch (code) {
+            case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_INVALID_URI:
+                mSummary.setText(R.string.wifi_dpp_could_not_detect_valid_qr_code);
+                break;
+
+            case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_AUTHENTICATION:
+                mSummary.setText(R.string.wifi_dpp_failure_authentication_or_configuration);
+                break;
+
+            case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_NOT_COMPATIBLE:
+                mSummary.setText(R.string.wifi_dpp_failure_not_compatible);
+                break;
+
+            case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_CONFIGURATION:
+                mSummary.setText(R.string.wifi_dpp_failure_authentication_or_configuration);
+                break;
+
+            case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_BUSY:
+                if (isConfigurationChange) {
+                    return;
+                }
+
+                if (code == mLatestStatusCode) {
+                    throw(new IllegalStateException("Tried restarting EasyConnectSession but still"
+                            + "receiving EASY_CONNECT_EVENT_FAILURE_BUSY"));
+                }
+
+                mLatestStatusCode = code;
+                final WifiManager wifiManager =
+                        getContext().getSystemService(WifiManager.class);
+                wifiManager.stopEasyConnectSession();
+                startWifiDppConfiguratorInitiator();
+                return;
+
+            case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_TIMEOUT:
+                mSummary.setText(R.string.wifi_dpp_failure_timeout);
+                break;
+
+            case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_GENERIC:
+                mSummary.setText(R.string.wifi_dpp_failure_generic);
+                break;
+
+            case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_NOT_SUPPORTED:
+                mSummary.setText(getString(R.string.wifi_dpp_failure_not_supported, getSsid()));
+                break;
+
+            case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_INVALID_NETWORK:
+                throw(new IllegalStateException("Wi-Fi DPP configurator used a non-PSK/non-SAE"
+                        + "network to handshake"));
+
+            default:
+                throw(new IllegalStateException("Unexpected Wi-Fi DPP error"));
+        }
+
+        mTitle.setText(R.string.wifi_dpp_could_not_add_device);
+        mWifiApPictureView.setImageResource(R.drawable.wifi_dpp_error);
+        mChooseDifferentNetwork.setVisibility(View.INVISIBLE);
+        if (hasRetryButton(code)) {
+            mButtonRight.setText(R.string.retry);
+        } else {
+            mButtonRight.setText(R.string.done);
+            mButtonRight.setOnClickListener(v -> getActivity().finish());
+            mButtonLeft.setVisibility(View.INVISIBLE);
+        }
+
+        if (!isConfigurationChange) {
+            mLatestStatusCode = code;
+        }
+
+        mButtonRight.setVisibility(isGoingInitiator() ? View.INVISIBLE : View.VISIBLE);
+    }
+
+    private boolean hasRetryButton(int code) {
+        switch (code) {
+            case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_INVALID_URI:
+            case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_NOT_COMPATIBLE:
+                return false;
+
+            default:
+                break;
+        }
+
+        return true;
+    }
+
     @Override
     public int getMetricsCategory() {
         return SettingsEnums.SETTINGS_WIFI_DPP_CONFIGURATOR;
     }
 
     @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        if (savedInstanceState != null) {
+            mLatestStatusCode = savedInstanceState.getInt(KEY_LATEST_ERROR_CODE);
+        }
+
+        final WifiDppInitiatorViewModel model =
+                ViewModelProviders.of(this).get(WifiDppInitiatorViewModel.class);
+
+        model.getStatusCode().observe(this, statusCode -> {
+            // After configuration change, observe callback will be triggered,
+            // do nothing for this case if a handshake does not end
+            if (model.isGoingInitiator()) {
+                return;
+            }
+
+            int code = statusCode.intValue();
+            if (code == WifiDppUtils.EASY_CONNECT_EVENT_SUCCESS) {
+                new EasyConnectConfiguratorStatusCallback().onConfiguratorSuccess(code);
+            } else {
+                new EasyConnectConfiguratorStatusCallback().onFailure(code);
+            }
+        });
+    }
+
+    @Override
     public void onActivityCreated(Bundle savedInstanceState) {
         super.onActivityCreated(savedInstanceState);
 
@@ -125,14 +249,7 @@
             mTitle.setText(information);
         }
 
-        final WifiNetworkConfig wifiNetworkConfig = ((WifiDppConfiguratorActivity) getActivity())
-                .getWifiNetworkConfig();
-        if (!WifiNetworkConfig.isValidConfig(wifiNetworkConfig)) {
-            throw new IllegalStateException("Invalid Wi-Fi network for configuring");
-        }
-        mSummary.setText(getString(R.string.wifi_dpp_add_device_to_wifi,
-                wifiNetworkConfig.getSsid()));
-
+        mSummary.setText(getString(R.string.wifi_dpp_add_device_to_wifi, getSsid()));
         mWifiApPictureView = view.findViewById(R.id.wifi_ap_picture_view);
 
         mChooseDifferentNetwork = view.findViewById(R.id.choose_different_network);
@@ -146,19 +263,48 @@
 
         mButtonRight = view.findViewById(R.id.button_right);
         mButtonRight.setText(R.string.wifi_dpp_share_wifi);
-        mButtonRight.setOnClickListener(v -> startWifiDppInitiator());
+        mButtonRight.setOnClickListener(v -> {
+            mButtonRight.setVisibility(View.INVISIBLE);
+            startWifiDppConfiguratorInitiator();
+        });
+
+        if (savedInstanceState != null) {
+            if (mLatestStatusCode == WifiDppUtils.EASY_CONNECT_EVENT_SUCCESS) {
+                showSuccessUi(/* isConfigurationChange */ true);
+            } else if (mLatestStatusCode == WifiDppUtils.EASY_CONNECT_EVENT_FAILURE_NONE) {
+                mButtonRight.setVisibility(isGoingInitiator() ? View.INVISIBLE : View.VISIBLE);
+            } else {
+                showErrorUi(mLatestStatusCode, /* isConfigurationChange */ true);
+            }
+        }
     }
 
-    private void startWifiDppInitiator() {
+    @Override
+    public void onSaveInstanceState(Bundle outState) {
+        outState.putInt(KEY_LATEST_ERROR_CODE, mLatestStatusCode);
+
+        super.onSaveInstanceState(outState);
+    }
+
+    private String getSsid() {
+        final WifiNetworkConfig wifiNetworkConfig = ((WifiDppConfiguratorActivity) getActivity())
+                .getWifiNetworkConfig();
+        if (!WifiNetworkConfig.isValidConfig(wifiNetworkConfig)) {
+            throw new IllegalStateException("Invalid Wi-Fi network for configuring");
+        }
+        return wifiNetworkConfig.getSsid();
+    }
+
+    private void startWifiDppConfiguratorInitiator() {
         final WifiQrCode wifiQrCode = ((WifiDppConfiguratorActivity) getActivity())
                 .getWifiDppQrCode();
         final String qrCode = wifiQrCode.getQrCode();
         final int networkId =
                 ((WifiDppConfiguratorActivity) getActivity()).getWifiNetworkConfig().getNetworkId();
-        final WifiManager wifiManager = getContext().getSystemService(WifiManager.class);
-        wifiManager.startEasyConnectAsConfiguratorInitiator(qrCode, networkId,
-                WifiManager.EASY_CONNECT_NETWORK_ROLE_STA, getContext().getMainExecutor(),
-                new EasyConnectStatusCallback());
+        final WifiDppInitiatorViewModel model =
+                ViewModelProviders.of(this).get(WifiDppInitiatorViewModel.class);
+
+        model.startEasyConnectAsConfiguratorInitiator(qrCode, networkId);
     }
 
     // Container Activity must implement this interface
@@ -180,4 +326,12 @@
 
         super.onDetach();
     }
+
+    // Check is Easy Connect handshaking or not
+    private boolean isGoingInitiator() {
+        final WifiDppInitiatorViewModel model =
+                ViewModelProviders.of(this).get(WifiDppInitiatorViewModel.class);
+
+        return model.isGoingInitiator();
+    }
 }
diff --git a/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java b/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java
index 65be11c..1770a02 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java
@@ -57,7 +57,6 @@
         WifiNetworkConfig.Retriever,
         WifiDppQrCodeGeneratorFragment.OnQrCodeGeneratorFragmentAddButtonClickedListener,
         WifiDppQrCodeScannerFragment.OnScanWifiDppSuccessListener,
-        WifiDppQrCodeScannerFragment.OnScanZxingWifiFormatSuccessListener,
         WifiDppAddDeviceFragment.OnClickChooseDifferentNetworkListener,
         WifiNetworkListFragment.OnChooseNetworkListener {
 
@@ -102,7 +101,7 @@
         if (savedInstanceState != null) {
             String qrCode = savedInstanceState.getString(KEY_QR_CODE);
 
-            mWifiDppQrCode = getValidWifiDppQrCodeOrNull(qrCode);
+            mWifiDppQrCode = WifiQrCode.getValidWifiDppQrCodeOrNull(qrCode);
 
             String security = savedInstanceState.getString(KEY_WIFI_SECURITY);
             String ssid = savedInstanceState.getString(KEY_WIFI_SSID);
@@ -148,7 +147,7 @@
             case Settings.ACTION_PROCESS_WIFI_EASY_CONNECT_QR_CODE:
                 String qrCode = intent.getStringExtra(Settings.EXTRA_QR_CODE);
                 mIsTest = intent.getBooleanExtra(WifiDppUtils.EXTRA_TEST, false);
-                mWifiDppQrCode = getValidWifiDppQrCodeOrNull(qrCode);
+                mWifiDppQrCode = WifiQrCode.getValidWifiDppQrCodeOrNull(qrCode);
                 final boolean isDppSupported = WifiDppUtils.isWifiDppEnabled(this);
                 if (!isDppSupported) {
                     Log.d(TAG, "Device doesn't support Wifi DPP");
@@ -285,21 +284,6 @@
         fragmentTransaction.commit();
     }
 
-    private WifiQrCode getValidWifiDppQrCodeOrNull(String qrCode) {
-        WifiQrCode wifiQrCode;
-        try {
-            wifiQrCode = new WifiQrCode(qrCode);
-        } catch(IllegalArgumentException e) {
-            return null;
-        }
-
-        if (WifiQrCode.SCHEME_DPP.equals(wifiQrCode.getScheme())) {
-            return wifiQrCode;
-        }
-
-        return null;
-    }
-
     @Override
     public WifiNetworkConfig getWifiNetworkConfig() {
         return mWifiNetworkConfig;
@@ -359,11 +343,6 @@
     }
 
     @Override
-    public void onScanZxingWifiFormatSuccess(WifiNetworkConfig wifiNetworkConfig) {
-        // Do nothing, it's impossible to be a configurator without a Wi-Fi DPP QR code
-    }
-
-    @Override
     public void onClickChooseDifferentNetwork() {
         showChooseSavedWifiNetworkFragment(/* addToBackStack */ true);
     }
diff --git a/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivity.java b/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivity.java
index 143f87f..392b27d 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivity.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivity.java
@@ -17,14 +17,10 @@
 package com.android.settings.wifi.dpp;
 
 import android.app.ActionBar;
-import android.app.Activity;
 import android.app.settings.SettingsEnums;
 import android.content.Context;
 import android.content.Intent;
-import android.net.wifi.WifiConfiguration;
-import android.net.wifi.WifiManager;
 import android.os.Bundle;
-import android.provider.Settings;
 import android.util.Log;
 
 import androidx.fragment.app.Fragment;
@@ -34,9 +30,6 @@
 import com.android.settings.R;
 import com.android.settings.core.InstrumentedActivity;
 
-import java.util.List;
-import java.util.concurrent.Executor;
-
 /**
  * To provision "this" device with specified Wi-Fi network.
  *
@@ -44,9 +37,7 @@
  * Wi-Fi network to be provisioned in {@code WifiDppUtils.EXTRA_WIFI_SSID}.
  */
 public class WifiDppEnrolleeActivity extends InstrumentedActivity implements
-        WifiManager.ActionListener,
-        WifiDppQrCodeScannerFragment.OnScanWifiDppSuccessListener,
-        WifiDppQrCodeScannerFragment.OnScanZxingWifiFormatSuccessListener {
+        WifiDppQrCodeScannerFragment.OnScanWifiDppSuccessListener {
     private static final String TAG = "WifiDppEnrolleeActivity";
 
     public static final String ACTION_ENROLLEE_QR_CODE_SCANNER =
@@ -54,40 +45,6 @@
 
     private FragmentManager mFragmentManager;
 
-    private class EasyConnectStatusCallback extends android.net.wifi.EasyConnectStatusCallback {
-        @Override
-        public void onEnrolleeSuccess(int newNetworkId) {
-            // Connect to the new network.
-            final WifiManager wifiManager = getSystemService(WifiManager.class);
-            final List<WifiConfiguration> wifiConfigs =
-                    wifiManager.getPrivilegedConfiguredNetworks();
-            for (WifiConfiguration wifiConfig : wifiConfigs) {
-                if (wifiConfig.networkId == newNetworkId) {
-                    wifiManager.connect(wifiConfig, WifiDppEnrolleeActivity.this);
-                    return;
-                }
-            }
-            Log.e(TAG, "Invalid networkId " + newNetworkId);
-            WifiDppEnrolleeActivity.this.onFailure(WifiManager.ERROR_AUTHENTICATING);
-        }
-
-        @Override
-        public void onConfiguratorSuccess(int code) {
-            // Do nothing
-        }
-
-        @Override
-        public void onFailure(int code) {
-            //TODO(b/122429170): Show DPP enrollee error state UI
-            Log.d(TAG, "EasyConnectStatusCallback.onFailure " + code);
-        }
-
-        @Override
-        public void onProgress(int code) {
-            // Do nothing
-        }
-    }
-
     @Override
     public int getMetricsCategory() {
         return SettingsEnums.SETTINGS_WIFI_DPP_ENROLLEE;
@@ -158,30 +115,6 @@
 
     @Override
     public void onScanWifiDppSuccess(WifiQrCode wifiQrCode) {
-        final WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
-        wifiManager.startEasyConnectAsEnrolleeInitiator(wifiQrCode.getQrCode(), getMainExecutor(),
-                new EasyConnectStatusCallback());
-    }
-
-    @Override
-    public void onScanZxingWifiFormatSuccess(WifiNetworkConfig wifiNetworkConfig) {
-        wifiNetworkConfig.connect(/* context */ this, /* listener */ this);
-    }
-
-    @Override
-    public void onSuccess() {
-        startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
-        setResult(Activity.RESULT_OK);
-        finish();
-    }
-
-    @Override
-    public void onFailure(int reason) {
-        Log.d(TAG, "Wi-Fi connect onFailure reason - " + reason);
-
-        final Fragment fragment = mFragmentManager.findFragmentById(R.id.fragment_container);
-        if (fragment instanceof WifiDppQrCodeScannerFragment) {
-            ((WifiDppQrCodeScannerFragment)fragment).showErrorMessage(true);
-        }
+        // Do nothing
     }
 }
diff --git a/src/com/android/settings/wifi/dpp/WifiDppInitiatorViewModel.java b/src/com/android/settings/wifi/dpp/WifiDppInitiatorViewModel.java
new file mode 100644
index 0000000..24e5ebe
--- /dev/null
+++ b/src/com/android/settings/wifi/dpp/WifiDppInitiatorViewModel.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.wifi.dpp;
+
+import android.app.Application;
+import android.net.wifi.EasyConnectStatusCallback;
+import android.net.wifi.WifiManager;
+
+import androidx.lifecycle.MutableLiveData;
+import androidx.lifecycle.AndroidViewModel;
+
+public class WifiDppInitiatorViewModel extends AndroidViewModel {
+    private MutableLiveData<Integer> mEnrolleeSuccessNetworkId;
+    private MutableLiveData<Integer> mStatusCode;
+    private boolean mIsGoingInitiator;
+
+    public WifiDppInitiatorViewModel(Application application) {
+        super(application);
+    }
+
+    public MutableLiveData<Integer> getEnrolleeSuccessNetworkId() {
+        if (mEnrolleeSuccessNetworkId == null) {
+            mEnrolleeSuccessNetworkId = new MutableLiveData<>();
+        }
+
+        return mEnrolleeSuccessNetworkId;
+    }
+
+    public MutableLiveData<Integer> getStatusCode() {
+        if (mStatusCode == null) {
+            mStatusCode = new MutableLiveData<>();
+        }
+
+        return mStatusCode;
+    }
+
+    public boolean isGoingInitiator() {
+        return mIsGoingInitiator;
+    }
+
+    public void startEasyConnectAsConfiguratorInitiator(String qrCode, int networkId) {
+        mIsGoingInitiator = true;
+        final WifiManager wifiManager = getApplication().getSystemService(WifiManager.class);
+
+        wifiManager.startEasyConnectAsConfiguratorInitiator(qrCode, networkId,
+                WifiManager.EASY_CONNECT_NETWORK_ROLE_STA, getApplication().getMainExecutor(),
+                new EasyConnectDelegateCallback());
+    }
+
+    public void startEasyConnectAsEnrolleeInitiator(String qrCode) {
+        mIsGoingInitiator = true;
+        final WifiManager wifiManager = getApplication().getSystemService(WifiManager.class);
+
+        wifiManager.startEasyConnectAsEnrolleeInitiator(qrCode, getApplication().getMainExecutor(),
+                new EasyConnectDelegateCallback());
+    }
+
+    private class EasyConnectDelegateCallback extends EasyConnectStatusCallback {
+        @Override
+        public void onEnrolleeSuccess(int newNetworkId) {
+            mIsGoingInitiator = false;
+            mEnrolleeSuccessNetworkId.setValue(newNetworkId);
+        }
+
+        @Override
+        public void onConfiguratorSuccess(int code) {
+            mIsGoingInitiator = false;
+            mStatusCode.setValue(WifiDppUtils.EASY_CONNECT_EVENT_SUCCESS);
+        }
+
+        @Override
+        public void onFailure(int code) {
+            mIsGoingInitiator = false;
+            mStatusCode.setValue(code);
+        }
+
+        @Override
+        public void onProgress(int code) {
+            // Do nothing
+        }
+    }
+}
diff --git a/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java b/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
index 9524fee..c88313b 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
@@ -17,15 +17,23 @@
 package com.android.settings.wifi.dpp;
 
 import android.app.ActionBar;
+import android.app.Activity;
 import android.app.settings.SettingsEnums;
 import android.content.Context;
+import android.content.pm.ActivityInfo;
+import android.content.Intent;
 import android.graphics.Matrix;
 import android.graphics.Rect;
 import android.graphics.SurfaceTexture;
+import android.net.wifi.EasyConnectStatusCallback;
+import android.net.wifi.WifiConfiguration;
+import android.net.wifi.WifiManager;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
+import android.provider.Settings;
 import android.text.TextUtils;
+import android.util.Log;
 import android.util.Size;
 import android.view.LayoutInflater;
 import android.view.Menu;
@@ -36,13 +44,18 @@
 import android.view.ViewGroup;
 import android.widget.TextView;
 
+import androidx.lifecycle.ViewModelProviders;
+
 import com.android.settings.R;
 import com.android.settings.wifi.qrcode.QrCamera;
 import com.android.settings.wifi.qrcode.QrDecorateView;
 
+import java.util.List;
+
 public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment implements
         SurfaceTextureListener,
-        QrCamera.ScannerCallback {
+        QrCamera.ScannerCallback,
+        WifiManager.ActionListener {
     private static final String TAG = "WifiDppQrCodeScannerFragment";
 
     /** Message sent to hide error message */
@@ -57,12 +70,12 @@
     /** Message sent to manipulate ZXing Wi-Fi QR code */
     private static final int MESSAGE_SCAN_ZXING_WIFI_FORMAT_SUCCESS = 4;
 
-    private static final long SHOW_ERROR_MESSAGE_INTERVAL = 2000;
+    private static final long SHOW_ERROR_MESSAGE_INTERVAL = 10000;
     private static final long SHOW_SUCCESS_SQUARE_INTERVAL = 1000;
 
     // Key for Bundle usage
-    private static final String KEY_PUBLIC_URI = "key_public_uri";
     private static final String KEY_IS_CONFIGURATOR_MODE = "key_is_configurator_mode";
+    private static final String KEY_LATEST_ERROR_CODE = "key_latest_error_code";
 
     private QrCamera mCamera;
     private TextureView mTextureView;
@@ -78,13 +91,41 @@
     /** QR code data scanned by camera */
     private WifiQrCode mWifiQrCode;
 
+    private int mLatestStatusCode = WifiDppUtils.EASY_CONNECT_EVENT_FAILURE_NONE;
+
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
         if (savedInstanceState != null) {
             mIsConfiguratorMode = savedInstanceState.getBoolean(KEY_IS_CONFIGURATOR_MODE);
+            mLatestStatusCode = savedInstanceState.getInt(KEY_LATEST_ERROR_CODE);
         }
+
+        final WifiDppInitiatorViewModel model =
+                ViewModelProviders.of(this).get(WifiDppInitiatorViewModel.class);
+
+        model.getEnrolleeSuccessNetworkId().observe(this, networkId -> {
+            // After configuration change, observe callback will be triggered,
+            // do nothing for this case if a handshake does not end
+            if (model.isGoingInitiator()) {
+                return;
+            }
+
+            new EasyConnectEnrolleeStatusCallback().onEnrolleeSuccess(networkId.intValue());
+        });
+
+        model.getStatusCode().observe(this, statusCode -> {
+            // After configuration change, observe callback will be triggered,
+            // do nothing for this case if a handshake does not end
+            if (model.isGoingInitiator()) {
+                return;
+            }
+
+            int code = statusCode.intValue();
+            Log.d(TAG, "Easy connect enrollee callback onFailure " + code);
+            new EasyConnectEnrolleeStatusCallback().onFailure(code);
+        });
     }
 
     @Override
@@ -102,12 +143,6 @@
     }
     OnScanWifiDppSuccessListener mScanWifiDppSuccessListener;
 
-    // Container Activity must implement this interface
-    public interface OnScanZxingWifiFormatSuccessListener {
-        public void onScanZxingWifiFormatSuccess(WifiNetworkConfig wifiNetworkConfig);
-    }
-    OnScanZxingWifiFormatSuccessListener mScanZxingWifiFormatSuccessListener;
-
     /**
      * Configurator container activity of the fragment should create instance with this constructor.
      */
@@ -144,13 +179,11 @@
         super.onAttach(context);
 
         mScanWifiDppSuccessListener = (OnScanWifiDppSuccessListener) context;
-        mScanZxingWifiFormatSuccessListener = (OnScanZxingWifiFormatSuccessListener) context;
     }
 
     @Override
     public void onDetach() {
         mScanWifiDppSuccessListener = null;
-        mScanZxingWifiFormatSuccessListener = null;
 
         super.onDetach();
     }
@@ -289,7 +322,9 @@
     }
 
     private void handleWifiDpp() {
-        destroyCamera();
+        if (mCamera != null) {
+            mCamera.stop();
+        }
         mDecorateView.setFocused(true);
 
         Message message = mHandler.obtainMessage(MESSAGE_SCAN_WIFI_DPP_SUCCESS);
@@ -299,7 +334,9 @@
     }
 
     private void handleZxingWifiFormat() {
-        destroyCamera();
+        if (mCamera != null) {
+            mCamera.stop();
+        }
         mDecorateView.setFocused(true);
 
         Message message = mHandler.obtainMessage(MESSAGE_SCAN_ZXING_WIFI_FORMAT_SUCCESS);
@@ -317,7 +354,14 @@
         // Check if the camera has already created.
         if (mCamera == null) {
             mCamera = new QrCamera(getContext(), this);
-            mCamera.start(surface);
+
+            if (isGoingInitiator()) {
+                if (mDecorateView != null) {
+                    mDecorateView.setFocused(true);
+                }
+            } else {
+                mCamera.start(surface);
+            }
         }
     }
 
@@ -328,14 +372,13 @@
         }
     }
 
-    public void showErrorMessage(boolean show) {
-        mErrorMessage.setVisibility(show ? View.VISIBLE : View.INVISIBLE);
+    public void showErrorMessage(String message) {
+        mErrorMessage.setVisibility(View.VISIBLE);
+        mErrorMessage.setText(message);
 
-        if (show) {
-            mHandler.removeMessages(MESSAGE_HIDE_ERROR_MESSAGE);
-            mHandler.sendEmptyMessageDelayed(MESSAGE_HIDE_ERROR_MESSAGE,
-                    SHOW_ERROR_MESSAGE_INTERVAL);
-        }
+        mHandler.removeMessages(MESSAGE_HIDE_ERROR_MESSAGE);
+        mHandler.sendEmptyMessageDelayed(MESSAGE_HIDE_ERROR_MESSAGE,
+                SHOW_ERROR_MESSAGE_INTERVAL);
     }
 
     private final Handler mHandler = new Handler() {
@@ -343,26 +386,32 @@
         public void handleMessage(Message msg) {
             switch (msg.what) {
                 case MESSAGE_HIDE_ERROR_MESSAGE:
-                    showErrorMessage(false);
+                    mErrorMessage.setVisibility(View.INVISIBLE);
                     break;
 
                 case MESSAGE_SHOW_ERROR_MESSAGE:
-                    showErrorMessage(true);
+                    showErrorMessage(getString(R.string.wifi_dpp_could_not_detect_valid_qr_code));
                     break;
 
                 case MESSAGE_SCAN_WIFI_DPP_SUCCESS:
+                    mErrorMessage.setVisibility(View.INVISIBLE);
+
                     if (mScanWifiDppSuccessListener == null) {
                         return;
                     }
                     mScanWifiDppSuccessListener.onScanWifiDppSuccess((WifiQrCode)msg.obj);
+
+                    if (!mIsConfiguratorMode) {
+                        startWifiDppEnrolleeInitiator((WifiQrCode)msg.obj);
+                    }
                     break;
 
                 case MESSAGE_SCAN_ZXING_WIFI_FORMAT_SUCCESS:
-                    if (mScanZxingWifiFormatSuccessListener == null) {
-                        return;
-                    }
-                    mScanZxingWifiFormatSuccessListener.onScanZxingWifiFormatSuccess(
-                            (WifiNetworkConfig)msg.obj);
+                    mErrorMessage.setVisibility(View.INVISIBLE);
+
+                    final WifiNetworkConfig wifiNetworkConfig = (WifiNetworkConfig)msg.obj;
+                    wifiNetworkConfig.connect(getContext(),
+                            /* listener */ WifiDppQrCodeScannerFragment.this);
                     break;
 
                 default:
@@ -374,7 +423,149 @@
     @Override
     public void onSaveInstanceState(Bundle outState) {
         outState.putBoolean(KEY_IS_CONFIGURATOR_MODE, mIsConfiguratorMode);
+        outState.putInt(KEY_LATEST_ERROR_CODE, mLatestStatusCode);
 
         super.onSaveInstanceState(outState);
     }
+
+    private class EasyConnectEnrolleeStatusCallback extends EasyConnectStatusCallback {
+        @Override
+        public void onEnrolleeSuccess(int newNetworkId) {
+
+            // Connect to the new network.
+            final WifiManager wifiManager = getContext().getSystemService(WifiManager.class);
+            final List<WifiConfiguration> wifiConfigs =
+                    wifiManager.getPrivilegedConfiguredNetworks();
+            for (WifiConfiguration wifiConfig : wifiConfigs) {
+                if (wifiConfig.networkId == newNetworkId) {
+                    mLatestStatusCode = WifiDppUtils.EASY_CONNECT_EVENT_SUCCESS;
+                    wifiManager.connect(wifiConfig, WifiDppQrCodeScannerFragment.this);
+                    return;
+                }
+            }
+
+            Log.e(TAG, "Invalid networkId " + newNetworkId);
+            mLatestStatusCode = EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_GENERIC;
+            showErrorMessage(getString(R.string.wifi_dpp_check_connection_try_again));
+            restartCamera();
+        }
+
+        @Override
+        public void onConfiguratorSuccess(int code) {
+            // Do nothing
+        }
+
+        @Override
+        public void onFailure(int code) {
+            Log.d(TAG, "EasyConnectEnrolleeStatusCallback.onFailure " + code);
+
+            switch (code) {
+                case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_INVALID_URI:
+                    showErrorMessage(getString(R.string.wifi_dpp_could_not_detect_valid_qr_code));
+                    break;
+
+                case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_AUTHENTICATION:
+                    showErrorMessage(
+                            getString(R.string.wifi_dpp_failure_authentication_or_configuration));
+                    break;
+
+                case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_NOT_COMPATIBLE:
+                    showErrorMessage(getString(R.string.wifi_dpp_failure_not_compatible));
+                    break;
+
+                case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_CONFIGURATION:
+                    showErrorMessage(
+                            getString(R.string.wifi_dpp_failure_authentication_or_configuration));
+                    break;
+
+                case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_BUSY:
+                    if (code == mLatestStatusCode) {
+                        throw(new IllegalStateException("stopEasyConnectSession and try again for"
+                                + "EASY_CONNECT_EVENT_FAILURE_BUSY but still failed"));
+                    }
+
+                    mLatestStatusCode = code;
+                    final WifiManager wifiManager =
+                        getContext().getSystemService(WifiManager.class);
+                    wifiManager.stopEasyConnectSession();
+                    startWifiDppEnrolleeInitiator(mWifiQrCode);
+                    return;
+
+                case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_TIMEOUT:
+                    showErrorMessage(getString(R.string.wifi_dpp_failure_timeout));
+                    break;
+
+                case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_GENERIC:
+                    showErrorMessage(getString(R.string.wifi_dpp_failure_generic));
+                    break;
+
+                case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_NOT_SUPPORTED:
+                    throw(new IllegalStateException("EASY_CONNECT_EVENT_FAILURE_NOT_SUPPORTED" +
+                            " should be a configurator only error"));
+
+                case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_INVALID_NETWORK:
+                    throw(new IllegalStateException("EASY_CONNECT_EVENT_FAILURE_INVALID_NETWORK" +
+                            " should be a configurator only error"));
+
+                default:
+                    throw(new IllegalStateException("Unexpected Wi-Fi DPP error"));
+            }
+
+            mLatestStatusCode = code;
+            restartCamera();
+        }
+
+        @Override
+        public void onProgress(int code) {
+            // Do nothing
+        }
+    }
+
+    private void startWifiDppEnrolleeInitiator(WifiQrCode wifiQrCode) {
+        final WifiDppInitiatorViewModel model =
+                ViewModelProviders.of(this).get(WifiDppInitiatorViewModel.class);
+
+        model.startEasyConnectAsEnrolleeInitiator(wifiQrCode.getQrCode());
+    }
+
+    @Override
+    public void onSuccess() {
+        startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
+        final Activity hostActivity = getActivity();
+        hostActivity.setResult(Activity.RESULT_OK);
+        hostActivity.finish();
+    }
+
+    @Override
+    public void onFailure(int reason) {
+        Log.d(TAG, "Wi-Fi connect onFailure reason - " + reason);
+
+        showErrorMessage(getString(R.string.wifi_dpp_check_connection_try_again));
+        restartCamera();
+    }
+
+    // Check is Easy Connect handshaking or not
+    private boolean isGoingInitiator() {
+        final WifiDppInitiatorViewModel model =
+                ViewModelProviders.of(this).get(WifiDppInitiatorViewModel.class);
+
+        return model.isGoingInitiator();
+    }
+
+    /**
+     * To resume camera decoding task after handshake fail or Wi-Fi connection fail.
+     */
+    private void restartCamera() {
+        if (mCamera == null) {
+            Log.d(TAG, "mCamera is not available for restarting camera");
+            return;
+        }
+
+        final SurfaceTexture surfaceTexture = mTextureView.getSurfaceTexture();
+        if (surfaceTexture == null) {
+            throw new IllegalStateException("SurfaceTexture is not ready for restarting camera");
+        }
+
+        mCamera.start(surfaceTexture);
+    }
 }
diff --git a/src/com/android/settings/wifi/dpp/WifiDppUtils.java b/src/com/android/settings/wifi/dpp/WifiDppUtils.java
index 7bc80e0..24cd1d7 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppUtils.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppUtils.java
@@ -75,12 +75,14 @@
     public static final String EXTRA_TEST = "test";
 
     /**
-     * Returns whether the user can share the network represented by this preference with QR code.
+     * Default status code for Easy Connect
      */
-    public static boolean isSharingNetworkEnabled(Context context) {
-        return FeatureFlagUtils.isEnabled(context,
-                com.android.settings.core.FeatureFlags.WIFI_SHARING);
-    }
+    public static final int EASY_CONNECT_EVENT_FAILURE_NONE = 0;
+
+    /**
+     * Success status code for Easy Connect.
+     */
+    public static final int EASY_CONNECT_EVENT_SUCCESS = 1;
 
     /**
      * Returns whether the device support WiFi DPP.
diff --git a/src/com/android/settings/wifi/dpp/WifiQrCode.java b/src/com/android/settings/wifi/dpp/WifiQrCode.java
index a08fb44..10971cf 100644
--- a/src/com/android/settings/wifi/dpp/WifiQrCode.java
+++ b/src/com/android/settings/wifi/dpp/WifiQrCode.java
@@ -228,4 +228,19 @@
 
         return new WifiNetworkConfig(mWifiNetworkConfig);
     }
+
+    public static WifiQrCode getValidWifiDppQrCodeOrNull(String qrCode) {
+        WifiQrCode wifiQrCode;
+        try {
+            wifiQrCode = new WifiQrCode(qrCode);
+        } catch(IllegalArgumentException e) {
+            return null;
+        }
+
+        if (SCHEME_DPP.equals(wifiQrCode.getScheme())) {
+            return wifiQrCode;
+        }
+
+        return null;
+    }
 }
diff --git a/src/com/android/settings/wifi/slice/ContextualWifiSlice.java b/src/com/android/settings/wifi/slice/ContextualWifiSlice.java
index 7a6d1fa..5761ae5 100644
--- a/src/com/android/settings/wifi/slice/ContextualWifiSlice.java
+++ b/src/com/android/settings/wifi/slice/ContextualWifiSlice.java
@@ -90,7 +90,7 @@
         }
 
         d.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN));
-        return IconCompat.createWithBitmap(Utils.drawableToBitmap(d));
+        return Utils.createIconWithDrawable(d);
     }
 
     @Override
diff --git a/src/com/android/settings/wifi/slice/WifiSlice.java b/src/com/android/settings/wifi/slice/WifiSlice.java
index b6fc17c..b4b94e1 100644
--- a/src/com/android/settings/wifi/slice/WifiSlice.java
+++ b/src/com/android/settings/wifi/slice/WifiSlice.java
@@ -93,8 +93,7 @@
         final SliceAction toggleSliceAction = SliceAction.createToggle(toggleAction,
                 null /* actionTitle */, isWifiEnabled);
 
-        final ListBuilder listBuilder = new ListBuilder(mContext, WIFI_SLICE_URI,
-                ListBuilder.INFINITY)
+        final ListBuilder listBuilder = new ListBuilder(mContext, getUri(), ListBuilder.INFINITY)
                 .setAccentColor(color)
                 .addRow(new ListBuilder.RowBuilder()
                         .setTitle(title)
diff --git a/tests/robotests/src/com/android/settings/UtilsTest.java b/tests/robotests/src/com/android/settings/UtilsTest.java
index c10e0d6..37186ca 100644
--- a/tests/robotests/src/com/android/settings/UtilsTest.java
+++ b/tests/robotests/src/com/android/settings/UtilsTest.java
@@ -34,6 +34,11 @@
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.UserInfo;
+import android.graphics.Bitmap;
+import android.graphics.Color;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.VectorDrawable;
 import android.net.ConnectivityManager;
 import android.net.LinkAddress;
 import android.net.LinkProperties;
@@ -48,6 +53,8 @@
 import android.widget.EditText;
 import android.widget.TextView;
 
+import androidx.core.graphics.drawable.IconCompat;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -96,7 +103,7 @@
     }
 
     @Test
-    public void testGetWifiIpAddresses_succeeds() throws Exception {
+    public void getWifiIpAddresses_succeeds() throws Exception {
         when(wifiManager.getCurrentNetwork()).thenReturn(network);
         LinkAddress address = new LinkAddress(InetAddress.getByName("127.0.0.1"), 0);
         LinkProperties lp = new LinkProperties();
@@ -107,7 +114,7 @@
     }
 
     @Test
-    public void testGetWifiIpAddresses_nullLinkProperties() {
+    public void getWifiIpAddresses_nullLinkProperties() {
         when(wifiManager.getCurrentNetwork()).thenReturn(network);
         // Explicitly set the return value to null for readability sake.
         when(connectivityManager.getLinkProperties(network)).thenReturn(null);
@@ -116,7 +123,7 @@
     }
 
     @Test
-    public void testGetWifiIpAddresses_nullNetwork() {
+    public void getWifiIpAddresses_nullNetwork() {
         // Explicitly set the return value to null for readability sake.
         when(wifiManager.getCurrentNetwork()).thenReturn(null);
 
@@ -124,7 +131,7 @@
     }
 
     @Test
-    public void testInitializeVolumeDoesntBreakOnNullVolume() {
+    public void initializeVolumeDoesntBreakOnNullVolume() {
         VolumeInfo info = new VolumeInfo("id", 0, new DiskInfo("id", 0), "");
         StorageManager storageManager = mock(StorageManager.class, RETURNS_DEEP_STUBS);
         when(storageManager.findVolumeById(anyString())).thenReturn(info);
@@ -133,13 +140,13 @@
     }
 
     @Test
-    public void testGetInstallationStatus_notInstalled_shouldReturnUninstalled() {
+    public void getInstallationStatus_notInstalled_shouldReturnUninstalled() {
         assertThat(Utils.getInstallationStatus(new ApplicationInfo()))
                 .isEqualTo(R.string.not_installed);
     }
 
     @Test
-    public void testGetInstallationStatus_enabled_shouldReturnInstalled() {
+    public void getInstallationStatus_enabled_shouldReturnInstalled() {
         final ApplicationInfo info = new ApplicationInfo();
         info.flags = ApplicationInfo.FLAG_INSTALLED;
         info.enabled = true;
@@ -148,7 +155,7 @@
     }
 
     @Test
-    public void testGetInstallationStatus_disabled_shouldReturnDisabled() {
+    public void getInstallationStatus_disabled_shouldReturnDisabled() {
         final ApplicationInfo info = new ApplicationInfo();
         info.flags = ApplicationInfo.FLAG_INSTALLED;
         info.enabled = false;
@@ -157,7 +164,7 @@
     }
 
     @Test
-    public void testIsProfileOrDeviceOwner_deviceOwnerApp_returnTrue() {
+    public void isProfileOrDeviceOwner_deviceOwnerApp_returnTrue() {
         when(mDevicePolicyManager.isDeviceOwnerAppOnAnyUser(PACKAGE_NAME)).thenReturn(true);
 
         assertThat(Utils.isProfileOrDeviceOwner(mUserManager, mDevicePolicyManager, PACKAGE_NAME))
@@ -165,7 +172,7 @@
     }
 
     @Test
-    public void testIsProfileOrDeviceOwner_profileOwnerApp_returnTrue() {
+    public void isProfileOrDeviceOwner_profileOwnerApp_returnTrue() {
         final List<UserInfo> userInfos = new ArrayList<>();
         userInfos.add(new UserInfo());
 
@@ -178,7 +185,7 @@
     }
 
     @Test
-    public void testSetEditTextCursorPosition_shouldGetExpectedEditTextLenght() {
+    public void setEditTextCursorPosition_shouldGetExpectedEditTextLenght() {
         final EditText editText = new EditText(mContext);
         final CharSequence text = "test";
         editText.setText(text, TextView.BufferType.EDITABLE);
@@ -189,7 +196,36 @@
     }
 
     @Test
-    public void testGetBadgedIcon_usePackageNameAndUserId()
+    public void createIconWithDrawable_BitmapDrawable() {
+        final Bitmap bitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888);
+        final BitmapDrawable drawable = new BitmapDrawable(mContext.getResources(), bitmap);
+
+        final IconCompat icon = Utils.createIconWithDrawable(drawable);
+
+        assertThat(icon.getBitmap()).isNotNull();
+    }
+
+    @Test
+    public void createIconWithDrawable_ColorDrawable() {
+        final ColorDrawable drawable = new ColorDrawable(Color.BLACK);
+
+        final IconCompat icon = Utils.createIconWithDrawable(drawable);
+
+        assertThat(icon.getBitmap()).isNotNull();
+    }
+
+    @Test
+    public void createIconWithDrawable_VectorDrawable() {
+        final VectorDrawable drawable = VectorDrawable.create(mContext.getResources(),
+                R.drawable.ic_settings_accent);
+
+        final IconCompat icon = Utils.createIconWithDrawable(drawable);
+
+        assertThat(icon.getBitmap()).isNotNull();
+    }
+
+    @Test
+    public void getBadgedIcon_usePackageNameAndUserId()
         throws PackageManager.NameNotFoundException {
         doReturn(mApplicationInfo).when(mPackageManager).getApplicationInfoAsUser(
                 PACKAGE_NAME, PackageManager.GET_META_DATA, USER_ID);
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultBrowserPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultBrowserPreferenceControllerTest.java
index 03b3867..1aa9f9d 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultBrowserPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultBrowserPreferenceControllerTest.java
@@ -181,11 +181,11 @@
     }
 
     @Test
-    public void getCandidates_shouldQueryActivityWithFlagsEquals0() {
+    public void getCandidates_shouldQueryActivityWithMatchAll() {
         DefaultBrowserPreferenceController.getCandidates(mPackageManager, 0 /* userId */);
 
         verify(mPackageManager).queryIntentActivitiesAsUser(
-            any(Intent.class), eq(0) /* flags */, eq(0) /* userId */);
+            any(Intent.class), eq(PackageManager.MATCH_ALL), eq(0) /* userId */);
     }
 
     @Test
@@ -221,6 +221,7 @@
         info.handleAllWebDataURI = true;
         info.activityInfo = new ActivityInfo();
         info.activityInfo.packageName = packageName;
+        info.activityInfo.applicationInfo = createApplicationInfo(packageName);
         return info;
     }
 
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultEmergencyPickerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultEmergencyPickerTest.java
index 6aa4bab..5d97f52 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultEmergencyPickerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultEmergencyPickerTest.java
@@ -18,15 +18,24 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
+import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 import android.app.Activity;
+import android.app.role.RoleManager;
+import android.app.role.RoleManagerCallback;
 import android.content.Context;
 import android.content.pm.PackageManager;
+import android.os.AsyncTask;
+import android.os.Process;
+import android.os.UserHandle;
 import android.os.UserManager;
 import android.provider.Settings;
+import android.util.Log;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -36,11 +45,15 @@
 import org.mockito.MockitoAnnotations;
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
+import org.robolectric.shadows.ShadowApplication;
 import org.robolectric.util.ReflectionHelpers;
 
+import java.util.Arrays;
+import java.util.concurrent.Executor;
+
 @RunWith(RobolectricTestRunner.class)
 public class DefaultEmergencyPickerTest {
-
+    private static final String TAG = DefaultEmergencyPickerTest.class.getSimpleName();
     private static final String TEST_APP_KEY = "test_app";
 
     @Mock(answer = Answers.RETURNS_DEEP_STUBS)
@@ -49,34 +62,41 @@
     private UserManager mUserManager;
     @Mock
     private PackageManager mPackageManager;
+    @Mock
+    private RoleManager mRoleManager;
 
     private DefaultEmergencyPicker mPicker;
 
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
+        ShadowApplication shadowApplication = ShadowApplication.getInstance();
+        shadowApplication.setSystemService(Context.ROLE_SERVICE, mRoleManager);
         when(mActivity.getSystemService(Context.USER_SERVICE)).thenReturn(mUserManager);
 
         mPicker = spy(new DefaultEmergencyPicker());
         mPicker.onAttach(mActivity);
 
         ReflectionHelpers.setField(mPicker, "mPm", mPackageManager);
-
-        doReturn(RuntimeEnvironment.application).when(mPicker).getContext();
+        when(mPicker.getContext()).thenReturn(RuntimeEnvironment.application);
     }
 
     @Test
     public void setDefaultAppKey_shouldUpdateDefault() {
-        assertThat(mPicker.setDefaultKey(TEST_APP_KEY)).isTrue();
-        assertThat(mPicker.getDefaultKey()).isEqualTo(TEST_APP_KEY);
+        mPicker.setDefaultKey(TEST_APP_KEY);
+        verify(mRoleManager).addRoleHolderAsUser(
+            eq(RoleManager.ROLE_EMERGENCY),
+            eq(TEST_APP_KEY),
+            eq(0),
+            any(UserHandle.class),
+            any(Executor.class),
+            any(RoleManagerCallback.class));
     }
 
     @Test
     public void getDefaultAppKey_shouldReturnDefault() {
-        Settings.Secure.putString(RuntimeEnvironment.application.getContentResolver(),
-                Settings.Secure.EMERGENCY_ASSISTANCE_APPLICATION,
-                TEST_APP_KEY);
-
-        assertThat(mPicker.getDefaultKey()).isEqualTo(TEST_APP_KEY);
+      when(mRoleManager.getRoleHolders(RoleManager.ROLE_EMERGENCY))
+              .thenReturn(Arrays.asList(TEST_APP_KEY));
+      assertThat(mPicker.getDefaultKey()).isEqualTo(TEST_APP_KEY);
     }
 }
diff --git a/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java b/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java
index 27aeccc..419fc49 100644
--- a/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java
@@ -466,27 +466,27 @@
 
     @Test
     public void updateFilterView_hasFilterSet_shouldShowFilterAndHavePaddingTop() {
-        mFragment.mContentContainer = new View(mContext);
+        mFragment.mRecyclerView = new RecyclerView(mContext);
         mFragment.mSpinnerHeader = new View(mContext);
         mFragment.mFilterAdapter = new ManageApplications.FilterSpinnerAdapter(mFragment);
 
         mFragment.mFilterAdapter.updateFilterView(true);
 
         assertThat(mFragment.mSpinnerHeader.getVisibility()).isEqualTo(View.VISIBLE);
-        assertThat(mFragment.mContentContainer.getPaddingTop()).isEqualTo(
+        assertThat(mFragment.mRecyclerView.getPaddingTop()).isEqualTo(
                 mContext.getResources().getDimensionPixelSize(R.dimen.app_bar_height));
     }
 
     @Test
     public void updateFilterView_noFilterSet_shouldHideFilterAndNoPaddingTop() {
-        mFragment.mContentContainer = new View(mContext);
+        mFragment.mRecyclerView = new RecyclerView(mContext);
         mFragment.mSpinnerHeader = new View(mContext);
         mFragment.mFilterAdapter = new ManageApplications.FilterSpinnerAdapter(mFragment);
 
         mFragment.mFilterAdapter.updateFilterView(false);
 
         assertThat(mFragment.mSpinnerHeader.getVisibility()).isEqualTo(View.GONE);
-        assertThat(mFragment.mContentContainer.getPaddingTop()).isEqualTo(0);
+        assertThat(mFragment.mRecyclerView.getPaddingTop()).isEqualTo(0);
     }
 
     private void setUpOptionMenus() {
diff --git a/tests/robotests/src/com/android/settings/development/ArtVerifierPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/ArtVerifierPreferenceControllerTest.java
new file mode 100644
index 0000000..e5dade4
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/development/ArtVerifierPreferenceControllerTest.java
@@ -0,0 +1,109 @@
+/*
+ * 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 static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.provider.Settings;
+
+import androidx.preference.PreferenceScreen;
+import androidx.preference.SwitchPreference;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public class ArtVerifierPreferenceControllerTest {
+
+    @Mock
+    private SwitchPreference mPreference;
+    @Mock
+    private PreferenceScreen mPreferenceScreen;
+
+    private Context mContext;
+    private ArtVerifierPreferenceController mController;
+
+    @Before
+    public void setup() {
+        MockitoAnnotations.initMocks(this);
+        mContext = RuntimeEnvironment.application;
+        mController = new ArtVerifierPreferenceController(mContext);
+        when(mPreferenceScreen.findPreference(mController.getPreferenceKey()))
+            .thenReturn(mPreference);
+        mController.displayPreference(mPreferenceScreen);
+    }
+
+    @Test
+    public void onPreferenceChanged_settingEnabled_turnOnArtVerifier() {
+        mController.onPreferenceChange(mPreference, true /* new value */);
+
+        final int mode = Settings.Global.getInt(mContext.getContentResolver(),
+                Settings.Global.ART_VERIFIER_VERIFY_DEBUGGABLE, -1 /* default */);
+
+        assertThat(mode).isEqualTo(ArtVerifierPreferenceController.SETTING_VALUE_ON);
+    }
+
+    @Test
+    public void onPreferenceChanged_settingDisabled_turnOffArtVerifier() {
+        mController.onPreferenceChange(mPreference, false /* new value */);
+
+        final int mode = Settings.Global.getInt(mContext.getContentResolver(),
+                Settings.Global.ART_VERIFIER_VERIFY_DEBUGGABLE, -1 /* default */);
+
+        assertThat(mode).isEqualTo(ArtVerifierPreferenceController.SETTING_VALUE_OFF);
+    }
+
+    @Test
+    public void updateState_settingEnabled_preferenceShouldBeChecked() {
+        Settings.Global.putInt(mContext.getContentResolver(),
+                Settings.Global.ART_VERIFIER_VERIFY_DEBUGGABLE,
+                ArtVerifierPreferenceController.SETTING_VALUE_ON);
+        mController.updateState(mPreference);
+
+        verify(mPreference).setChecked(true);
+    }
+
+    @Test
+    public void updateState_settingDisabled_preferenceShouldBeChecked() {
+        Settings.Global.putInt(mContext.getContentResolver(),
+                Settings.Global.ART_VERIFIER_VERIFY_DEBUGGABLE,
+                ArtVerifierPreferenceController.SETTING_VALUE_OFF);
+        mController.updateState(mPreference);
+
+        verify(mPreference).setChecked(false);
+    }
+
+    @Test
+    public void onDeveloperOptionsSwitchDisabled_shouldDisablePreference() {
+        mController.onDeveloperOptionsSwitchDisabled();
+        final int mode = Settings.Global.getInt(mContext.getContentResolver(),
+                Settings.Global.ART_VERIFIER_VERIFY_DEBUGGABLE, -1 /* default */);
+
+        assertThat(mode).isEqualTo(ArtVerifierPreferenceController.SETTING_VALUE_ON);
+        verify(mPreference).setEnabled(false);
+        verify(mPreference).setChecked(true);
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/development/OemUnlockPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/OemUnlockPreferenceControllerTest.java
index 08502dd..0d6fbd1 100644
--- a/tests/robotests/src/com/android/settings/development/OemUnlockPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/OemUnlockPreferenceControllerTest.java
@@ -30,6 +30,7 @@
 
 import android.app.Activity;
 import android.content.Context;
+import android.content.pm.PackageManager;
 import android.content.res.Resources;
 import android.os.UserManager;
 import android.service.oemlock.OemLockManager;
@@ -60,6 +61,8 @@
     @Mock
     private RestrictedSwitchPreference mPreference;
     @Mock
+    private PackageManager mPackageManager;
+    @Mock
     private PreferenceScreen mPreferenceScreen;
     @Mock
     private OemLockManager mOemLockManager;
@@ -74,6 +77,9 @@
     @Before
     public void setup() {
         MockitoAnnotations.initMocks(this);
+        when(mContext.getPackageManager()).thenReturn(mPackageManager);
+        when(mContext.getPackageManager().hasSystemFeature(PackageManager
+                    .FEATURE_TELEPHONY_CARRIERLOCK)).thenReturn(true);
         when(mContext.getSystemService(Context.OEM_LOCK_SERVICE)).thenReturn(mOemLockManager);
         when(mContext.getSystemService(Context.USER_SERVICE)).thenReturn(mUserManager);
         when(mContext.getSystemService(Context.TELEPHONY_SERVICE)).thenReturn(mTelephonyManager);
@@ -87,6 +93,16 @@
     }
 
     @Test
+    public void OemUnlockPreferenceController_shouldNotCrashWhenMissingFEATURE_TELEPHONY_CARRIERLOCK() {
+        when(mContext.getPackageManager().hasSystemFeature(PackageManager
+                    .FEATURE_TELEPHONY_CARRIERLOCK)).thenReturn(false);
+        when(mContext.getSystemService(Context.OEM_LOCK_SERVICE)).thenThrow
+            (new RuntimeException());
+
+        new OemUnlockPreferenceController(mContext, mActivity, mFragment);
+    }
+
+    @Test
     public void isAvailable_shouldReturnTrueWhenOemLockManagerIsNotNull() {
         boolean returnValue = mController.isAvailable();
 
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardLoaderTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardLoaderTest.java
index f04008b..18aa1c4 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardLoaderTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardLoaderTest.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.homepage.contextualcards;
 
+import static android.app.slice.Slice.HINT_ERROR;
+
 import static com.android.settings.homepage.contextualcards.ContextualCardLoader.DEFAULT_CARD_COUNT;
 
 import static com.google.common.truth.Truth.assertThat;
@@ -27,6 +29,8 @@
 import android.content.Context;
 import android.net.Uri;
 
+import androidx.slice.Slice;
+
 import com.android.settings.R;
 import com.android.settings.slices.CustomSliceRegistry;
 
@@ -43,13 +47,18 @@
 @RunWith(RobolectricTestRunner.class)
 public class ContextualCardLoaderTest {
 
+    private static final String TEST_SLICE_URI = "content://test/test";
+
     private Context mContext;
     private ContextualCardLoader mContextualCardLoader;
+    private EligibleCardChecker mEligibleCardChecker;
 
     @Before
     public void setUp() {
         mContext = RuntimeEnvironment.application;
         mContextualCardLoader = spy(new ContextualCardLoader(mContext));
+        mEligibleCardChecker =
+                spy(new EligibleCardChecker(mContext, getContextualCard(TEST_SLICE_URI)));
     }
 
     @Test
@@ -61,25 +70,33 @@
                 .setSummaryText("custom_summary")
                 .build();
 
-        assertThat(mContextualCardLoader.isCardEligibleToDisplay(customCard)).isTrue();
+        assertThat(mEligibleCardChecker.isCardEligibleToDisplay(customCard)).isTrue();
     }
 
     @Test
     public void isCardEligibleToDisplay_invalidScheme_returnFalse() {
         final String sliceUri = "contet://com.android.settings.slices/action/flashlight";
 
-        assertThat(
-                mContextualCardLoader.isCardEligibleToDisplay(
-                        getContextualCard(sliceUri))).isFalse();
+        assertThat(mEligibleCardChecker.isCardEligibleToDisplay(getContextualCard(sliceUri)))
+                .isFalse();
     }
 
     @Test
-    public void isCardEligibleToDisplay_noProvider_returnFalse() {
-        final String sliceUri = "content://com.android.settings.test.slices/action/flashlight";
+    public void isCardEligibleToDisplay_nullSlice_returnFalse() {
+        doReturn(null).when(mEligibleCardChecker).bindSlice(Uri.parse(TEST_SLICE_URI));
 
-        assertThat(
-                mContextualCardLoader.isCardEligibleToDisplay(
-                        getContextualCard(sliceUri))).isFalse();
+        assertThat(mEligibleCardChecker.isCardEligibleToDisplay(getContextualCard(TEST_SLICE_URI)))
+                .isFalse();
+    }
+
+    @Test
+    public void isCardEligibleToDisplay_errorSlice_returnFalse() {
+        final Slice slice = new Slice.Builder(Uri.parse(TEST_SLICE_URI))
+                .addHints(HINT_ERROR).build();
+        doReturn(slice).when(mEligibleCardChecker).bindSlice(Uri.parse(TEST_SLICE_URI));
+
+        assertThat(mEligibleCardChecker.isCardEligibleToDisplay(getContextualCard(TEST_SLICE_URI)))
+                .isFalse();
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSliceTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSliceTest.java
index 02d7a9d..77fc5d9 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSliceTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSliceTest.java
@@ -30,7 +30,6 @@
 import android.app.PendingIntent;
 import android.content.Context;
 import android.content.Intent;
-import android.text.TextUtils;
 
 import androidx.core.graphics.drawable.IconCompat;
 import androidx.slice.Slice;
@@ -123,18 +122,6 @@
     }
 
     @Test
-    public void getSlice_hasBluetoothDevices_shouldHavePairNewDevice() {
-        mockBluetoothDeviceList(1);
-        doReturn(mBluetoothDeviceList).when(mBluetoothDevicesSlice).getConnectedBluetoothDevices();
-
-        final Slice slice = mBluetoothDevicesSlice.getSlice();
-
-        final List<SliceItem> sliceItems = slice.getItems();
-        SliceTester.assertAnySliceItemContainsTitle(sliceItems,
-                mContext.getString(R.string.bluetooth_pairing_pref_title));
-    }
-
-    @Test
     public void getSlice_noBluetoothDevices_shouldHaveNoBluetoothDevicesTitle() {
         doReturn(mBluetoothDeviceList).when(mBluetoothDevicesSlice).getConnectedBluetoothDevices();
 
@@ -146,17 +133,6 @@
     }
 
     @Test
-    public void getSlice_noBluetoothDevices_shouldNotHavePairNewDevice() {
-        doReturn(mBluetoothDeviceList).when(mBluetoothDevicesSlice).getConnectedBluetoothDevices();
-
-        final Slice slice = mBluetoothDevicesSlice.getSlice();
-
-        final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
-        assertThat(hasTitle(metadata,
-                mContext.getString(R.string.bluetooth_pairing_pref_title))).isFalse();
-    }
-
-    @Test
     public void getSlice_exceedDefaultRowCount_shouldOnlyShowDefaultRows() {
         mockBluetoothDeviceList(BluetoothDevicesSlice.DEFAULT_EXPANDED_ROW_COUNT + 1);
         doReturn(mBluetoothDeviceList).when(mBluetoothDevicesSlice).getConnectedBluetoothDevices();
@@ -204,9 +180,4 @@
             mBluetoothDeviceList.add(mCachedBluetoothDevice);
         }
     }
-
-    private boolean hasTitle(SliceMetadata metadata, String title) {
-        final CharSequence sliceTitle = metadata.getTitle();
-        return TextUtils.equals(sliceTitle, title);
-    }
 }
diff --git a/tests/robotests/src/com/android/settings/inputmethod/UserDictionaryListControllerTest.java b/tests/robotests/src/com/android/settings/inputmethod/UserDictionaryListControllerTest.java
index ff3f0ec..fd6d6a1 100644
--- a/tests/robotests/src/com/android/settings/inputmethod/UserDictionaryListControllerTest.java
+++ b/tests/robotests/src/com/android/settings/inputmethod/UserDictionaryListControllerTest.java
@@ -142,9 +142,9 @@
                 String sortOrder) {
             if (hasDictionary) {
                 final MatrixCursor cursor = new MatrixCursor(
-                        new String[] {UserDictionary.Words.LOCALE});
-                cursor.addRow(new Object[] {"en"});
-                cursor.addRow(new Object[] {"es"});
+                        new String[]{UserDictionary.Words.LOCALE});
+                cursor.addRow(new Object[]{"en"});
+                cursor.addRow(new Object[]{"es"});
                 return cursor;
             } else {
                 return null;
diff --git a/tests/robotests/src/com/android/settings/network/telephony/MobileDataPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/telephony/MobileDataPreferenceControllerTest.java
index 4c242c1..1b7b4b4 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/MobileDataPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/MobileDataPreferenceControllerTest.java
@@ -149,4 +149,23 @@
 
         verify(mTelephonyManager).setDataEnabled(true);
     }
+
+    @Test
+    public void isChecked_returnUserDataEnabled() {
+        mController.init(mFragmentManager, SUB_ID);
+        assertThat(mController.isChecked()).isFalse();
+
+        doReturn(true).when(mTelephonyManager).isDataEnabled();
+        assertThat(mController.isChecked()).isTrue();
+    }
+
+    @Test
+    public void updateState_opportunistic_disabled() {
+        doReturn(mSubscriptionInfo).when(mSubscriptionManager).getActiveSubscriptionInfo(SUB_ID);
+        mController.init(mFragmentManager, SUB_ID);
+        doReturn(true).when(mSubscriptionInfo).isOpportunistic();
+        mController.updateState(mPreference);
+
+        assertThat(mPreference.isEnabled()).isFalse();
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/notification/SwipeDirectionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/SwipeDirectionPreferenceControllerTest.java
new file mode 100644
index 0000000..32ba592
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/notification/SwipeDirectionPreferenceControllerTest.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.notification;
+
+import static android.provider.Settings.Secure.NOTIFICATION_DISMISS_RTL;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.provider.Settings;
+
+import com.android.settings.R;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Answers;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+import androidx.preference.ListPreference;
+import androidx.preference.PreferenceScreen;
+
+@RunWith(RobolectricTestRunner.class)
+public class SwipeDirectionPreferenceControllerTest {
+
+    private Context mContext;
+    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
+    private PreferenceScreen mScreen;
+
+    private SwipeDirectionPreferenceController mController;
+    private ListPreference mPreference;
+
+    private static final String KEY = "swipe";
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mContext = RuntimeEnvironment.application;
+        mController = new SwipeDirectionPreferenceController(mContext, KEY);
+        mPreference = new ListPreference(RuntimeEnvironment.application);
+        mPreference.setKey(mController.getPreferenceKey());
+        when(mScreen.findPreference(mPreference.getKey())).thenReturn(mPreference);
+    }
+
+    @Test
+    public void display_shouldDisplay() {
+        assertThat(mPreference.isVisible()).isTrue();
+    }
+
+    @Test
+    public void updateState_SettingIsOn() {
+        Settings.Secure.putInt(mContext.getContentResolver(),
+                NOTIFICATION_DISMISS_RTL,
+                1);
+
+        mController.updateState(mPreference);
+
+        assertThat(mPreference.getValue()).isEqualTo("1");
+    }
+
+    @Test
+    public void updateState_SettingIsOff() {
+        Settings.Secure.putInt(mContext.getContentResolver(),
+                NOTIFICATION_DISMISS_RTL,
+                0);
+
+        mController.updateState(mPreference);
+
+        assertThat(mPreference.getValue()).isEqualTo("0");
+    }
+
+    @Test
+    public void onPreferenceChange_LTR() {
+        Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_DISMISS_RTL, 1);
+
+        mController.onPreferenceChange(mPreference, "0");
+
+        assertThat(Settings.Secure.getInt(mContext.getContentResolver(),
+                NOTIFICATION_DISMISS_RTL, 1)).isEqualTo(0);
+
+        assertThat(mPreference.getSummary()).isEqualTo(
+                mContext.getResources().getStringArray(R.array.swipe_direction_titles)[1]);
+    }
+
+    @Test
+    public void onPreferenceChange_On() {
+        Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_DISMISS_RTL, 0);
+
+        mController.onPreferenceChange(mPreference, "1");
+
+        assertThat(Settings.Secure.getInt(mContext.getContentResolver(),
+                NOTIFICATION_DISMISS_RTL, 0)).isEqualTo(1);
+
+        assertThat(mPreference.getSummary()).isEqualTo(
+                mContext.getResources().getStringArray(R.array.swipe_direction_titles)[0]);
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/privacy/PermissionBarChartPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/privacy/PermissionBarChartPreferenceControllerTest.java
index b947630..f664f4f 100644
--- a/tests/robotests/src/com/android/settings/privacy/PermissionBarChartPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/privacy/PermissionBarChartPreferenceControllerTest.java
@@ -22,18 +22,26 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
+import android.content.pm.UserInfo;
+import android.os.UserManager;
 import android.permission.RuntimePermissionUsageInfo;
 import android.provider.DeviceConfig;
+import android.view.accessibility.AccessibilityManager;
 
 import androidx.preference.PreferenceScreen;
 
+import com.android.internal.widget.LockPatternUtils;
+import com.android.settings.testutils.FakeFeatureFactory;
 import com.android.settings.testutils.shadow.ShadowDeviceConfig;
+import com.android.settings.testutils.shadow.ShadowPermissionControllerManager;
+import com.android.settings.testutils.shadow.ShadowUserManager;
 import com.android.settingslib.widget.BarChartInfo;
 import com.android.settingslib.widget.BarChartPreference;
 import com.android.settingslib.widget.BarViewInfo;
@@ -47,26 +55,45 @@
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
 import org.robolectric.annotation.Config;
+import org.robolectric.shadow.api.Shadow;
+import org.robolectric.shadows.ShadowAccessibilityManager;
+import org.robolectric.shadows.androidx.fragment.FragmentController;
 
 import java.util.ArrayList;
 import java.util.List;
 
 @RunWith(RobolectricTestRunner.class)
-@Config(shadows = {ShadowDeviceConfig.class})
+@Config(shadows = {ShadowDeviceConfig.class, ShadowUserManager.class,
+        ShadowPermissionControllerManager.class})
 public class PermissionBarChartPreferenceControllerTest {
 
     @Mock
     private PreferenceScreen mScreen;
+    @Mock
+    private LockPatternUtils mLockPatternUtils;
 
     private PermissionBarChartPreferenceController mController;
     private BarChartPreference mPreference;
+    private PrivacyDashboardFragment mFragment;
 
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
-        Context Context = RuntimeEnvironment.application;
-        mController = new PermissionBarChartPreferenceController(Context, "test_key");
-        mPreference = spy(new BarChartPreference(Context));
+        final Context context = RuntimeEnvironment.application;
+        final UserManager userManager = context.getSystemService(UserManager.class);
+        final ShadowUserManager shadowUserManager = Shadow.extract(userManager);
+        final ShadowAccessibilityManager accessibilityManager = Shadow.extract(
+                AccessibilityManager.getInstance(context));
+        accessibilityManager.setEnabledAccessibilityServiceList(new ArrayList<>());
+        shadowUserManager.addProfile(new UserInfo(123, null, 0));
+        when(FakeFeatureFactory.setupForTest().securityFeatureProvider.getLockPatternUtils(
+                any(Context.class))).thenReturn(mLockPatternUtils);
+
+        mController = spy(new PermissionBarChartPreferenceController(context, "test_key"));
+        mFragment = spy(FragmentController.of(new PrivacyDashboardFragment())
+                .create().start().get());
+        mController.setFragment(mFragment);
+        mPreference = spy(new BarChartPreference(context));
         when(mScreen.findPreference(mController.getPreferenceKey()))
                 .thenReturn((BarChartPreference) mPreference);
     }
@@ -130,4 +157,41 @@
 
         verify(mPreference, times(1)).setBarViewInfos(any(BarViewInfo[].class));
     }
+
+    @Test
+    public void onStart_permissionHubEnabled_shouldShowProgressBar() {
+        DeviceConfig.setProperty(DeviceConfig.Privacy.NAMESPACE,
+                DeviceConfig.Privacy.PROPERTY_PERMISSIONS_HUB_ENABLED, "true", true);
+        mController.displayPreference(mScreen);
+
+        mController.onStart();
+
+        verify(mFragment).setLoadingEnabled(true /* enabled */);
+        verify(mPreference).updateLoadingState(true /* isLoading */);
+    }
+
+    @Test
+    public void onStart_permissionHubDisabled_shouldNotShowProgressBar() {
+        DeviceConfig.setProperty(DeviceConfig.Privacy.NAMESPACE,
+                DeviceConfig.Privacy.PROPERTY_PERMISSIONS_HUB_ENABLED, "false", false);
+
+        mController.onStart();
+
+        verify(mFragment, never()).setLoadingEnabled(true /* enabled */);
+        verify(mPreference, never()).updateLoadingState(true /* isLoading */);
+    }
+
+    @Test
+    public void onPermissionUsageResult_shouldHideProgressBar() {
+        final List<RuntimePermissionUsageInfo> infos1 = new ArrayList<>();
+        final RuntimePermissionUsageInfo info1 =
+                new RuntimePermissionUsageInfo("permission 1", 10);
+        infos1.add(info1);
+        mController.displayPreference(mScreen);
+
+        mController.onPermissionUsageResult(infos1);
+
+        verify(mFragment).setLoadingEnabled(false /* enabled */);
+        verify(mPreference).updateLoadingState(false /* isLoading */);
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/privacy/PrivacyDashboardFragmentTest.java b/tests/robotests/src/com/android/settings/privacy/PrivacyDashboardFragmentTest.java
index d073e9b..482eaeb 100644
--- a/tests/robotests/src/com/android/settings/privacy/PrivacyDashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/privacy/PrivacyDashboardFragmentTest.java
@@ -16,53 +16,96 @@
 
 package com.android.settings.privacy;
 
-import static org.mockito.Mockito.mock;
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import android.app.ActionBar;
 import android.content.Context;
+import android.content.pm.UserInfo;
 import android.os.Bundle;
+import android.os.UserManager;
+import android.permission.PermissionControllerManager;
 import android.view.View;
+import android.view.accessibility.AccessibilityManager;
 
-import androidx.fragment.app.FragmentActivity;
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.android.settingslib.core.lifecycle.Lifecycle;
+import com.android.internal.widget.LockPatternUtils;
+import com.android.settings.testutils.FakeFeatureFactory;
+import com.android.settings.testutils.shadow.ShadowPermissionControllerManager;
+import com.android.settings.testutils.shadow.ShadowUserManager;
 
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.robolectric.Robolectric;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
+import org.robolectric.shadow.api.Shadow;
+import org.robolectric.shadows.ShadowAccessibilityManager;
+import org.robolectric.shadows.androidx.fragment.FragmentController;
+
+import java.util.ArrayList;
+
 
 @RunWith(RobolectricTestRunner.class)
+@Config(shadows = {ShadowUserManager.class, ShadowPermissionControllerManager.class})
 public class PrivacyDashboardFragmentTest {
 
+    @Mock
+    private LockPatternUtils mLockPatternUtils;
+    @Mock
+    private PermissionControllerManager mPCM;
+
     private Context mContext;
     private PrivacyDashboardFragment mFragment;
 
     @Before
     public void setUp() {
+        MockitoAnnotations.initMocks(this);
         mContext = RuntimeEnvironment.application;
-        mFragment = spy(new PrivacyDashboardFragment());
+        final UserManager userManager = mContext.getSystemService(UserManager.class);
+        final ShadowUserManager shadowUserManager = Shadow.extract(userManager);
+        final ShadowAccessibilityManager accessibilityManager = Shadow.extract(
+                AccessibilityManager.getInstance(mContext));
+        accessibilityManager.setEnabledAccessibilityServiceList(new ArrayList<>());
+        shadowUserManager.addProfile(new UserInfo(123, null, 0));
+        when(FakeFeatureFactory.setupForTest().securityFeatureProvider.getLockPatternUtils(
+                any(Context.class))).thenReturn(mLockPatternUtils);
+        mFragment = spy(FragmentController.of(new PrivacyDashboardFragment())
+                .create().start().get());
     }
 
     @Test
     public void onViewCreated_shouldCallStyleActionBar() {
-        final FragmentActivity activity = spy(
-                Robolectric.buildActivity(FragmentActivity.class).get());
-        final ActionBar actionBar = mock(ActionBar.class);
-
-        when(mFragment.getActivity()).thenReturn(activity);
-        when(mFragment.getSettingsLifecycle()).thenReturn(mock(Lifecycle.class));
-        when(mFragment.getListView()).thenReturn(mock(RecyclerView.class));
-        when(activity.getActionBar()).thenReturn(actionBar);
-
         mFragment.onViewCreated(new View(mContext), new Bundle());
 
         verify(mFragment).styleActionBar();
     }
+
+    @Test
+    public void onViewCreated_shouldInitLinearProgressBar() {
+        mFragment.onViewCreated(new View(mContext), new Bundle());
+
+        verify(mFragment).initLoadingBar();
+    }
+
+    @Test
+    public void updateLinearProgressbar_isVisible_shouldShowProgressBar() {
+        mFragment.setLoadingEnabled(true /* enabled */);
+
+        assertThat(mFragment.mProgressHeader.getVisibility()).isEqualTo(View.VISIBLE);
+        assertThat(mFragment.mProgressAnimation.getVisibility()).isEqualTo(View.VISIBLE);
+    }
+
+    @Test
+    public void updateLinearProgressbar_isInVisible_shouldHideProgressBar() {
+        mFragment.setLoadingEnabled(false /* enabled */);
+
+        assertThat(mFragment.mProgressHeader.getVisibility()).isEqualTo(View.INVISIBLE);
+        assertThat(mFragment.mProgressAnimation.getVisibility()).isEqualTo(View.INVISIBLE);
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowPermissionControllerManager.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowPermissionControllerManager.java
new file mode 100644
index 0000000..091b244
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowPermissionControllerManager.java
@@ -0,0 +1,44 @@
+/*
+ * 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.testutils.shadow;
+
+import android.annotation.CallbackExecutor;
+import android.content.Context;
+import android.permission.PermissionControllerManager;
+
+import androidx.annotation.NonNull;
+
+import org.robolectric.annotation.Implementation;
+import org.robolectric.annotation.Implements;
+
+import java.util.concurrent.Executor;
+
+@Implements(PermissionControllerManager.class)
+public class ShadowPermissionControllerManager {
+
+    protected void __constructor__(Context context) {
+        // no nothing, everything is shadowed
+    }
+
+    @Implementation
+    public void getPermissionUsages(boolean countSystem, long numMillis,
+            @NonNull @CallbackExecutor Executor executor,
+            @NonNull PermissionControllerManager.OnPermissionUsageResultCallback callback) {
+
+        // Do nothing
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/wifi/NetworkRequestDialogFragmentTest.java b/tests/robotests/src/com/android/settings/wifi/NetworkRequestDialogFragmentTest.java
index 0286d07..21b68f2 100644
--- a/tests/robotests/src/com/android/settings/wifi/NetworkRequestDialogFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/NetworkRequestDialogFragmentTest.java
@@ -33,6 +33,7 @@
 import android.net.wifi.WifiManager;
 import android.net.wifi.WifiManager.NetworkRequestUserSelectionCallback;
 import android.os.Bundle;
+import android.view.View;
 import android.widget.Button;
 import android.widget.TextView;
 
@@ -264,20 +265,77 @@
     private List<AccessPoint> createAccessPointList() {
         List<AccessPoint> accessPointList = spy(new ArrayList<>());
         Bundle bundle = new Bundle();
+
         bundle.putString(KEY_SSID, "Test AP 1");
         bundle.putInt(KEY_SECURITY, 1);
         accessPointList.add(new AccessPoint(mContext, bundle));
+
         bundle.putString(KEY_SSID, "Test AP 2");
         bundle.putInt(KEY_SECURITY, 1);
         accessPointList.add(new AccessPoint(mContext, bundle));
+
         bundle.putString(KEY_SSID, "Test AP 3");
         bundle.putInt(KEY_SECURITY, 2);
-        AccessPoint clickedAccessPoint = new AccessPoint(mContext, bundle);
-        accessPointList.add(clickedAccessPoint);
+        accessPointList.add(new AccessPoint(mContext, bundle));
+
         bundle.putString(KEY_SSID, "Test AP 4");
         bundle.putInt(KEY_SECURITY, 0);
         accessPointList.add(new AccessPoint(mContext, bundle));
 
         return accessPointList;
     }
+
+    @Test
+    public void display_shouldNotShowNeutralButton() {
+        networkRequestDialogFragment.show(mActivity.getSupportFragmentManager(), /* tag */ null);
+        final AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
+
+        final Button button = alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL);
+        assertThat(button).isNotNull();
+        assertThat(button.getVisibility()).isEqualTo(View.GONE);
+    }
+
+    @Test
+    public void onMatchManyResult_showNeutralButton() {
+        networkRequestDialogFragment.show(mActivity.getSupportFragmentManager(), /* tag */ null);
+        final AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
+
+        final String SSID_AP = "Test AP ";
+        final List<ScanResult> scanResults = new ArrayList<>();
+        for (int i = 0; i < 6 ; i ++) {
+            ScanResult scanResult = new ScanResult();
+            scanResult.SSID = SSID_AP + i;
+            scanResult.capabilities = "WEP";
+            scanResults.add(scanResult);
+        }
+        networkRequestDialogFragment.onMatch(scanResults);
+
+        final Button button = alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL);
+        assertThat(button).isNotNull();
+        assertThat(button.getVisibility()).isEqualTo(View.VISIBLE);
+    }
+
+    @Test
+    public void clickNeutralButton_hideNeutralButton() {
+        // Assert
+        networkRequestDialogFragment.show(mActivity.getSupportFragmentManager(), /* tag */ null);
+        final AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
+
+        final String SSID_AP = "Test AP ";
+        final List<ScanResult> scanResults = new ArrayList<>();
+        for (int i = 0; i < 6 ; i ++) {
+            ScanResult scanResult = new ScanResult();
+            scanResult.SSID = SSID_AP + i;
+            scanResult.capabilities = "WEP";
+            scanResults.add(scanResult);
+        }
+        networkRequestDialogFragment.onMatch(scanResults);
+
+        // Action
+        final Button button = alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL);
+        button.performClick();
+
+        // Check
+        assertThat(button.getVisibility()).isEqualTo(View.GONE);
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/wifi/details/WifiPrivacyPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/details/WifiPrivacyPreferenceControllerTest.java
index 1e2e718..a1af8bf 100644
--- a/tests/robotests/src/com/android/settings/wifi/details/WifiPrivacyPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/details/WifiPrivacyPreferenceControllerTest.java
@@ -93,4 +93,20 @@
         mPreferenceController.getRandomizationValue();
         mPreferenceController.onPreferenceChange(mDropDownPreference, "1");
     }
+
+    @Test
+    public void testUpdateState_isNotEphemeralNetwork_shouldBeSelectable() {
+        mPreferenceController.setIsEphemeral(false);
+        mPreferenceController.updateState(mDropDownPreference);
+
+        assertThat(mDropDownPreference.isSelectable()).isTrue();
+    }
+
+    @Test
+    public void testUpdateState_isEphemeralNetwork_shouldNotSelectable() {
+        mPreferenceController.setIsEphemeral(true);
+        mPreferenceController.updateState(mDropDownPreference);
+
+        assertThat(mDropDownPreference.isSelectable()).isFalse();
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/wifi/qrcode/QrCameraTest.java b/tests/robotests/src/com/android/settings/wifi/qrcode/QrCameraTest.java
index a57fefc..bd2ce1e 100644
--- a/tests/robotests/src/com/android/settings/wifi/qrcode/QrCameraTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/qrcode/QrCameraTest.java
@@ -22,14 +22,11 @@
 
 import android.content.Context;
 import android.graphics.Bitmap;
-import android.graphics.Color;
 import android.graphics.Matrix;
 import android.graphics.Rect;
 import android.graphics.SurfaceTexture;
 import android.util.Size;
 
-import com.android.settings.R;
-
 import com.google.zxing.BinaryBitmap;
 import com.google.zxing.LuminanceSource;
 import com.google.zxing.RGBLuminanceSource;
diff --git a/tests/robotests/src/com/android/settings/wifi/slice/ContextualWifiSliceTest.java b/tests/robotests/src/com/android/settings/wifi/slice/ContextualWifiSliceTest.java
index b7f713d..d681afe 100644
--- a/tests/robotests/src/com/android/settings/wifi/slice/ContextualWifiSliceTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/slice/ContextualWifiSliceTest.java
@@ -35,6 +35,7 @@
 import androidx.slice.widget.SliceLiveData;
 
 import com.android.settings.R;
+import com.android.settings.slices.CustomSliceRegistry;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -97,4 +98,13 @@
                 R.drawable.ic_settings_wireless);
         assertThat(primaryAction.getIcon().toString()).isEqualTo(expectedToggleIcon.toString());
     }
+
+    @Test
+    public void getWifiSlice_contextualWifiSlice_shouldReturnContextualWifiSliceUri() {
+        mWifiSlice.mPreviouslyDisplayed = true;
+
+        final Slice wifiSlice = mWifiSlice.getSlice();
+
+        assertThat(wifiSlice.getUri()).isEqualTo(CustomSliceRegistry.CONTEXTUAL_WIFI_SLICE_URI);
+    }
 }
diff --git a/tests/unit/src/com/android/settings/homepage/contextualcards/ContextualCardLoaderTest.java b/tests/unit/src/com/android/settings/homepage/contextualcards/ContextualCardLoaderTest.java
index 82fcd7d..447e2b4 100644
--- a/tests/unit/src/com/android/settings/homepage/contextualcards/ContextualCardLoaderTest.java
+++ b/tests/unit/src/com/android/settings/homepage/contextualcards/ContextualCardLoaderTest.java
@@ -21,9 +21,12 @@
 import android.content.Context;
 import android.net.Uri;
 
+import androidx.slice.Slice;
 import androidx.test.InstrumentationRegistry;
 import androidx.test.runner.AndroidJUnit4;
 
+import com.android.settings.slices.CustomSliceRegistry;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -34,36 +37,57 @@
 @RunWith(AndroidJUnit4.class)
 public class ContextualCardLoaderTest {
 
+    private static final Uri TEST_URI = Uri.parse("content://test/test");
+
     private Context mContext;
     private ContextualCardLoader mContextualCardLoader;
+    private EligibleCardChecker mEligibleCardChecker;
 
     @Before
     public void setUp() {
         mContext = InstrumentationRegistry.getTargetContext();
         mContextualCardLoader = new ContextualCardLoader(mContext);
+        mEligibleCardChecker = new EligibleCardChecker(mContext, getContextualCard(TEST_URI));
     }
 
     @Test
-    public void filter_twoInvalidCards_shouldReturnOneCard() {
+    public void filterEligibleCards_twoInvalidCards_shouldReturnOneCard() {
         final String sliceUri1 = "content://com.android.settings.slices/action/flashlight"; //valid
         final String sliceUri2 = "content://com.android.settings.test.slices/action/flashlight";
         final String sliceUri3 = "cotent://com.android.settings.slices/action/flashlight";
 
         final List<ContextualCard> cards = new ArrayList<>();
-        cards.add(getContextualCard(sliceUri1));
-        cards.add(getContextualCard(sliceUri2));
-        cards.add(getContextualCard(sliceUri3));
+        cards.add(getContextualCard(Uri.parse(sliceUri1)));
+        cards.add(getContextualCard(Uri.parse(sliceUri2)));
+        cards.add(getContextualCard(Uri.parse(sliceUri3)));
 
         final List<ContextualCard> result = mContextualCardLoader.filterEligibleCards(cards);
 
         assertThat(result).hasSize(1);
     }
 
-    private ContextualCard getContextualCard(String sliceUri) {
+    @Test
+    public void bindSlice_flashlightUri_shouldReturnFlashlightSlice() {
+        final Slice loadedSlice =
+                mEligibleCardChecker.bindSlice(CustomSliceRegistry.FLASHLIGHT_SLICE_URI);
+
+        assertThat(loadedSlice.getUri()).isEqualTo(CustomSliceRegistry.FLASHLIGHT_SLICE_URI);
+    }
+
+    @Test
+    public void bindSlice_noProvider_shouldReturnNull() {
+        final String sliceUri = "content://com.android.settings.test.slices/action/flashlight";
+
+        final Slice loadedSlice = mEligibleCardChecker.bindSlice(Uri.parse(sliceUri));
+
+        assertThat(loadedSlice).isNull();
+    }
+
+    private ContextualCard getContextualCard(Uri sliceUri) {
         return new ContextualCard.Builder()
                 .setName("test_card")
                 .setCardType(ContextualCard.CardType.SLICE)
-                .setSliceUri(Uri.parse(sliceUri))
+                .setSliceUri(sliceUri)
                 .build();
     }
 }
diff --git a/tests/unit/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivityTest.java b/tests/unit/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivityTest.java
index 76df764..a425177 100644
--- a/tests/unit/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivityTest.java
+++ b/tests/unit/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivityTest.java
@@ -110,14 +110,6 @@
     }
 
     @Test
-    public void testActivity_shouldImplementsOnScanZxingWifiFormatSuccessCallback() {
-        WifiDppConfiguratorActivity activity = mActivityRule.getActivity();
-
-        assertThat(activity instanceof WifiDppQrCodeScannerFragment
-                .OnScanZxingWifiFormatSuccessListener).isEqualTo(true);
-    }
-
-    @Test
     public void testActivity_shouldImplementsOnClickChooseDifferentNetworkCallback() {
         WifiDppConfiguratorActivity activity = mActivityRule.getActivity();
 
diff --git a/tests/unit/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivityTest.java b/tests/unit/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivityTest.java
index 283da13..aef4767 100644
--- a/tests/unit/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivityTest.java
+++ b/tests/unit/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivityTest.java
@@ -38,12 +38,4 @@
         assertThat(activity instanceof WifiDppQrCodeScannerFragment
                 .OnScanWifiDppSuccessListener).isEqualTo(true);
     }
-
-    @Test
-    public void testActivity_shouldImplementsOnScanZxingWifiFormatSuccessCallback() {
-        WifiDppEnrolleeActivity activity = mActivityRule.getActivity();
-
-        assertThat(activity instanceof WifiDppQrCodeScannerFragment
-                .OnScanZxingWifiFormatSuccessListener).isEqualTo(true);
-    }
 }