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

Commit 249dca8b authored by Matt Pietal's avatar Matt Pietal Committed by Android (Google) Code Review
Browse files

Merge "MIGRAGE_NSSL - Fix QS pulldown on lockscreen" into main

parents c0cd3f3e 409296f3
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -113,6 +113,7 @@ public class NotificationShadeWindowViewController implements Dumpable {
    private final SysUIKeyEventHandler mSysUIKeyEventHandler;
    private final PrimaryBouncerInteractor mPrimaryBouncerInteractor;
    private final AlternateBouncerInteractor mAlternateBouncerInteractor;
    private final QuickSettingsController mQuickSettingsController;
    private GestureDetector mPulsingWakeupGestureHandler;
    private GestureDetector mDreamingWakeupGestureHandler;
    private View mBrightnessMirror;
@@ -188,6 +189,7 @@ public class NotificationShadeWindowViewController implements Dumpable {
            BouncerMessageInteractor bouncerMessageInteractor,
            BouncerLogger bouncerLogger,
            SysUIKeyEventHandler sysUIKeyEventHandler,
            QuickSettingsController quickSettingsController,
            PrimaryBouncerInteractor primaryBouncerInteractor,
            AlternateBouncerInteractor alternateBouncerInteractor,
            SelectedUserInteractor selectedUserInteractor) {
@@ -220,6 +222,7 @@ public class NotificationShadeWindowViewController implements Dumpable {
        mSysUIKeyEventHandler = sysUIKeyEventHandler;
        mPrimaryBouncerInteractor = primaryBouncerInteractor;
        mAlternateBouncerInteractor = alternateBouncerInteractor;
        mQuickSettingsController = quickSettingsController;

        // This view is not part of the newly inflated expanded status bar.
        mBrightnessMirror = mView.findViewById(R.id.brightness_mirror_container);
@@ -454,6 +457,16 @@ public class NotificationShadeWindowViewController implements Dumpable {
                        && !bouncerShowing
                        && !mStatusBarStateController.isDozing()) {
                    if (mDragDownHelper.isDragDownEnabled()) {
                        if (mFeatureFlagsClassic.isEnabled(Flags.MIGRATE_NSSL)) {
                            // When on lockscreen, if the touch originates at the top of the screen
                            // go directly to QS and not the shade
                            if (mQuickSettingsController.shouldQuickSettingsIntercept(
                                    ev.getX(), ev.getY(), 0)) {
                                mShadeLogger.d("NSWVC: QS intercepted");
                                return true;
                            }
                        }

                        // This handles drag down over lockscreen
                        boolean result = mDragDownHelper.onInterceptTouchEvent(ev);
                        if (mFeatureFlagsClassic.isEnabled(Flags.MIGRATE_NSSL)) {
+33 −8
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@ import com.android.systemui.util.mockito.any
import com.android.systemui.util.mockito.eq
import com.android.systemui.util.time.FakeSystemClock
import com.google.common.truth.Truth.assertThat
import java.util.Optional
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.emptyFlow
import kotlinx.coroutines.test.TestScope
@@ -111,9 +112,8 @@ import org.mockito.Mockito.mock
import org.mockito.Mockito.never
import org.mockito.Mockito.times
import org.mockito.Mockito.verify
import org.mockito.MockitoAnnotations
import java.util.Optional
import org.mockito.Mockito.`when` as whenever
import org.mockito.MockitoAnnotations

@OptIn(ExperimentalCoroutinesApi::class)
@SmallTest
@@ -140,6 +140,7 @@ class NotificationShadeWindowViewControllerTest : SysuiTestCase() {
    @Mock private lateinit var stackScrollLayoutController: NotificationStackScrollLayoutController
    @Mock private lateinit var statusBarKeyguardViewManager: StatusBarKeyguardViewManager
    @Mock private lateinit var statusBarWindowStateController: StatusBarWindowStateController
    @Mock private lateinit var quickSettingsController: QuickSettingsController
    @Mock
    private lateinit var lockscreenShadeTransitionController: LockscreenShadeTransitionController
    @Mock private lateinit var lockIconViewController: LockIconViewController
@@ -274,6 +275,7 @@ class NotificationShadeWindowViewControllerTest : SysuiTestCase() {
                ),
                BouncerLogger(logcatLogBuffer("BouncerLog")),
                sysUIKeyEventHandler,
                quickSettingsController,
                primaryBouncerInteractor,
                alternateBouncerInteractor,
                mSelectedUserInteractor,
@@ -460,9 +462,11 @@ class NotificationShadeWindowViewControllerTest : SysuiTestCase() {
        // AND alternate bouncer doesn't want the touch
        whenever(statusBarKeyguardViewManager.shouldInterceptTouchEvent(DOWN_EVENT))
            .thenReturn(false)
        // AND quick settings controller doesn't want it
        whenever(quickSettingsController.shouldQuickSettingsIntercept(any(), any(), any()))
            .thenReturn(false)
        // AND the lock icon wants the touch
        whenever(lockIconViewController.willHandleTouchWhileDozing(DOWN_EVENT))
                .thenReturn(true)
        whenever(lockIconViewController.willHandleTouchWhileDozing(DOWN_EVENT)).thenReturn(true)

        featureFlagsClassic.set(MIGRATE_NSSL, true)

@@ -478,7 +482,9 @@ class NotificationShadeWindowViewControllerTest : SysuiTestCase() {
        whenever(statusBarKeyguardViewManager.shouldInterceptTouchEvent(DOWN_EVENT))
            .thenReturn(false)
        // AND the lock icon does NOT want the touch
        whenever(lockIconViewController.willHandleTouchWhileDozing(DOWN_EVENT))
        whenever(lockIconViewController.willHandleTouchWhileDozing(DOWN_EVENT)).thenReturn(false)
        // AND quick settings controller doesn't want it
        whenever(quickSettingsController.shouldQuickSettingsIntercept(any(), any(), any()))
            .thenReturn(false)

        featureFlagsClassic.set(MIGRATE_NSSL, true)
@@ -487,6 +493,25 @@ class NotificationShadeWindowViewControllerTest : SysuiTestCase() {
        assertThat(interactionEventHandler.shouldInterceptTouchEvent(DOWN_EVENT)).isTrue()
    }

    @Test
    fun shouldInterceptTouchEvent_dozing_touchInStatusBar_touchIntercepted() {
        // GIVEN dozing
        whenever(sysuiStatusBarStateController.isDozing).thenReturn(true)
        // AND alternate bouncer doesn't want the touch
        whenever(statusBarKeyguardViewManager.shouldInterceptTouchEvent(DOWN_EVENT))
            .thenReturn(false)
        // AND the lock icon does NOT want the touch
        whenever(lockIconViewController.willHandleTouchWhileDozing(DOWN_EVENT)).thenReturn(false)
        // AND quick settings controller DOES want it
        whenever(quickSettingsController.shouldQuickSettingsIntercept(any(), any(), any()))
            .thenReturn(true)

        featureFlagsClassic.set(MIGRATE_NSSL, true)

        // THEN touch should NOT be intercepted by NotificationShade
        assertThat(interactionEventHandler.shouldInterceptTouchEvent(DOWN_EVENT)).isTrue()
    }

    @Test
    fun testGetKeyguardMessageArea() =
        testScope.runTest {
+2 −0
Original line number Diff line number Diff line
@@ -121,6 +121,7 @@ class NotificationShadeWindowViewTest : SysuiTestCase() {
    @Mock private lateinit var notificationStackScrollLayout: NotificationStackScrollLayout
    @Mock private lateinit var notificationShadeDepthController: NotificationShadeDepthController
    @Mock private lateinit var notificationShadeWindowController: NotificationShadeWindowController
    @Mock private lateinit var quickSettingsController: QuickSettingsController
    @Mock
    private lateinit var notificationStackScrollLayoutController:
        NotificationStackScrollLayoutController
@@ -264,6 +265,7 @@ class NotificationShadeWindowViewTest : SysuiTestCase() {
                ),
                BouncerLogger(logcatLogBuffer("BouncerLog")),
                Mockito.mock(SysUIKeyEventHandler::class.java),
                quickSettingsController,
                primaryBouncerInteractor,
                alternateBouncerInteractor,
                mSelectedUserInteractor,