AOD: Fix wakeup transition jank
No longer do the upwards animation from AOD1, because there is a fade in instead now. Also, because the DozeService gets finished when waking up, we were disallowing animations again. Instead, we now ignore disallowing animations while waking up. Also don't cancel the NotificationPanelView wakeup animation when another identical request comes in. Also adds tracing for various SystemUI states. Bug: 63531607 Test: Wake up from AOD1. Ensure there is no jank or flicker Change-Id: I383ffa320f28ac4bf5432e4f4f5c06372717f66f
This commit is contained in:
@@ -100,7 +100,6 @@ public class DozeUi implements DozeMachine.Part {
|
||||
|
||||
private boolean shouldAnimateWakeup(DozeMachine.State state) {
|
||||
switch (state) {
|
||||
case DOZE_AOD:
|
||||
case DOZE_REQUEST_PULSE:
|
||||
case DOZE_PULSING:
|
||||
case DOZE_PULSE_DONE:
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.systemui.keyguard;
|
||||
|
||||
import android.os.Trace;
|
||||
|
||||
import com.android.systemui.Dumpable;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
@@ -38,22 +40,22 @@ public class ScreenLifecycle extends Lifecycle<ScreenLifecycle.Observer> impleme
|
||||
}
|
||||
|
||||
public void dispatchScreenTurningOn() {
|
||||
mScreenState = SCREEN_TURNING_ON;
|
||||
setScreenState(SCREEN_TURNING_ON);
|
||||
dispatch(Observer::onScreenTurningOn);
|
||||
}
|
||||
|
||||
public void dispatchScreenTurnedOn() {
|
||||
mScreenState = SCREEN_ON;
|
||||
setScreenState(SCREEN_ON);
|
||||
dispatch(Observer::onScreenTurnedOn);
|
||||
}
|
||||
|
||||
public void dispatchScreenTurningOff() {
|
||||
mScreenState = SCREEN_TURNING_OFF;
|
||||
setScreenState(SCREEN_TURNING_OFF);
|
||||
dispatch(Observer::onScreenTurningOff);
|
||||
}
|
||||
|
||||
public void dispatchScreenTurnedOff() {
|
||||
mScreenState = SCREEN_OFF;
|
||||
setScreenState(SCREEN_OFF);
|
||||
dispatch(Observer::onScreenTurnedOff);
|
||||
}
|
||||
|
||||
@@ -63,6 +65,11 @@ public class ScreenLifecycle extends Lifecycle<ScreenLifecycle.Observer> impleme
|
||||
pw.println(" mScreenState=" + mScreenState);
|
||||
}
|
||||
|
||||
private void setScreenState(int screenState) {
|
||||
mScreenState = screenState;
|
||||
Trace.traceCounter(Trace.TRACE_TAG_APP, "screenState", screenState);
|
||||
}
|
||||
|
||||
public interface Observer {
|
||||
default void onScreenTurningOn() {}
|
||||
default void onScreenTurnedOn() {}
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.systemui.keyguard;
|
||||
|
||||
import android.os.Trace;
|
||||
|
||||
import com.android.systemui.Dumpable;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
@@ -39,22 +41,22 @@ public class WakefulnessLifecycle extends Lifecycle<WakefulnessLifecycle.Observe
|
||||
}
|
||||
|
||||
public void dispatchStartedWakingUp() {
|
||||
mWakefulness = WAKEFULNESS_WAKING;
|
||||
setWakefulness(WAKEFULNESS_WAKING);
|
||||
dispatch(Observer::onStartedWakingUp);
|
||||
}
|
||||
|
||||
public void dispatchFinishedWakingUp() {
|
||||
mWakefulness = WAKEFULNESS_AWAKE;
|
||||
setWakefulness(WAKEFULNESS_AWAKE);
|
||||
dispatch(Observer::onFinishedWakingUp);
|
||||
}
|
||||
|
||||
public void dispatchStartedGoingToSleep() {
|
||||
mWakefulness = WAKEFULNESS_GOING_TO_SLEEP;
|
||||
setWakefulness(WAKEFULNESS_GOING_TO_SLEEP);
|
||||
dispatch(Observer::onStartedGoingToSleep);
|
||||
}
|
||||
|
||||
public void dispatchFinishedGoingToSleep() {
|
||||
mWakefulness = WAKEFULNESS_ASLEEP;
|
||||
setWakefulness(WAKEFULNESS_ASLEEP);
|
||||
dispatch(Observer::onFinishedGoingToSleep);
|
||||
}
|
||||
|
||||
@@ -64,6 +66,11 @@ public class WakefulnessLifecycle extends Lifecycle<WakefulnessLifecycle.Observe
|
||||
pw.println(" mWakefulness=" + mWakefulness);
|
||||
}
|
||||
|
||||
private void setWakefulness(int wakefulness) {
|
||||
mWakefulness = wakefulness;
|
||||
Trace.traceCounter(Trace.TRACE_TAG_APP, "wakefulness", wakefulness);
|
||||
}
|
||||
|
||||
public interface Observer {
|
||||
default void onStartedWakingUp() {}
|
||||
default void onFinishedWakingUp() {}
|
||||
|
||||
@@ -232,6 +232,7 @@ public class NotificationPanelView extends PanelView implements
|
||||
private int mAmbientIndicationBottomPadding;
|
||||
private boolean mIsFullWidth;
|
||||
private float mDarkAmount;
|
||||
private float mDarkAmountTarget;
|
||||
private LockscreenGestureLogger mLockscreenGestureLogger = new LockscreenGestureLogger();
|
||||
private boolean mNoVisibleNotifications = true;
|
||||
private ValueAnimator mDarkAnimator;
|
||||
@@ -2590,8 +2591,13 @@ public class NotificationPanelView extends PanelView implements
|
||||
return;
|
||||
}
|
||||
if (mDarkAnimator != null && mDarkAnimator.isRunning()) {
|
||||
mDarkAnimator.cancel();
|
||||
if (animate && mDarkAmountTarget == darkAmount) {
|
||||
return;
|
||||
} else {
|
||||
mDarkAnimator.cancel();
|
||||
}
|
||||
}
|
||||
mDarkAmountTarget = darkAmount;
|
||||
if (animate) {
|
||||
mDarkAnimator = ObjectAnimator.ofFloat(this, SET_DARK_AMOUNT_PROPERTY, darkAmount);
|
||||
mDarkAnimator.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN);
|
||||
|
||||
@@ -4611,6 +4611,7 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
}
|
||||
|
||||
private void updateDozingState() {
|
||||
Trace.traceCounter(Trace.TRACE_TAG_APP, "dozing", mDozing ? 1 : 0);
|
||||
Trace.beginSection("StatusBar#updateDozingState");
|
||||
boolean animate = !mDozing && mDozeServiceHost.shouldAnimateWakeup();
|
||||
mNotificationPanel.setDozing(mDozing, animate);
|
||||
@@ -5492,6 +5493,11 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
|
||||
@Override
|
||||
public void setAnimateWakeup(boolean animateWakeup) {
|
||||
if (mWakefulnessLifecycle.getWakefulness() == WAKEFULNESS_AWAKE
|
||||
|| mWakefulnessLifecycle.getWakefulness() == WAKEFULNESS_WAKING) {
|
||||
// Too late to change the wakeup animation.
|
||||
return;
|
||||
}
|
||||
mAnimateWakeup = animateWakeup;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user