Merge "Use RoleControllerService for role related APIs."
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 48b1333..96e3dd1 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -3029,11 +3029,15 @@
                      <category android:name="android.intent.category.DEFAULT" />
                  </intent-filter>
                 <intent-filter>
-                    <action android:name="android.settings.panel.action.VOLUME" />
+                    <action android:name="android.settings.panel.action.NFC" />
                     <category android:name="android.intent.category.DEFAULT" />
                 </intent-filter>
                 <intent-filter>
-                    <action android:name="android.settings.panel.action.NFC" />
+                    <action android:name="android.settings.panel.action.WIFI" />
+                    <category android:name="android.intent.category.DEFAULT" />
+                </intent-filter>
+                <intent-filter>
+                    <action android:name="android.settings.panel.action.VOLUME" />
                     <category android:name="android.intent.category.DEFAULT" />
                 </intent-filter>
         </activity>
diff --git a/res/layout/homepage_slice_tile.xml b/res/layout/homepage_slice_tile.xml
index 807c26b..e95129e 100644
--- a/res/layout/homepage_slice_tile.xml
+++ b/res/layout/homepage_slice_tile.xml
@@ -31,6 +31,7 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_gravity="center_vertical"
+            android:animateLayoutChanges="true"
             style="@style/SliceViewStyle"/>
 
         <!--dismissal view-->
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 6cbe22b..f3fe1f0 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5587,6 +5587,12 @@
     <!-- Battery saver: Title for battery saver schedule screen [CHAR_LIMIT=40] -->
     <string name="battery_saver_schedule_settings_title">Set a schedule</string>
 
+    <!-- Battery Saver: Title for sticky battery saver preference [CHAR_LIMIT=60] -->
+    <string name="battery_saver_sticky_title">Keep battery saver on</string>
+
+    <!-- Battery Saver: Description for sticky battery saver preference [CHAR_LIMIT=NONE] -->
+    <string name="battery_saver_sticky_description">Battery saver will stay on even after device is fully charged</string>
+
     <!-- Battery saver: Label for seekbar to change battery saver threshold [CHAR_LIMIT=40] -->
     <string name="battery_saver_seekbar_title"><xliff:g id="percent">%1$s</xliff:g></string>
 
@@ -7151,6 +7157,9 @@
     <string name="keywords_ring_vibration">haptics, vibrate, phone, call, sensitivity, ring</string>
     <!-- List of synonyms for notification vibration setting (changes whether your phone vibrates when it shows a notification), used to match in settings search [CHAR LIMIT=NONE] -->
     <string name="keywords_notification_vibration">haptics, vibrate, sensitivity</string>
+    <!-- Battery Saver: Search terms for sticky battery saver preference [CHAR_LIMIT=NONE] -->
+    <string name="keywords_battery_saver_sticky">battery saver, sticky, persist, power saver, battery</string>
+
 
     <!-- NFC Wi-Fi pairing/setup strings-->
 
@@ -10657,6 +10666,9 @@
     <!-- Title for the Volume dialog (settings panel) with all volume streams[CHAR LIMIT=50] -->
     <string name="volume_connectivity_panel_title">Volume</string>
 
+    <!-- Subtitle explaining that mobile data cannot be used while airplane mode is on [CHAR LIMIT=50] -->
+    <string name="mobile_data_ap_mode_disabled">Unavailable during airplane mode</string>
+
     <!-- UI debug setting: force desktop mode [CHAR LIMIT=50] -->
     <string name="force_desktop_mode">Force desktop mode</string>
     <!-- UI debug setting: force desktop mode summary [CHAR LIMIT=NONE] -->
diff --git a/res/xml/battery_saver_settings.xml b/res/xml/battery_saver_settings.xml
index 89f7eab..ae9d14d 100644
--- a/res/xml/battery_saver_settings.xml
+++ b/res/xml/battery_saver_settings.xml
@@ -26,6 +26,13 @@
         android:title="@string/battery_saver_schedule_settings_title"
         settings:controller="com.android.settings.fuelgauge.batterysaver.BatterySaverSchedulePreferenceController"/>
 
+    <SwitchPreference
+        android:key="battery_saver_sticky"
+        android:title="@string/battery_saver_sticky_title"
+        android:summary="@string/battery_saver_sticky_description"
+        settings:keywords="@string/keywords_battery_saver_sticky"
+        settings:controller="com.android.settings.fuelgauge.batterysaver.BatterySaverStickyPreferenceController"/>
+
     <com.android.settings.widget.TwoStateButtonPreference
         android:key="battery_saver"
         android:title="@string/battery_saver"
diff --git a/res/xml/language_and_input.xml b/res/xml/language_and_input.xml
index b04bdf8..e3690a9 100644
--- a/res/xml/language_and_input.xml
+++ b/res/xml/language_and_input.xml
@@ -94,7 +94,8 @@
 
     <com.android.settings.widget.WorkOnlyCategory
         android:key="language_and_input_for_work_category"
-        android:title="@string/language_and_input_for_work_category_title">
+        android:title="@string/language_and_input_for_work_category_title"
+        settings:searchable="false">
 
         <Preference
             android:key="virtual_keyboards_for_work_pref"
diff --git a/res/xml/top_level_settings.xml b/res/xml/top_level_settings.xml
index 64b620a..367f426 100644
--- a/res/xml/top_level_settings.xml
+++ b/res/xml/top_level_settings.xml
@@ -18,8 +18,7 @@
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:settings="http://schemas.android.com/apk/res-auto"
-    android:key="top_level_settings"
-    android:title="@string/settings_label_launcher">
+    android:key="top_level_settings">
 
     <Preference
         android:key="top_level_network"
diff --git a/src/com/android/settings/biometrics/BiometricEnrollActivity.java b/src/com/android/settings/biometrics/BiometricEnrollActivity.java
index b650c6c..39a7a80 100644
--- a/src/com/android/settings/biometrics/BiometricEnrollActivity.java
+++ b/src/com/android/settings/biometrics/BiometricEnrollActivity.java
@@ -16,8 +16,6 @@
 
 package com.android.settings.biometrics;
 
