diff options
| -rw-r--r-- | services/core/java/com/android/server/notification/NotificationIntrusivenessExtractor.java | 6 | ||||
| -rw-r--r-- | services/core/java/com/android/server/notification/NotificationRecord.java | 8 |
2 files changed, 13 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/notification/NotificationIntrusivenessExtractor.java b/services/core/java/com/android/server/notification/NotificationIntrusivenessExtractor.java index f92bf3dd4427..4981d5c5731f 100644 --- a/services/core/java/com/android/server/notification/NotificationIntrusivenessExtractor.java +++ b/services/core/java/com/android/server/notification/NotificationIntrusivenessExtractor.java @@ -66,7 +66,11 @@ public class NotificationIntrusivenessExtractor implements NotificationSignalExt @Override public void applyChangesLocked(NotificationRecord record) { - record.setRecentlyIntrusive(false); + // there will be another reconsideration in the message queue HANG_TIME_MS + // from each time this record alerts, which can finally clear this flag. + if ((System.currentTimeMillis() - record.getLastIntrusive()) >= HANG_TIME_MS) { + record.setRecentlyIntrusive(false); + } } }; } diff --git a/services/core/java/com/android/server/notification/NotificationRecord.java b/services/core/java/com/android/server/notification/NotificationRecord.java index 90257daae453..f019a5ce00ea 100644 --- a/services/core/java/com/android/server/notification/NotificationRecord.java +++ b/services/core/java/com/android/server/notification/NotificationRecord.java @@ -85,6 +85,7 @@ public final class NotificationRecord { // to communicate with the ranking module. private float mContactAffinity; private boolean mRecentlyIntrusive; + private long mLastIntrusive; // is this notification currently being intercepted by Zen Mode? private boolean mIntercept; @@ -515,12 +516,19 @@ public final class NotificationRecord { public void setRecentlyIntrusive(boolean recentlyIntrusive) { mRecentlyIntrusive = recentlyIntrusive; + if (recentlyIntrusive) { + mLastIntrusive = System.currentTimeMillis(); + } } public boolean isRecentlyIntrusive() { return mRecentlyIntrusive; } + public long getLastIntrusive() { + return mLastIntrusive; + } + public void setPackagePriority(int packagePriority) { mPackagePriority = packagePriority; } |