Merge "Fix janky in App info screen"
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/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/values-sw720dp-land/dimens.xml b/res/values-sw720dp-land/dimens.xml
index 7f707d2..82c3fef 100644
--- a/res/values-sw720dp-land/dimens.xml
+++ b/res/values-sw720dp-land/dimens.xml
@@ -15,7 +15,6 @@
 -->
 
 <resources>
-    <dimen name="settings_side_margin">112dp</dimen>
 
     <!-- ActionBar contentInsetStart -->
     <dimen name="actionbar_contentInsetStart">128dp</dimen>
diff --git a/res/values-sw720dp/dimens.xml b/res/values-sw720dp/dimens.xml
index 6accad7..c701044 100644
--- a/res/values-sw720dp/dimens.xml
+++ b/res/values-sw720dp/dimens.xml
@@ -17,8 +17,6 @@
 <resources>
     <dimen name="pager_tabs_padding">0dp</dimen>
 
-    <dimen name="settings_side_margin">64dp</dimen>
-
     <!-- Weight of the left pane in a multi-pane preference layout. -->
     <integer name="preferences_left_pane_weight">1</integer>
     <!-- Weight of the right pane in a multi-pane preference layout. So the split is 1:2 -->
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 88f66ff..b787473 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -2102,6 +2102,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] -->
@@ -9169,8 +9171,11 @@
     <!-- 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 [CHAR LIMIT=36] -->
-    <string name="condition_zen_summary">Impacts what you hear and see</string>
+    <!-- Summary of condition that do not disturb is on and all exceptions set to off [CHAR LIMIT=36] -->
+    <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] -->
+    <string name="condition_zen_summary_with_exceptions">With exceptions</string>
 
     <!-- Title of condition that battery saver is on [CHAR LIMIT=30] -->
     <string name="condition_battery_title">Battery Saver is on</string>
@@ -9200,25 +9205,16 @@
     <string name="condition_device_muted_action_turn_on_sound">Turn on sound</string>
 
     <!-- Title of condition that indicates device is muted [CHAR LIMIT=50] -->
-    <string name="condition_device_muted_title" product="tablet">Device is muted</string>
-
-    <!-- Title of condition that indicates device is muted [CHAR LIMIT=50] -->
-    <string name="condition_device_muted_title" product="default">Phone muted</string>
+    <string name="condition_device_muted_title">Ringer muted</string>
 
     <!-- Summary of condition that indicates device is muted -->
     <string name="condition_device_muted_summary">For calls &amp; notifications</string>
 
     <!-- Title of condition that indicates device is set to vibrate [CHAR LIMIT=50] -->
-    <string name="condition_device_vibrate_title" product="tablet">Device is set to vibrate</string>
-
-    <!-- Title of condition that indicates device is muted [CHAR LIMIT=50] -->
-    <string name="condition_device_vibrate_title" product="default">Vibration only</string>
+    <string name="condition_device_vibrate_title">Vibration only</string>
 
     <!-- Summary of condition that indicates device is set to vibrate -->
-    <string name="condition_device_vibrate_summary" product="tablet">Calls and notifications will vibrate device</string>
-
-    <!-- Summary of condition that indicates device is set to vibrate -->
-    <string name="condition_device_vibrate_summary" product="default">For calls &amp; notifications</string>
+    <string name="condition_device_vibrate_summary">For calls &amp; notifications</string>
 
     <!--  Night display: Title for the night display option Suggestion (renamed "Night Light" with title caps). [CHAR LIMIT=46] -->
     <string name="night_display_suggestion_title">Set Night Light schedule</string>
@@ -10442,27 +10438,27 @@
     </plurals>
 
     <!-- Network & internet page. Summary indicating that a SIM is used by default for calls when
-         multiple SIMs are present. [CHAR LIMIT=40] -->
+         multiple SIMs are present. [CHAR LIMIT=50] -->
     <string name="default_for_calls">Default for calls</string>
     <!-- Network & internet page. Summary indicating that a SIM is used by default for SMS messages