-import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
-
 import android.app.settings.SettingsEnums;
 import android.content.Intent;
 import android.content.pm.PackageManager;
@@ -25,8 +23,11 @@
 
 import com.android.settings.biometrics.face.FaceEnrollIntroduction;
 import com.android.settings.biometrics.fingerprint.FingerprintEnrollIntroduction;
+import com.android.settings.biometrics.fingerprint.SetupFingerprintEnrollIntroduction;
 import com.android.settings.core.InstrumentedActivity;
 
+import com.google.android.setupcompat.util.WizardManagerHelper;
+
 /**
  * Trampoline activity launched by the {@code android.settings.BIOMETRIC_ENROLL} action which
  * shows the user an appropriate enrollment flow depending on the device's biometric hardware.
@@ -40,20 +41,38 @@
         super.onCreate(savedInstanceState);
 
         final PackageManager pm = getApplicationContext().getPackageManager();
-        final Intent intent = new Intent();
+        Intent intent;
 
         // This logic may have to be modified on devices with multiple biometrics.
         if (pm.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)) {
-            intent.setClassName(SETTINGS_PACKAGE_NAME,
-                    FingerprintEnrollIntroduction.class.getName());
+            intent = getFingerprintEnrollIntent();
         } else if (pm.hasSystemFeature(PackageManager.FEATURE_FACE)) {
-            intent.setClassName(SETTINGS_PACKAGE_NAME, FaceEnrollIntroduction.class.getName());
+            intent = getFaceEnrollIntent();
+        } else {
+            intent = new Intent();
         }
 
+        intent.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
         startActivity(intent);
         finish();
     }
 
+    private Intent getFingerprintEnrollIntent() {
+        if (WizardManagerHelper.isAnySetupWizard(getIntent())) {
+            Intent intent = new Intent(this, SetupFingerprintEnrollIntroduction.class);
+            WizardManagerHelper.copyWizardManagerExtras(getIntent(), intent);
+            return intent;
+        } else {
+            return new Intent(this, FingerprintEnrollIntroduction.class);
+        }
+    }
+
+    private Intent getFaceEnrollIntent() {
+        Intent intent = new Intent(this, FaceEnrollIntroduction.class);
+        WizardManagerHelper.copyWizardManagerExtras(getIntent(), intent);
+        return intent;
+    }
+
     @Override
     public int getMetricsCategory() {
         return SettingsEnums.BIOMETRIC_ENROLL_ACTIVITY;
diff --git a/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java b/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java
index e8cf809..d7f2c97 100644
--- a/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java
+++ b/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java
@@ -27,8 +27,10 @@
 import com.android.settings.R;
 import com.android.settings.password.ChooseLockGeneric;
 import com.android.settings.password.ChooseLockSettingsHelper;
+import com.android.settings.password.SetupChooseLockGeneric;
 
 import com.google.android.setupcompat.template.FooterButton;
+import com.google.android.setupcompat.util.WizardManagerHelper;
 import com.google.android.setupdesign.span.LinkSpan;
 
 /**
@@ -199,7 +201,13 @@
     }
 
     protected Intent getChooseLockIntent() {
-        return new Intent(this, ChooseLockGeneric.class);
+        if (WizardManagerHelper.isAnySetupWizard(getIntent())) {
+            Intent intent = new Intent(this, SetupChooseLockGeneric.class);
+            WizardManagerHelper.copyWizardManagerExtras(getIntent(), intent);
+            return intent;
+        } else {
+            return new Intent(this, ChooseLockGeneric.class);
+        }
     }
 
     @Override
diff --git a/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java b/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java
index e45817d..8d4c82e 100644
--- a/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java
+++ b/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java
@@ -36,6 +36,7 @@
 
 import com.google.android.setupcompat.template.FooterBarMixin;
 import com.google.android.setupcompat.template.FooterButton;
+import com.google.android.setupcompat.util.WizardManagerHelper;
 import com.google.android.setupdesign.span.LinkSpan;
 
 public class FaceEnrollIntroduction extends BiometricEnrollIntroduction {
@@ -166,6 +167,7 @@
             intent.setClass(this, FaceEnrollEnrolling.class);
         }
         intent.putExtra(EXTRA_KEY_REQUIRE_DIVERSITY, mSwitchDiversity.isChecked());
+        WizardManagerHelper.copyWizardManagerExtras(getIntent(), intent);
         return intent;
     }
 
diff --git a/src/com/android/settings/biometrics/face/FaceSettings.java b/src/com/android/settings/biometrics/face/FaceSettings.java
index 490580d..ea5a303 100644
--- a/src/com/android/settings/biometrics/face/FaceSettings.java
+++ b/src/com/android/settings/biometrics/face/FaceSettings.java
@@ -156,6 +156,9 @@
 
     @Override
     protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
+        if (!isAvailable(context)) {
+            return null;
+        }
         final List<AbstractPreferenceController> controllers =
                 buildPreferenceControllers(context, getSettingsLifecycle());
         // There's no great way of doing this right now :/
@@ -197,7 +200,11 @@
                 @Override
                 public List<AbstractPreferenceController> createPreferenceControllers(
                         Context context) {
-                    return buildPreferenceControllers(context, null /* lifecycle */);
+                    if (isAvailable(context)) {
+                        return buildPreferenceControllers(context, null /* lifecycle */);
+                    } else {
+                        return null;
+                    }
                 }
 
                 @Override
diff --git a/src/com/android/settings/fuelgauge/BatteryInfo.java b/src/com/android/settings/fuelgauge/BatteryInfo.java
index 1f11f5a..c851a71 100644
--- a/src/com/android/settings/fuelgauge/BatteryInfo.java
+++ b/src/com/android/settings/fuelgauge/BatteryInfo.java
@@ -47,6 +47,7 @@
     public long averageTimeToDischarge = Estimate.AVERAGE_TIME_TO_DISCHARGE_UNKNOWN;
     public String batteryPercentString;
     public String statusLabel;
