Zen: Simplify notification policy api, add zenmode api.

 - Remove the concept of a notification policy management token
   in favor of a simple grant/deny per app.  Currently, all requests
   are immediately granted.
 - Add zen mode getter/setting, limit to apps that have been granted
   policy access.
 - Add intent for zen mode changes.
 - Public name for zen mode = "interruption filter", moved from
   NotificationListenerService to NotificationManager.
 - Add settings metadata for new DND access Settings screen.
 - Add the split sender settings for calls vs messages to the public
   Policy api.
 - This change is meant to finalize the public api, persisting
   granted app status and showing the user-visible dialog will be
   done as followups.

Bug: 18298798
Change-Id: I511be98d69939f057c0c7dc1a6dfe63d1c468193
diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl
index ac8d5d8..63ff005 100644
--- a/core/java/android/app/INotificationManager.aidl
+++ b/core/java/android/app/INotificationManager.aidl
@@ -75,7 +75,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);
+    void setInterruptionFilter(String pkg, int interruptionFilter);
 
     ComponentName getEffectsSuppressor();
     boolean matchesCallFilter(in Bundle extras);
@@ -87,10 +87,13 @@
     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);
+    oneway void requestNotificationPolicyAccess(String pkg, in INotificationManagerCallback callback);
+    boolean isNotificationPolicyAccessGranted(String pkg);
+    NotificationManager.Policy getNotificationPolicy(String pkg);
+    void setNotificationPolicy(String pkg, in NotificationManager.Policy policy);
+    String[] getPackagesRequestingNotificationPolicyAccess();
+    boolean isNotificationPolicyAccessGrantedForPackage(String pkg);
+    void setNotificationPolicyAccessGranted(String pkg, boolean granted);
 
     byte[] getBackupPayload(int user);
     void applyRestore(in byte[] payload, int user);