-         when multiple SIMs are present. [CHAR LIMIT=40] -->
+         when multiple SIMs are present. [CHAR LIMIT=50] -->
     <string name="default_for_sms">Default for SMS</string>
     <!-- Network & internet page. Summary indicating that a SIM is used by default for calls and SMS
-         messages when multiple SIMs are present. [CHAR LIMIT=40] -->
+         messages when multiple SIMs are present. [CHAR LIMIT=50] -->
     <string name="default_for_calls_and_sms">Default for calls &amp; SMS</string>
     <!-- Network & internet page. Summary indicating that a SIM is used by default for mobile data
-         when multiple SIMs are present. [CHAR LIMIT=40] -->
+         when multiple SIMs are present. [CHAR LIMIT=50] -->
     <string name="default_for_mobile_data">Default for mobile data</string>
     <!-- Network & internet page. Summary indicating that a SIM has an active mobile data connection
-         when multiple SIMs are present. [CHAR LIMIT=40] -->
+         when multiple SIMs are present. [CHAR LIMIT=50] -->
     <string name="mobile_data_active">Mobile data active</string>
     <!-- Network & internet page. Summary indicating that a SIM is used by default for mobile data
          when multiple SIMs are present, but mobile data is currently turned off.
-         [CHAR LIMIT=40] -->
+         [CHAR LIMIT=50] -->
     <string name="mobile_data_off">Mobile data off</string>
     <!-- Network & internet page. Summary indicating that a SIM is available to be used for services
          such as calls, SMS, or data when multiple SIMs are present, but is not currently the
-          default SIM for any of those services. [CHAR LIMIT=40] -->
+          default SIM for any of those services. [CHAR LIMIT=50] -->
     <string name="subscription_available">Available</string>
 
     <!-- Title of item shown at the bottom of the page listing multiple mobile service
@@ -10566,6 +10562,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">
diff --git a/src/com/android/settings/MasterClear.java b/src/com/android/settings/MasterClear.java
index 8dad57f..58bc58c 100644
--- a/src/com/android/settings/MasterClear.java
+++ b/src/com/android/settings/MasterClear.java
@@ -65,10 +65,10 @@
 import com.android.settings.password.ConfirmLockPattern;
 import com.android.settingslib.RestrictedLockUtilsInternal;
 
-import com.google.android.setupcompat.TemplateLayout;
 import com.google.android.setupcompat.template.FooterBarMixin;
 import com.google.android.setupcompat.template.FooterButton;
 import com.google.android.setupcompat.template.FooterButton.ButtonType;
+import com.google.android.setupdesign.GlifLayout;
 
 import java.util.List;
 
@@ -416,7 +416,7 @@
             return;
         }
 
