summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorJulia Reynolds <juliacr@google.com>2018-07-13 13:38:34 -0400
committerJulia Reynolds <juliacr@google.com>2018-07-31 16:07:20 -0400
commit70aaea7bb23feff2207ae4cc4627cae62079be7f (patch)
tree4df0be31345d3a619cf4ad4118708314e0201e16 /core/java/android
parentc436cea87b07bffa550a004638ea4bf78ea3d13a (diff)
Limit cross user adjustments from assistants.
All NotificationListenerService callbacks and methods will still work for managed profiles, but NotificationAssistantServices must operate within their current user. Fixes: 111429721 Test: runtest systemui-notification Change-Id: I9747db80f986e172e309f8f17559c943ce265c76
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/service/notification/NotificationAssistantService.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/core/java/android/service/notification/NotificationAssistantService.java b/core/java/android/service/notification/NotificationAssistantService.java
index 18e0ab00a78b..81889c11cc9c 100644
--- a/core/java/android/service/notification/NotificationAssistantService.java
+++ b/core/java/android/service/notification/NotificationAssistantService.java
@@ -19,6 +19,8 @@ package android.service.notification;
import android.annotation.SdkConstant;
import android.annotation.SystemApi;
import android.annotation.TestApi;
+import android.app.admin.DevicePolicyManager;
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
@@ -34,6 +36,22 @@ import java.util.List;
/**
* A service that helps the user manage notifications.
+ * <p>
+ * Only one notification assistant can be active at a time. Unlike notification listener services,
+ * assistant services can additionally modify certain aspects about notifications
+ * (see {@link Adjustment}) before they are posted.
+ *<p>
+ * A note about managed profiles: Unlike {@link NotificationListenerService listener services},
+ * NotificationAssistantServices are allowed to run in managed profiles
+ * (see {@link DevicePolicyManager#isManagedProfile(ComponentName)}), so they can access the
+ * information they need to create good {@link Adjustment adjustments}. To maintain the contract
+ * with {@link NotificationListenerService}, an assistant service will receive all of the
+ * callbacks from {@link NotificationListenerService} for the current user, managed profiles of
+ * that user, and ones that affect all users. However,
+ * {@link #onNotificationEnqueued(StatusBarNotification)} will only be called for notifications
+ * sent to the current user, and {@link Adjustment adjuments} will only be accepted for the
+ * current user.
+ *
* @hide
*/
@SystemApi