From 807749301fcbda892dfc8a5832b19acf7d1cf53b Mon Sep 17 00:00:00 2001 From: John Spurlock Date: Thu, 7 May 2015 17:38:50 -0400 Subject: 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 --- api/current.txt | 41 ++++++++++++++++++++++------------------- api/system-current.txt | 41 ++++++++++++++++++++++------------------- 2 files changed, 44 insertions(+), 38 deletions(-) (limited to 'api') diff --git a/api/current.txt b/api/current.txt index cdc2404..d5b24c7 100644 --- a/api/current.txt +++ b/api/current.txt @@ -5145,17 +5145,31 @@ package android.app { method public void cancel(java.lang.String, int); method public void cancelAll(); method public android.service.notification.StatusBarNotification[] getActiveNotifications(); - method public android.app.NotificationManager.Policy getNotificationPolicy(android.app.NotificationManager.Policy.Token); - method public boolean isNotificationPolicyTokenValid(android.app.NotificationManager.Policy.Token); + method public final int getCurrentInterruptionFilter(); + method public android.app.NotificationManager.Policy getNotificationPolicy(); + method public boolean isNotificationPolicyAccessGranted(); method public void notify(int, android.app.Notification); method public void notify(java.lang.String, int, android.app.Notification); - method public void requestNotificationPolicyToken(android.app.NotificationManager.Policy.Token.RequestCallback, android.os.Handler); - method public void setNotificationPolicy(android.app.NotificationManager.Policy.Token, android.app.NotificationManager.Policy); + method public void requestPolicyAccess(android.app.NotificationManager.NotificationPolicyAccessRequestCallback, android.os.Handler); + method public final void setInterruptionFilter(int); + method public void setNotificationPolicy(android.app.NotificationManager.Policy); + field public static final java.lang.String ACTION_INTERRUPTION_FILTER_CHANGED = "android.app.action.INTERRUPTION_FILTER_CHANGED"; field public static final java.lang.String ACTION_NOTIFICATION_POLICY_CHANGED = "android.app.action.NOTIFICATION_POLICY_CHANGED"; + field public static final int INTERRUPTION_FILTER_ALARMS = 4; // 0x4 + field public static final int INTERRUPTION_FILTER_ALL = 1; // 0x1 + field public static final int INTERRUPTION_FILTER_NONE = 3; // 0x3 + field public static final int INTERRUPTION_FILTER_PRIORITY = 2; // 0x2 + field public static final int INTERRUPTION_FILTER_UNKNOWN = 0; // 0x0 + } + + public static abstract class NotificationManager.NotificationPolicyAccessRequestCallback { + ctor public NotificationManager.NotificationPolicyAccessRequestCallback(); + method public abstract void onAccessDenied(); + method public abstract void onAccessGranted(); } public static class NotificationManager.Policy implements android.os.Parcelable { - ctor public NotificationManager.Policy(int, int); + ctor public NotificationManager.Policy(int, int, int); method public int describeContents(); method public static java.lang.String priorityCategoriesToString(int); method public static java.lang.String prioritySendersToString(int); @@ -5169,20 +5183,9 @@ package android.app { field public static final int PRIORITY_SENDERS_ANY = 0; // 0x0 field public static final int PRIORITY_SENDERS_CONTACTS = 1; // 0x1 field public static final int PRIORITY_SENDERS_STARRED = 2; // 0x2 + field public final int priorityCallSenders; field public final int priorityCategories; - field public final int prioritySenders; - } - - public static class NotificationManager.Policy.Token implements android.os.Parcelable { - method public int describeContents(); - method public void writeToParcel(android.os.Parcel, int); - field public static final android.os.Parcelable.Creator CREATOR; - } - - public static abstract class NotificationManager.Policy.Token.RequestCallback { - ctor public NotificationManager.Policy.Token.RequestCallback(); - method public abstract void onTokenDenied(); - method public abstract void onTokenGranted(android.app.NotificationManager.Policy.Token); + field public final int priorityMessageSenders; } public final class PendingIntent implements android.os.Parcelable { @@ -26544,6 +26547,7 @@ package android.provider { field public static final java.lang.String ACTION_WIFI_IP_SETTINGS = "android.settings.WIFI_IP_SETTINGS"; field public static final java.lang.String ACTION_WIFI_SETTINGS = "android.settings.WIFI_SETTINGS"; field public static final java.lang.String ACTION_WIRELESS_SETTINGS = "android.settings.WIRELESS_SETTINGS"; + field public static final java.lang.String ACTION_ZEN_ACCESS_SETTINGS = "android.settings.ZEN_ACCESS_SETTINGS"; field public static final java.lang.String AUTHORITY = "settings"; field public static final java.lang.String EXTRA_ACCOUNT_TYPES = "account_types"; field public static final java.lang.String EXTRA_AIRPLANE_MODE_ENABLED = "airplane_mode_enabled"; @@ -28843,7 +28847,6 @@ package android.service.notification { method public final int getCurrentInterruptionFilter(); method public final int getCurrentListenerHints(); method public android.service.notification.NotificationListenerService.RankingMap getCurrentRanking(); - method public final android.app.NotificationManager.Policy.Token getNotificationPolicyToken(); method public android.os.IBinder onBind(android.content.Intent); method public void onInterruptionFilterChanged(int); method public void onListenerConnected(); diff --git a/api/system-current.txt b/api/system-current.txt index 7012773..458cfbb 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -5237,17 +5237,31 @@ package android.app { method public void cancel(java.lang.String, int); method public void cancelAll(); method public android.service.notification.StatusBarNotification[] getActiveNotifications(); - method public android.app.NotificationManager.Policy getNotificationPolicy(android.app.NotificationManager.Policy.Token); - method public boolean isNotificationPolicyTokenValid(android.app.NotificationManager.Policy.Token); + method public final int getCurrentInterruptionFilter(); + method public android.app.NotificationManager.Policy getNotificationPolicy(); + method public boolean isNotificationPolicyAccessGranted(); method public void notify(int, android.app.Notification); method public void notify(java.lang.String, int, android.app.Notification); - method public void requestNotificationPolicyToken(android.app.NotificationManager.Policy.Token.RequestCallback, android.os.Handler); - method public void setNotificationPolicy(android.app.NotificationManager.Policy.Token, android.app.NotificationManager.Policy); + method public void requestPolicyAccess(android.app.NotificationManager.NotificationPolicyAccessRequestCallback, android.os.Handler); + method public final void setInterruptionFilter(int); + method public void setNotificationPolicy(android.app.NotificationManager.Policy); + field public static final java.lang.String ACTION_INTERRUPTION_FILTER_CHANGED = "android.app.action.INTERRUPTION_FILTER_CHANGED"; field public static final java.lang.String ACTION_NOTIFICATION_POLICY_CHANGED = "android.app.action.NOTIFICATION_POLICY_CHANGED"; + field public static final int INTERRUPTION_FILTER_ALARMS = 4; // 0x4 + field public static final int INTERRUPTION_FILTER_ALL = 1; // 0x1 + field public static final int INTERRUPTION_FILTER_NONE = 3; // 0x3 + field public static final int INTERRUPTION_FILTER_PRIORITY = 2; // 0x2 + field public static final int INTERRUPTION_FILTER_UNKNOWN = 0; // 0x0 + } + + public static abstract class NotificationManager.NotificationPolicyAccessRequestCallback { + ctor public NotificationManager.NotificationPolicyAccessRequestCallback(); + method public abstract void onAccessDenied(); + method public abstract void onAccessGranted(); } public static class NotificationManager.Policy implements android.os.Parcelable { - ctor public NotificationManager.Policy(int, int); + ctor public NotificationManager.Policy(int, int, int); method public int describeContents(); method public static java.lang.String priorityCategoriesToString(int); method public static java.lang.String prioritySendersToString(int); @@ -5261,20 +5275,9 @@ package android.app { field public static final int PRIORITY_SENDERS_ANY = 0; // 0x0 field public static final int PRIORITY_SENDERS_CONTACTS = 1; // 0x1 field public static final int PRIORITY_SENDERS_STARRED = 2; // 0x2 + field public final int priorityCallSenders; field public final int priorityCategories; - field public final int prioritySenders; - } - - public static class NotificationManager.Policy.Token implements android.os.Parcelable { - method public int describeContents(); - method public void writeToParcel(android.os.Parcel, int); - field public static final android.os.Parcelable.Creator CREATOR; - } - - public static abstract class NotificationManager.Policy.Token.RequestCallback { - ctor public NotificationManager.Policy.Token.RequestCallback(); - method public abstract void onTokenDenied(); - method public abstract void onTokenGranted(android.app.NotificationManager.Policy.Token); + field public final int priorityMessageSenders; } public final class PendingIntent implements android.os.Parcelable { @@ -28557,6 +28560,7 @@ package android.provider { field public static final java.lang.String ACTION_WIFI_IP_SETTINGS = "android.settings.WIFI_IP_SETTINGS"; field public static final java.lang.String ACTION_WIFI_SETTINGS = "android.settings.WIFI_SETTINGS"; field public static final java.lang.String ACTION_WIRELESS_SETTINGS = "android.settings.WIRELESS_SETTINGS"; + field public static final java.lang.String ACTION_ZEN_ACCESS_SETTINGS = "android.settings.ZEN_ACCESS_SETTINGS"; field public static final java.lang.String AUTHORITY = "settings"; field public static final java.lang.String EXTRA_ACCOUNT_TYPES = "account_types"; field public static final java.lang.String EXTRA_AIRPLANE_MODE_ENABLED = "airplane_mode_enabled"; @@ -30897,7 +30901,6 @@ package android.service.notification { method public final int getCurrentInterruptionFilter(); method public final int getCurrentListenerHints(); method public android.service.notification.NotificationListenerService.RankingMap getCurrentRanking(); - method public final android.app.NotificationManager.Policy.Token getNotificationPolicyToken(); method public android.os.IBinder onBind(android.content.Intent); method public void onInterruptionFilterChanged(int); method public void onListenerConnected(); -- cgit v1.1