Class ShadowNotificationListenerService


@Implements(value=android.service.notification.NotificationListenerService.class, minSdk=21) public class ShadowNotificationListenerService extends ShadowService
Shadow implementation of NotificationListenerService.
  • Constructor Details

    • ShadowNotificationListenerService

      public ShadowNotificationListenerService()
  • Method Details

    • addActiveNotification

      public String addActiveNotification(String packageName, int id, Notification notification)
      Adds the given Notification to the list of active Notifications. A corresponding StatusBarNotification will be generated from this Notification, which will be included in the result of NotificationListenerService.getActiveNotifications().
      Returns:
      the key of the generated StatusBarNotification
    • addActiveNotification

      public String addActiveNotification(StatusBarNotification statusBarNotification)
      Adds the given StatusBarNotification to the list of active Notifications. The given StatusBarNotification will be included in the result of NotificationListenerService.getActiveNotifications().
      Returns:
      the key of the given StatusBarNotification
    • requestRebind

      @Implementation(minSdk=24) protected static void requestRebind(ComponentName componentName)
    • requestUnbind

      @Implementation(minSdk=24) protected void requestUnbind()
    • cancelAllNotifications

      @Implementation protected final void cancelAllNotifications()
    • cancelNotification

      @Implementation protected final void cancelNotification(String key)
    • getActiveNotifications

      @Implementation protected StatusBarNotification[] getActiveNotifications(String[] keys, int trim)
      Returns zero or more notifications, added by addActiveNotification(java.lang.String, int, android.app.Notification), that match one of the provided keys.
      Parameters:
      keys - the keys to match
      trim - ignored, trimming is not supported
    • requestInterruptionFilter

      @Implementation protected void requestInterruptionFilter(int interruptionFilter)
    • getCurrentInterruptionFilter

      @Implementation protected int getCurrentInterruptionFilter()
    • requestListenerHints

      @Implementation protected void requestListenerHints(int hint)
    • getCurrentListenerHints

      @Implementation protected int getCurrentListenerHints()
    • getCurrentRanking

      @Implementation protected NotificationListenerService.RankingMap 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

      @Resetter public static void reset()
      Resets this shadow instance.