-        final TemplateLayout layout = mContentView.findViewById(R.id.setup_wizard_layout);
+        final GlifLayout layout = mContentView.findViewById(R.id.setup_wizard_layout);
         final FooterBarMixin mixin = layout.getMixin(FooterBarMixin.class);
         mixin.setPrimaryButton(
                 new FooterButton.Builder(getActivity())
diff --git a/src/com/android/settings/MasterClearConfirm.java b/src/com/android/settings/MasterClearConfirm.java
index c25f2af..618dd2c 100644
--- a/src/com/android/settings/MasterClearConfirm.java
+++ b/src/com/android/settings/MasterClearConfirm.java
@@ -44,10 +44,10 @@
 import com.android.settings.enterprise.ActionDisabledByAdminDialogHelper;
 import com.android.settingslib.RestrictedLockUtilsInternal;
 
-import com.google.android.setupcompat.TemplateLayout;
 import com.google.android.setupcompat.template.FooterBarMixin;
 import com.google.android.setupcompat.template.FooterButton;
 import com.google.android.setupcompat.template.FooterButton.ButtonType;
+import com.google.android.setupdesign.GlifLayout;
 
 /**
  * Confirm and execute a reset of the device to a clean "just out of the box"
@@ -152,7 +152,7 @@
      * Configure the UI for the final confirmation interaction
      */
     private void establishFinalConfirmationState() {
-        final TemplateLayout layout = mContentView.findViewById(R.id.setup_wizard_layout);
+        final GlifLayout layout = mContentView.findViewById(R.id.setup_wizard_layout);
 
         final FooterBarMixin mixin = layout.getMixin(FooterBarMixin.class);
         mixin.setPrimaryButton(
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/fuelgauge/TopLevelBatteryPreferenceController.java b/src/com/android/settings/fuelgauge/TopLevelBatteryPreferenceController.java
index ce85be8..c4da670 100644
--- a/src/com/android/settings/fuelgauge/TopLevelBatteryPreferenceController.java
+++ b/src/com/android/settings/fuelgauge/TopLevelBatteryPreferenceController.java
@@ -80,7 +80,9 @@
         }
         CharSequence label;
         final BidiFormatter formatter = BidiFormatter.getInstance();
-        if (info.remainingLabel == null) {
+        if (!info.discharging && info.chargeLabel != null) {
+            label = info.chargeLabel;
+        } else if (info.remainingLabel == null) {
             label = info.batteryPercentString;
         } else {
             label = context.getString(R.string.power_remaining_settings_home_page,
diff --git a/src/com/android/settings/homepage/contextualcards/conditional/DndConditionCardController.java b/src/com/android/settings/homepage/contextualcards/conditional/DndConditionCardController.java
index 43ff537..5f95de4 100644
--- a/src/com/android/settings/homepage/contextualcards/conditional/DndConditionCardController.java
+++ b/src/com/android/settings/homepage/contextualcards/conditional/DndConditionCardController.java
@@ -23,6 +23,7 @@
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.provider.Settings;
+import android.service.notification.ZenModeConfig;
 
 import androidx.annotation.VisibleForTesting;
 
@@ -97,7 +98,7 @@
                 .setName(mAppContext.getPackageName() + "/"
                         + mAppContext.getText(R.string.condition_zen_title))
                 .setTitleText(mAppContext.getText(R.string.condition_zen_title).toString())
-                .setSummaryText(mAppContext.getText(R.string.condition_zen_summary).toString())
+                .setSummaryText(getSummary())
                 .setIconDrawable(mAppContext.getDrawable(R.drawable.ic_do_not_disturb_on_24dp))
                 .setViewType(ConditionContextualCardRenderer.VIEW_TYPE_HALF_WIDTH)
                 .build();
@@ -112,4 +113,11 @@
             }
         }
     }
+
+    private String getSummary() {
+        if (ZenModeConfig.areAllZenBehaviorSoundsMuted(mNotificationManager.getZenModeConfig())) {
+            return mAppContext.getText(R.string.condition_zen_summary_phone_muted).toString();
+        }
+        return mAppContext.getText(R.string.condition_zen_summary_with_exceptions).toString();
+    }
 }
diff --git a/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSlice.java b/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSlice.java
index 5673948..0156ac6 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();
     }
 
@@ -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/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/notification/AppNotificationSettings.java b/src/com/android/settings/notification/AppNotificationSettings.java
index 3977e45..5553dd7 100644
--- a/src/com/android/settings/notification/AppNotificationSettings.java
+++ b/src/com/android/settings/notification/AppNotificationSettings.java
@@ -51,6 +51,8 @@
     private static String KEY_ADVANCED_CATEGORY = "app_advanced";
     private static String KEY_BADGE = "badge";
     private static String KEY_APP_LINK = "app_link";
+    private static String KEY_BUBBLE = "bubble";
+    private static String[] LEGACY_NON_ADVANCED_KEYS = {KEY_BADGE, KEY_APP_LINK, KEY_BUBBLE};
 
     private List<NotificationChannelGroup> mChannelGroupList;
 
