From e96e39cfc1c5d9a1a7ac33fa6fa881120e8fb1cd Mon Sep 17 00:00:00 2001 From: Johannes Gallmann Date: Wed, 15 Nov 2023 14:08:55 +0100 Subject: Fix notification shade not expanding from right side after unfold The width of mKeyguardStatusBar is not adjusted when unfolding. It is only adjusted once the shade gets expanded the first time. Therefore we need to query the window width and use that instead for the back bypass check. Bug: 309628369 Flag: LEGACY WM_SHADE_ANIMATE_BACK_GESTURE DISABLED Test: Manual, i.e. testing shade expansion behaviour after unfolding Change-Id: I4c8453fb6bd2357f9c975435e0806b33a8375164 --- .../com/android/systemui/shade/QuickSettingsController.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsController.java b/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsController.java index 3c68438ff61b..4e1505649da2 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsController.java @@ -260,6 +260,14 @@ public class QuickSettingsController implements Dumpable { */ private Insets mCachedGestureInsets; + /** + * The window width currently in effect -- used together with + * {@link QuickSettingsController#mCachedGestureInsets} to decide whether a back gesture should + * receive a horizontal swipe inwards from the left/right vertical edge of the screen. + * We cache this on ACTION_DOWN, and query it during both ACTION_DOWN and ACTION_MOVE events. + */ + private int mCachedWindowWidth; + /** * The amount of progress we are currently in if we're transitioning to the full shade. * 0.0f means we're not transitioning yet, while 1 means we're all the way in the full @@ -544,6 +552,7 @@ public class QuickSettingsController implements Dumpable { WindowMetrics windowMetrics = wm.getCurrentWindowMetrics(); mCachedGestureInsets = windowMetrics.getWindowInsets().getInsets( WindowInsets.Type.systemGestures()); + mCachedWindowWidth = windowMetrics.getBounds().width(); } /** @@ -552,7 +561,7 @@ public class QuickSettingsController implements Dumpable { */ public boolean shouldBackBypassQuickSettings(float touchX) { return (touchX < mCachedGestureInsets.left) - || (touchX > mKeyguardStatusBar.getWidth() - mCachedGestureInsets.right); + || (touchX > mCachedWindowWidth - mCachedGestureInsets.right); } /** Returns whether touch is within QS area */ @@ -2121,6 +2130,8 @@ public class QuickSettingsController implements Dumpable { ipw.println(mAnimatorExpand); ipw.print("mCachedGestureInsets="); ipw.println(mCachedGestureInsets); + ipw.print("mCachedWindowWidth="); + ipw.println(mCachedWindowWidth); ipw.print("mTransitioningToFullShadeProgress="); ipw.println(mTransitioningToFullShadeProgress); ipw.print("mDistanceForFullShadeTransition="); -- cgit v1.2.3-59-g8ed1b