+    public String suggestionLabel;
     private boolean mCharging;
     private BatteryStats mStats;
     private static final String LOG_TAG = "BatteryInfo";
@@ -247,6 +248,7 @@
         final int status = batteryBroadcast.getIntExtra(BatteryManager.EXTRA_STATUS,
                 BatteryManager.BATTERY_STATUS_UNKNOWN);
         info.discharging = false;
+        info.suggestionLabel = null;
         if (chargeTime > 0 && status != BatteryManager.BATTERY_STATUS_FULL) {
             info.remainingTimeUs = chargeTime;
             CharSequence timeString = StringUtil.formatElapsedTime(context,
@@ -282,8 +284,11 @@
                     info.batteryPercentString,
                     estimate.isBasedOnUsage && !shortString
             );
+            info.suggestionLabel = PowerUtil.getBatteryTipStringFormatted(
+                    context, PowerUtil.convertUsToMs(drainTimeUs));
         } else {
             info.remainingLabel = null;
+            info.suggestionLabel = null;
             info.chargeLabel = info.batteryPercentString;
         }
     }
diff --git a/src/com/android/settings/fuelgauge/batterysaver/BatterySaverStickyPreferenceController.java b/src/com/android/settings/fuelgauge/batterysaver/BatterySaverStickyPreferenceController.java
new file mode 100644
index 0000000..b14fec9
--- /dev/null
+++ b/src/com/android/settings/fuelgauge/batterysaver/BatterySaverStickyPreferenceController.java
@@ -0,0 +1,41 @@
+package com.android.settings.fuelgauge.batterysaver;
+
+import android.content.Context;
+import android.provider.Settings;
+import androidx.preference.Preference;
+import androidx.preference.SwitchPreference;
+import com.android.settings.core.BasePreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+
+public class BatterySaverStickyPreferenceController extends BasePreferenceController implements
+        PreferenceControllerMixin, Preference.OnPreferenceChangeListener {
+
+    public static final String LOW_POWER_STICKY_AUTO_DISABLE_ENABLED =
+            "low_power_sticky_auto_disable_enabled";
+
+    public BatterySaverStickyPreferenceController(Context context, String preferenceKey) {
+        super(context, preferenceKey);
+    }
+
+    @Override
+    public void updateState(Preference preference) {
+        int setting = Settings.System.getInt(mContext.getContentResolver(),
+                LOW_POWER_STICKY_AUTO_DISABLE_ENABLED, 1);
+
+        ((SwitchPreference) preference).setChecked(setting == 0);
+    }
+
+    @Override
+    public boolean onPreferenceChange(Preference preference, Object newValue) {
+        boolean keepActive = (Boolean) newValue;
+        Settings.System.putInt(mContext.getContentResolver(),
+                LOW_POWER_STICKY_AUTO_DISABLE_ENABLED,
+                keepActive ? 0 : 1);
+        return true;
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return AVAILABLE;
+    }
+}
diff --git a/src/com/android/settings/fuelgauge/batterytip/detectors/LowBatteryDetector.java b/src/com/android/settings/fuelgauge/batterytip/detectors/LowBatteryDetector.java
index 21cc28a..ca9141d 100644
--- a/src/com/android/settings/fuelgauge/batterytip/detectors/LowBatteryDetector.java
+++ b/src/com/android/settings/fuelgauge/batterytip/detectors/LowBatteryDetector.java
@@ -62,6 +62,6 @@
         }
 
         return new LowBatteryTip(
-                state, powerSaveModeOn, mBatteryInfo.remainingLabel);
+                state, powerSaveModeOn, mBatteryInfo.suggestionLabel);
     }
 }
diff --git a/src/com/android/settings/homepage/contextualcards/ContextualCardFeatureProviderImpl.java b/src/com/android/settings/homepage/contextualcards/ContextualCardFeatureProviderImpl.java
index 12590ff..43e90e8 100644
--- a/src/com/android/settings/homepage/contextualcards/ContextualCardFeatureProviderImpl.java
+++ b/src/com/android/settings/homepage/contextualcards/ContextualCardFeatureProviderImpl.java
@@ -165,6 +165,7 @@
                 com.android.settings.intelligence.ContextualCardProto.ContextualCard.newBuilder()
                         .setSliceUri(card.getSliceUri().toString())
                         .setCardName(card.getName())
+                        .setCardScore(card.getRankingScore())
                         .build()));
         return builder.build().toByteArray();
     }
diff --git a/src/com/android/settings/homepage/contextualcards/ContextualCardLoader.java b/src/com/android/settings/homepage/contextualcards/ContextualCardLoader.java
index ea6ac43..13564b5 100644
--- a/src/com/android/settings/homepage/contextualcards/ContextualCardLoader.java
+++ b/src/com/android/settings/homepage/contextualcards/ContextualCardLoader.java
@@ -26,7 +26,6 @@
 import android.net.Uri;
 import android.os.Handler;
 import android.os.Looper;
-import android.text.format.DateUtils;
 import android.util.Log;
 
 import androidx.annotation.NonNull;
@@ -50,7 +49,6 @@
     @VisibleForTesting
     static final int DEFAULT_CARD_COUNT = 4;
     static final int CARD_CONTENT_LOADER_ID = 1;
-    static final long CARD_CONTENT_LOADER_TIMEOUT_MS = DateUtils.SECOND_IN_MILLIS;
 
     private static final String TAG = "ContextualCardLoader";
     private static final long ELIGIBILITY_CHECKER_TIMEOUT_MS = 250;
diff --git a/src/com/android/settings/homepage/contextualcards/ContextualCardManager.java b/src/com/android/settings/homepage/contextualcards/ContextualCardManager.java
index 3b8aacd..c829015 100644
--- a/src/com/android/settings/homepage/contextualcards/ContextualCardManager.java
+++ b/src/com/android/settings/homepage/contextualcards/ContextualCardManager.java
@@ -24,6 +24,8 @@
 
 import android.content.Context;
 import android.os.Bundle;