@@ -65,21 +67,16 @@
         final PreferenceScreen screen = getPreferenceScreen();
         if (mShowLegacyChannelConfig && screen != null) {
             // if showing legacy settings, pull advanced settings out of the advanced category
-            Preference badge = findPreference(KEY_BADGE);
-            Preference appLink = findPreference(KEY_APP_LINK);
             PreferenceGroup advanced = (PreferenceGroup) findPreference(KEY_ADVANCED_CATEGORY);
             removePreference(KEY_ADVANCED_CATEGORY);
-            if (badge != null) {
-                if (advanced != null) {
-                    advanced.removePreference(badge);
+            if (advanced != null) {
+                for (String key : LEGACY_NON_ADVANCED_KEYS) {
+                    Preference pref = advanced.findPreference(key);
+                    advanced.removePreference(pref);
+                    if (pref != null) {
+                        screen.addPreference(pref);
+                    }
                 }
-                screen.addPreference(badge);
-            }
-            if (appLink != null) {
-                if (advanced != null) {
-                    advanced.removePreference(appLink);
-                }
-                screen.addPreference(appLink);
             }
         }
     }
@@ -255,7 +252,7 @@
                 int childCount = groupGroup.getPreferenceCount();
                 for (int i = 0; i < childCount; i++) {
                     Preference pref = groupGroup.getPreference(i);
-                    if (pref instanceof MasterCheckBoxPreference) {
+                    if (pref instanceof ChannelSummaryPreference) {
                         toRemove.add(pref);
                     }
                 }
diff --git a/src/com/android/settings/notification/NotificationSettingsBase.java b/src/com/android/settings/notification/NotificationSettingsBase.java
index 19aeb51..b9fabb6 100644
--- a/src/com/android/settings/notification/NotificationSettingsBase.java
+++ b/src/com/android/settings/notification/NotificationSettingsBase.java
@@ -309,7 +309,9 @@
                         return true;
                     }
                 });
-        parent.addPreference(channelPref);
+        if (parent.findPreference(channelPref.getKey()) == null) {
+            parent.addPreference(channelPref);
+        }
         return channelPref;
     }
 
diff --git a/src/com/android/settings/privacy/AccessibilityUsagePreferenceController.java b/src/com/android/settings/privacy/AccessibilityUsagePreferenceController.java
index 8aff223..bcf8f47 100644
--- a/src/com/android/settings/privacy/AccessibilityUsagePreferenceController.java
+++ b/src/com/android/settings/privacy/AccessibilityUsagePreferenceController.java
@@ -18,6 +18,7 @@
 
 import android.accessibilityservice.AccessibilityServiceInfo;
 import android.content.Context;
+import android.provider.DeviceConfig;
 import android.view.accessibility.AccessibilityManager;
 
 import androidx.annotation.NonNull;
@@ -44,7 +45,10 @@
 
     @Override
     public int getAvailabilityStatus() {
-        return mEnabledServiceInfos.isEmpty() ? UNSUPPORTED_ON_DEVICE : AVAILABLE;
+        return (mEnabledServiceInfos.isEmpty() || !Boolean.parseBoolean(
+                DeviceConfig.getProperty(DeviceConfig.Privacy.NAMESPACE,
+                        DeviceConfig.Privacy.PROPERTY_PERMISSIONS_HUB_ENABLED)))
+                ? UNSUPPORTED_ON_DEVICE : AVAILABLE;
     }
 
     @Override
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 d1648e0..5c662e5 100644
--- a/src/com/android/settings/slices/SettingsSliceProvider.java
+++ b/src/com/android/settings/slices/SettingsSliceProvider.java
@@ -129,8 +129,6 @@
     @VisibleForTesting
     Map<Uri, SliceData> mSliceDataCache;
 
