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. Change-Id: If4b7013be35c89695786af2dbbea2edcf7a189f3 Merged-In: Ice608b9a7bd6f38b73e581eb3723f0a2fae96f2b Test: make RunSettingsRoboTests Fixes: 67997377
This commit is contained in:
@@ -33,6 +33,7 @@ import android.os.StrictMode;
|
||||
import android.provider.SettingsSlicesContract;
|
||||
|
||||
import com.android.settings.wifi.WifiSliceBuilder;
|
||||
import com.android.settings.notification.ZenModeSliceBuilder;
|
||||
import com.android.settings.testutils.DatabaseTestUtils;
|
||||
import com.android.settings.testutils.FakeToggleController;
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
@@ -78,6 +79,10 @@ public class SettingsSliceProviderTest {
|
||||
WifiSliceBuilder.WIFI_URI
|
||||
);
|
||||
|
||||
private static final List<Uri> SPECIAL_CASE_OEM_URIS = Arrays.asList(
|
||||
ZenModeSliceBuilder.ZEN_MODE_URI
|
||||
);
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mContext = spy(RuntimeEnvironment.application);
|
||||
@@ -221,6 +226,7 @@ public class SettingsSliceProviderTest {
|
||||
.build();
|
||||
|
||||
final Collection<Uri> descendants = mProvider.onGetSliceDescendants(uri);
|
||||
descendants.removeAll(SPECIAL_CASE_OEM_URIS);
|
||||
|
||||
assertThat(descendants).isEmpty();
|
||||
}
|
||||
@@ -248,6 +254,7 @@ public class SettingsSliceProviderTest {
|
||||
.build();
|
||||
|
||||
final Collection<Uri> descendants = mProvider.onGetSliceDescendants(uri);
|
||||
descendants.removeAll(SPECIAL_CASE_OEM_URIS);
|
||||
|
||||
assertThat(descendants).isEmpty();
|
||||
}
|
||||
@@ -261,16 +268,18 @@ public class SettingsSliceProviderTest {
|
||||
.authority(SettingsSliceProvider.SLICE_AUTHORITY)
|
||||
.appendPath(SettingsSlicesContract.PATH_SETTING_ACTION)
|
||||
.build();
|
||||
final Uri expectedUri = new Uri.Builder()
|
||||
final Collection<Uri> expectedUris = new HashSet<>();
|
||||
expectedUris.addAll(SPECIAL_CASE_OEM_URIS);
|
||||
expectedUris.add(new Uri.Builder()
|
||||
.scheme(SCHEME_CONTENT)
|
||||
.authority(SettingsSliceProvider.SLICE_AUTHORITY)
|
||||
.appendPath(SettingsSlicesContract.PATH_SETTING_ACTION)
|
||||
.appendPath(key)
|
||||
.build();
|
||||
.build());
|
||||
|
||||
final Collection<Uri> descendants = mProvider.onGetSliceDescendants(uri);
|
||||
|
||||
assertThat(descendants).containsExactly(expectedUri);
|
||||
assertThat(descendants).containsExactlyElementsIn(expectedUris);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -281,16 +290,18 @@ public class SettingsSliceProviderTest {
|
||||
.scheme(SCHEME_CONTENT)
|
||||
.authority(SettingsSliceProvider.SLICE_AUTHORITY)
|
||||
.build();
|
||||
final Uri expectedUri = new Uri.Builder()
|
||||
final Collection<Uri> expectedUris = new HashSet<>();
|
||||
expectedUris.addAll(SPECIAL_CASE_OEM_URIS);
|
||||
expectedUris.add(new Uri.Builder()
|
||||
.scheme(SCHEME_CONTENT)
|
||||
.authority(SettingsSliceProvider.SLICE_AUTHORITY)
|
||||
.appendPath(SettingsSlicesContract.PATH_SETTING_ACTION)
|
||||
.appendPath(key)
|
||||
.build();
|
||||
.build());
|
||||
|
||||
final Collection<Uri> descendants = mProvider.onGetSliceDescendants(uri);
|
||||
|
||||
assertThat(descendants).containsExactly(expectedUri);
|
||||
assertThat(descendants).containsExactlyElementsIn(expectedUris);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -349,6 +360,7 @@ public class SettingsSliceProviderTest {
|
||||
.build();
|
||||
final Collection<Uri> expectedUris = new HashSet<>();
|
||||
expectedUris.addAll(SPECIAL_CASE_PLATFORM_URIS);
|
||||
expectedUris.addAll(SPECIAL_CASE_OEM_URIS);
|
||||
expectedUris.add(new Uri.Builder()
|
||||
.scheme(SCHEME_CONTENT)
|
||||
.authority(SettingsSlicesContract.AUTHORITY)
|
||||
|
Reference in New Issue
Block a user