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

Commit 0d56b715 authored by William Xiao's avatar William Xiao Committed by Android (Google) Code Review
Browse files

Merge "Don't consume swipe gesture if screen lock is not secure" into main

parents a55c1fb8 573af3e1
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());
    }