-    final Set<Uri> mRegisteredUris = new ArraySet<>();
-
     final Map<Uri, SliceBackgroundWorker> mPinnedWorkers = new ArrayMap<>();
 
     public SettingsSliceProvider() {
@@ -173,14 +171,8 @@
 
     @Override
     public void onSliceUnpinned(Uri sliceUri) {
-        if (mRegisteredUris.contains(sliceUri)) {
-            Log.d(TAG, "Unregistering uri broadcast relay: " + sliceUri);
-            SliceBroadcastRelay.unregisterReceivers(getContext(), sliceUri);
-            mRegisteredUris.remove(sliceUri);
-        }
-        ThreadUtils.postOnMainThread(() -> {
-            stopBackgroundWorker(sliceUri);
-        });
+        SliceBroadcastRelay.unregisterReceivers(getContext(), sliceUri);
+        ThreadUtils.postOnMainThread(() -> stopBackgroundWorker(sliceUri));
         mSliceDataCache.remove(sliceUri);
     }
 
@@ -419,9 +411,7 @@
 
     @VisibleForTesting
     void loadSliceInBackground(Uri uri) {
-        ThreadUtils.postOnBackgroundThread(() -> {
-            loadSlice(uri);
-        });
+        ThreadUtils.postOnBackgroundThread(() -> loadSlice(uri));
     }
 
     /**
@@ -462,8 +452,6 @@
      * {@param intentFilter} happen.
      */
     void registerIntentToUri(IntentFilter intentFilter, Uri sliceUri) {
-        Log.d(TAG, "Registering Uri for broadcast relay: " + sliceUri);
-        mRegisteredUris.add(sliceUri);
         SliceBroadcastRelay.registerReceiver(getContext(), sliceUri, SliceRelayReceiver.class,
                 intentFilter);
     }
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..656f8ef 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;
@@ -62,22 +63,12 @@
 
         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 +87,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..8e72f65 100644
--- a/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
+++ b/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
@@ -534,8 +534,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;
     }
 
     /**
diff --git a/src/com/android/settings/wifi/details/WifiNetworkDetailsFragment.java b/src/com/android/settings/wifi/details/WifiNetworkDetailsFragment.java
index ec43b0f..225ddbc 100644
--- a/src/com/android/settings/wifi/details/WifiNetworkDetailsFragment.java
+++ b/src/com/android/settings/wifi/details/WifiNetworkDetailsFragment.java
@@ -141,6 +141,7 @@
         WifiPrivacyPreferenceController preferenceController = new WifiPrivacyPreferenceController(
                 context);
         preferenceController.setWifiConfiguration(mAccessPoint.getConfig());
+        preferenceController.setIsEphemeral(mAccessPoint.isEphemeral());
         controllers.add(preferenceController);
 
         return controllers;
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/WifiDppUtils.java b/src/com/android/settings/wifi/dpp/WifiDppUtils.java
index 7bc80e0..8b333e2 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppUtils.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppUtils.java
@@ -75,14 +75,6 @@
     public static final String EXTRA_TEST = "test";
 
     /**
-     * Returns whether the user can share the network represented by this preference with QR code.
-     */
-    public static boolean isSharingNetworkEnabled(Context context) {
-        return FeatureFlagUtils.isEnabled(context,
-                com.android.settings.core.FeatureFlags.WIFI_SHARING);
-    }
-
-    /**
      * Returns whether the device support WiFi DPP.
      */
     public static boolean isWifiDppEnabled(Context context) {
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/TopLevelBatteryPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/fuelgauge/TopLevelBatteryPreferenceControllerTest.java
index 7568987..58ed6b4 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/TopLevelBatteryPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/TopLevelBatteryPreferenceControllerTest.java
@@ -61,5 +61,9 @@
 
         info.remainingLabel = "Phone will shut down soon";
         assertThat(getDashboardLabel(mContext, info)).isEqualTo("3% - Phone will shut down soon");
+
+        info.discharging = false;
+        info.chargeLabel = "5% - charging";
+        assertThat(getDashboardLabel(mContext, info)).isEqualTo("5% - charging");
     }
 }
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/conditional/DndConditionalCardControllerTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/conditional/DndConditionalCardControllerTest.java
index 5d72ee4..dcd0963 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/conditional/DndConditionalCardControllerTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/conditional/DndConditionalCardControllerTest.java
@@ -16,13 +16,22 @@
 
 package com.android.settings.homepage.contextualcards.conditional;
 
