use of androidx.preference.Preference 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 androidx.preference.Preference 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 androidx.preference.Preference 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());
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class MinImportancePreferenceControllerTest method testUpdateState_defaultApp.
@Test
public void testUpdateState_defaultApp() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.systemApp = true;
NotificationChannel channel = mock(NotificationChannel.class);
when(channel.isImportanceLockedByCriticalDeviceFunction()).thenReturn(true);
when(channel.getImportance()).thenReturn(IMPORTANCE_LOW);
mController.onResume(appRow, channel, null, null);
Preference pref = new RestrictedSwitchPreference(mContext, null);
mController.updateState(pref);
assertTrue(pref.isEnabled());
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SimLockPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
ShadowApplication shadowApplication = ShadowApplication.getInstance();
shadowApplication.setSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE, mSubscriptionManager);
shadowApplication.setSystemService(Context.CARRIER_CONFIG_SERVICE, mCarrierManager);
shadowApplication.setSystemService(Context.USER_SERVICE, mUserManager);
shadowApplication.setSystemService(Context.TELEPHONY_SERVICE, mTelephonyManager);
mController = new SimLockPreferenceController(RuntimeEnvironment.application);
mPreference = new Preference(RuntimeEnvironment.application);
mPreference.setKey(mController.getPreferenceKey());
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
}
Aggregations