Package org.robolectric.shadows
Class ShadowNotificationListenerService
java.lang.Object
org.robolectric.shadows.ShadowContextWrapper
org.robolectric.shadows.ShadowService
org.robolectric.shadows.ShadowNotificationListenerService
@Implements(value=android.service.notification.NotificationListenerService.class, minSdk=21) public class ShadowNotificationListenerService extends ShadowService
Shadow implementation of
NotificationListenerService
.-
Constructor Summary
Constructors Constructor Description ShadowNotificationListenerService()
-
Method Summary
Modifier and Type Method Description String
addActiveNotification(StatusBarNotification statusBarNotification)
Adds the givenStatusBarNotification
to the list of active Notifications.String
addActiveNotification(String packageName, int id, Notification notification)
Adds the givenNotification
to the list of active Notifications.protected void
cancelAllNotifications()
protected void
cancelNotification(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 int
getCurrentInterruptionFilter()
protected int
getCurrentListenerHints()
protected NotificationListenerService.RankingMap
getCurrentRanking()
static int
getRebindRequestCount()
Returns the number of times rebind was requested.int
getUnbindRequestCount()
Returns the number of times unbind was requested.protected void
requestInterruptionFilter(int interruptionFilter)
protected void
requestListenerHints(int hint)
protected static void
requestRebind(ComponentName componentName)
protected void
requestUnbind()
static void
reset()
Resets this shadow instance.Methods inherited from class org.robolectric.shadows.ShadowService
getLastForegroundNotification, getLastForegroundNotificationId, getNotificationShouldRemoved, getStopSelfId, getStopSelfResultId, isForegroundStopped, isLastForegroundNotificationAttached, isStoppedBySelf, onDestroy, startForeground, stopForeground, stopForeground, stopSelf, stopSelf, stopSelfResult
Methods 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 givenNotification
to the list of active Notifications. A correspondingStatusBarNotification
will be generated from this Notification, which will be included in the result ofNotificationListenerService.getActiveNotifications()
.- Returns:
- the key of the generated
StatusBarNotification
-
addActiveNotification
Adds the givenStatusBarNotification
to the list of active Notifications. The givenStatusBarNotification
will 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.
-