Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ffb93503 authored by Juan Sebastian Martinez's avatar Juan Sebastian Martinez
Browse files

Making ShadeInteractor aware of user interactions remotely initiated.

A user swipe that originates remotely (i.e., in Launcher) and continues
to be processed in System UI is still a user-generated gesture. The
ShadeInteractor should consider this event as well in the
isUserInteracting Flow. Consolidating this upstream logic also makes the
shade pull haptics logic simpler.

Test: refactored Unit tests.
Test: manual. Verified shade pull haptics continue to work when swiping
  and flinging from the homescreen, status bar, and lockscreen (with
  dual and single shade)
Bug: 437426109
Flag: com.android.systemui.scene_container
Change-Id: I4962fcf0ba0dd5ffd9a8aa9715d5996486323434
parent cda0f42f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -228,7 +228,7 @@ class SceneContainerHapticsViewModelTest : SysuiTestCase() {
            // WHEN the transition occurs
            sceneInteractor.setTransitionState(MutableStateFlow(validTransition))
            runCurrent()
            assertThat(isUserInteracting).isFalse()
            assertThat(isUserInteracting).isTrue()

            // THEN the expected token plays without interaction properties
            assertThat(msdlPlayer.latestTokenPlayed).isEqualTo(MSDLToken.SWIPE_THRESHOLD_INDICATOR)
@@ -254,7 +254,7 @@ class SceneContainerHapticsViewModelTest : SysuiTestCase() {
            // WHEN the transition occurs
            sceneInteractor.setTransitionState(MutableStateFlow(validTransition))
            runCurrent()
            assertThat(isUserInteracting).isFalse()
            assertThat(isUserInteracting).isTrue()

            // THEN the expected token plays without interaction properties
            assertThat(msdlPlayer.latestTokenPlayed).isEqualTo(MSDLToken.SWIPE_THRESHOLD_INDICATOR)
+2 −1
Original line number Diff line number Diff line
@@ -360,7 +360,8 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase {
                        mTestScope.getBackgroundScope(),
                        mFakeKeyguardRepository,
                        mShadeRepository
                ));
                ),
                mKosmos.getSceneInteractor());
        SystemClock systemClock = new FakeSystemClock();
        mStatusBarStateController = new StatusBarStateControllerImpl(
                mUiEventLogger,
+2 −1
Original line number Diff line number Diff line
@@ -198,7 +198,8 @@ public class QuickSettingsControllerImplBaseTest extends SysuiTestCase {
                        mTestScope.getBackgroundScope(),
                        mKeyguardRepository,
                        mShadeRepository
                ));
                ),
                mKosmos.getSceneInteractor());

        when(mResources.getDimensionPixelSize(
                R.dimen.lockscreen_shade_qs_transition_distance)).thenReturn(DEFAULT_HEIGHT);
+4 −7
Original line number Diff line number Diff line
@@ -57,13 +57,10 @@ constructor(

    /** Should haptics be played by pulling down the shade */
    private val isShadePullHapticsRequired: Flow<Boolean> =
        combine(
                shadeInteractor.isUserInteracting,
                sceneInteractor.transitionState,
                sceneInteractor.isRemoteUserInteractionOngoing,
            ) { interacting, transitionState, remoteInteractionGoing ->
                val validInteraction = interacting || remoteInteractionGoing
                validInteraction && transitionState.isValidForShadePullHaptics()
        combine(shadeInteractor.isUserInteracting, sceneInteractor.transitionState) {
                interacting,
                transitionState ->
                interacting && transitionState.isValidForShadePullHaptics()
            }
            .distinctUntilChanged()

+2 −1
Original line number Diff line number Diff line
@@ -47,7 +47,8 @@ interface ShadeInteractor : BaseShadeInteractor {
    /**
     * Whether the user is expanding or collapsing either the shade or quick settings with user
     * input (i.e. dragging a pointer). This will be true even if the user's input gesture had ended
     * but a transition they initiated is still animating.
     * but a transition they initiated is still animating. It will also be true if the gesture was
     * originated by the user but outside of System UI.
     */
    val isUserInteracting: StateFlow<Boolean>

Loading