use of android.service.notification.NotificationListenerFilter in project android_packages_apps_Settings by omnirom.
the class BridgedAppsLinkPreferenceControllerTest method testAvailable_lowTargetSdk_customizations.
@Test
public void testAvailable_lowTargetSdk_customizations() {
when(mNm.isNotificationListenerAccessGranted(any())).thenReturn(true);
mController.setTargetSdk(Build.VERSION_CODES.S);
NotificationListenerFilter nlf = new NotificationListenerFilter();
nlf.setTypes(FLAG_FILTER_TYPE_CONVERSATIONS);
when(mNm.getListenerFilter(mCn, 0)).thenReturn(nlf);
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
}
use of android.service.notification.NotificationListenerFilter in project android_packages_apps_Settings by omnirom.
the class PreUpgradePreferenceControllerTest method testAvailable_highTargetSdk_noCustomizations.
@Test
public void testAvailable_highTargetSdk_noCustomizations() {
when(mNm.isNotificationListenerAccessGranted(any())).thenReturn(true);
mController.setTargetSdk(Build.VERSION_CODES.CUR_DEVELOPMENT + 1);
when(mNm.getListenerFilter(mCn, 0)).thenReturn(new NotificationListenerFilter());
assertThat(mController.getAvailabilityStatus()).isEqualTo(CONDITIONALLY_UNAVAILABLE);
}
use of android.service.notification.NotificationListenerFilter in project android_packages_apps_Settings by omnirom.
the class PreUpgradePreferenceControllerTest method testAvailable_lowTargetSdk_customizations.
@Test
public void testAvailable_lowTargetSdk_customizations() {
when(mNm.isNotificationListenerAccessGranted(any())).thenReturn(true);
mController.setTargetSdk(Build.VERSION_CODES.S);
NotificationListenerFilter nlf = new NotificationListenerFilter();
nlf.setTypes(FLAG_FILTER_TYPE_CONVERSATIONS);
when(mNm.getListenerFilter(mCn, 0)).thenReturn(nlf);
assertThat(mController.getAvailabilityStatus()).isEqualTo(CONDITIONALLY_UNAVAILABLE);
}
use of android.service.notification.NotificationListenerFilter in project android_packages_apps_Settings by omnirom.
the class PreUpgradePreferenceControllerTest method testAvailable_lowTargetSdk_noCustomizations.
@Test
public void testAvailable_lowTargetSdk_noCustomizations() {
when(mNm.isNotificationListenerAccessGranted(any())).thenReturn(true);
mController.setTargetSdk(Build.VERSION_CODES.S);
when(mNm.getListenerFilter(mCn, 0)).thenReturn(new NotificationListenerFilter());
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
}
use of android.service.notification.NotificationListenerFilter in project android_packages_apps_Settings by omnirom.
the class TypeFilterPreferenceControllerTest method updateState_enabled_metaData_disableFilter_notThisField.
@Test
public void updateState_enabled_metaData_disableFilter_notThisField() {
mSi.metaData = new Bundle();
mSi.metaData.putCharSequence(NotificationListenerService.META_DATA_DISABLED_FILTER_TYPES, "1|alerting");
when(mNm.isNotificationListenerAccessGranted(mCn)).thenReturn(true);
when(mNm.getListenerFilter(mCn, 0)).thenReturn(new NotificationListenerFilter());
CheckBoxPreference pref = new CheckBoxPreference(mContext);
mController.updateState(pref);
assertThat(pref.isEnabled()).isTrue();
}
Aggregations