use of com.android.settings.applications.AppStateNotificationBridge.NotificationsSentState in project android_packages_apps_Settings by omnirom.
the class AppStateNotificationBridgeTest method testGetAggregatedUsageEvents_onlyNotificationEvents.
@Test
public void testGetAggregatedUsageEvents_onlyNotificationEvents() throws Exception {
List<Event> events = new ArrayList<>();
Event good = new Event();
good.mEventType = Event.NOTIFICATION_INTERRUPTION;
good.mPackage = PKG1;
good.mTimeStamp = 1;
events.add(good);
Event bad = new Event();
bad.mEventType = Event.CHOOSER_ACTION;
bad.mPackage = PKG1;
bad.mTimeStamp = 2;
events.add(bad);
UsageEvents usageEvents = getUsageEvents(events);
when(mUsageStats.queryEventsForUser(anyLong(), anyLong(), anyInt(), anyString())).thenReturn(usageEvents);
Map<String, NotificationsSentState> map = mBridge.getAggregatedUsageEvents();
assertThat(map.get(AppStateNotificationBridge.getKey(0, PKG1)).sentCount).isEqualTo(1);
}
use of com.android.settings.applications.AppStateNotificationBridge.NotificationsSentState in project android_packages_apps_Settings by omnirom.
the class AppStateNotificationBridgeTest method testFilterFrequency.
@Test
public void testFilterFrequency() {
NotificationsSentState allowState = new NotificationsSentState();
allowState.sentCount = 1;
AppEntry allow = mock(AppEntry.class);
allow.extraInfo = allowState;
assertTrue(FILTER_APP_NOTIFICATION_FREQUENCY.filterApp(allow));
NotificationsSentState denyState = new NotificationsSentState();
denyState.sentCount = 0;
AppEntry deny = mock(AppEntry.class);
deny.extraInfo = denyState;
assertFalse(FILTER_APP_NOTIFICATION_FREQUENCY.filterApp(deny));
}
Aggregations