summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Omar Miatello <omarmt@google.com> 2023-06-30 09:38:09 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2023-06-30 09:38:09 +0000
commitc38b6c3e1e68ae74f03f57a6fdf629531757e7f2 (patch)
treeac8dd3fd0266f5ff12ffb49ec096cf6224f377dd
parentb5087269ffdafe83b48bd5716ff3a2f8f73a2d34 (diff)
parent3620213c626b2f415d913e13803cd822cd887997 (diff)
Merge "Fix notifications wrong corners after "clear all"" into udc-dev am: 3620213c62
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23793183 Change-Id: Ib6bf71bfa4c2388d40d38aaa9fb123b6428e426d Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java6
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutControllerTest.java31
2 files changed, 35 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java
index 9272c376d4fe..11ba753643ac 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java
@@ -411,7 +411,8 @@ public class NotificationStackScrollLayoutController {
}
};
- private final NotificationSwipeHelper.NotificationCallback mNotificationCallback =
+ @VisibleForTesting
+ final NotificationSwipeHelper.NotificationCallback mNotificationCallback =
new NotificationSwipeHelper.NotificationCallback() {
@Override
@@ -470,10 +471,11 @@ public class NotificationStackScrollLayoutController {
*/
public void handleChildViewDismissed(View view) {
+ // The View needs to clean up the Swipe states, e.g. roundness.
+ mView.onSwipeEnd();
if (mView.getClearAllInProgress()) {
return;
}
- mView.onSwipeEnd();
if (view instanceof ExpandableNotificationRow) {
ExpandableNotificationRow row = (ExpandableNotificationRow) view;
if (row.isHeadsUp()) {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutControllerTest.java
index 02666e40b98d..cd0550e13540 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutControllerTest.java
@@ -74,6 +74,7 @@ import com.android.systemui.statusbar.notification.collection.render.SectionHead
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController.NotificationPanelEvent;
+import com.android.systemui.statusbar.notification.stack.NotificationSwipeHelper.NotificationCallback;
import com.android.systemui.statusbar.notification.stack.ui.viewmodel.NotificationListViewModel;
import com.android.systemui.statusbar.phone.CentralSurfaces;
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
@@ -339,6 +340,36 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase {
}
@Test
+ public void callSwipeCallbacksDuringClearAll() {
+ initController(/* viewIsAttached= */ true);
+ ExpandableNotificationRow row = mock(ExpandableNotificationRow.class);
+ NotificationCallback notificationCallback = mController.mNotificationCallback;
+
+ when(mNotificationStackScrollLayout.getClearAllInProgress()).thenReturn(true);
+
+ notificationCallback.onBeginDrag(row);
+ verify(mNotificationStackScrollLayout).onSwipeBegin(row);
+
+ notificationCallback.handleChildViewDismissed(row);
+ verify(mNotificationStackScrollLayout).onSwipeEnd();
+ }
+
+ @Test
+ public void callSwipeCallbacksDuringClearNotification() {
+ initController(/* viewIsAttached= */ true);
+ ExpandableNotificationRow row = mock(ExpandableNotificationRow.class);
+ NotificationCallback notificationCallback = mController.mNotificationCallback;
+
+ when(mNotificationStackScrollLayout.getClearAllInProgress()).thenReturn(false);
+
+ notificationCallback.onBeginDrag(row);
+ verify(mNotificationStackScrollLayout).onSwipeBegin(row);
+
+ notificationCallback.handleChildViewDismissed(row);
+ verify(mNotificationStackScrollLayout).onSwipeEnd();
+ }
+
+ @Test
public void testOnMenuClickedLogging() {
ExpandableNotificationRow row = mock(ExpandableNotificationRow.class, RETURNS_DEEP_STUBS);
when(row.getEntry().getSbn().getLogMaker()).thenReturn(new LogMaker(