summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Beverly <beverlyt@google.com> 2019-11-06 14:20:29 -0500
committer Beverly Tai <beverlyt@google.com> 2019-11-06 21:28:06 +0000
commite018f0d8d046e74c58d973393458f3124bf4b86d (patch)
tree65fe387f3f24f7ce5d907ff380c3c374d5f4dc95
parent07a945d97bc49a57b7cc32abcceaadc3363a6e77 (diff)
Use onPreEntryUpdated instead of onPostEntryUpdated
Many of the registered entryListeners don't actually care whether filtering has occured or not yet, so they should use the onPreEntryUpdated callback to better align with the future notification pipeline. Test: atest SystemUITests Change-Id: I9faeb51700631eb839910454f4133e2cc79202dd
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationAlertingManager.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java13
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationLogger.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java8
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/ExpansionStateLoggerTest.java4
5 files changed, 15 insertions, 22 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationAlertingManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationAlertingManager.java
index 005f01dc8df0..65f3fa94374b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationAlertingManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationAlertingManager.java
@@ -71,7 +71,7 @@ public class NotificationAlertingManager {
}
@Override
- public void onPostEntryUpdated(NotificationEntry entry) {
+ public void onPreEntryUpdated(NotificationEntry entry) {
updateAlertState(entry);
}
@@ -114,8 +114,8 @@ public class NotificationAlertingManager {
private void updateAlertState(NotificationEntry entry) {
boolean alertAgain = alertAgain(entry, entry.getSbn().getNotification());
- boolean shouldAlert;
- shouldAlert = mNotificationInterruptionStateProvider.shouldHeadsUp(entry);
+ // includes check for whether this notification should be filtered:
+ boolean shouldAlert = mNotificationInterruptionStateProvider.shouldHeadsUp(entry);
final boolean wasAlerting = mHeadsUpManager.isAlerting(entry.getKey());
if (wasAlerting) {
if (shouldAlert) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java
index 1daf48492ea0..1b57308f1c0f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java
@@ -69,20 +69,13 @@ public class VisualStabilityManager implements OnHeadsUpChangedListener, Dumpabl
notificationEntryManager.addNotificationEntryListener(new NotificationEntryListener() {
@Override
public void onPreEntryUpdated(NotificationEntry entry) {
- final boolean mAmbientStateHasChanged =
+ final boolean ambientStateHasChanged =
entry.isAmbient() != entry.getRow().isLowPriority();
- if (mAmbientStateHasChanged) {
+ if (ambientStateHasChanged) {
+ // note: entries are removed in onReorderingFinished
mLowPriorityReorderingViews.add(entry);
}
}
-
- @Override
- public void onPostEntryUpdated(NotificationEntry entry) {
- // This line is technically not required as we'll get called as the hierarchy
- // manager will call onReorderingFinished() immediately before this.
- // TODO: Find a way to make this relationship more explicit
- mLowPriorityReorderingViews.remove(entry);
- }
});
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationLogger.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationLogger.java
index b7f408ebe557..90c5502bd119 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationLogger.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationLogger.java
@@ -220,8 +220,8 @@ public class NotificationLogger implements StateListener {
}
@Override
- public void onEntryReinflated(NotificationEntry entry) {
- mExpansionStateLogger.onEntryReinflated(entry.getKey());
+ public void onPreEntryUpdated(NotificationEntry entry) {
+ mExpansionStateLogger.onEntryUpdated(entry.getKey());
}
@Override
@@ -480,7 +480,7 @@ public class NotificationLogger implements StateListener {
}
@VisibleForTesting
- void onEntryReinflated(String key) {
+ void onEntryUpdated(String key) {
// When the notification is updated, we should consider the notification as not
// yet logged.
mLoggedExpansionState.remove(key);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
index 2b9912ce055d..66843996c46a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
@@ -604,10 +604,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
mEntryManager.addNotificationEntryListener(new NotificationEntryListener() {
@Override
- public void onPostEntryUpdated(NotificationEntry entry) {
- if (!entry.getSbn().isClearable()) {
- // The user may have performed a dismiss action on the notification, since it's
- // not clearable we should snap it back.
+ public void onPreEntryUpdated(NotificationEntry entry) {
+ if (entry.rowExists() && !entry.getSbn().isClearable()) {
+ // If the row already exists, the user may have performed a dismiss action on
+ // the notification. Since it's not clearable we should snap it back.
snapViewIfNeeded(entry);
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/ExpansionStateLoggerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/ExpansionStateLoggerTest.java
index 2b343c21fc8f..4f1ffbe50fc1 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/ExpansionStateLoggerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/ExpansionStateLoggerTest.java
@@ -158,7 +158,7 @@ public class ExpansionStateLoggerTest extends SysuiTestCase {
}
@Test
- public void testOnEntryReinflated() throws RemoteException {
+ public void testOnEntryUpdated() throws RemoteException {
mLogger.onExpansionChanged(NOTIFICATION_KEY, true, true,
NotificationVisibility.NotificationLocation.LOCATION_UNKNOWN);
mLogger.onVisibilityChanged(
@@ -168,7 +168,7 @@ public class ExpansionStateLoggerTest extends SysuiTestCase {
verify(mBarService).onNotificationExpansionChanged(
NOTIFICATION_KEY, true, true, ExpandableViewState.LOCATION_UNKNOWN);
- mLogger.onEntryReinflated(NOTIFICATION_KEY);
+ mLogger.onEntryUpdated(NOTIFICATION_KEY);
mLogger.onVisibilityChanged(
Collections.singletonList(createNotificationVisibility(NOTIFICATION_KEY, true)),
Collections.emptyList());