use of com.android.settings.RestrictedListPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class VisibilityPreferenceControllerTest method testUpdateState_noPrivateLockScreenNotificationsGlobally.
@Test
public void testUpdateState_noPrivateLockScreenNotificationsGlobally() {
Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, 1);
Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 0);
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
NotificationChannel channel = mock(NotificationChannel.class);
mController.onResume(appRow, channel, null, null);
RestrictedListPreference pref = mock(RestrictedListPreference.class);
mController.updateState(pref);
ArgumentCaptor<CharSequence[]> argumentCaptor = ArgumentCaptor.forClass(CharSequence[].class);
verify(pref, times(1)).setEntryValues(argumentCaptor.capture());
assertEquals(2, toStringList(argumentCaptor.getValue()).size());
assertFalse(toStringList(argumentCaptor.getValue()).contains(String.valueOf(VISIBILITY_NO_OVERRIDE)));
}
use of com.android.settings.RestrictedListPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class VisibilityPreferenceControllerTest method testUpdateState_noLockScreenNotificationsGloballyInProfile.
@Test
public void testUpdateState_noLockScreenNotificationsGloballyInProfile() {
final int primaryUserId = 2;
final UserInfo primaryUserInfo = new UserInfo(primaryUserId, "user 2", 0);
when(mUm.getProfileParent(anyInt())).thenReturn(primaryUserInfo);
Settings.Secure.putIntForUser(mContext.getContentResolver(), Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, 0, primaryUserId);
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
NotificationChannel channel = mock(NotificationChannel.class);
mController.onResume(appRow, channel, null, null);
RestrictedListPreference pref = mock(RestrictedListPreference.class);
mController.updateState(pref);
ArgumentCaptor<CharSequence[]> argumentCaptor = ArgumentCaptor.forClass(CharSequence[].class);
verify(pref, times(1)).setEntryValues(argumentCaptor.capture());
assertFalse(toStringList(argumentCaptor.getValue()).contains(String.valueOf(VISIBILITY_NO_OVERRIDE)));
assertFalse(toStringList(argumentCaptor.getValue()).contains(String.valueOf(VISIBILITY_PRIVATE)));
}
use of com.android.settings.RestrictedListPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class VisibilityPreferenceControllerTest method testUpdateState_channelOverride.
@Test
public void testUpdateState_channelOverride() {
Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 0);
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
NotificationChannel channel = mock(NotificationChannel.class);
when(channel.getLockscreenVisibility()).thenReturn(Notification.VISIBILITY_SECRET);
mController.onResume(appRow, channel, null, null);
RestrictedListPreference pref = mock(RestrictedListPreference.class);
mController.updateState(pref);
ArgumentCaptor<String> argumentCaptor = ArgumentCaptor.forClass(String.class);
verify(pref, times(1)).setValue(argumentCaptor.capture());
assertEquals(String.valueOf(Notification.VISIBILITY_SECRET), argumentCaptor.getValue());
}
use of com.android.settings.RestrictedListPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class VisibilityPreferenceControllerTest method testUpdateState_noLockScreenNotificationsGlobally.
@Test
public void testUpdateState_noLockScreenNotificationsGlobally() {
Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, 0);
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
NotificationChannel channel = mock(NotificationChannel.class);
mController.onResume(appRow, channel, null, null);
RestrictedListPreference pref = mock(RestrictedListPreference.class);
mController.updateState(pref);
ArgumentCaptor<CharSequence[]> argumentCaptor = ArgumentCaptor.forClass(CharSequence[].class);
verify(pref, times(1)).setEntryValues(argumentCaptor.capture());
assertFalse(toStringList(argumentCaptor.getValue()).contains(String.valueOf(VISIBILITY_NO_OVERRIDE)));
assertFalse(toStringList(argumentCaptor.getValue()).contains(String.valueOf(VISIBILITY_PRIVATE)));
}
Aggregations