+import static com.google.common.truth.Truth.assertThat;
+
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
 
+import android.app.NotificationManager;
 import android.content.Context;
+import android.service.notification.ZenModeConfig;
 
+import com.android.settings.R;
+import com.android.settings.homepage.contextualcards.ContextualCard;
+import com.android.settings.testutils.shadow.ShadowNotificationManager;
+
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -30,7 +39,10 @@
 import org.mockito.MockitoAnnotations;
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
+import org.robolectric.shadow.api.Shadow;
 
+@Config(shadows = ShadowNotificationManager.class)
 @RunWith(RobolectricTestRunner.class)
 public class DndConditionalCardControllerTest {
 
@@ -38,12 +50,14 @@
     private ConditionManager mConditionManager;
     private Context mContext;
     private DndConditionCardController mController;
+    private ShadowNotificationManager mNotificationManager;
 
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
         mContext = spy(RuntimeEnvironment.application);
         mController = new DndConditionCardController(mContext, mConditionManager);
+        mNotificationManager = Shadow.extract(mContext.getSystemService(NotificationManager.class));
     }
 
     @Test
@@ -55,4 +69,58 @@
                 eq(DndConditionCardController.DND_FILTER));
         verify(mContext).unregisterReceiver(any(DndConditionCardController.Receiver.class));
     }
+
+    @Test
+    public void buildContextualCard_allSoundsMuted_shouldHavePhoneMutedSummary() {
+        mNotificationManager.setZenModeConfig(getMutedAllConfig());
+
+        final ContextualCard card = mController.buildContextualCard();
+
+        assertThat(card.getSummaryText()).isEqualTo(
+                mContext.getString(R.string.condition_zen_summary_phone_muted));
+    }
+
+    @Test
+    public void buildContextualCard_allowSomeSounds_shouldHaveWittExceptionsSummary() {
+        mNotificationManager.setZenModeConfig(getCustomConfig());
+
+        final ContextualCard card = mController.buildContextualCard();
+
+        assertThat(card.getSummaryText()).isEqualTo(
+                mContext.getString(R.string.condition_zen_summary_with_exceptions));
+    }
+
+    private ZenModeConfig getCustomConfig() {
+        final ZenModeConfig config = new ZenModeConfig();
+        // Some sounds allowed
+        config.allowAlarms = true;
+        config.allowMedia = false;
+        config.allowSystem = false;
+        config.allowCalls = true;
+        config.allowRepeatCallers = true;
+        config.allowMessages = false;
+        config.allowReminders = false;
+        config.allowEvents = false;
+        config.areChannelsBypassingDnd = false;
+        config.allowCallsFrom = ZenModeConfig.SOURCE_ANYONE;
+        config.allowMessagesFrom = ZenModeConfig.SOURCE_ANYONE;
+        config.suppressedVisualEffects = 0;
+        return config;
+    }
+
+    private ZenModeConfig getMutedAllConfig() {
+        final ZenModeConfig config = new ZenModeConfig();
+        // No sounds allowed
+        config.allowAlarms = false;
+        config.allowMedia = false;
+        config.allowSystem = false;
+        config.allowCalls = false;
+        config.allowRepeatCallers = false;
+        config.allowMessages = false;
+        config.allowReminders = false;
+        config.allowEvents = false;
+        config.areChannelsBypassingDnd = false;
+        config.suppressedVisualEffects = 0;
+        return config;
+    }
 }
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/privacy/AccessibilityUsagePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/privacy/AccessibilityUsagePreferenceControllerTest.java
index 1033446..05ce30a 100644
--- a/tests/robotests/src/com/android/settings/privacy/AccessibilityUsagePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/privacy/AccessibilityUsagePreferenceControllerTest.java
@@ -22,8 +22,11 @@
 import static com.google.common.truth.Truth.assertThat;
 import android.accessibilityservice.AccessibilityServiceInfo;
 import android.content.Context;
+import android.provider.DeviceConfig;
 import android.view.accessibility.AccessibilityManager;
 
