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

Commit e29ff090 authored by Jeff DeCew's avatar Jeff DeCew Committed by Android (Google) Code Review
Browse files

Merge changes from topic "tsuji-wakeup" into tm-qpr-dev

* changes:
  Create AnimatorTestRule2 which avoids the test interaction bugs with the original as it currently exists
  Keep the clock centered until the delayed doze animation plays.
  Delay the dozeAmount change animation.
  Run ktfmt on NotificationWakeUpCoordinator.kt
  Restructure the NotificationWakeUpCoordinator's dozeAmount recalculation.
  Tell NotificationWakeupCoordinator if we're waking from power button w/ SFPS press-to-unlock.
parents 1a033981 6de9be16
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -254,6 +254,7 @@ public final class NotificationPanelViewController implements Dumpable {
    public static final float FLING_SPEED_UP_FACTOR = 0.6f;
    public static final float FLING_CLOSING_MAX_LENGTH_SECONDS = 0.6f;
    public static final float FLING_CLOSING_SPEED_UP_FACTOR = 0.6f;
    public static final int WAKEUP_ANIMATION_DELAY_MS = 250;
    private static final boolean DEBUG_LOGCAT = Compile.IS_DEBUG && Log.isLoggable(TAG, Log.DEBUG);
    private static final boolean SPEW_LOGCAT = Compile.IS_DEBUG && Log.isLoggable(TAG, Log.VERBOSE);
    private static final boolean DEBUG_DRAWABLE = false;
@@ -276,6 +277,7 @@ public final class NotificationPanelViewController implements Dumpable {
    private static final int NO_FIXED_DURATION = -1;
    private static final long SHADE_OPEN_SPRING_OUT_DURATION = 350L;
    private static final long SHADE_OPEN_SPRING_BACK_DURATION = 400L;

    /**
     * The factor of the usual high velocity that is needed in order to reach the maximum overshoot
     * when flinging. A low value will make it that most flings will reach the maximum overshoot.
@@ -588,6 +590,12 @@ public final class NotificationPanelViewController implements Dumpable {
    private boolean mGestureWaitForTouchSlop;
    private boolean mIgnoreXTouchSlop;
    private boolean mExpandLatencyTracking;
    /**
     * Whether we're waking up and will play the delayed doze animation in
     * {@link NotificationWakeUpCoordinator}. If so, we'll want to keep the clock centered until the
     * delayed doze animation starts.
     */
    private boolean mWillPlayDelayedDozeAmountAnimation = false;
    private final DreamingToLockscreenTransitionViewModel mDreamingToLockscreenTransitionViewModel;
    private final OccludedToLockscreenTransitionViewModel mOccludedToLockscreenTransitionViewModel;
    private final LockscreenToDreamingTransitionViewModel mLockscreenToDreamingTransitionViewModel;
@@ -1044,6 +1052,12 @@ public final class NotificationPanelViewController implements Dumpable {
                    requestScrollerTopPaddingUpdate(false /* animate */);
                }
            }

            @Override
            public void onDelayedDozeAmountAnimationRunning(boolean running) {
                // On running OR finished, the animation is no longer waiting to play
                setWillPlayDelayedDozeAmountAnimation(false);
            }
        });

        mView.setRtlChangeListener(layoutDirection -> {
@@ -1640,11 +1654,28 @@ public final class NotificationPanelViewController implements Dumpable {
            // Pulsing notification appears on the right. Move clock left to avoid overlap.
            return false;
        }
        if (mWillPlayDelayedDozeAmountAnimation) {
            return true;
        }
        // "Visible" notifications are actually not visible on AOD (unless pulsing), so it is safe
        // to center the clock without overlap.
        return isOnAod();
    }

    /**
     * Notify us that {@link NotificationWakeUpCoordinator} is going to play the doze wakeup
     * animation after a delay. If so, we'll keep the clock centered until that animation starts.
     */
    public void setWillPlayDelayedDozeAmountAnimation(boolean willPlay) {
        if (mWillPlayDelayedDozeAmountAnimation == willPlay) return;

        mWillPlayDelayedDozeAmountAnimation = willPlay;
        mWakeUpCoordinator.logDelayingClockWakeUpAnimation(willPlay);

        // Once changing this value, see if we should move the clock.
        positionClockAndNotifications();
    }

    private boolean isOnAod() {
        return mDozing && mDozeParameters.getAlwaysOn();
    }
Loading