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

Commit 573af3e1 authored by William Xiao's avatar William Xiao
Browse files

Don't consume swipe gesture if screen lock is not secure

If the screen lock is set to swipe or none, swiping up from the dream
will not go to the bouncer, so previously we prevented the animation
from occurring, but by consuming the gesture, it also prevented the
dream from doing anything, meaning that nothing happened when swiping
up.

This change stops consuming the gesture so that the underlying dream
will receive it and can wake the device.

Bug: 298716569
Test: atest BouncerSwipeTouchHandlerTest
Change-Id: If5a495974cfbe5b49433460146116f028fdb4007
parent 9e3e45e2
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -155,9 +155,12 @@ public class BouncerSwipeTouchHandler implements DreamTouchHandler {
                        return true;
                    }

                    // Don't set expansion if the user doesn't have a pin/password set.
                    // Don't set expansion if the user doesn't have a pin/password set so that no
                    // animations are played we're not transitioning to the bouncer.
                    if (!mLockPatternUtils.isSecure(mUserTracker.getUserId())) {
                        return true;
                        // Return false so the gesture is not consumed, allowing the dream to wake
                        // if it wants instead of doing nothing.
                        return false;
                    }

                    // For consistency, we adopt the expansion definition found in the
+5 −3
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.systemui.dreams.touch;

import static com.google.common.truth.Truth.assertThat;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyFloat;
import static org.mockito.ArgumentMatchers.eq;
@@ -295,7 +294,8 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase {
    }

    /**
     * Makes sure the expansion amount is proportional to (1 - scroll).
     * Verifies that swiping up when the lock pattern is not secure does not consume the scroll
     * gesture or expand.
     */
    @Test
    public void testSwipeUp_keyguardNotSecure_doesNotExpand() {
@@ -314,8 +314,10 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase {
                0, SCREEN_HEIGHT_PX - distanceY, 0);

        reset(mScrimController);

        // Scroll gesture is not consumed.
        assertThat(gestureListener.onScroll(event1, event2, 0, distanceY))
                .isTrue();
                .isFalse();
        // We should not expand since the keyguard is not secure
        verify(mScrimController, never()).expand(any());
    }