+import com.android.settings.testutils.shadow.ShadowDeviceConfig;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -31,6 +34,7 @@
 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;
 
@@ -38,6 +42,7 @@
 import java.util.Arrays;
 
 @RunWith(RobolectricTestRunner.class)
+@Config(shadows = {ShadowDeviceConfig.class})
 public class AccessibilityUsagePreferenceControllerTest {
 
     private Context mContext;
@@ -54,10 +59,23 @@
     @After
     public void tearDown() {
         ShadowAccessibilityManager.reset();
+        ShadowDeviceConfig.reset();
+    }
+
+    @Test
+    public void isAvailable_permissionHubNotSet_shouldReturnUnsupported() {
+        mAccessibilityManager.setEnabledAccessibilityServiceList(new ArrayList<>());
+        AccessibilityUsagePreferenceController controller =
+                new AccessibilityUsagePreferenceController(mContext, "test_key");
+
+        // We have not yet set the property to show the Permissions Hub.
+        assertThat(controller.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
     }
 
     @Test
     public void getAvailabilityStatus_noEnabledServices_shouldReturnUnsupported() {
+        DeviceConfig.setProperty(DeviceConfig.Privacy.NAMESPACE,
+                DeviceConfig.Privacy.PROPERTY_PERMISSIONS_HUB_ENABLED, "true", true);
         mAccessibilityManager.setEnabledAccessibilityServiceList(new ArrayList<>());
         AccessibilityUsagePreferenceController controller =
                 new AccessibilityUsagePreferenceController(mContext, "test_key");
@@ -67,6 +85,8 @@
 
     @Test
     public void getAvailabilityStatus_enabledServices_shouldReturnAvailableUnsearchable() {
+        DeviceConfig.setProperty(DeviceConfig.Privacy.NAMESPACE,
+                DeviceConfig.Privacy.PROPERTY_PERMISSIONS_HUB_ENABLED, "true", true);
         mAccessibilityManager.setEnabledAccessibilityServiceList(
                 new ArrayList<>(Arrays.asList(new AccessibilityServiceInfo())));
         AccessibilityUsagePreferenceController controller =
diff --git a/tests/robotests/src/com/android/settings/privacy/PermissionBarChartPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/privacy/PermissionBarChartPreferenceControllerTest.java
index b947630..f9913f6 100644
--- a/tests/robotests/src/com/android/settings/privacy/PermissionBarChartPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/privacy/PermissionBarChartPreferenceControllerTest.java
@@ -22,18 +22,25 @@
 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 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 +54,41 @@
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
 import org.robolectric.annotation.Config;
+import org.robolectric.shadow.api.Shadow;
+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);
+        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 +152,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..161c39a 100644
--- a/tests/robotests/src/com/android/settings/privacy/PrivacyDashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/privacy/PrivacyDashboardFragmentTest.java
@@ -16,53 +16,89 @@
 
 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 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.androidx.fragment.FragmentController;
+
 
 @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);
+        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/ShadowNotificationManager.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowNotificationManager.java
index a1b1a23..8325777 100644
--- a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowNotificationManager.java
+++ b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowNotificationManager.java
@@ -18,6 +18,7 @@
 
 import android.app.NotificationManager;
 import android.net.Uri;
+import android.service.notification.ZenModeConfig;
 
 import org.robolectric.annotation.Implementation;
 import org.robolectric.annotation.Implements;
@@ -26,6 +27,7 @@
 public class ShadowNotificationManager {
 
     private int mZenMode;
+    private ZenModeConfig mZenModeConfig;
 
     @Implementation
     protected void setZenMode(int mode, Uri conditionId, String reason) {
@@ -36,4 +38,13 @@
     protected int getZenMode() {
         return mZenMode;
     }
+
+    @Implementation
+    public ZenModeConfig getZenModeConfig() {
+        return mZenModeConfig;
+    }
+
+    public void setZenModeConfig(ZenModeConfig config) {
+        mZenModeConfig = config;
+    }
 }
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();
+    }
 }