Merge "Fix race condition between lockNow() and updateLockscreenTimeout" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f02c375c6f
@@ -819,6 +819,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
|
||||
private boolean mAodShowing;
|
||||
|
||||
private boolean mLockNowPending = false;
|
||||
|
||||
private static final int MSG_ENABLE_POINTER_LOCATION = 1;
|
||||
private static final int MSG_DISABLE_POINTER_LOCATION = 2;
|
||||
private static final int MSG_DISPATCH_MEDIA_KEY_WITH_WAKE_LOCK = 3;
|
||||
@@ -7748,6 +7750,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
mKeyguardDelegate.doKeyguardTimeout(options);
|
||||
}
|
||||
mLockScreenTimerActive = false;
|
||||
mLockNowPending = false;
|
||||
options = null;
|
||||
}
|
||||
}
|
||||
@@ -7757,7 +7760,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
}
|
||||
}
|
||||
|
||||
ScreenLockTimeout mScreenLockTimeout = new ScreenLockTimeout();
|
||||
final ScreenLockTimeout mScreenLockTimeout = new ScreenLockTimeout();
|
||||
|
||||
@Override
|
||||
public void lockNow(Bundle options) {
|
||||
@@ -7769,10 +7772,17 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
mScreenLockTimeout.setLockOptions(options);
|
||||
}
|
||||
mHandler.post(mScreenLockTimeout);
|
||||
synchronized (mScreenLockTimeout) {
|
||||
mLockNowPending = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void updateLockScreenTimeout() {
|
||||
synchronized (mScreenLockTimeout) {
|
||||
if (mLockNowPending) {
|
||||
Log.w(TAG, "lockNow pending, ignore updating lockscreen timeout");
|
||||
return;
|
||||
}
|
||||
boolean enable = (mAllowLockscreenWhenOn && mAwake &&
|
||||
mKeyguardDelegate != null && mKeyguardDelegate.isSecure(mCurrentUserId));
|
||||
if (mLockScreenTimerActive != enable) {
|
||||
|
||||
Reference in New Issue
Block a user