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

Commit 551a79c1 authored by Brad Hinegardner's avatar Brad Hinegardner Committed by Android (Google) Code Review
Browse files

Merge "Reset screen timeout upon keyguard touches for nssl migration" into main

parents 88a14ceb 7fbc8a0e
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -4838,7 +4838,9 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump

            switch (event.getActionMasked()) {
                case MotionEvent.ACTION_DOWN:
                    if (!KeyguardShadeMigrationNssl.isEnabled()) {
                        mCentralSurfaces.userActivity();
                    }
                    mAnimatingOnDown = mHeightAnimator != null && !mIsSpringBackAnimation;
                    mMinExpandHeight = 0.0f;
                    mDownTime = mSystemClock.uptimeMillis();
+3 −0
Original line number Diff line number Diff line
@@ -311,6 +311,9 @@ public class NotificationShadeWindowViewController implements Dumpable {
                    mTouchActive = true;
                    mTouchCancelled = false;
                    mDownEvent = ev;
                    if (KeyguardShadeMigrationNssl.isEnabled()) {
                        mService.userActivity();
                    }
                } else if (ev.getActionMasked() == MotionEvent.ACTION_UP
                        || ev.getActionMasked() == MotionEvent.ACTION_CANCEL) {
                    mTouchActive = false;
+22 −0
Original line number Diff line number Diff line
@@ -361,6 +361,28 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo
        assertThat(mNotificationPanelViewController.isTracking()).isTrue();
    }

    @Test
    public void onInterceptTouchEvent_nsslMigrationOff_userActivity() {
        mSetFlagsRule.disableFlags(com.android.systemui.Flags.FLAG_KEYGUARD_SHADE_MIGRATION_NSSL);

        mTouchHandler.onInterceptTouchEvent(MotionEvent.obtain(0L /* downTime */,
                0L /* eventTime */, MotionEvent.ACTION_DOWN, 0f /* x */, 0f /* y */,
                0 /* metaState */));

        verify(mCentralSurfaces).userActivity();
    }

    @Test
    public void onInterceptTouchEvent_nsslMigrationOn_userActivity_not_called() {
        mSetFlagsRule.enableFlags(com.android.systemui.Flags.FLAG_KEYGUARD_SHADE_MIGRATION_NSSL);

        mTouchHandler.onInterceptTouchEvent(MotionEvent.obtain(0L /* downTime */,
                0L /* eventTime */, MotionEvent.ACTION_DOWN, 0f /* x */, 0f /* y */,
                0 /* metaState */));

        verify(mCentralSurfaces, times(0)).userActivity();
    }

    @Test
    public void testOnTouchEvent_expansionResumesAfterBriefTouch() {
        mFalsingManager.setIsClassifierEnabled(true);
+22 −2
Original line number Diff line number Diff line
@@ -98,7 +98,6 @@ 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
@@ -113,8 +112,9 @@ import org.mockito.Mockito.mock
import org.mockito.Mockito.never
import org.mockito.Mockito.times
import org.mockito.Mockito.verify
import org.mockito.Mockito.`when` as whenever
import org.mockito.MockitoAnnotations
import java.util.Optional
import org.mockito.Mockito.`when` as whenever

@OptIn(ExperimentalCoroutinesApi::class)
@SmallTest
@@ -445,6 +445,26 @@ class NotificationShadeWindowViewControllerTest : SysuiTestCase() {
            verify(notificationShadeWindowController).setLaunchingActivity(false)
        }

    @Test
    fun handleDispatchTouchEvent_nsslMigrationOff_userActivity_not_called() {
        mSetFlagsRule.disableFlags(Flags.FLAG_KEYGUARD_SHADE_MIGRATION_NSSL)
        underTest.setStatusBarViewController(phoneStatusBarViewController)

        interactionEventHandler.handleDispatchTouchEvent(DOWN_EVENT)

        verify(centralSurfaces, times(0)).userActivity()
    }

    @Test
    fun handleDispatchTouchEvent_nsslMigrationOn_userActivity() {
        mSetFlagsRule.enableFlags(Flags.FLAG_KEYGUARD_SHADE_MIGRATION_NSSL)
        underTest.setStatusBarViewController(phoneStatusBarViewController)

        interactionEventHandler.handleDispatchTouchEvent(DOWN_EVENT)

        verify(centralSurfaces).userActivity()
    }

    @Test
    fun shouldInterceptTouchEvent_statusBarKeyguardViewManagerShouldIntercept() {
        // down event should be intercepted by keyguardViewManager