Merge "Refactor PhoneWindowManager#setKeyguardOccludedLw" into sc-v2-dev am: 6497a301fd

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15924832

Change-Id: If23ddebb3463e9560bc3ce8b4e396577d2473bdb
This commit is contained in:
Issei Suzuki
2021-09-29 08:44:43 +00:00
committed by Automerger Merge Worker

View File

@@ -3272,36 +3272,33 @@ public class PhoneWindowManager implements WindowManagerPolicy {
/** /**
* Updates the occluded state of the Keyguard. * Updates the occluded state of the Keyguard.
* *
* @param isOccluded Whether the Keyguard is occluded by another window.
* @param force notify the occluded status to KeyguardService and update flags even though
* occlude status doesn't change.
* @return Whether the flags have changed and we have to redo the layout. * @return Whether the flags have changed and we have to redo the layout.
*/ */
private boolean setKeyguardOccludedLw(boolean isOccluded, boolean force) { private boolean setKeyguardOccludedLw(boolean isOccluded, boolean force) {
if (DEBUG_KEYGUARD) Slog.d(TAG, "setKeyguardOccluded occluded=" + isOccluded); if (DEBUG_KEYGUARD) Slog.d(TAG, "setKeyguardOccluded occluded=" + isOccluded);
final boolean wasOccluded = mKeyguardOccluded; if (mKeyguardOccluded == isOccluded && !force) {
return false;
}
final boolean showing = mKeyguardDelegate.isShowing(); final boolean showing = mKeyguardDelegate.isShowing();
final boolean changed = wasOccluded != isOccluded || force; final boolean animate = showing && !isOccluded;
if (!isOccluded && changed && showing) { mKeyguardOccluded = isOccluded;
mKeyguardOccluded = false; mKeyguardDelegate.setOccluded(isOccluded, animate);
mKeyguardDelegate.setOccluded(false, true /* animate */);
if (!showing) {
return false;
}
if (mKeyguardCandidate != null) { if (mKeyguardCandidate != null) {
if (!mKeyguardDelegate.hasLockscreenWallpaper()) { if (isOccluded) {
mKeyguardCandidate.getAttrs().flags &= ~FLAG_SHOW_WALLPAPER;
} else if (!mKeyguardDelegate.hasLockscreenWallpaper()) {
mKeyguardCandidate.getAttrs().flags |= FLAG_SHOW_WALLPAPER; mKeyguardCandidate.getAttrs().flags |= FLAG_SHOW_WALLPAPER;
} }
} }
return true; return true;
} else if (isOccluded && changed && showing) {
mKeyguardOccluded = true;
mKeyguardDelegate.setOccluded(true, false /* animate */);
if (mKeyguardCandidate != null) {
mKeyguardCandidate.getAttrs().flags &= ~FLAG_SHOW_WALLPAPER;
}
return true;
} else if (changed) {
mKeyguardOccluded = isOccluded;
mKeyguardDelegate.setOccluded(isOccluded, false /* animate */);
return false;
} else {
return false;
}
} }
/** {@inheritDoc} */ /** {@inheritDoc} */