+import android.provider.Settings;
+import android.text.format.DateUtils;
 import android.util.ArrayMap;
 import android.util.Log;
 import android.widget.BaseAdapter;
@@ -62,8 +64,12 @@
 public class ContextualCardManager implements ContextualCardLoader.CardContentLoaderListener,
         ContextualCardUpdateListener, LifecycleObserver, OnSaveInstanceState {
 
-    private static final String KEY_CONTEXTUAL_CARDS = "key_contextual_cards";
+    @VisibleForTesting
+    static final long CARD_CONTENT_LOADER_TIMEOUT_MS = DateUtils.SECOND_IN_MILLIS;
+    @VisibleForTesting
+    static final String KEY_GLOBAL_CARD_LOADER_TIMEOUT = "global_card_loader_timeout_key";
 
+    private static final String KEY_CONTEXTUAL_CARDS = "key_contextual_cards";
     private static final String TAG = "ContextualCardManager";
 
     //The list for Settings Custom Card
@@ -201,7 +207,8 @@
         }
 
         //only log homepage display upon a fresh launch
-        if (loadTime <= ContextualCardLoader.CARD_CONTENT_LOADER_TIMEOUT_MS) {
+        final long timeoutLimit = getCardLoaderTimeout(mContext);
+        if (loadTime <= timeoutLimit) {
             onContextualCardUpdated(cards.stream()
                     .collect(groupingBy(ContextualCard::getCardType)));
         }
@@ -239,6 +246,14 @@
         return getCardsWithSuggestionViewType(result);
     }
 
+    @VisibleForTesting
+    long getCardLoaderTimeout(Context context) {
+        // Return the timeout limit if Settings.Global has the KEY_GLOBAL_CARD_LOADER_TIMEOUT key,
+        // else return default timeout.
+        return Settings.Global.getLong(mContext.getContentResolver(),
+                KEY_GLOBAL_CARD_LOADER_TIMEOUT, CARD_CONTENT_LOADER_TIMEOUT_MS);
+    }
+
     private List<ContextualCard> getCardsWithSuggestionViewType(List<ContextualCard> cards) {
         // Shows as half cards if 2 suggestion type of cards are next to each other.
         // Shows as full card if 1 suggestion type of card lives alone.
diff --git a/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSlice.java b/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSlice.java
index 95412a8..3320be0 100644
--- a/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSlice.java
+++ b/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSlice.java
@@ -179,14 +179,9 @@
         final Collection<CachedBluetoothDevice> cachedDevices =
                 bluetoothManager.getCachedDeviceManager().getCachedDevicesCopy();
 
-        /**
-         * TODO(b/114807655): Contextual Home Page - Connected Device
-         * It's under discussion for including available media devices and currently connected
-         * devices from Bluetooth. Will update the devices list or remove TODO later.
-         */
-        // Get available media device list and sort them.
+        // Get all connected devices and sort them.
         return cachedDevices.stream()
-                .filter(device -> device.isConnected() && device.isConnectedA2dpDevice())
+                .filter(device -> device.getDevice().isConnected())
                 .sorted(COMPARATOR).collect(Collectors.toList());
     }
 
@@ -217,7 +212,7 @@
             return Utils.createIconWithDrawable(pair.first);
         } else {
             return IconCompat.createWithResource(mContext,
-                com.android.internal.R.drawable.ic_settings_bluetooth);
+                    com.android.internal.R.drawable.ic_settings_bluetooth);
         }
     }
 
@@ -226,18 +221,29 @@
         final List<ListBuilder.RowBuilder> bluetoothRows = new ArrayList<>();
         final List<CachedBluetoothDevice> bluetoothDevices = getConnectedBluetoothDevices();
         for (CachedBluetoothDevice bluetoothDevice : bluetoothDevices) {
-            bluetoothRows.add(new ListBuilder.RowBuilder()
+            final ListBuilder.RowBuilder rowBuilder = new ListBuilder.RowBuilder()
                     .setTitleItem(getBluetoothDeviceIcon(bluetoothDevice), ListBuilder.ICON_IMAGE)
                     .setTitle(bluetoothDevice.getName())
-                    .setSubtitle(bluetoothDevice.getConnectionSummary())
-                    .setPrimaryAction(buildBluetoothDeviceAction(bluetoothDevice))
-                    .addEndItem(buildBluetoothDetailDeepLinkAction(bluetoothDevice)));
+                    .setSubtitle(bluetoothDevice.getConnectionSummary());
+
+            if (bluetoothDevice.isConnectedA2dpDevice()) {
+                // For available media devices, the primary action is to active audio stream and
+                // add setting icon to the end to link detail page.
+                rowBuilder.setPrimaryAction(buildMediaBluetoothAction(bluetoothDevice));
+                rowBuilder.addEndItem(buildBluetoothDetailDeepLinkAction(bluetoothDevice));
+            } else {
+                // For other devices, the primary action is to link detail page.
+                rowBuilder.setPrimaryAction(buildBluetoothDetailDeepLinkAction(bluetoothDevice));
+            }
+
+            bluetoothRows.add(rowBuilder);
         }
 
         return bluetoothRows;
     }
 
-    private SliceAction buildBluetoothDeviceAction(CachedBluetoothDevice bluetoothDevice) {
+    @VisibleForTesting
+    SliceAction buildMediaBluetoothAction(CachedBluetoothDevice bluetoothDevice) {
         // Send broadcast to activate available media device.
         final Intent intent = new Intent(getUri().toString())
                 .setClass(mContext, SliceBroadcastReceiver.class)
@@ -250,7 +256,8 @@
                 bluetoothDevice.getName());
     }
 
