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

Commit 95ea4dd3 authored by Shawn Lee's avatar Shawn Lee Committed by Automerger Merge Worker
Browse files

Merge "Fixed Shade freezing when tapped while collapsing" into tm-qpr-dev am:...

Merge "Fixed Shade freezing when tapped while collapsing" into tm-qpr-dev am: 3d0ea920 am: 589573a0

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20090883



Change-Id: I7612febcd62d9de173169cb1f59f365f74c443fa
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 9b46e8da 589573a0
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -1443,6 +1443,16 @@ public final class NotificationPanelViewController {
        mMaxAllowedKeyguardNotifications = maxAllowed;
    }

    @VisibleForTesting
    boolean getClosing() {
        return mClosing;
    }

    @VisibleForTesting
    boolean getIsFlinging() {
        return mIsFlinging;
    }

    private void updateMaxDisplayedNotifications(boolean recompute) {
        if (recompute) {
            setMaxDisplayedNotifications(Math.max(computeMaxKeyguardNotifications(), 1));
@@ -3718,6 +3728,11 @@ public final class NotificationPanelViewController {
        setListening(true);
    }

    @VisibleForTesting
    void setTouchSlopExceeded(boolean isTouchSlopExceeded) {
        mTouchSlopExceeded = isTouchSlopExceeded;
    }

    public void setOverExpansion(float overExpansion) {
        if (overExpansion == mOverExpansion) {
            return;
@@ -4776,6 +4791,7 @@ public final class NotificationPanelViewController {
        mAmbientState.setSwipingUp(false);
        if ((mTracking && mTouchSlopExceeded) || Math.abs(x - mInitialExpandX) > mTouchSlop
                || Math.abs(y - mInitialExpandY) > mTouchSlop
                || (!isFullyExpanded() && !isFullyCollapsed())
                || event.getActionMasked() == MotionEvent.ACTION_CANCEL || forceCancel) {
            mVelocityTracker.computeCurrentVelocity(1000);
            float vel = mVelocityTracker.getYVelocity();
+32 −0
Original line number Diff line number Diff line
@@ -756,6 +756,38 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
        assertThat(mNotificationPanelViewController.isTracking()).isTrue();
    }

    @Test
    public void testOnTouchEvent_expansionResumesAfterBriefTouch() {
        // Start shade collapse with swipe up
        onTouchEvent(MotionEvent.obtain(0L /* downTime */,
                0L /* eventTime */, MotionEvent.ACTION_DOWN, 0f /* x */, 0f /* y */,
                0 /* metaState */));
        onTouchEvent(MotionEvent.obtain(0L /* downTime */,
                0L /* eventTime */, MotionEvent.ACTION_MOVE, 0f /* x */, 300f /* y */,
                0 /* metaState */));
        onTouchEvent(MotionEvent.obtain(0L /* downTime */,
                0L /* eventTime */, MotionEvent.ACTION_UP, 0f /* x */, 300f /* y */,
                0 /* metaState */));

        assertThat(mNotificationPanelViewController.getClosing()).isTrue();
        assertThat(mNotificationPanelViewController.getIsFlinging()).isTrue();

        // simulate touch that does not exceed touch slop
        onTouchEvent(MotionEvent.obtain(2L /* downTime */,
                2L /* eventTime */, MotionEvent.ACTION_DOWN, 0f /* x */, 300f /* y */,
                0 /* metaState */));

        mNotificationPanelViewController.setTouchSlopExceeded(false);

        onTouchEvent(MotionEvent.obtain(2L /* downTime */,
                2L /* eventTime */, MotionEvent.ACTION_UP, 0f /* x */, 300f /* y */,
                0 /* metaState */));

        // fling should still be called after a touch that does not exceed touch slop
        assertThat(mNotificationPanelViewController.getClosing()).isTrue();
        assertThat(mNotificationPanelViewController.getIsFlinging()).isTrue();
    }

    @Test
    public void handleTouchEventFromStatusBar_panelsNotEnabled_returnsFalseAndNoViewEvent() {
        when(mCommandQueue.panelsEnabled()).thenReturn(false);