From b884231800260652c0530076a0bef71d4857c355 Mon Sep 17 00:00:00 2001 From: Caitlin Cassidy Date: Tue, 29 Jun 2021 19:19:09 +0000 Subject: [PATCH] Allow swiping down from area directly below notch to trigger QS instead of notification shade. Demo uploaded to bug. Fixes: 191114862 Test: Manual (see demo video) Change-Id: I3181963bd9f66196b992d63b99bf6c2614fefe4b --- .../phone/NotificationPanelViewController.java | 15 +++++++++++---- .../phone/StatusBarTouchableRegionManager.java | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java index f461d944d2c29..50b90d479efc2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java @@ -578,6 +578,7 @@ public class NotificationPanelViewController extends PanelViewController { */ private ValueAnimator mQsClippingAnimation = null; private final Rect mKeyguardStatusAreaClipBounds = new Rect(); + private final Region mQsInterceptRegion = new Region(); /** * The alpha of the views which only show on the keyguard but not in shade / shade locked @@ -2643,10 +2644,16 @@ public class NotificationPanelViewController extends PanelViewController { return false; } View header = mKeyguardShowing || mQs == null ? mKeyguardStatusBar : mQs.getHeader(); - final boolean - onHeader = - x >= mQsFrame.getX() && x <= mQsFrame.getX() + mQsFrame.getWidth() - && y >= header.getTop() && y <= header.getBottom(); + + mQsInterceptRegion.set( + /* left= */ (int) mQsFrame.getX(), + /* top= */ header.getTop(), + /* right= */ (int) mQsFrame.getX() + mQsFrame.getWidth(), + /* bottom= */ header.getBottom()); + // Also allow QS to intercept if the touch is near the notch. + mStatusBarTouchableRegionManager.updateRegionForNotch(mQsInterceptRegion); + final boolean onHeader = mQsInterceptRegion.contains((int) x, (int) y); + if (mQsExpanded) { return onHeader || (yDiff < 0 && isInQsArea(x, y)); } else { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManager.java index b859250a24423..d3d90639546a4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManager.java @@ -223,7 +223,7 @@ public final class StatusBarTouchableRegionManager implements Dumpable { } } - private void updateRegionForNotch(Region touchableRegion) { + void updateRegionForNotch(Region touchableRegion) { WindowInsets windowInsets = mNotificationShadeWindowView.getRootWindowInsets(); if (windowInsets == null) { Log.w(TAG, "StatusBarWindowView is not attached.");