From fe992198c11264f0ac2e857d6d6d53b3f4b4011f Mon Sep 17 00:00:00 2001
From: Julia Reynolds
Date: Fri, 7 Sep 2018 10:33:19 -0400
Subject: [PATCH] Add documentation about threading.
Change-Id: I8e0df7398f464cc829a83012f2ab6ee6441d0e4c
Fixes: 112249346
Test: make
---
.../service/notification/NotificationAssistantService.java | 3 +++
.../service/notification/NotificationListenerService.java | 4 ++++
2 files changed, 7 insertions(+)
diff --git a/core/java/android/service/notification/NotificationAssistantService.java b/core/java/android/service/notification/NotificationAssistantService.java
index 3b820ca1e165e..26240c5728988 100644
--- a/core/java/android/service/notification/NotificationAssistantService.java
+++ b/core/java/android/service/notification/NotificationAssistantService.java
@@ -52,6 +52,9 @@ import java.util.List;
* {@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.
+ *
+ * All callbacks are called on the main thread.
+ *
*
* @hide
*/
diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java
index 1b588f470971d..d9ed2aafc9cdb 100644
--- a/core/java/android/service/notification/NotificationListenerService.java
+++ b/core/java/android/service/notification/NotificationListenerService.java
@@ -91,6 +91,10 @@ import java.util.List;
* notification listeners running in a work profile. A
* {@link android.app.admin.DevicePolicyManager} might block notifications originating from a work
* profile.
+ *
+ * From {@link Build.VERSION_CODES#N} onward all callbacks are called on the main thread. Prior
+ * to N, there is no guarantee on what thread the callback will happen.
+ *
*/
public abstract class NotificationListenerService extends Service {