Loading packages/SystemUI/aconfig/systemui.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -2033,3 +2033,13 @@ flag { purpose: PURPOSE_BUGFIX } } flag { name: "hub_blurred_by_shade_fix" namespace: "systemui" description: "Fixes the blurring issue on hub after the shade is pulled down slightly." bug: "412261838" metadata { purpose: PURPOSE_BUGFIX } } packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java +13 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.shade; import static com.android.systemui.Flags.communalShadeTouchHandlingFixes; import static com.android.systemui.Flags.hubBlurredByShadeFix; import static com.android.systemui.keyguard.shared.model.KeyguardState.DREAMING; import static com.android.systemui.keyguard.shared.model.KeyguardState.LOCKSCREEN; import static com.android.systemui.statusbar.StatusBarState.KEYGUARD; Loading Loading @@ -155,6 +156,11 @@ public class NotificationShadeWindowViewController implements Dumpable { * True if we are in the process of handling an external touch event. */ private boolean mHandlingExternalTouch = false; /** * True if drag down helper intercepted and we're in the dragging process. */ private boolean mUseDragDownHelperForTouch = false; private boolean mIsTrackingBarGesture = false; private boolean mIsOcclusionTransitionRunning = false; private DisableSubpixelTextTransitionListener mDisableSubpixelTextTransitionListener; Loading Loading @@ -344,6 +350,13 @@ public class NotificationShadeWindowViewController implements Dumpable { if (!mView.dispatchTouchEvent(event)) { return; } if (hubBlurredByShadeFix()) { // When the DragDownHelper has already initiated a drag of the shade over the hub, // just send the touch. If onInterceptTouchEvent is called again mid-drag, it can // lead to ACTION_UP being ignored, causing the shade to become stuck. mExternalTouchIntercepted = mUseDragDownHelperForTouch && mDragDownHelper.isDraggingDown(); } if (!mExternalTouchIntercepted) { mExternalTouchIntercepted = mView.onInterceptTouchEvent(event); } Loading @@ -363,7 +376,6 @@ public class NotificationShadeWindowViewController implements Dumpable { mView.setLayoutInsetsController(mNotificationInsetsController); mView.setWindowRootViewKeyEventHandler(mWindowRootViewKeyEventHandler); mView.setInteractionEventHandler(new NotificationShadeWindowView.InteractionEventHandler() { boolean mUseDragDownHelperForTouch = false; boolean mLastInterceptWasDragDownHelper = false; @Override Loading packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt +50 −0 Original line number Diff line number Diff line Loading @@ -522,6 +522,56 @@ class NotificationShadeWindowViewControllerTest(flags: FlagsParameterization) : verify(view, never()).onTouchEvent(any()) } @Test @EnableFlags(Flags.FLAG_HUB_BLURRED_BY_SHADE_FIX) fun handleExternalTouch_isNotInterceptedAndIsNotDraggingDown_onTouchNotSent() { whenever(view.dispatchTouchEvent(any())).thenReturn(true) whenever(view.onInterceptTouchEvent(any())).thenReturn(false) whenever(dragDownHelper.isDraggingDown).thenReturn(false) underTest.setStatusBarViewController(phoneStatusBarViewController) underTest.handleExternalTouch(DOWN_EVENT) underTest.handleExternalTouch(MOVE_EVENT) // Interception offered for both events, and onTouchEvent is not called. verify(view).onInterceptTouchEvent(DOWN_EVENT) verify(view).onInterceptTouchEvent(MOVE_EVENT) verify(view, never()).onTouchEvent(any()) } @Test @EnableFlags(Flags.FLAG_HUB_BLURRED_BY_SHADE_FIX) fun handleExternalTouch_isDraggingDown_onTouchSentAndInterceptTouchNotCalledAgain() { whenever(view.dispatchTouchEvent(any())).thenReturn(true) whenever(view.onInterceptTouchEvent(any())).thenReturn(false) underTest.setStatusBarViewController(phoneStatusBarViewController) underTest.handleExternalTouch(DOWN_EVENT) whenever(panelExpansionInteractor.isFullyExpanded).thenReturn(true) // AND quick settings controller doesn't want it whenever(quickSettingsController.shouldQuickSettingsIntercept(any(), any(), any())) .thenReturn(false) whenever(dragDownHelper.isDragDownEnabled).thenReturn(true) whenever(dragDownHelper.onInterceptTouchEvent(any())).thenReturn(true) // THEN dragDownHelper should intercept. assertThat(interactionEventHandler.shouldInterceptTouchEvent(MOVE_EVENT)).isTrue() verify(dragDownHelper).onInterceptTouchEvent(MOVE_EVENT) clearInvocations(view) // AND dragging down is in progress. whenever(dragDownHelper.isDraggingDown).thenReturn(true) // Handle touch sent by hub. underTest.handleExternalTouch(MOVE_EVENT) // Interception not called again. verify(view, never()).onInterceptTouchEvent(MOVE_EVENT) // onTouchEvent goes to the view. verify(view).onTouchEvent(MOVE_EVENT) } @Test @EnableFlags(Flags.FLAG_COMMUNAL_SHADE_TOUCH_HANDLING_FIXES) @DisableSceneContainer Loading Loading
packages/SystemUI/aconfig/systemui.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -2033,3 +2033,13 @@ flag { purpose: PURPOSE_BUGFIX } } flag { name: "hub_blurred_by_shade_fix" namespace: "systemui" description: "Fixes the blurring issue on hub after the shade is pulled down slightly." bug: "412261838" metadata { purpose: PURPOSE_BUGFIX } }
packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java +13 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.shade; import static com.android.systemui.Flags.communalShadeTouchHandlingFixes; import static com.android.systemui.Flags.hubBlurredByShadeFix; import static com.android.systemui.keyguard.shared.model.KeyguardState.DREAMING; import static com.android.systemui.keyguard.shared.model.KeyguardState.LOCKSCREEN; import static com.android.systemui.statusbar.StatusBarState.KEYGUARD; Loading Loading @@ -155,6 +156,11 @@ public class NotificationShadeWindowViewController implements Dumpable { * True if we are in the process of handling an external touch event. */ private boolean mHandlingExternalTouch = false; /** * True if drag down helper intercepted and we're in the dragging process. */ private boolean mUseDragDownHelperForTouch = false; private boolean mIsTrackingBarGesture = false; private boolean mIsOcclusionTransitionRunning = false; private DisableSubpixelTextTransitionListener mDisableSubpixelTextTransitionListener; Loading Loading @@ -344,6 +350,13 @@ public class NotificationShadeWindowViewController implements Dumpable { if (!mView.dispatchTouchEvent(event)) { return; } if (hubBlurredByShadeFix()) { // When the DragDownHelper has already initiated a drag of the shade over the hub, // just send the touch. If onInterceptTouchEvent is called again mid-drag, it can // lead to ACTION_UP being ignored, causing the shade to become stuck. mExternalTouchIntercepted = mUseDragDownHelperForTouch && mDragDownHelper.isDraggingDown(); } if (!mExternalTouchIntercepted) { mExternalTouchIntercepted = mView.onInterceptTouchEvent(event); } Loading @@ -363,7 +376,6 @@ public class NotificationShadeWindowViewController implements Dumpable { mView.setLayoutInsetsController(mNotificationInsetsController); mView.setWindowRootViewKeyEventHandler(mWindowRootViewKeyEventHandler); mView.setInteractionEventHandler(new NotificationShadeWindowView.InteractionEventHandler() { boolean mUseDragDownHelperForTouch = false; boolean mLastInterceptWasDragDownHelper = false; @Override Loading
packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt +50 −0 Original line number Diff line number Diff line Loading @@ -522,6 +522,56 @@ class NotificationShadeWindowViewControllerTest(flags: FlagsParameterization) : verify(view, never()).onTouchEvent(any()) } @Test @EnableFlags(Flags.FLAG_HUB_BLURRED_BY_SHADE_FIX) fun handleExternalTouch_isNotInterceptedAndIsNotDraggingDown_onTouchNotSent() { whenever(view.dispatchTouchEvent(any())).thenReturn(true) whenever(view.onInterceptTouchEvent(any())).thenReturn(false) whenever(dragDownHelper.isDraggingDown).thenReturn(false) underTest.setStatusBarViewController(phoneStatusBarViewController) underTest.handleExternalTouch(DOWN_EVENT) underTest.handleExternalTouch(MOVE_EVENT) // Interception offered for both events, and onTouchEvent is not called. verify(view).onInterceptTouchEvent(DOWN_EVENT) verify(view).onInterceptTouchEvent(MOVE_EVENT) verify(view, never()).onTouchEvent(any()) } @Test @EnableFlags(Flags.FLAG_HUB_BLURRED_BY_SHADE_FIX) fun handleExternalTouch_isDraggingDown_onTouchSentAndInterceptTouchNotCalledAgain() { whenever(view.dispatchTouchEvent(any())).thenReturn(true) whenever(view.onInterceptTouchEvent(any())).thenReturn(false) underTest.setStatusBarViewController(phoneStatusBarViewController) underTest.handleExternalTouch(DOWN_EVENT) whenever(panelExpansionInteractor.isFullyExpanded).thenReturn(true) // AND quick settings controller doesn't want it whenever(quickSettingsController.shouldQuickSettingsIntercept(any(), any(), any())) .thenReturn(false) whenever(dragDownHelper.isDragDownEnabled).thenReturn(true) whenever(dragDownHelper.onInterceptTouchEvent(any())).thenReturn(true) // THEN dragDownHelper should intercept. assertThat(interactionEventHandler.shouldInterceptTouchEvent(MOVE_EVENT)).isTrue() verify(dragDownHelper).onInterceptTouchEvent(MOVE_EVENT) clearInvocations(view) // AND dragging down is in progress. whenever(dragDownHelper.isDraggingDown).thenReturn(true) // Handle touch sent by hub. underTest.handleExternalTouch(MOVE_EVENT) // Interception not called again. verify(view, never()).onInterceptTouchEvent(MOVE_EVENT) // onTouchEvent goes to the view. verify(view).onTouchEvent(MOVE_EVENT) } @Test @EnableFlags(Flags.FLAG_COMMUNAL_SHADE_TOUCH_HANDLING_FIXES) @DisableSceneContainer Loading