Merge "Do not request WAKE transition when device wake up." into tm-qpr-dev

This commit is contained in:
TreeHugger Robot
2022-12-05 23:25:46 +00:00
committed by Android (Google) Code Review
2 changed files with 16 additions and 14 deletions

View File

@@ -63,7 +63,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_TOAST;
import static android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION;
import static android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION_STARTING;
import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
import static android.view.WindowManager.TRANSIT_WAKE;
import static android.view.WindowManagerGlobal.ADD_OKAY;
import static android.view.WindowManagerPolicyConstants.ACTION_HDMI_PLUGGED;
import static android.view.WindowManagerPolicyConstants.ALT_BAR_BOTTOM;
@@ -804,13 +803,7 @@ public class DisplayPolicy {
if (!mDisplayContent.isDefaultDisplay) {
return;
}
if (mAwake && mDisplayContent.mTransitionController.isShellTransitionsEnabled()
&& !mDisplayContent.mTransitionController.isCollecting()) {
// Start a transition for waking. This is needed for showWhenLocked activities.
mDisplayContent.mTransitionController.requestTransitionIfNeeded(TRANSIT_WAKE,
0 /* flags */, null /* trigger */, mDisplayContent);
}
mService.mAtmService.mKeyguardController.updateDeferWakeTransition(
mService.mAtmService.mKeyguardController.updateDeferTransitionForAod(
mAwake /* waiting */);
}
}

View File

@@ -176,7 +176,7 @@ class KeyguardController {
final boolean keyguardChanged = (keyguardShowing != state.mKeyguardShowing)
|| (state.mKeyguardGoingAway && keyguardShowing && !aodRemoved);
if (aodRemoved) {
updateDeferWakeTransition(false /* waiting */);
updateDeferTransitionForAod(false /* waiting */);
}
if (!keyguardChanged && !aodChanged) {
setWakeTransitionReady();
@@ -535,24 +535,25 @@ class KeyguardController {
private final Runnable mResetWaitTransition = () -> {
synchronized (mWindowManager.mGlobalLock) {
updateDeferWakeTransition(false /* waiting */);
updateDeferTransitionForAod(false /* waiting */);
}
};
void updateDeferWakeTransition(boolean waiting) {
// Defer transition until AOD dismissed.
void updateDeferTransitionForAod(boolean waiting) {
if (waiting == mWaitingForWakeTransition) {
return;
}
if (!mWindowManager.mAtmService.getTransitionController().isShellTransitionsEnabled()) {
if (!mService.getTransitionController().isCollecting()) {
return;
}
// if aod is showing, defer the wake transition until aod state changed.
// if AOD is showing, defer the wake transition until AOD state changed.
if (waiting && isAodShowing(DEFAULT_DISPLAY)) {
mWaitingForWakeTransition = true;
mWindowManager.mAtmService.getTransitionController().deferTransitionReady();
mWindowManager.mH.postDelayed(mResetWaitTransition, DEFER_WAKE_TRANSITION_TIMEOUT_MS);
} else if (!waiting) {
// dismiss the deferring if the aod state change or cancel awake.
// dismiss the deferring if the AOD state change or cancel awake.
mWaitingForWakeTransition = false;
mWindowManager.mAtmService.getTransitionController().continueTransitionReady();
mWindowManager.mH.removeCallbacks(mResetWaitTransition);
@@ -659,10 +660,18 @@ class KeyguardController {
mTopTurnScreenOnActivity.setCurrentLaunchCanTurnScreenOn(false);
}
boolean hasChange = false;
if (lastOccluded != mOccluded) {
controller.handleOccludedChanged(mDisplayId, mTopOccludesActivity);
hasChange = true;
} else if (!lastKeyguardGoingAway && mKeyguardGoingAway) {
controller.handleKeyguardGoingAwayChanged(display);
hasChange = true;
}
// Collect the participates for shell transition, so that transition won't happen too
// early since the transition was set ready.
if (hasChange && top != null && (mOccluded || mKeyguardGoingAway)) {
display.mTransitionController.collect(top);
}
}