Unify keygaurd occluded status variable.

Bug: 15871167
Test: no-op refactoring, pass existing tests.
Change-Id: Ib7bfe10b111a885e5f2937102991566e0ff62cfc
This commit is contained in:
Issei Suzuki
2021-09-28 15:34:09 +02:00
parent 7fd080847b
commit e02eb07d40
2 changed files with 13 additions and 11 deletions

View File

@@ -508,7 +508,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
private boolean mKeyguardOccludedChanged;
private ActivityTaskManagerInternal.SleepTokenAcquirer mScreenOffSleepTokenAcquirer;
volatile boolean mKeyguardOccluded;
Intent mHomeIntent;
Intent mCarDockIntent;
Intent mDeskDockIntent;
@@ -2399,7 +2398,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// the keyguard is being hidden. This is okay because starting windows never show
// secret information.
// TODO(b/113840485): Occluded may not only happen on default display
if (displayId == DEFAULT_DISPLAY && mKeyguardOccluded) {
if (displayId == DEFAULT_DISPLAY && isKeyguardOccluded()) {
windowFlags |= FLAG_SHOW_WHEN_LOCKED;
}
}
@@ -3215,7 +3214,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
return;
}
if (!mKeyguardOccluded && mKeyguardDelegate.isInputRestricted()) {
if (!isKeyguardOccluded() && mKeyguardDelegate.isInputRestricted()) {
// when in keyguard restricted mode, must first verify unlock
// before launching home
mKeyguardDelegate.verifyUnlock(new OnKeyguardExitResult() {
@@ -3266,7 +3265,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
@Override
public void setKeyguardCandidateLw(WindowState win) {
mKeyguardCandidate = win;
setKeyguardOccludedLw(mKeyguardOccluded, true /* force */);
setKeyguardOccludedLw(isKeyguardOccluded(), true /* force */);
}
/**
@@ -3279,13 +3278,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
*/
private boolean setKeyguardOccludedLw(boolean isOccluded, boolean force) {
if (DEBUG_KEYGUARD) Slog.d(TAG, "setKeyguardOccluded occluded=" + isOccluded);
if (mKeyguardOccluded == isOccluded && !force) {
if (isKeyguardOccluded() == isOccluded && !force) {
return false;
}
final boolean showing = mKeyguardDelegate.isShowing();
final boolean animate = showing && !isOccluded;
mKeyguardOccluded = isOccluded;
mKeyguardDelegate.setOccluded(isOccluded, animate);
if (!showing) {
@@ -4593,7 +4591,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
@Override
public boolean isKeyguardShowingAndNotOccluded() {
if (mKeyguardDelegate == null) return false;
return mKeyguardDelegate.isShowing() && !mKeyguardOccluded;
return mKeyguardDelegate.isShowing() && !isKeyguardOccluded();
}
@Override
@@ -4619,7 +4617,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
@Override
public boolean isKeyguardOccluded() {
if (mKeyguardDelegate == null) return false;
return mKeyguardOccluded;
return mKeyguardDelegate.isOccluded();
}
/** {@inheritDoc} */
@@ -5305,7 +5303,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
proto.write(KEYGUARD_DRAW_COMPLETE, mDefaultDisplayPolicy.isKeyguardDrawComplete());
proto.write(WINDOW_MANAGER_DRAW_COMPLETE,
mDefaultDisplayPolicy.isWindowManagerDrawComplete());
proto.write(KEYGUARD_OCCLUDED, mKeyguardOccluded);
proto.write(KEYGUARD_OCCLUDED, isKeyguardOccluded());
proto.write(KEYGUARD_OCCLUDED_CHANGED, mKeyguardOccludedChanged);
proto.write(KEYGUARD_OCCLUDED_PENDING, mPendingKeyguardOccluded);
if (mKeyguardDelegate != null) {
@@ -5390,7 +5388,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
final int key = mDisplayHomeButtonHandlers.keyAt(i);
pw.println(mDisplayHomeButtonHandlers.get(key));
}
pw.print(prefix); pw.print("mKeyguardOccluded="); pw.print(mKeyguardOccluded);
pw.print(prefix); pw.print("mKeyguardOccluded="); pw.print(isKeyguardOccluded());
pw.print(" mKeyguardOccludedChanged="); pw.print(mKeyguardOccludedChanged);
pw.print(" mPendingKeyguardOccluded="); pw.println(mPendingKeyguardOccluded);
pw.print(prefix); pw.print("mAllowLockscreenWhenOnDisplays=");

View File

@@ -67,7 +67,7 @@ public class KeyguardServiceDelegate {
boolean showing;
boolean showingAndNotOccluded;
boolean inputRestricted;
boolean occluded;
volatile boolean occluded;
boolean secure;
boolean dreaming;
boolean systemIsReady;
@@ -272,6 +272,10 @@ public class KeyguardServiceDelegate {
mKeyguardState.occluded = isOccluded;
}
public boolean isOccluded() {
return mKeyguardState.occluded;
}
public void dismiss(IKeyguardDismissCallback callback, CharSequence message) {
if (mKeyguardService != null) {
mKeyguardService.dismiss(callback, message);