From 94a2d6b58bf3164b59149a0ec4a9ca8f5f856f81 Mon Sep 17 00:00:00 2001 From: Beverly Date: Mon, 18 May 2020 17:01:53 -0400 Subject: [PATCH] Check unmagnified coordinates to close notif guts To determine whether touches are inside a notification view, use the unmagnified coordinates since we aren't scaling the view's size. Test: manual 1. enable magnification a11y service 2. look at notification shade with notifications 3. magnify a notification 4. longpress on notification to see its interruptive settings 5. change the interruptive setting (observe the guts don't close instantly upon changing the option, so user is able to still apply new interruptive settings) Test: atest NotificationSwipeHelperTest Fixes: 146316350 Change-Id: I5ce20763f18412f33310ca5cc547debbe94dbe97 --- .../notification/stack/NotificationSwipeHelper.java | 4 ++-- .../stack/NotificationSwipeHelperTest.java | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java index 6c0655e7e3b32..d7d09e05c2386 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java @@ -426,8 +426,8 @@ class NotificationSwipeHelper extends SwipeHelper implements NotificationSwipeAc final int height = (view instanceof ExpandableView) ? ((ExpandableView) view).getActualHeight() : view.getHeight(); - final int rx = (int) ev.getRawX(); - final int ry = (int) ev.getRawY(); + final int rx = (int) ev.getX(); + final int ry = (int) ev.getY(); int[] temp = new int[2]; view.getLocationOnScreen(temp); final int x = temp[0]; diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java index 06a2eecd208cb..323d8bd9d2e6a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java @@ -436,8 +436,8 @@ public class NotificationSwipeHelperTest extends SysuiTestCase { assertEquals("returns false when view is null", false, NotificationSwipeHelper.isTouchInView(mEvent, null)); - doReturn(5f).when(mEvent).getRawX(); - doReturn(10f).when(mEvent).getRawY(); + doReturn(5f).when(mEvent).getX(); + doReturn(10f).when(mEvent).getY(); doReturn(20).when(mView).getWidth(); doReturn(20).when(mView).getHeight(); @@ -453,7 +453,7 @@ public class NotificationSwipeHelperTest extends SysuiTestCase { assertTrue("Touch is within the view", mSwipeHelper.isTouchInView(mEvent, mView)); - doReturn(50f).when(mEvent).getRawX(); + doReturn(50f).when(mEvent).getX(); assertFalse("Touch is not within the view", mSwipeHelper.isTouchInView(mEvent, mView)); @@ -464,8 +464,8 @@ public class NotificationSwipeHelperTest extends SysuiTestCase { assertEquals("returns false when view is null", false, NotificationSwipeHelper.isTouchInView(mEvent, null)); - doReturn(5f).when(mEvent).getRawX(); - doReturn(10f).when(mEvent).getRawY(); + doReturn(5f).when(mEvent).getX(); + doReturn(10f).when(mEvent).getY(); doReturn(20).when(mNotificationRow).getWidth(); doReturn(20).when(mNotificationRow).getActualHeight(); @@ -481,7 +481,7 @@ public class NotificationSwipeHelperTest extends SysuiTestCase { assertTrue("Touch is within the view", mSwipeHelper.isTouchInView(mEvent, mNotificationRow)); - doReturn(50f).when(mEvent).getRawX(); + doReturn(50f).when(mEvent).getX(); assertFalse("Touch is not within the view", mSwipeHelper.isTouchInView(mEvent, mNotificationRow));