Add DnD as a special case Slice

Add DND Slice as a special case, since there is an existing
inheritance structures in the zen mode preference controllers which
would be too risky to change at this point in the release.

Test: make RunSettingsRoboTests
Bug: 67997377
Change-Id: Ice608b9a7bd6f38b73e581eb3723f0a2fae96f2b
This commit is contained in:
Matthew Fritze
2018-04-30 12:48:44 -07:00
parent f868f86672
commit 4710917aa4
7 changed files with 307 additions and 17 deletions

View File

@@ -16,6 +16,7 @@
package com.android.settings.wifi;
import static android.app.slice.Slice.EXTRA_TOGGLE_STATE;
import static android.provider.SettingsSlicesContract.KEY_WIFI;
import android.annotation.ColorInt;
@@ -78,8 +79,7 @@ public class WifiSliceBuilder {
/**
* Return a Wifi Slice bound to {@link #WIFI_URI}.
* <p>
* Note that you should register a listener with {@link #registerIntentFilter(Context, Uri)}
* to get changes from Wifi.
* Note that you should register a listener for {@link #INTENT_FILTER} to get changes for Wifi.
*/
public static Slice getSlice(Context context) {
final boolean isWifiEnabled = isWifiEnabled(context);
@@ -110,7 +110,7 @@ public class WifiSliceBuilder {
*/
public static void handleUriChange(Context context, Intent intent) {
final WifiManager wifiManager = context.getSystemService(WifiManager.class);
final boolean newState = intent.getBooleanExtra(android.app.slice.Slice.EXTRA_TOGGLE_STATE,
final boolean newState = intent.getBooleanExtra(EXTRA_TOGGLE_STATE,
wifiManager.isWifiEnabled());
wifiManager.setWifiEnabled(newState);
// Do not notifyChange on Uri. The service takes longer to update the current value than it