-    private SliceAction buildBluetoothDetailDeepLinkAction(CachedBluetoothDevice bluetoothDevice) {
+    @VisibleForTesting
+    SliceAction buildBluetoothDetailDeepLinkAction(CachedBluetoothDevice bluetoothDevice) {
         return SliceAction.createDeeplink(
                 getBluetoothDetailIntent(bluetoothDevice),
                 IconCompat.createWithResource(mContext, R.drawable.ic_settings_24dp),
diff --git a/src/com/android/settings/homepage/contextualcards/slices/SliceFullCardRendererHelper.java b/src/com/android/settings/homepage/contextualcards/slices/SliceFullCardRendererHelper.java
index ef0a67d..ee63536 100644
--- a/src/com/android/settings/homepage/contextualcards/slices/SliceFullCardRendererHelper.java
+++ b/src/com/android/settings/homepage/contextualcards/slices/SliceFullCardRendererHelper.java
@@ -16,6 +16,7 @@
 
 package com.android.settings.homepage.contextualcards.slices;
 
+import android.animation.LayoutTransition;
 import android.content.Context;
 import android.view.View;
 
@@ -94,6 +95,7 @@
         public SliceViewHolder(View view) {
             super(view);
             sliceView = view.findViewById(R.id.slice_view);
+            sliceView.getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING);
         }
     }
 }
diff --git a/src/com/android/settings/network/telephony/MobileDataSlice.java b/src/com/android/settings/network/telephony/MobileDataSlice.java
index 6efd8c3..5a5d6a2 100644
--- a/src/com/android/settings/network/telephony/MobileDataSlice.java
+++ b/src/com/android/settings/network/telephony/MobileDataSlice.java
@@ -74,8 +74,27 @@
         final IconCompat icon = IconCompat.createWithResource(mContext,
                 R.drawable.ic_network_cell);
         final String title = mContext.getText(R.string.mobile_data_settings_title).toString();
-        final CharSequence summary = getSummary();
         @ColorInt final int color = Utils.getColorAccentDefaultColor(mContext);
