Fix black frame flicker in UNOCCLUDE transition.

When an activity which occludes the keyguard finishes, WindowManager
immediately updatees the keyguard occluded status, so show-when-locked
wallpaper was not used anymore. However sysui needed some time to finish
keyguard occluded status change in their side, and meantime no wallpaper
target existed.

With this change, we keep using show-when-locked wallpaper until app
transition finishes.

Bug: 201560359
Test: manual. Show assist app on the lockscreen and close.
Change-Id: I4958a2f5ecdd12b3db43b44ee4a221972070ab2c
This commit is contained in:
Issei Suzuki
2021-10-14 19:56:24 +02:00
parent 3e4737aafa
commit f5a613e528
5 changed files with 31 additions and 1 deletions

View File

@@ -4630,6 +4630,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
return mKeyguardDelegate.isInputRestricted();
}
/** {@inheritDoc} */
@Override
public boolean isKeyguardUnoccluding() {
return keyguardOn() && !mWindowManagerFuncs.isAppTransitionStateIdle();
}
@Override
public void dismissKeyguardLw(IKeyguardDismissCallback callback, CharSequence message) {
if (mKeyguardDelegate != null && mKeyguardDelegate.isShowing()) {

View File

@@ -367,6 +367,12 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {
* as the top display.
*/
void moveDisplayToTop(int displayId);
/**
* Return whether the app transition state is idle.
* @return {@code true} if app transition state is idle on the default display.
*/
boolean isAppTransitionStateIdle();
}
/**
@@ -973,6 +979,14 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {
*/
public boolean isKeyguardOccluded();
/**
* Return whether the keyguard is unoccluding.
* @return {@code true} if the keyguard is unoccluding.
*/
default boolean isKeyguardUnoccluding() {
return false;
}
/**
* @return true if in keyguard is on.
*/

View File

@@ -365,6 +365,10 @@ public class AppTransition implements Dump {
setAppTransitionState(APP_STATE_IDLE);
}
boolean isIdle() {
return mAppTransitionState == APP_STATE_IDLE;
}
boolean isTimeout() {
return mAppTransitionState == APP_STATE_TIMEOUT;
}

View File

@@ -159,7 +159,8 @@ class WallpaperController {
boolean needsShowWhenLockedWallpaper = false;
if ((w.mAttrs.flags & FLAG_SHOW_WHEN_LOCKED) != 0
&& mService.mPolicy.isKeyguardLocked()
&& mService.mPolicy.isKeyguardOccluded()) {
&& (mService.mPolicy.isKeyguardOccluded()
|| mService.mPolicy.isKeyguardUnoccluding())) {
// The lowest show when locked window decides whether we need to put the wallpaper
// behind.
needsShowWhenLockedWallpaper = !isFullscreen(w.mAttrs)

View File

@@ -3071,6 +3071,11 @@ public class WindowManagerService extends IWindowManager.Stub
syncInputTransactions(true /* waitForAnimations */);
}
@Override
public boolean isAppTransitionStateIdle() {
return getDefaultDisplayContentLocked().mAppTransition.isIdle();
}
/**
* Notifies activity manager that some Keyguard flags have changed and that it needs to
* reevaluate the visibilities of the activities.