Loading services/core/java/com/android/server/policy/PhoneWindowManager.java +26 −1 Original line number Diff line number Diff line Loading @@ -358,6 +358,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { boolean mSystemReady; boolean mSystemBooted; private boolean mDeferBindKeyguard; boolean mHdmiPlugged; HdmiControl mHdmiControl; IUiModeManager mUiModeManager; Loading Loading @@ -6014,6 +6015,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { readCameraLensCoverState(); updateUiMode(); boolean bindKeyguardNow; synchronized (mLock) { updateOrientationListenerLp(); mSystemReady = true; Loading @@ -6023,13 +6025,36 @@ public class PhoneWindowManager implements WindowManagerPolicy { updateSettings(); } }); bindKeyguardNow = mDeferBindKeyguard; if (bindKeyguardNow) { // systemBooted ran but wasn't able to bind to the Keyguard, we'll do it now. mDeferBindKeyguard = false; } } if (bindKeyguardNow) { mKeyguardDelegate.bindService(mContext); mKeyguardDelegate.onBootCompleted(); } } /** {@inheritDoc} */ @Override public void systemBooted() { boolean bindKeyguardNow = false; synchronized (mLock) { // Time to bind Keyguard; take care to only bind it once, either here if ready or // in systemReady if not. if (mKeyguardDelegate != null) { bindKeyguardNow = true; } else { // Because mKeyguardDelegate is null, we know that the synchronized block in // systemReady didn't run yet and setting this will actually have an effect. mDeferBindKeyguard = true; } } if (bindKeyguardNow) { mKeyguardDelegate.bindService(mContext); mKeyguardDelegate.onBootCompleted(); } Loading services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java +17 −10 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ public class KeyguardServiceDelegate { private final KeyguardState mKeyguardState = new KeyguardState(); private DrawnListener mDrawnListenerWhenConnect; /* package */ static final class KeyguardState { private static final class KeyguardState { KeyguardState() { // Assume keyguard is showing and secure until we know for sure. This is here in // the event something checks before the service is actually started. Loading Loading @@ -119,8 +119,13 @@ public class KeyguardServiceDelegate { mKeyguardState.showing = false; mKeyguardState.showingAndNotOccluded = false; mKeyguardState.secure = false; synchronized (mKeyguardState) { // TODO: Fix synchronisation model in this class. The other state in this class // is at least self-healing but a race condition here can lead to the scrim being // stuck on keyguard-less devices. mKeyguardState.deviceHasKeyguard = false; hideScrim(); } } else { if (DEBUG) Log.v(TAG, "*** Keyguard started"); } Loading Loading @@ -315,6 +320,7 @@ public class KeyguardServiceDelegate { } public void showScrim() { synchronized (mKeyguardState) { if (!mKeyguardState.deviceHasKeyguard) return; mScrim.post(new Runnable() { @Override Loading @@ -323,6 +329,7 @@ public class KeyguardServiceDelegate { } }); } } public void hideScrim() { mScrim.post(new Runnable() { Loading Loading
services/core/java/com/android/server/policy/PhoneWindowManager.java +26 −1 Original line number Diff line number Diff line Loading @@ -358,6 +358,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { boolean mSystemReady; boolean mSystemBooted; private boolean mDeferBindKeyguard; boolean mHdmiPlugged; HdmiControl mHdmiControl; IUiModeManager mUiModeManager; Loading Loading @@ -6014,6 +6015,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { readCameraLensCoverState(); updateUiMode(); boolean bindKeyguardNow; synchronized (mLock) { updateOrientationListenerLp(); mSystemReady = true; Loading @@ -6023,13 +6025,36 @@ public class PhoneWindowManager implements WindowManagerPolicy { updateSettings(); } }); bindKeyguardNow = mDeferBindKeyguard; if (bindKeyguardNow) { // systemBooted ran but wasn't able to bind to the Keyguard, we'll do it now. mDeferBindKeyguard = false; } } if (bindKeyguardNow) { mKeyguardDelegate.bindService(mContext); mKeyguardDelegate.onBootCompleted(); } } /** {@inheritDoc} */ @Override public void systemBooted() { boolean bindKeyguardNow = false; synchronized (mLock) { // Time to bind Keyguard; take care to only bind it once, either here if ready or // in systemReady if not. if (mKeyguardDelegate != null) { bindKeyguardNow = true; } else { // Because mKeyguardDelegate is null, we know that the synchronized block in // systemReady didn't run yet and setting this will actually have an effect. mDeferBindKeyguard = true; } } if (bindKeyguardNow) { mKeyguardDelegate.bindService(mContext); mKeyguardDelegate.onBootCompleted(); } Loading
services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java +17 −10 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ public class KeyguardServiceDelegate { private final KeyguardState mKeyguardState = new KeyguardState(); private DrawnListener mDrawnListenerWhenConnect; /* package */ static final class KeyguardState { private static final class KeyguardState { KeyguardState() { // Assume keyguard is showing and secure until we know for sure. This is here in // the event something checks before the service is actually started. Loading Loading @@ -119,8 +119,13 @@ public class KeyguardServiceDelegate { mKeyguardState.showing = false; mKeyguardState.showingAndNotOccluded = false; mKeyguardState.secure = false; synchronized (mKeyguardState) { // TODO: Fix synchronisation model in this class. The other state in this class // is at least self-healing but a race condition here can lead to the scrim being // stuck on keyguard-less devices. mKeyguardState.deviceHasKeyguard = false; hideScrim(); } } else { if (DEBUG) Log.v(TAG, "*** Keyguard started"); } Loading Loading @@ -315,6 +320,7 @@ public class KeyguardServiceDelegate { } public void showScrim() { synchronized (mKeyguardState) { if (!mKeyguardState.deviceHasKeyguard) return; mScrim.post(new Runnable() { @Override Loading @@ -323,6 +329,7 @@ public class KeyguardServiceDelegate { } }); } } public void hideScrim() { mScrim.post(new Runnable() { Loading