From 7276e63f4c62e37cae1540c928d5f07d7da52a7d Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Thu, 29 Mar 2018 15:22:59 -0400 Subject: [PATCH 1/2] Wait before computing contact affinity Instead of assuming we'll have an answer as soon as the handler gets around to handling the rankingreconsideration. Change-Id: Id8f2147f59abf6435d869b9ffcc5cf2c2b52f0f7 Fixes: 73010730 Test: cts-verifier --- .../server/notification/ValidateNotificationPeople.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/notification/ValidateNotificationPeople.java b/services/core/java/com/android/server/notification/ValidateNotificationPeople.java index c0c66b248ea5d..6cf8f86aed83f 100644 --- a/services/core/java/com/android/server/notification/ValidateNotificationPeople.java +++ b/services/core/java/com/android/server/notification/ValidateNotificationPeople.java @@ -468,12 +468,14 @@ public class ValidateNotificationPeople implements NotificationSignalExtractor { private final LinkedList mPendingLookups; private final Context mContext; + // Amount of time to wait for a result from the contacts db before rechecking affinity. + private static final long LOOKUP_TIME = 1000; private float mContactAffinity = NONE; private NotificationRecord mRecord; private PeopleRankingReconsideration(Context context, String key, LinkedList pendingLookups) { - super(key); + super(key, LOOKUP_TIME); mContext = context; mPendingLookups = pendingLookups; } From 8d2b053611fe4a52602c125bf1f577c12083848a Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Thu, 29 Mar 2018 15:44:13 -0400 Subject: [PATCH 2/2] Update notification blocking documentation. Change-Id: I3e5425321d127fbf11adfa1c4ac5bed53fc73e03 Fixes: 73750866 Test: make --- core/java/android/app/NotificationChannel.java | 6 +++++- core/java/android/app/NotificationChannelGroup.java | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/java/android/app/NotificationChannel.java b/core/java/android/app/NotificationChannel.java index 30f2697c1b1f0..4a7cf62356e34 100644 --- a/core/java/android/app/NotificationChannel.java +++ b/core/java/android/app/NotificationChannel.java @@ -463,7 +463,11 @@ public final class NotificationChannel implements Parcelable { /** * Returns the user specified importance e.g. {@link NotificationManager#IMPORTANCE_LOW} for - * notifications posted to this channel. + * notifications posted to this channel. Note: This value might be > + * {@link NotificationManager#IMPORTANCE_NONE}, but notifications posted to this channel will + * not be shown to the user if the parent {@link NotificationChannelGroup} or app is blocked. + * See {@link NotificationChannelGroup#isBlocked()} and + * {@link NotificationManager#areNotificationsEnabled()}. */ public int getImportance() { return mImportance; diff --git a/core/java/android/app/NotificationChannelGroup.java b/core/java/android/app/NotificationChannelGroup.java index 16166f7cf1cf7..0fa3c7fa6492f 100644 --- a/core/java/android/app/NotificationChannelGroup.java +++ b/core/java/android/app/NotificationChannelGroup.java @@ -145,7 +145,9 @@ public final class NotificationChannelGroup implements Parcelable { /** * Returns whether or not notifications posted to {@link NotificationChannel channels} belonging - * to this group are blocked. + * to this group are blocked. This value is independent of + * {@link NotificationManager#areNotificationsEnabled()} and + * {@link NotificationChannel#getImportance()}. */ public boolean isBlocked() { return mBlocked;