Package org.robolectric.shadows
Class ShadowNotificationListenerService
java.lang.Object
org.robolectric.shadows.ShadowContextWrapper
org.robolectric.shadows.ShadowService
org.robolectric.shadows.ShadowNotificationListenerService
@Implements(android.service.notification.NotificationListenerService.class)
public class ShadowNotificationListenerService
extends ShadowService
Shadow implementation of
NotificationListenerService.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddActiveNotification(StatusBarNotification statusBarNotification) Adds the givenStatusBarNotificationto the list of active Notifications.addActiveNotification(String packageName, int id, Notification notification) Adds the givenNotificationto the list of active Notifications.protected voidprotected voidcancelNotification(String key) protected StatusBarNotification[]getActiveNotifications(String[] keys, int trim) Returns zero or more notifications, added byaddActiveNotification(java.lang.String, int, android.app.Notification), that match one of the provided keys.protected intprotected intprotected NotificationListenerService.RankingMapstatic intReturns the number of times rebind was requested.intReturns the number of times unbind was requested.protected voidrequestInterruptionFilter(int interruptionFilter) protected voidrequestListenerHints(int hint) protected static voidrequestRebind(ComponentName componentName) protected voidstatic voidreset()Resets this shadow instance.Methods inherited from class org.robolectric.shadows.ShadowService
getForegroundServiceType, getLastForegroundNotification, getLastForegroundNotificationId, getNotificationShouldRemoved, getStopSelfId, getStopSelfResultId, isForegroundStopped, isLastForegroundNotificationAttached, isStoppedBySelf, onDestroy, startForeground, startForeground, stopForeground, stopForeground, stopSelf, stopSelf, stopSelfResultMethods inherited from class org.robolectric.shadows.ShadowContextWrapper
clearBroadcastIntents, clearNextStartedActivities, clearStartedServices, denyPermissions, denyPermissions, getAllStartedServices, getBroadcastIntents, getBroadcastIntentsForUser, getBroadcastOptions, getNextStartedActivity, getNextStartedActivityForResult, getNextStartedService, getNextStoppedService, grantPermissions, grantPermissions, peekNextStartedActivity, peekNextStartedActivityForResult, peekNextStartedService, removeSystemService
-
Constructor Details
-
ShadowNotificationListenerService
public ShadowNotificationListenerService()
-
-
Method Details
-
addActiveNotification
Adds the givenNotificationto the list of active Notifications. A correspondingStatusBarNotificationwill be generated from this Notification, which will be included in the result ofNotificationListenerService.getActiveNotifications().- Returns:
- the key of the generated
StatusBarNotification
-
addActiveNotification
Adds the givenStatusBarNotificationto the list of active Notifications. The givenStatusBarNotificationwill be included in the result ofNotificationListenerService.getActiveNotifications().- Returns:
- the key of the given
StatusBarNotification
-
requestRebind
-
requestUnbind
-
cancelAllNotifications
-
cancelNotification
-
getActiveNotifications
Returns zero or more notifications, added byaddActiveNotification(java.lang.String, int, android.app.Notification), that match one of the provided keys.- Parameters:
keys- the keys to matchtrim- ignored, trimming is not supported
-
requestInterruptionFilter
-
getCurrentInterruptionFilter
-
requestListenerHints
-
getCurrentListenerHints
-
getCurrentRanking
-
getRebindRequestCount
public static int getRebindRequestCount()Returns the number of times rebind was requested. -
getUnbindRequestCount
public int getUnbindRequestCount()Returns the number of times unbind was requested. -
reset
Resets this shadow instance.
-