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

Commit 47576405 authored by Daniel Akinola's avatar Daniel Akinola
Browse files

Open shade via trackpad swipe on display where cursor is

Adding change so now when triggering the shade via trackpad swipe, it
will move to whatever display the cursor is currently on before opening

Bug: 362719719
Bug: 378688068
Test: LauncherProxyServiceTest
Test: manualy testing
Flag: com.android.systemui.shade_window_goes_around
Change-Id: Iec3c8a9abce67111e7a16a9c1c8922ab2210252c
parent 435b88b0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -311,6 +311,7 @@ public class LauncherProxyService implements CallbackController<LauncherProxyLis

        @Override
        public void onStatusBarTrackpadEvent(MotionEvent event) {
            moveShadeWindowIfNeeded(event);
            verifyCallerAndClearCallingIdentityPostMain("onStatusBarTrackpadEvent", () -> {
                if (SceneContainerFlag.isEnabled()) {
                    int action = event.getActionMasked();
+34 −1
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.platform.test.annotations.EnableFlags
import android.testing.TestableLooper
import android.view.Display
import android.view.MotionEvent
import android.view.ViewGroup
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.internal.app.AssistUtils
@@ -332,7 +333,39 @@ class LauncherProxyServiceTest : SysuiTestCase() {
        Flags.FLAG_SCENE_CONTAINER,
        Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR,
    )
    fun onStatusBarTouchEvent_withSceneFlag_callsOnLauncherDrag() =
    fun onStatusBarTrackpadEvent_callsOnStatusBarOrLauncherTouched() =
        kosmos.testScope.runTest {
            val shadeDisplayId = 1
            whenever(statusBarShadeDisplayPolicy.displayId)
                .thenReturn(MutableStateFlow(shadeDisplayId))

            val event =
                MotionEvent.obtain(500, 500, MotionEvent.ACTION_MOVE, 500f, 500f, 0).apply {
                    displayId = 0
                }

            whenever(statusBarWinController.windowRootView).thenReturn(mock(ViewGroup::class.java))
            whenever(shadeViewController
                .handleExternalTouch(argThat<MotionEvent> { displayId == event.displayId }))
                .thenReturn(true)



            subject.mSysUiProxy.onStatusBarTrackpadEvent(event)
            verify(statusBarShadeDisplayPolicy)
                .onStatusBarOrLauncherTouched(
                    argThat<MotionEvent> { displayId == event.displayId },
                    anyInt(),
                )
        }

    @Test
    @EnableFlags(
        Flags.FLAG_SHADE_WINDOW_GOES_AROUND,
        Flags.FLAG_SCENE_CONTAINER,
        Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR,
    )
    fun onStatusBarTouchEvent_withSceneFlag_callsOnStatusBarOrLauncherTouched() =
        kosmos.testScope.runTest {
            val shadeDisplayId = 1
            whenever(statusBarShadeDisplayPolicy.displayId)