+
+        // Return a Slice without the mobile data toggle when airplane mode is on.
+        if (isAirplaneModeEnabled()) {
+            final CharSequence summary = mContext.getText(R.string.mobile_data_ap_mode_disabled);
+            // Intent does nothing, but we have to pass an intent to the Row.
+            final PendingIntent intent = PendingIntent.getActivity(mContext, 0 /* requestCode */,
+                    new Intent(), 0 /* flags */);
+            final SliceAction deadAction =
+                    SliceAction.create(intent, icon, ListBuilder.ICON_IMAGE, title);
+            final ListBuilder listBuilder = new ListBuilder(mContext, getUri(),
+                    ListBuilder.INFINITY)
+                    .setAccentColor(color)
+                    .addRow(new ListBuilder.RowBuilder()
+                            .setTitle(title)
+                            .setSubtitle(summary)
+                            .setPrimaryAction(deadAction));
+            return listBuilder.build();
+        }
+
+        final CharSequence summary = getSummary();
         final PendingIntent toggleAction = getBroadcastIntent(mContext);
         final PendingIntent primaryAction = getPrimaryAction();
         final SliceAction primarySliceAction = SliceAction.createDeeplink(primaryAction, icon,
@@ -101,11 +120,6 @@
 
     @Override
     public void onNotifyChange(Intent intent) {
-        // Don't make a change if we are in Airplane Mode.
-        if (isAirplaneModeEnabled()) {
-            return;
-        }
-
         final boolean newState = intent.getBooleanExtra(EXTRA_TOGGLE_STATE,
                     isMobileDataEnabled());
 
diff --git a/src/com/android/settings/notification/AppNotificationSettings.java b/src/com/android/settings/notification/AppNotificationSettings.java
index 5553dd7..9f5ece2 100644
--- a/src/com/android/settings/notification/AppNotificationSettings.java
+++ b/src/com/android/settings/notification/AppNotificationSettings.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.notification;
 
+import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
+
 import android.app.NotificationChannel;
 import android.app.NotificationChannelGroup;
 import android.app.settings.SettingsEnums;
@@ -24,6 +26,8 @@
 import android.os.Bundle;
 import android.text.TextUtils;
 import android.util.Log;
+import android.view.Window;
+import android.view.WindowManager;
 
 import androidx.preference.Preference;
 import androidx.preference.PreferenceCategory;
@@ -33,7 +37,6 @@
 
 import com.android.internal.widget.LockPatternUtils;
 import com.android.settings.R;
-import com.android.settings.widget.MasterCheckBoxPreference;
 import com.android.settingslib.RestrictedSwitchPreference;
 import com.android.settingslib.core.AbstractPreferenceController;
 
@@ -85,6 +88,8 @@
     public void onResume() {
         super.onResume();
 
+        getActivity().getWindow().addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
+
         if (mUid < 0 || TextUtils.isEmpty(mPkg) || mPkgInfo == null) {
             Log.w(TAG, "Missing package or uid or packageinfo");
             finish();
@@ -119,6 +124,15 @@
     }
 
     @Override
+    public void onPause() {
+        super.onPause();
+        final Window window = getActivity().getWindow();
+        final WindowManager.LayoutParams attrs = window.getAttributes();
+        attrs.privateFlags &= ~SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
+        window.setAttributes(attrs);
+    }
+
+    @Override
     protected String getLogTag() {
         return TAG;
     }
diff --git a/src/com/android/settings/panel/NfcPanel.java b/src/com/android/settings/panel/NfcPanel.java
index 8fa41d9..6a9c74d 100644
--- a/src/com/android/settings/panel/NfcPanel.java
+++ b/src/com/android/settings/panel/NfcPanel.java
@@ -1,3 +1,19 @@
+/*
+ * 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.panel;
 
 import android.app.settings.SettingsEnums;
diff --git a/src/com/android/settings/panel/PanelFeatureProviderImpl.java b/src/com/android/settings/panel/PanelFeatureProviderImpl.java
index 6b096a1..67c300f 100644
--- a/src/com/android/settings/panel/PanelFeatureProviderImpl.java
+++ b/src/com/android/settings/panel/PanelFeatureProviderImpl.java
@@ -28,12 +28,14 @@
         switch (panelType) {
             case Settings.Panel.ACTION_INTERNET_CONNECTIVITY:
                 return InternetConnectivityPanel.create(context);
-            case Settings.Panel.ACTION_VOLUME:
-                return VolumePanel.create(context);
-            case Settings.Panel.ACTION_NFC:
-                return NfcPanel.create(context);
             case ACTION_MEDIA_OUTPUT:
                 return MediaOutputPanel.create(context, mediaPackageName);
+            case Settings.Panel.ACTION_NFC:
+                return NfcPanel.create(context);
+            case Settings.Panel.ACTION_WIFI:
+                return WifiPanel.create(context);
+            case Settings.Panel.ACTION_VOLUME:
+                return VolumePanel.create(context);
         }
 
         throw new IllegalStateException("No matching panel for: "  + panelType);
diff --git a/src/com/android/settings/panel/WifiPanel.java b/src/com/android/settings/panel/WifiPanel.java
new file mode 100644
index 0000000..6d83742
--- /dev/null
+++ b/src/com/android/settings/panel/WifiPanel.java
@@ -0,0 +1,77 @@
+/*
+ * 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.panel;
+
+import android.app.settings.SettingsEnums;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+
+import com.android.settings.R;
+import com.android.settings.SubSettings;
+import com.android.settings.network.NetworkDashboardFragment;
+import com.android.settings.slices.CustomSliceRegistry;
+import com.android.settings.slices.SliceBuilderUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Panel data class for Wifi settings.
+ */
+public class WifiPanel implements PanelContent {
+
+    private final Context mContext;
+
+    public static WifiPanel create(Context context) {
+        return new WifiPanel(context);
+    }
+
+    private WifiPanel(Context context) {
+        mContext = context.getApplicationContext();
+    }
+
+    @Override
+    public CharSequence getTitle() {
+        return mContext.getText(R.string.wifi_settings);
+    }
+
+    @Override
+    public List<Uri> getSlices() {
+        final List<Uri> uris = new ArrayList<>();
+        uris.add(CustomSliceRegistry.WIFI_SLICE_URI);
+        return uris;
+    }
+
+    @Override
+    public Intent getSeeMoreIntent() {
+        final String screenTitle =
+                mContext.getText(R.string.network_dashboard_title).toString();
+        final Intent intent = SliceBuilderUtils.buildSearchResultPageIntent(mContext,
+                NetworkDashboardFragment.class.getName(),
+                null /* key */,
+                screenTitle,
+                SettingsEnums.SETTINGS_NETWORK_CATEGORY);
+        intent.setClassName(mContext.getPackageName(), SubSettings.class.getName());
+        return intent;
+    }
+
+    @Override
+    public int getMetricsCategory() {
+        return SettingsEnums.PANEL_WIFI;
+    }
+}
diff --git a/src/com/android/settings/wifi/slice/WifiSlice.java b/src/com/android/settings/wifi/slice/WifiSlice.java
index 8d20f7f..a2debb8 100644
--- a/src/com/android/settings/wifi/slice/WifiSlice.java
+++ b/src/com/android/settings/wifi/slice/WifiSlice.java
@@ -198,7 +198,7 @@
 
     private IconCompat getEndIcon(AccessPoint accessPoint) {
         if (accessPoint.isActive()) {
-            return IconCompat.createWithResource(mContext, R.drawable.ic_settings_accent);
+            return null;
         } else if (accessPoint.getSecurity() != AccessPoint.SECURITY_NONE) {
             return IconCompat.createWithResource(mContext, R.drawable.ic_friction_lock_closed);
         } else if (accessPoint.isMetered()) {
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatteryInfoTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatteryInfoTest.java
index 0103031..d5e0ed8 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatteryInfoTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatteryInfoTest.java
@@ -65,7 +65,9 @@
     private static final String STATUS_NOT_CHARGING = "Not charging";
     private static final long REMAINING_TIME_NULL = -1;
     private static final long REMAINING_TIME = 2;
+    // Strings are defined in frameworks/base/packages/SettingsLib/res/values/strings.xml
     private static final String ENHANCED_STRING_SUFFIX = "based on your usage";
+    private static final String EXTEND_PREFIX = "Extend battery life past";
     private static final long TEST_CHARGE_TIME_REMAINING = TimeUnit.MINUTES.toMicros(1);
     private static final String TEST_CHARGE_TIME_REMAINING_STRINGIFIED =
             "1 min left until fully charged";
@@ -148,8 +150,10 @@
 
         // We only add special mention for the long string
         assertThat(info.remainingLabel.toString()).contains(ENHANCED_STRING_SUFFIX);
+        assertThat(info.suggestionLabel).contains(EXTEND_PREFIX);
         // shortened string should not have extra text
         assertThat(info2.remainingLabel.toString()).doesNotContain(ENHANCED_STRING_SUFFIX);
+        assertThat(info2.suggestionLabel).contains(EXTEND_PREFIX);
     }
 
     @Test
@@ -169,6 +173,19 @@
                 mContext.getString(R.string.power_remaining_duration_only_shutdown_imminent));
         assertThat(info2.remainingLabel.toString()).isEqualTo(
                 mContext.getString(R.string.power_remaining_duration_only_shutdown_imminent));
+        assertThat(info2.suggestionLabel).contains(EXTEND_PREFIX);
+    }
+
+    @Test
+    public void getBatteryInfo_MoreThanOneDay_suggestionLabelIsCorrectString() {
+        Estimate estimate = new Estimate(Duration.ofDays(3).toMillis(),
+                true /* isBasedOnUsage */,
+                1000 /* averageDischargeTime */);
+        BatteryInfo info = BatteryInfo.getBatteryInfo(mContext, mDisChargingBatteryBroadcast,
+                mBatteryStats, estimate, SystemClock.elapsedRealtime() * 1000,
+                false /* shortString */);
+
+        assertThat(info.suggestionLabel).doesNotContain(EXTEND_PREFIX);
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/batterysaver/BatterySaverStickyPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/fuelgauge/batterysaver/BatterySaverStickyPreferenceControllerTest.java
new file mode 100644
index 0000000..a441864
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/fuelgauge/batterysaver/BatterySaverStickyPreferenceControllerTest.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.fuelgauge.batterysaver;
+
+import static com.android.settings.fuelgauge.batterysaver.BatterySaverStickyPreferenceController.LOW_POWER_STICKY_AUTO_DISABLE_ENABLED;
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+import android.provider.Settings;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public class BatterySaverStickyPreferenceControllerTest {
+
+    private static final String PREF_KEY = "battery_saver_sticky";
+
+    private Context mContext;
+    private BatterySaverStickyPreferenceController mController;
+
+    @Before
+    public void setup() {
+        mContext = RuntimeEnvironment.application;
+        mController = new BatterySaverStickyPreferenceController(mContext, PREF_KEY);
+    }
+
+    private int getAutoDisableSetting() {
+        return Settings.System.getInt(mContext.getContentResolver(),
+                LOW_POWER_STICKY_AUTO_DISABLE_ENABLED,
+                1);
+    }
+
+    @Test
+    public void testOnPreferenceChange_turnOnKeepActive_autoDisableOff() {
+        mController.onPreferenceChange(null, true);
+        final int isOn = getAutoDisableSetting();
+        assertThat(isOn).isEqualTo(0);
+    }
+
+    @Test
+    public void testOnPreferenceChange_TurnOffKeepActive_autoDisableOff() {
+        mController.onPreferenceChange(null, false);
+        final int isOn = getAutoDisableSetting();
+        assertThat(isOn).isEqualTo(1);
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardManagerTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardManagerTest.java
index 1a0539c..eb9a461 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardManagerTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardManagerTest.java
@@ -31,6 +31,7 @@
 
 import android.content.Context;
 import android.net.Uri;
+import android.provider.Settings;
 import android.util.ArrayMap;
 
 import com.android.settings.homepage.contextualcards.conditional.ConditionFooterContextualCard;
@@ -126,6 +127,24 @@
     }
 
     @Test
+    public void getCardLoaderTimeout_noConfiguredTimeout_shouldReturnDefaultTimeout() {
+        final long timeout = mManager.getCardLoaderTimeout(mContext);
+
+        assertThat(timeout).isEqualTo(ContextualCardManager.CARD_CONTENT_LOADER_TIMEOUT_MS);
+    }
+
+    @Test
+    public void getCardLoaderTimeout_hasConfiguredTimeout_shouldReturnConfiguredTimeout() {
+        final long configuredTimeout = 5000L;
+        Settings.Global.putLong(mContext.getContentResolver(),
+                ContextualCardManager.KEY_GLOBAL_CARD_LOADER_TIMEOUT, configuredTimeout);
+
+        final long timeout = mManager.getCardLoaderTimeout(mContext);
+
+        assertThat(timeout).isEqualTo(configuredTimeout);
+    }
+
+    @Test
     public void onFinishCardLoading_fastLoad_shouldCallOnContextualCardUpdated() {
         mManager.mStartTime = System.currentTimeMillis();
         final ContextualCardManager manager = spy(mManager);
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 77fc5d9..4a23c33 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
@@ -23,6 +23,7 @@
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
@@ -83,7 +84,7 @@
 
         // Mock the icon and detail intent of Bluetooth.
         mIcon = IconCompat.createWithResource(mContext,
-            com.android.internal.R.drawable.ic_settings_bluetooth);
+                com.android.internal.R.drawable.ic_settings_bluetooth);
         mDetailIntent = PendingIntent.getActivity(mContext, 0, new Intent("test action"), 0);
         doReturn(mIcon).when(mBluetoothDevicesSlice).getBluetoothDeviceIcon(any());
         doReturn(mDetailIntent).when(mBluetoothDevicesSlice).getBluetoothDetailIntent(any());
@@ -122,6 +123,27 @@
     }
 
     @Test
+    public void getSlice_hasMediaBluetoothDevice_shouldBuildMediaBluetoothAction() {
+        mockBluetoothDeviceList(1 /* deviceCount */);
+        doReturn(true).when(mBluetoothDeviceList.get(0)).isConnectedA2dpDevice();
+        doReturn(mBluetoothDeviceList).when(mBluetoothDevicesSlice).getConnectedBluetoothDevices();
+
+        mBluetoothDevicesSlice.getSlice();
+
+        verify(mBluetoothDevicesSlice).buildMediaBluetoothAction(any());
+    }
+
+    @Test
+    public void getSlice_noMediaBluetoothDevice_shouldNotBuildMediaBluetoothAction() {
+        mockBluetoothDeviceList(1 /* deviceCount */);
+        doReturn(mBluetoothDeviceList).when(mBluetoothDevicesSlice).getConnectedBluetoothDevices();
+
+        mBluetoothDevicesSlice.getSlice();
+
+        verify(mBluetoothDevicesSlice, never()).buildMediaBluetoothAction(any());
+    }
+
+    @Test
     public void getSlice_noBluetoothDevices_shouldHaveNoBluetoothDevicesTitle() {
         doReturn(mBluetoothDeviceList).when(mBluetoothDevicesSlice).getConnectedBluetoothDevices();
 
@@ -175,7 +197,6 @@
         doReturn(BLUETOOTH_MOCK_TITLE).when(mCachedBluetoothDevice).getName();
         doReturn(BLUETOOTH_MOCK_SUMMARY).when(mCachedBluetoothDevice).getConnectionSummary();
         doReturn(BLUETOOTH_MOCK_ADDRESS).when(mCachedBluetoothDevice).getAddress();
-        doReturn(true).when(mCachedBluetoothDevice).isConnectedA2dpDevice();
         for (int i = 0; i < deviceCount; i++) {
             mBluetoothDeviceList.add(mCachedBluetoothDevice);
         }
diff --git a/tests/robotests/src/com/android/settings/network/telephony/MobileDataSliceTest.java b/tests/robotests/src/com/android/settings/network/telephony/MobileDataSliceTest.java
index c497cf8..31daa37 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/MobileDataSliceTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/MobileDataSliceTest.java
@@ -24,6 +24,7 @@
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 
+import android.app.PendingIntent;
 import android.content.Context;
 import android.content.Intent;
 import android.provider.Settings;
@@ -162,4 +163,27 @@
 
         assertThat(isMobileDataEnabled).isEqualTo(seed);
     }
+
+    @Test
+    public void airplaneModeEnabled_slicePrimaryActionIsEmpty() {
+        doReturn(true).when(mMobileDataSlice).isAirplaneModeEnabled();
+        doReturn(mSubscriptionInfo).when(mSubscriptionManager).getActiveSubscriptionInfo(SUB_ID);
+        final Slice mobileData = mMobileDataSlice.getSlice();
+
+        final SliceMetadata metadata = SliceMetadata.from(mContext, mobileData);
+        assertThat(metadata.getTitle())
+                .isEqualTo(mContext.getString(R.string.mobile_data_settings_title));
+
+        assertThat(metadata.getSubtitle())
+                .isEqualTo(mContext.getString(R.string.mobile_data_ap_mode_disabled));
+
+        final List<SliceAction> toggles = metadata.getToggles();
+        assertThat(toggles).hasSize(0);
+
+        final SliceAction primaryAction = metadata.getPrimaryAction();
+        final PendingIntent pendingIntent = primaryAction.getAction();
+        final Intent actionIntent = pendingIntent.getIntent();
+
+        assertThat(actionIntent.getAction()).isNull();
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/notification/AppNotificationSettingsTest.java b/tests/robotests/src/com/android/settings/notification/AppNotificationSettingsTest.java
new file mode 100644
index 0000000..9555a56
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/notification/AppNotificationSettingsTest.java
@@ -0,0 +1,93 @@
+package com.android.settings.notification;
+
+import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.view.Window;
+import android.view.WindowManager;
+
+import androidx.fragment.app.FragmentActivity;
+import androidx.fragment.app.FragmentManager;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.Robolectric;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.annotation.Config;
+import org.robolectric.annotation.Implementation;
+import org.robolectric.annotation.Implements;
+
+@RunWith(RobolectricTestRunner.class)
+public class AppNotificationSettingsTest {
+
+    private WindowManager.LayoutParams mLayoutParams;
+    private AppNotificationSettings mFragment;
+    private FragmentActivity mActivity;
+    @Mock
+    private Window mWindow;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mLayoutParams = new WindowManager.LayoutParams();
+        mActivity = spy(Robolectric.setupActivity(FragmentActivity.class));
+        mFragment = spy(new AppNotificationSettings());
+        when(mFragment.getActivity()).thenReturn(mActivity);
+        when(mFragment.getFragmentManager()).thenReturn(mock(FragmentManager.class));
+        when(mActivity.getWindow()).thenReturn(mWindow);
+        when(mWindow.getAttributes()).thenReturn(mLayoutParams);
+    }
+
+    @Test
+    @Config(shadows = {ShadowNotificationSettingsBase.class})
+    public void onResume_shouldHideSystemOverlay() {
+        mFragment.onResume();
+
+        verify(mWindow).addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
+    }
+
+    @Test
+    @Config(shadows = {ShadowNotificationSettingsBase.class})
+    public void onPause_shouldRemoveHideSystemOverlay() {
+        mFragment.onResume();
+
+        verify(mWindow).addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
+
+        mFragment.onPause();
+
+        // There's no Window.clearPrivateFlags() method, so the Window.attributes are updated.
+        ArgumentCaptor<WindowManager.LayoutParams> paramCaptor = ArgumentCaptor.forClass(
+                WindowManager.LayoutParams.class);
+        verify(mWindow).setAttributes(paramCaptor.capture());
+        assertEquals(0,
+                paramCaptor.getValue().privateFlags
+                        & SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
+    }
+
+    @Implements(NotificationSettingsBase.class)
+    public static class ShadowNotificationSettingsBase {
+
+        protected void __constructor__() {
+            // Do nothing
+        }
+
+        @Implementation
+        protected void onResume() {
+            // No-op.
+        }
+
+        @Implementation
+        protected void onPause() {
+            // No-op.
+        }
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/panel/NfcPanelTest.java b/tests/robotests/src/com/android/settings/panel/NfcPanelTest.java
index bf6662d..1de2c5a 100644
--- a/tests/robotests/src/com/android/settings/panel/NfcPanelTest.java
+++ b/tests/robotests/src/com/android/settings/panel/NfcPanelTest.java
@@ -1,3 +1,19 @@
+/*
+ * 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.panel;
 
 import static com.google.common.truth.Truth.assertThat;
diff --git a/tests/robotests/src/com/android/settings/panel/WifiPanelTest.java b/tests/robotests/src/com/android/settings/panel/WifiPanelTest.java
new file mode 100644
index 0000000..08db23e
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/panel/WifiPanelTest.java
@@ -0,0 +1,55 @@
+/*
+ * 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.panel;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.net.Uri;
+
+import com.android.settings.slices.CustomSliceRegistry;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+import java.util.List;
+
+@RunWith(RobolectricTestRunner.class)
+public class WifiPanelTest {
+
+    private WifiPanel mPanel;
+
+    @Before
+    public void setUp() {
+        mPanel = WifiPanel.create(RuntimeEnvironment.application);
+    }
+
+    @Test
+    public void getSlices_containsNecessarySlices() {
+        final List<Uri> uris = mPanel.getSlices();
+
+        assertThat(uris).containsExactly(
+                CustomSliceRegistry.WIFI_SLICE_URI);
+    }
+
+    @Test
+    public void getSeeMoreIntent_notNull() {
+        assertThat(mPanel.getSeeMoreIntent()).isNotNull();
+    }
+}