use of com.android.settingslib.RestrictedSwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DndPreferenceControllerTest method testUpdateState_configurable.
@Test
public void testUpdateState_configurable() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
NotificationChannel channel = mock(NotificationChannel.class);
when(channel.getId()).thenReturn("something");
mController.onResume(appRow, channel, null, null);
Preference pref = new RestrictedSwitchPreference(RuntimeEnvironment.application);
mController.updateState(pref);
assertTrue(pref.isEnabled());
}
use of com.android.settingslib.RestrictedSwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DndPreferenceControllerTest method testOnPreferenceChange_off.
@Test
public void testOnPreferenceChange_off() {
NotificationChannel channel = new NotificationChannel(DEFAULT_CHANNEL_ID, "a", IMPORTANCE_HIGH);
mController.onResume(new NotificationBackend.AppRow(), channel, null, null);
RestrictedSwitchPreference pref = new RestrictedSwitchPreference(RuntimeEnvironment.application);
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(pref);
mController.displayPreference(mScreen);
mController.updateState(pref);
mController.onPreferenceChange(pref, false);
assertFalse(channel.canBypassDnd());
verify(mBackend, times(1)).updateChannel(any(), anyInt(), any());
}
use of com.android.settingslib.RestrictedSwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class MinImportancePreferenceControllerTest method testUpdateState_disabledByAdmin.
@Test
public void testUpdateState_disabledByAdmin() {
NotificationChannel channel = mock(NotificationChannel.class);
when(channel.getImportance()).thenReturn(IMPORTANCE_LOW);
mController.onResume(new NotificationBackend.AppRow(), channel, null, mock(RestrictedLockUtils.EnforcedAdmin.class));
Preference pref = new RestrictedSwitchPreference(mContext, null);
mController.updateState(pref);
assertFalse(pref.isEnabled());
}
use of com.android.settingslib.RestrictedSwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class MinImportancePreferenceControllerTest method testUpdateState_low.
@Test
public void testUpdateState_low() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
NotificationChannel channel = new NotificationChannel("", "", IMPORTANCE_LOW);
mController.onResume(appRow, channel, null, null);
RestrictedSwitchPreference pref = new RestrictedSwitchPreference(mContext);
mController.updateState(pref);
assertFalse(pref.isChecked());
}
use of com.android.settingslib.RestrictedSwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class MinImportancePreferenceControllerTest method testUpdateState_notConfigurable.
@Test
public void testUpdateState_notConfigurable() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
NotificationChannel channel = mock(NotificationChannel.class);
when(channel.isImportanceLockedByOEM()).thenReturn(true);
when(channel.getImportance()).thenReturn(IMPORTANCE_LOW);
mController.onResume(appRow, channel, null, null);
Preference pref = new RestrictedSwitchPreference(mContext, null);
mController.updateState(pref);
assertFalse(pref.isEnabled());
}
Aggregations