Do not request WAKE transition when device wake up.
The wake up transition should be used to waiting for ShowWhenLocked transition, but we cannot know whether there have an activity which requested device wake up, it can be also be a normal screen on. For those keyguard-related transition, they can be request in KeyguardController while updateVisibility, and collect participated activity at the same time, so the transition won't happen too early. The empty wake transition can affect tests which use injectInputEvent while waiting for animation (WMS#waitForAnimationsToComplete), which lost those input event. Bug: 259231431 Test: run atest KeyguardTests KeyguardLockedTests KeyguardInputTests w/o AOD enabled. Test: atest LockscreenWithInvalidPassword Change-Id: Ib2db22bb5fe92f79dbd14948dae8d8a2b538f605
This commit is contained in:
committed by
Wei Sheng Shih
parent
be69929b02
commit
d5c42788cd
@@ -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 */);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user