Zen: Add notification policy management api.

 - Allow apps to read and modify notification policy (currently
   which items are prioritized in "priority only" mode), but only
   after they've been granted access by noman.
 - Access to read/modify notification policy requires a token provided
   by noman.  Enabled notification listeners are automatically given
   tokens (new getter on NLS), but any other app can also request them.
 - Currently, all requests are granted.
 - Also add a new change intent when the public policy changes.

Bug: 18541928
Change-Id: I482d1c39852d0d961931515e0f0e059a8faee4ed
diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl
index e2230da..913159a 100644
--- a/core/java/android/app/INotificationManager.aidl
+++ b/core/java/android/app/INotificationManager.aidl
@@ -17,8 +17,10 @@
 
 package android.app;
 
+import android.app.INotificationManagerCallback;
 import android.app.ITransientNotification;
 import android.app.Notification;
+import android.app.NotificationManager;
 import android.content.ComponentName;
 import android.content.Intent;
 import android.content.pm.ParceledListSlice;
@@ -71,6 +73,7 @@
     void requestInterruptionFilterFromListener(in INotificationListener token, int interruptionFilter);
     int getInterruptionFilterFromListener(in INotificationListener token);
     void setOnNotificationPostedTrimFromListener(in INotificationListener token, int trim);
+    NotificationManager.Policy.Token getPolicyTokenFromListener(in INotificationListener listener);
 
     ComponentName getEffectsSuppressor();
     boolean matchesCallFilter(in Bundle extras);
@@ -82,4 +85,8 @@
     oneway void setZenMode(int mode, in Uri conditionId, String reason);
     oneway void notifyConditions(String pkg, in IConditionProvider provider, in Condition[] conditions);
     oneway void requestZenModeConditions(in IConditionListener callback, int relevance);
+    oneway void requestNotificationPolicyToken(String pkg, in INotificationManagerCallback callback);
+    boolean isNotificationPolicyTokenValid(String pkg, in NotificationManager.Policy.Token token);
+    NotificationManager.Policy getNotificationPolicy(in NotificationManager.Policy.Token token);
+    void setNotificationPolicy(in NotificationManager.Policy.Token token, in NotificationManager.Policy policy);
 }