diff options
Diffstat (limited to 'core/java/android/service/notification/NotificationListenerService.java')
-rw-r--r-- | core/java/android/service/notification/NotificationListenerService.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java index fa782e4..cc7f880 100644 --- a/core/java/android/service/notification/NotificationListenerService.java +++ b/core/java/android/service/notification/NotificationListenerService.java @@ -21,6 +21,7 @@ import android.annotation.SdkConstant; import android.app.INotificationManager; import android.app.Notification; import android.app.Notification.Builder; +import android.app.NotificationManager.Policy; import android.app.Service; import android.content.ComponentName; import android.content.Context; @@ -501,6 +502,22 @@ public abstract class NotificationListenerService extends Service { } /** + * Gets the notification policy token associated with this listener. + * + * <p> + * Returns null if this listener is not currently active. + */ + public final Policy.Token getNotificationPolicyToken() { + if (!isBound()) return null; + try { + return getNotificationInterface().getPolicyTokenFromListener(mWrapper); + } catch (android.os.RemoteException ex) { + Log.v(TAG, "Unable to contact notification manager", ex); + return null; + } + } + + /** * Sets the desired {@link #getCurrentListenerHints() listener hints}. * * <p> |