Loading packages/SystemUI/src/com/android/systemui/shade/GlanceableHubContainerController.kt +9 −1 Original line number Diff line number Diff line Loading @@ -203,6 +203,13 @@ constructor( */ private var shadeConsumingTouches = false /** * True if the shade is showing at all. * * Inverse of [ShadeInteractor.isShadeFullyCollapsed] */ private var shadeShowing = false /** True if the keyguard transition state is finished on [KeyguardState.LOCKSCREEN]. */ private var onLockscreen = false Loading Loading @@ -414,6 +421,7 @@ constructor( ), { (isFullyExpanded, isUserInteracting, isShadeFullyCollapsed) -> shadeConsumingTouches = isUserInteracting shadeShowing = !isShadeFullyCollapsed val expandedAndNotInteractive = isFullyExpanded && !isUserInteracting // If we ever are fully expanded and not interacting, capture this state as we Loading Loading @@ -529,7 +537,7 @@ constructor( val isMove = ev.actionMasked == MotionEvent.ACTION_MOVE val isCancel = ev.actionMasked == MotionEvent.ACTION_CANCEL val hubOccluded = anyBouncerShowing || shadeShowingAndConsumingTouches val hubOccluded = anyBouncerShowing || shadeConsumingTouches || shadeShowing if ((isDown || isMove) && !hubOccluded) { if (isDown) { Loading packages/SystemUI/tests/src/com/android/systemui/shade/GlanceableHubContainerControllerTest.kt +31 −3 Original line number Diff line number Diff line Loading @@ -417,13 +417,17 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { // Communal is open. goToScene(CommunalScenes.Communal) // Shade shows up. shadeTestUtil.setQsExpansion(0.5f) testableLooper.processAllMessages() // Touch starts and ends. assertThat(underTest.onTouchEvent(DOWN_EVENT)).isTrue() assertThat(underTest.onTouchEvent(CANCEL_EVENT)).isTrue() // Up event is no longer processed assertThat(underTest.onTouchEvent(UP_EVENT)).isFalse() // Move event can still be processed assertThat(underTest.onTouchEvent(MOVE_EVENT)).isTrue() assertThat(underTest.onTouchEvent(MOVE_EVENT)).isTrue() assertThat(underTest.onTouchEvent(UP_EVENT)).isTrue() } } Loading Loading @@ -715,6 +719,30 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { } } @Test fun onTouchEvent_shadeExpanding_touchesNotDispatched() = with(kosmos) { testScope.runTest { // On lockscreen. goToScene(CommunalScenes.Blank) whenever( notificationStackScrollLayoutController.isBelowLastNotification( any(), any() ) ) .thenReturn(true) // Shade is open slightly. fakeShadeRepository.setLegacyShadeExpansion(0.01f) testableLooper.processAllMessages() // Touches are not consumed. assertThat(underTest.onTouchEvent(DOWN_EVENT)).isFalse() verify(containerView, never()).onTouchEvent(DOWN_EVENT) } } @Test fun onTouchEvent_bouncerInteracting_movesNotDispatched() = with(kosmos) { Loading Loading
packages/SystemUI/src/com/android/systemui/shade/GlanceableHubContainerController.kt +9 −1 Original line number Diff line number Diff line Loading @@ -203,6 +203,13 @@ constructor( */ private var shadeConsumingTouches = false /** * True if the shade is showing at all. * * Inverse of [ShadeInteractor.isShadeFullyCollapsed] */ private var shadeShowing = false /** True if the keyguard transition state is finished on [KeyguardState.LOCKSCREEN]. */ private var onLockscreen = false Loading Loading @@ -414,6 +421,7 @@ constructor( ), { (isFullyExpanded, isUserInteracting, isShadeFullyCollapsed) -> shadeConsumingTouches = isUserInteracting shadeShowing = !isShadeFullyCollapsed val expandedAndNotInteractive = isFullyExpanded && !isUserInteracting // If we ever are fully expanded and not interacting, capture this state as we Loading Loading @@ -529,7 +537,7 @@ constructor( val isMove = ev.actionMasked == MotionEvent.ACTION_MOVE val isCancel = ev.actionMasked == MotionEvent.ACTION_CANCEL val hubOccluded = anyBouncerShowing || shadeShowingAndConsumingTouches val hubOccluded = anyBouncerShowing || shadeConsumingTouches || shadeShowing if ((isDown || isMove) && !hubOccluded) { if (isDown) { Loading
packages/SystemUI/tests/src/com/android/systemui/shade/GlanceableHubContainerControllerTest.kt +31 −3 Original line number Diff line number Diff line Loading @@ -417,13 +417,17 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { // Communal is open. goToScene(CommunalScenes.Communal) // Shade shows up. shadeTestUtil.setQsExpansion(0.5f) testableLooper.processAllMessages() // Touch starts and ends. assertThat(underTest.onTouchEvent(DOWN_EVENT)).isTrue() assertThat(underTest.onTouchEvent(CANCEL_EVENT)).isTrue() // Up event is no longer processed assertThat(underTest.onTouchEvent(UP_EVENT)).isFalse() // Move event can still be processed assertThat(underTest.onTouchEvent(MOVE_EVENT)).isTrue() assertThat(underTest.onTouchEvent(MOVE_EVENT)).isTrue() assertThat(underTest.onTouchEvent(UP_EVENT)).isTrue() } } Loading Loading @@ -715,6 +719,30 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { } } @Test fun onTouchEvent_shadeExpanding_touchesNotDispatched() = with(kosmos) { testScope.runTest { // On lockscreen. goToScene(CommunalScenes.Blank) whenever( notificationStackScrollLayoutController.isBelowLastNotification( any(), any() ) ) .thenReturn(true) // Shade is open slightly. fakeShadeRepository.setLegacyShadeExpansion(0.01f) testableLooper.processAllMessages() // Touches are not consumed. assertThat(underTest.onTouchEvent(DOWN_EVENT)).isFalse() verify(containerView, never()).onTouchEvent(DOWN_EVENT) } } @Test fun onTouchEvent_bouncerInteracting_movesNotDispatched() = with(kosmos) { Loading