Redirect to new modes page when modes_ui is on.
The new modes page has essentially no content yet, but this is a rough proof of concept for the existing abstract classes and hopefully serves as a building block for future changes. It lists modes and those preferences lead to contentless pages that will be fleshed out later.. Flag: android.app.modes_ui Bug: 327260745 Test: ZenModePreferenceControllerTest Test: manual; individual pages only have skeleton functionality and should be unit tested in future CLs Change-Id: I12f48b48f761e3c9ff1a173445b15f7536d34edb
This commit is contained in:
@@ -16,10 +16,13 @@
|
||||
|
||||
package com.android.settings.notification.zen;
|
||||
|
||||
import static android.platform.test.flag.junit.SetFlagsRule.DefaultInitValueType.DEVICE_DEFAULT;
|
||||
|
||||
import static com.android.settings.core.BasePreferenceController.AVAILABLE_UNSEARCHABLE;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.never;
|
||||
@@ -27,13 +30,20 @@ import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.app.Flags;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.NotificationManager.Policy;
|
||||
import android.content.Context;
|
||||
import android.platform.test.annotations.DisableFlags;
|
||||
import android.platform.test.annotations.EnableFlags;
|
||||
import android.platform.test.flag.junit.SetFlagsRule;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.notification.modes.ZenModesListFragment;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
@@ -46,6 +56,9 @@ import org.robolectric.util.ReflectionHelpers;
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class ZenModePreferenceControllerTest {
|
||||
|
||||
@Rule
|
||||
public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(DEVICE_DEFAULT);
|
||||
|
||||
@Mock
|
||||
private Preference mPreference;
|
||||
@Mock
|
||||
@@ -96,4 +109,20 @@ public class ZenModePreferenceControllerTest {
|
||||
|
||||
verify(mPreference, never()).setSummary(anyString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@EnableFlags(Flags.FLAG_MODES_UI)
|
||||
public void updateState_modesUi_resetsTitleAndFragment() {
|
||||
mController.updateState(mPreference);
|
||||
verify(mPreference).setTitle(anyInt()); // Resource IDs are ints
|
||||
verify(mPreference).setFragment(ZenModesListFragment.class.getCanonicalName());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisableFlags(Flags.FLAG_MODES_UI)
|
||||
public void updateState_noModesUi_doesNotSetTitleAndFragment() {
|
||||
mController.updateState(mPreference);
|
||||
verify(mPreference, never()).setTitle(anyInt());
|
||||
verify(mPreference, never()).setFragment(anyString());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user