summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationLogger.java13
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/ExpansionStateLoggerTest.java24
2 files changed, 35 insertions, 2 deletions
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 35b7ef42177d..5e5241910e7f 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
@@ -39,7 +39,6 @@ import com.android.systemui.statusbar.StatusBarStateController.StateListener;
import com.android.systemui.statusbar.notification.NotificationEntryListener;
import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
-import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.stack.ExpandableViewState;
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
import com.android.systemui.statusbar.policy.HeadsUpManager;
@@ -221,6 +220,11 @@ public class NotificationLogger implements StateListener {
}
@Override
+ public void onEntryReinflated(NotificationEntry entry) {
+ mExpansionStateLogger.onEntryReinflated(entry.key);
+ }
+
+ @Override
public void onInflationError(
StatusBarNotification notification,
Exception exception) {
@@ -468,6 +472,13 @@ public class NotificationLogger implements StateListener {
mLoggedExpansionState.remove(key);
}
+ @VisibleForTesting
+ void onEntryReinflated(String key) {
+ // When the notification is updated, we should consider the notification as not
+ // yet logged.
+ mLoggedExpansionState.remove(key);
+ }
+
private State getState(String key) {
State state = mExpansionStates.get(key);
if (state == null) {
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 5ff9d1490f3a..f1d900332607 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
@@ -15,10 +15,10 @@
*/
package com.android.systemui.statusbar.notification.logging;
-import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import android.os.RemoteException;
@@ -31,6 +31,7 @@ import com.android.internal.statusbar.NotificationVisibility;
import com.android.systemui.Dependency;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.UiOffloadThread;
+import com.android.systemui.statusbar.notification.stack.ExpandableViewState;
import org.junit.Before;
import org.junit.Test;
@@ -155,6 +156,27 @@ public class ExpansionStateLoggerTest extends SysuiTestCase {
NotificationVisibility.NotificationLocation.LOCATION_UNKNOWN.toMetricsEventEnum());
}
+ @Test
+ public void testOnEntryReinflated() throws RemoteException {
+ mLogger.onExpansionChanged(NOTIFICATION_KEY, true, true,
+ NotificationVisibility.NotificationLocation.LOCATION_UNKNOWN);
+ mLogger.onVisibilityChanged(
+ Collections.singletonList(createNotificationVisibility(NOTIFICATION_KEY, true)),
+ Collections.emptyList());
+ waitForUiOffloadThread();
+ verify(mBarService).onNotificationExpansionChanged(
+ NOTIFICATION_KEY, true, true, ExpandableViewState.LOCATION_UNKNOWN);
+
+ mLogger.onEntryReinflated(NOTIFICATION_KEY);
+ mLogger.onVisibilityChanged(
+ Collections.singletonList(createNotificationVisibility(NOTIFICATION_KEY, true)),
+ Collections.emptyList());
+ waitForUiOffloadThread();
+ // onNotificationExpansionChanged is called the second time.
+ verify(mBarService, times(2)).onNotificationExpansionChanged(
+ NOTIFICATION_KEY, true, true, ExpandableViewState.LOCATION_UNKNOWN);
+ }
+
private NotificationVisibility createNotificationVisibility(String key, boolean visibility) {
return createNotificationVisibility(key, visibility,
NotificationVisibility.NotificationLocation.LOCATION_UNKNOWN);