use of com.android.settingslib.RestrictedSwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class VibrationPreferenceControllerTest method testUpdateState_notBlockable.
@Test
public void testUpdateState_notBlockable() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
NotificationChannel channel = mock(NotificationChannel.class);
when(channel.isImportanceLockedByOEM()).thenReturn(true);
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 VibrationPreferenceControllerTest method testUpdateState_vibrateOff.
@Test
public void testUpdateState_vibrateOff() {
NotificationChannel channel = mock(NotificationChannel.class);
when(channel.shouldVibrate()).thenReturn(false);
mController.onResume(new NotificationBackend.AppRow(), channel, null, null);
RestrictedSwitchPreference pref = new RestrictedSwitchPreference(RuntimeEnvironment.application);
mController.updateState(pref);
assertFalse(pref.isChecked());
}
use of com.android.settingslib.RestrictedSwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class VibrationPreferenceControllerTest method testUpdateState_disabledByAdmin.
@Test
public void testUpdateState_disabledByAdmin() {
NotificationChannel channel = mock(NotificationChannel.class);
when(channel.getId()).thenReturn("something");
mController.onResume(new NotificationBackend.AppRow(), channel, null, mock(RestrictedLockUtils.EnforcedAdmin.class));
Preference pref = new RestrictedSwitchPreference(RuntimeEnvironment.application);
mController.updateState(pref);
assertFalse(pref.isEnabled());
}
use of com.android.settingslib.RestrictedSwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class VibrationPreferenceControllerTest method testUpdateState_vibrateOn.
@Test
public void testUpdateState_vibrateOn() {
NotificationChannel channel = mock(NotificationChannel.class);
when(channel.shouldVibrate()).thenReturn(true);
mController.onResume(new NotificationBackend.AppRow(), channel, null, null);
RestrictedSwitchPreference pref = new RestrictedSwitchPreference(RuntimeEnvironment.application);
mController.updateState(pref);
assertTrue(pref.isChecked());
}
use of com.android.settingslib.RestrictedSwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class VibrationPreferenceControllerTest method testOnPreferenceChange_on.
@Test
public void testOnPreferenceChange_on() {
NotificationChannel channel = new NotificationChannel(DEFAULT_CHANNEL_ID, "a", IMPORTANCE_DEFAULT);
mController.onResume(new NotificationBackend.AppRow(), channel, null, null);
RestrictedSwitchPreference pref = new RestrictedSwitchPreference(RuntimeEnvironment.application);
mController.updateState(pref);
mController.onPreferenceChange(pref, true);
assertTrue(channel.shouldVibrate());
verify(mBackend, times(1)).updateChannel(any(), anyInt(), any());
}
Aggregations