Loading packages/SystemUI/src/com/android/systemui/shade/GlanceableHubContainerController.kt +14 −21 Original line number Diff line number Diff line Loading @@ -108,7 +108,7 @@ constructor( fun dispatchTouchEvent( ev: MotionEvent?, disallowInterceptConsumer: Consumer<Boolean>? disallowInterceptConsumer: Consumer<Boolean>?, ): Boolean { disallowInterceptConsumer?.apply { consumers.add(this) } Loading Loading @@ -252,9 +252,7 @@ constructor( * * @throws RuntimeException if the view is already initialized */ fun initView( context: Context, ): View { fun initView(context: Context): View { return initView( ComposeView(context).apply { repeatWhenAttached { Loading Loading @@ -329,12 +327,7 @@ constructor( val ltr = containerView.layoutDirection == View.LAYOUT_DIRECTION_LTR val backGestureInset = Rect( 0, 0, if (ltr) 0 else containerView.right, containerView.bottom, ) Rect(0, 0, if (ltr) 0 else containerView.right, containerView.bottom) containerView.systemGestureExclusionRects = if (Flags.hubmodeFullscreenVerticalSwipeFix()) { Loading @@ -351,11 +344,11 @@ constructor( 0, topEdgeSwipeRegionWidth, containerView.right, containerView.bottom - bottomEdgeSwipeRegionWidth containerView.bottom - bottomEdgeSwipeRegionWidth, ), // Disable back gestures on the left side of the screen, to avoid // conflicting with scene transitions. backGestureInset backGestureInset, ) } logger.d({ "Insets updated: $str1" }) { Loading @@ -372,7 +365,7 @@ constructor( containerView, anyOf( keyguardInteractor.primaryBouncerShowing, keyguardInteractor.alternateBouncerShowing keyguardInteractor.alternateBouncerShowing, ), { anyBouncerShowing = it Loading @@ -380,12 +373,12 @@ constructor( logger.d({ "New value for anyBouncerShowing: $bool1" }) { bool1 = it } } updateTouchHandlingState() } }, ) collectFlow( containerView, keyguardTransitionInteractor.isFinishedIn(KeyguardState.LOCKSCREEN), { onLockscreen = it } { onLockscreen = it }, ) collectFlow( containerView, Loading @@ -393,7 +386,7 @@ constructor( { hubShowing = it updateTouchHandlingState() } }, ) collectFlow( containerView, Loading @@ -404,12 +397,12 @@ constructor( communalInteractor.editActivityShowing, keyguardTransitionInteractor.isInTransition( Edge.create(KeyguardState.GONE, KeyguardState.GLANCEABLE_HUB) ) ), ), { inEditModeTransition = it updateTouchHandlingState() } }, ) collectFlow( containerView, Loading @@ -417,7 +410,7 @@ constructor( shadeInteractor.isAnyFullyExpanded, shadeInteractor.isUserInteracting, shadeInteractor.isShadeFullyCollapsed, ::Triple ::Triple, ), { (isFullyExpanded, isUserInteracting, isShadeFullyCollapsed) -> shadeConsumingTouches = isUserInteracting Loading @@ -441,7 +434,7 @@ constructor( } } updateTouchHandlingState() } }, ) collectFlow(containerView, keyguardInteractor.isDreaming, { isDreaming = it }) Loading Loading @@ -628,7 +621,7 @@ constructor( powerManager.userActivity( SystemClock.uptimeMillis(), PowerManager.USER_ACTIVITY_EVENT_TOUCH, 0 0, ) } } Loading packages/SystemUI/tests/src/com/android/systemui/shade/GlanceableHubContainerControllerTest.kt +26 −26 Original line number Diff line number Diff line Loading @@ -118,7 +118,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { override fun create( lifecycleOwner: LifecycleOwner, touchHandlers: Set<TouchHandler>, loggingName: String loggingName: String, ): AmbientTouchComponent = object : AmbientTouchComponent { override fun getTouchMonitor(): TouchMonitor = touchMonitor Loading @@ -141,7 +141,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { kosmos.notificationStackScrollLayoutController, kosmos.keyguardMediaController, kosmos.lockscreenSmartspaceController, logcatLogBuffer("GlanceableHubContainerControllerTest") logcatLogBuffer("GlanceableHubContainerControllerTest"), ) } testableLooper = TestableLooper.get(this) Loading @@ -150,7 +150,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { overrideResource(R.dimen.communal_top_edge_swipe_region_height, TOP_SWIPE_REGION_WIDTH) overrideResource( R.dimen.communal_bottom_edge_swipe_region_height, BOTTOM_SWIPE_REGION_WIDTH BOTTOM_SWIPE_REGION_WIDTH, ) // Make communal available so that communalInteractor.desiredScene accurately reflects Loading Loading @@ -188,7 +188,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { kosmos.notificationStackScrollLayoutController, kosmos.keyguardMediaController, kosmos.lockscreenSmartspaceController, logcatLogBuffer("GlanceableHubContainerControllerTest") logcatLogBuffer("GlanceableHubContainerControllerTest"), ) // First call succeeds. Loading Loading @@ -217,7 +217,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { kosmos.notificationStackScrollLayoutController, kosmos.keyguardMediaController, kosmos.lockscreenSmartspaceController, logcatLogBuffer("GlanceableHubContainerControllerTest") logcatLogBuffer("GlanceableHubContainerControllerTest"), ) assertThat(underTest.lifecycle.currentState).isEqualTo(Lifecycle.State.INITIALIZED) Loading @@ -241,7 +241,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { kosmos.notificationStackScrollLayoutController, kosmos.keyguardMediaController, kosmos.lockscreenSmartspaceController, logcatLogBuffer("GlanceableHubContainerControllerTest") logcatLogBuffer("GlanceableHubContainerControllerTest"), ) // Only initView without attaching a view as we don't want the flows to start collecting Loading Loading @@ -342,7 +342,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { from = KeyguardState.GONE, to = KeyguardState.GLANCEABLE_HUB, value = 1.0f, transitionState = TransitionState.RUNNING transitionState = TransitionState.RUNNING, ) ) testableLooper.processAllMessages() Loading Loading @@ -458,14 +458,14 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { /* left= */ 0, /* top= */ TOP_SWIPE_REGION_WIDTH, /* right= */ CONTAINER_WIDTH, /* bottom= */ CONTAINER_HEIGHT - BOTTOM_SWIPE_REGION_WIDTH /* bottom= */ CONTAINER_HEIGHT - BOTTOM_SWIPE_REGION_WIDTH, ), Rect( /* left= */ 0, /* top= */ 0, /* right= */ 0, /* bottom= */ CONTAINER_HEIGHT ) /* bottom= */ CONTAINER_HEIGHT, ), ) } } Loading @@ -484,7 +484,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { /* left= */ 0, /* top= */ 0, /* right= */ 0, /* bottom= */ CONTAINER_HEIGHT /* bottom= */ CONTAINER_HEIGHT, ) ) } Loading @@ -504,14 +504,14 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { /* left= */ 0, /* top= */ TOP_SWIPE_REGION_WIDTH, /* right= */ CONTAINER_WIDTH, /* bottom= */ CONTAINER_HEIGHT - BOTTOM_SWIPE_REGION_WIDTH /* bottom= */ CONTAINER_HEIGHT - BOTTOM_SWIPE_REGION_WIDTH, ), Rect( /* left= */ 0, /* top= */ 0, /* right= */ CONTAINER_WIDTH, /* bottom= */ CONTAINER_HEIGHT ) /* bottom= */ CONTAINER_HEIGHT, ), ) } } Loading @@ -529,7 +529,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { /* left= */ 0, /* top= */ 0, /* right= */ CONTAINER_WIDTH, /* bottom= */ CONTAINER_HEIGHT /* bottom= */ CONTAINER_HEIGHT, ) ) } Loading Loading @@ -597,7 +597,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { whenever( notificationStackScrollLayoutController.isBelowLastNotification( any(), any() any(), ) ) .thenReturn(false) Loading Loading @@ -675,7 +675,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { from = KeyguardState.GONE, to = KeyguardState.GLANCEABLE_HUB, value = 1.0f, transitionState = TransitionState.RUNNING transitionState = TransitionState.RUNNING, ) ) testableLooper.processAllMessages() Loading @@ -696,7 +696,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { whenever( notificationStackScrollLayoutController.isBelowLastNotification( any(), any() any(), ) ) .thenReturn(true) Loading Loading @@ -728,7 +728,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { whenever( notificationStackScrollLayoutController.isBelowLastNotification( any(), any() any(), ) ) .thenReturn(true) Loading @@ -752,7 +752,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { whenever( notificationStackScrollLayoutController.isBelowLastNotification( any(), any() any(), ) ) .thenReturn(true) Loading Loading @@ -805,13 +805,13 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.LOCKSCREEN, to = KeyguardState.GLANCEABLE_HUB, kosmos.testScope kosmos.testScope, ) } else { kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.GLANCEABLE_HUB, to = KeyguardState.LOCKSCREEN, kosmos.testScope kosmos.testScope, ) } testableLooper.processAllMessages() Loading @@ -836,7 +836,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { MotionEvent.ACTION_DOWN, CONTAINER_WIDTH.toFloat() / 2, CONTAINER_HEIGHT.toFloat() / 2, 0 0, ) private val CANCEL_EVENT = Loading @@ -846,7 +846,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { MotionEvent.ACTION_CANCEL, CONTAINER_WIDTH.toFloat() / 2, CONTAINER_HEIGHT.toFloat() / 2, 0 0, ) private val MOVE_EVENT = Loading @@ -856,7 +856,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { MotionEvent.ACTION_MOVE, CONTAINER_WIDTH.toFloat() / 2, CONTAINER_HEIGHT.toFloat() / 2, 0 0, ) private val UP_EVENT = Loading @@ -866,7 +866,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { MotionEvent.ACTION_UP, CONTAINER_WIDTH.toFloat() / 2, CONTAINER_HEIGHT.toFloat() / 2, 0 0, ) } } Loading
packages/SystemUI/src/com/android/systemui/shade/GlanceableHubContainerController.kt +14 −21 Original line number Diff line number Diff line Loading @@ -108,7 +108,7 @@ constructor( fun dispatchTouchEvent( ev: MotionEvent?, disallowInterceptConsumer: Consumer<Boolean>? disallowInterceptConsumer: Consumer<Boolean>?, ): Boolean { disallowInterceptConsumer?.apply { consumers.add(this) } Loading Loading @@ -252,9 +252,7 @@ constructor( * * @throws RuntimeException if the view is already initialized */ fun initView( context: Context, ): View { fun initView(context: Context): View { return initView( ComposeView(context).apply { repeatWhenAttached { Loading Loading @@ -329,12 +327,7 @@ constructor( val ltr = containerView.layoutDirection == View.LAYOUT_DIRECTION_LTR val backGestureInset = Rect( 0, 0, if (ltr) 0 else containerView.right, containerView.bottom, ) Rect(0, 0, if (ltr) 0 else containerView.right, containerView.bottom) containerView.systemGestureExclusionRects = if (Flags.hubmodeFullscreenVerticalSwipeFix()) { Loading @@ -351,11 +344,11 @@ constructor( 0, topEdgeSwipeRegionWidth, containerView.right, containerView.bottom - bottomEdgeSwipeRegionWidth containerView.bottom - bottomEdgeSwipeRegionWidth, ), // Disable back gestures on the left side of the screen, to avoid // conflicting with scene transitions. backGestureInset backGestureInset, ) } logger.d({ "Insets updated: $str1" }) { Loading @@ -372,7 +365,7 @@ constructor( containerView, anyOf( keyguardInteractor.primaryBouncerShowing, keyguardInteractor.alternateBouncerShowing keyguardInteractor.alternateBouncerShowing, ), { anyBouncerShowing = it Loading @@ -380,12 +373,12 @@ constructor( logger.d({ "New value for anyBouncerShowing: $bool1" }) { bool1 = it } } updateTouchHandlingState() } }, ) collectFlow( containerView, keyguardTransitionInteractor.isFinishedIn(KeyguardState.LOCKSCREEN), { onLockscreen = it } { onLockscreen = it }, ) collectFlow( containerView, Loading @@ -393,7 +386,7 @@ constructor( { hubShowing = it updateTouchHandlingState() } }, ) collectFlow( containerView, Loading @@ -404,12 +397,12 @@ constructor( communalInteractor.editActivityShowing, keyguardTransitionInteractor.isInTransition( Edge.create(KeyguardState.GONE, KeyguardState.GLANCEABLE_HUB) ) ), ), { inEditModeTransition = it updateTouchHandlingState() } }, ) collectFlow( containerView, Loading @@ -417,7 +410,7 @@ constructor( shadeInteractor.isAnyFullyExpanded, shadeInteractor.isUserInteracting, shadeInteractor.isShadeFullyCollapsed, ::Triple ::Triple, ), { (isFullyExpanded, isUserInteracting, isShadeFullyCollapsed) -> shadeConsumingTouches = isUserInteracting Loading @@ -441,7 +434,7 @@ constructor( } } updateTouchHandlingState() } }, ) collectFlow(containerView, keyguardInteractor.isDreaming, { isDreaming = it }) Loading Loading @@ -628,7 +621,7 @@ constructor( powerManager.userActivity( SystemClock.uptimeMillis(), PowerManager.USER_ACTIVITY_EVENT_TOUCH, 0 0, ) } } Loading
packages/SystemUI/tests/src/com/android/systemui/shade/GlanceableHubContainerControllerTest.kt +26 −26 Original line number Diff line number Diff line Loading @@ -118,7 +118,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { override fun create( lifecycleOwner: LifecycleOwner, touchHandlers: Set<TouchHandler>, loggingName: String loggingName: String, ): AmbientTouchComponent = object : AmbientTouchComponent { override fun getTouchMonitor(): TouchMonitor = touchMonitor Loading @@ -141,7 +141,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { kosmos.notificationStackScrollLayoutController, kosmos.keyguardMediaController, kosmos.lockscreenSmartspaceController, logcatLogBuffer("GlanceableHubContainerControllerTest") logcatLogBuffer("GlanceableHubContainerControllerTest"), ) } testableLooper = TestableLooper.get(this) Loading @@ -150,7 +150,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { overrideResource(R.dimen.communal_top_edge_swipe_region_height, TOP_SWIPE_REGION_WIDTH) overrideResource( R.dimen.communal_bottom_edge_swipe_region_height, BOTTOM_SWIPE_REGION_WIDTH BOTTOM_SWIPE_REGION_WIDTH, ) // Make communal available so that communalInteractor.desiredScene accurately reflects Loading Loading @@ -188,7 +188,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { kosmos.notificationStackScrollLayoutController, kosmos.keyguardMediaController, kosmos.lockscreenSmartspaceController, logcatLogBuffer("GlanceableHubContainerControllerTest") logcatLogBuffer("GlanceableHubContainerControllerTest"), ) // First call succeeds. Loading Loading @@ -217,7 +217,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { kosmos.notificationStackScrollLayoutController, kosmos.keyguardMediaController, kosmos.lockscreenSmartspaceController, logcatLogBuffer("GlanceableHubContainerControllerTest") logcatLogBuffer("GlanceableHubContainerControllerTest"), ) assertThat(underTest.lifecycle.currentState).isEqualTo(Lifecycle.State.INITIALIZED) Loading @@ -241,7 +241,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { kosmos.notificationStackScrollLayoutController, kosmos.keyguardMediaController, kosmos.lockscreenSmartspaceController, logcatLogBuffer("GlanceableHubContainerControllerTest") logcatLogBuffer("GlanceableHubContainerControllerTest"), ) // Only initView without attaching a view as we don't want the flows to start collecting Loading Loading @@ -342,7 +342,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { from = KeyguardState.GONE, to = KeyguardState.GLANCEABLE_HUB, value = 1.0f, transitionState = TransitionState.RUNNING transitionState = TransitionState.RUNNING, ) ) testableLooper.processAllMessages() Loading Loading @@ -458,14 +458,14 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { /* left= */ 0, /* top= */ TOP_SWIPE_REGION_WIDTH, /* right= */ CONTAINER_WIDTH, /* bottom= */ CONTAINER_HEIGHT - BOTTOM_SWIPE_REGION_WIDTH /* bottom= */ CONTAINER_HEIGHT - BOTTOM_SWIPE_REGION_WIDTH, ), Rect( /* left= */ 0, /* top= */ 0, /* right= */ 0, /* bottom= */ CONTAINER_HEIGHT ) /* bottom= */ CONTAINER_HEIGHT, ), ) } } Loading @@ -484,7 +484,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { /* left= */ 0, /* top= */ 0, /* right= */ 0, /* bottom= */ CONTAINER_HEIGHT /* bottom= */ CONTAINER_HEIGHT, ) ) } Loading @@ -504,14 +504,14 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { /* left= */ 0, /* top= */ TOP_SWIPE_REGION_WIDTH, /* right= */ CONTAINER_WIDTH, /* bottom= */ CONTAINER_HEIGHT - BOTTOM_SWIPE_REGION_WIDTH /* bottom= */ CONTAINER_HEIGHT - BOTTOM_SWIPE_REGION_WIDTH, ), Rect( /* left= */ 0, /* top= */ 0, /* right= */ CONTAINER_WIDTH, /* bottom= */ CONTAINER_HEIGHT ) /* bottom= */ CONTAINER_HEIGHT, ), ) } } Loading @@ -529,7 +529,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { /* left= */ 0, /* top= */ 0, /* right= */ CONTAINER_WIDTH, /* bottom= */ CONTAINER_HEIGHT /* bottom= */ CONTAINER_HEIGHT, ) ) } Loading Loading @@ -597,7 +597,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { whenever( notificationStackScrollLayoutController.isBelowLastNotification( any(), any() any(), ) ) .thenReturn(false) Loading Loading @@ -675,7 +675,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { from = KeyguardState.GONE, to = KeyguardState.GLANCEABLE_HUB, value = 1.0f, transitionState = TransitionState.RUNNING transitionState = TransitionState.RUNNING, ) ) testableLooper.processAllMessages() Loading @@ -696,7 +696,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { whenever( notificationStackScrollLayoutController.isBelowLastNotification( any(), any() any(), ) ) .thenReturn(true) Loading Loading @@ -728,7 +728,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { whenever( notificationStackScrollLayoutController.isBelowLastNotification( any(), any() any(), ) ) .thenReturn(true) Loading @@ -752,7 +752,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { whenever( notificationStackScrollLayoutController.isBelowLastNotification( any(), any() any(), ) ) .thenReturn(true) Loading Loading @@ -805,13 +805,13 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.LOCKSCREEN, to = KeyguardState.GLANCEABLE_HUB, kosmos.testScope kosmos.testScope, ) } else { kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.GLANCEABLE_HUB, to = KeyguardState.LOCKSCREEN, kosmos.testScope kosmos.testScope, ) } testableLooper.processAllMessages() Loading @@ -836,7 +836,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { MotionEvent.ACTION_DOWN, CONTAINER_WIDTH.toFloat() / 2, CONTAINER_HEIGHT.toFloat() / 2, 0 0, ) private val CANCEL_EVENT = Loading @@ -846,7 +846,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { MotionEvent.ACTION_CANCEL, CONTAINER_WIDTH.toFloat() / 2, CONTAINER_HEIGHT.toFloat() / 2, 0 0, ) private val MOVE_EVENT = Loading @@ -856,7 +856,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { MotionEvent.ACTION_MOVE, CONTAINER_WIDTH.toFloat() / 2, CONTAINER_HEIGHT.toFloat() / 2, 0 0, ) private val UP_EVENT = Loading @@ -866,7 +866,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { MotionEvent.ACTION_UP, CONTAINER_WIDTH.toFloat() / 2, CONTAINER_HEIGHT.toFloat() / 2, 0 0, ) } }