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

Commit b9e3b6af authored by Bin Huang's avatar Bin Huang Committed by Matt Pietal
Browse files

Avoid keyguard fling transition interrupt for timing issue

For some low-end or bad performance devices, sometimes keyguard
flingToHeight animation still not complete, at this moment if received
the onStartedWakingUp while try turn screen on, it will cause the
remote SystemUI keyguard dismiss transition can't run.

Before execute a fling animation of Keyguard, set the animation execution time to 0 determines that it is Screen Off state.
This solution makes Screen On can not affect animation.

Bug: 301196699
Test: run cts KeyguardTests

Change-Id: Ic7be1b5e41814adb44ce79857b79283040b4e3a4
Merged-In: I4743c0ad53f89ee2fdc2f8e9eed864fe79f3bfc3
parent e933e38c
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -619,6 +619,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
    private int mDreamingToLockscreenTransitionTranslationY;
    private int mLockscreenToDreamingTransitionTranslationY;
    private int mGoneToDreamingTransitionTranslationY;
    private boolean mForceFlingAnimationForTest = false;
    private SplitShadeStateController mSplitShadeStateController;
    private final Runnable mFlingCollapseRunnable = () -> fling(0, false /* expand */,
            mNextCollapseSpeedUpFactor, false /* expandBecauseOfFalsing */);
@@ -2174,10 +2175,18 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
                }
            }
        });
        if (!mScrimController.isScreenOn() && !mForceFlingAnimationForTest) {
            animator.setDuration(1);
        }
        setAnimator(animator);
        animator.start();
    }

    @VisibleForTesting
    void setForceFlingAnimationForTest(boolean force) {
        mForceFlingAnimationForTest = force;
    }

    @VisibleForTesting
    void onFlingEnd(boolean cancelled) {
        mIsFlinging = false;
+4 −0
Original line number Diff line number Diff line
@@ -1588,6 +1588,10 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
        mScreenOn = false;
    }

    public boolean isScreenOn() {
        return mScreenOn;
    }

    public void setExpansionAffectsAlpha(boolean expansionAffectsAlpha) {
        mExpansionAffectsAlpha = expansionAffectsAlpha;
    }
+2 −0
Original line number Diff line number Diff line
@@ -387,6 +387,7 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo
    public void testOnTouchEvent_expansionResumesAfterBriefTouch() {
        mFalsingManager.setIsClassifierEnabled(true);
        mFalsingManager.setIsFalseTouch(false);
        mNotificationPanelViewController.setForceFlingAnimationForTest(true);
        // Start shade collapse with swipe up
        onTouchEvent(MotionEvent.obtain(0L /* downTime */,
                0L /* eventTime */, MotionEvent.ACTION_DOWN, 0f /* x */, 0f /* y */,
@@ -415,6 +416,7 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo
        // fling should still be called after a touch that does not exceed touch slop
        assertThat(mNotificationPanelViewController.isClosing()).isTrue();
        assertThat(mNotificationPanelViewController.isFlinging()).isTrue();
        mNotificationPanelViewController.setForceFlingAnimationForTest(false);
    }

    @Test