From 3c6a594c1352e7bca4aa4cf74812996ff6b7882e Mon Sep 17 00:00:00 2001 From: Michal Brzezinski Date: Wed, 25 Aug 2021 18:33:12 +0100 Subject: [PATCH] Fixing QS reacting to touches in notifications area in split shade In split shade quick settings and notifications should be move independently and react to touches only in their respective areas. This CL introduces limits QS reacting to touches to only if X position of the touch is inside their bounds. Fixes: 196191619 Test: manual Change-Id: Iaac383b6fa3d4f6a261f6a94f6b0fa7a91de0c95 --- .../phone/NotificationPanelViewController.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 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 d559cd1604d32..be03f939ae7f4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java @@ -1898,6 +1898,9 @@ public class NotificationPanelViewController extends PanelViewController { private boolean handleQsTouch(MotionEvent event) { + if (mShouldUseSplitNotificationShade && touchXOutsideOfQs(event.getX())) { + return false; + } final int action = event.getActionMasked(); if (action == MotionEvent.ACTION_DOWN && getExpandedFraction() == 1f && mBarState != KEYGUARD && !mQsExpanded && isQsExpansionEnabled()) { @@ -1939,8 +1942,12 @@ public class NotificationPanelViewController extends PanelViewController { return false; } + private boolean touchXOutsideOfQs(float touchX) { + return touchX < mQsFrame.getX() || touchX > mQsFrame.getX() + mQsFrame.getWidth(); + } + private boolean isInQsArea(float x, float y) { - if (x < mQsFrame.getX() || x > mQsFrame.getX() + mQsFrame.getWidth()) { + if (touchXOutsideOfQs(x)) { return false; } // Let's reject anything at the very bottom around the home handle in gesture nav @@ -4160,9 +4167,7 @@ public class NotificationPanelViewController extends PanelViewController { @Override public void flingTopOverscroll(float velocity, boolean open) { // in split shade mode we want to expand/collapse QS only when touch happens within QS - if (mShouldUseSplitNotificationShade - && (mInitialTouchX < mQsFrame.getX() - || mInitialTouchX > mQsFrame.getX() + mQsFrame.getWidth())) { + if (mShouldUseSplitNotificationShade && touchXOutsideOfQs(mInitialTouchX)) { return; } mLastOverscroll = 0f;