Merge "Unify keygaurd occluded status variable." into sc-v2-dev

This commit is contained in:
Issei Suzuki
2021-09-29 08:34:41 +00:00
committed by Android (Google) Code Review
2 changed files with 13 additions and 11 deletions

View File

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

View File

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