diff options
| author | Lyn Han <lynhan@google.com> | 2019-08-13 16:07:55 -0700 |
|---|---|---|
| committer | Julia Reynolds <juliacr@google.com> | 2019-09-18 10:05:50 -0400 |
| commit | 405e0b705eea943dea9daa58d5a1b9c191472701 (patch) | |
| tree | cf15e22705ac67aeb41eb54c0d0262cfe3fc0f5a /core/java | |
| parent | 1d35b3cd99fe376961e4787af4ff0472c630cc8d (diff) | |
Dedup smart reply updates for bubble flyout
Smart reply updates are not visually interruptive and bubbles should not
show flyout for them, since flyout text remains the same.
1) Modify NoMan.isVisuallyInterruptive to skip evaluation of fields
irrelevant to bubbles
2) Modify NotificationComparator to rank interruptive notifs higher
3) Pipe bool (isInterruptive) from system_process to SysUI
NoMan --- set bool on notif record and ranking
Ranking --- parcel bool for cross-process transport
SysUI notif entry --- get bool from ranking
SysUI bubble data --- on notif entry update, suppress flyout if isInterruptive=false
Considered adding "isInterruptive" bool to StatusBarNotification.
Did not because "visually-interruptive" is additional information that the
system figured out and SBNs should be limited to info from the app.
4) NoMan --- schedule ranking update if interruptive changes for bubble
Fixes: 138755533
Test: manual - send one sms => flyout appears once
Test: manual - send multiple sms in a row => flyout appears for each one
Test: atest FrameworksUiServicesTests
Test: atest NotificationComparatorTest
Test: atest SystemUITests
Change-Id: Id4b855054689ee73a109bb7cd18004531b41f28c
(cherry picked from commit 0dddc61824d091e48962e36939828cae3cde2aa9)
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/service/notification/NotificationListenerService.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java index 78e30ab8cdc3..85f13d552fcf 100644 --- a/core/java/android/service/notification/NotificationListenerService.java +++ b/core/java/android/service/notification/NotificationListenerService.java @@ -1522,6 +1522,7 @@ public abstract class NotificationListenerService extends Service { private ArrayList<Notification.Action> mSmartActions; private ArrayList<CharSequence> mSmartReplies; private boolean mCanBubble; + private boolean mVisuallyInterruptive; private static final int PARCEL_VERSION = 2; @@ -1553,6 +1554,7 @@ public abstract class NotificationListenerService extends Service { out.writeTypedList(mSmartActions, flags); out.writeCharSequenceList(mSmartReplies); out.writeBoolean(mCanBubble); + out.writeBoolean(mVisuallyInterruptive); } /** @hide */ @@ -1585,6 +1587,7 @@ public abstract class NotificationListenerService extends Service { mSmartActions = in.createTypedArrayList(Notification.Action.CREATOR); mSmartReplies = in.readCharSequenceList(); mCanBubble = in.readBoolean(); + mVisuallyInterruptive = in.readBoolean(); } @@ -1772,6 +1775,11 @@ public abstract class NotificationListenerService extends Service { } /** @hide */ + public boolean visuallyInterruptive() { + return mVisuallyInterruptive; + } + + /** @hide */ public boolean isNoisy() { return mNoisy; } @@ -1787,7 +1795,8 @@ public abstract class NotificationListenerService extends Service { ArrayList<SnoozeCriterion> snoozeCriteria, boolean showBadge, int userSentiment, boolean hidden, long lastAudiblyAlertedMs, boolean noisy, ArrayList<Notification.Action> smartActions, - ArrayList<CharSequence> smartReplies, boolean canBubble) { + ArrayList<CharSequence> smartReplies, boolean canBubble, + boolean visuallyInterruptive) { mKey = key; mRank = rank; mIsAmbient = importance < NotificationManager.IMPORTANCE_LOW; @@ -1808,6 +1817,7 @@ public abstract class NotificationListenerService extends Service { mSmartActions = smartActions; mSmartReplies = smartReplies; mCanBubble = canBubble; + mVisuallyInterruptive = visuallyInterruptive; } /** @@ -1832,7 +1842,8 @@ public abstract class NotificationListenerService extends Service { other.mNoisy, other.mSmartActions, other.mSmartReplies, - other.mCanBubble); + other.mCanBubble, + other.mVisuallyInterruptive); } /** |
