summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Steven Ross <stross@google.com> 2011-10-08 09:06:37 -0400
committer Steven Ross <stross@google.com> 2011-10-10 06:46:20 -0400
commitc3892c525d5fffc40f068e7fdc975807e987c9d4 (patch)
treec952e7fc0a410d21eab84b124dbe4ce26ec81313
parentbdb3df82bb800de6f86de6b5bb2a4d29e09b3383 (diff)
Fixes 5429869 Only displaying FaceUnlock when window is focused
Makes sure that the screen is on and the window is focused before bringing up FaceUnlock Change-Id: I4c138c5c60fde217b6243627bd043194278835c2
-rw-r--r--policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java39
1 files changed, 30 insertions, 9 deletions
diff --git a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
index 071044ed2b9c..265024be98b5 100644
--- a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
+++ b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
@@ -98,7 +98,8 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
private View mLockScreen;
private View mUnlockScreen;
- private boolean mScreenOn = false;
+ private volatile boolean mScreenOn = false;
+ private volatile boolean mWindowFocused = false;
private boolean mEnableFallback = false; // assume no fallback UI until we know better
private boolean mShowLockBeforeUnlock = false;
@@ -110,6 +111,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
private boolean mFaceLockServiceRunning = false;
private final Object mFaceLockServiceRunningLock = new Object();
+ private final Object mFaceLockStartupLock = new Object();
private Handler mHandler;
private final int MSG_SHOW_FACELOCK_AREA_VIEW = 0;
@@ -514,13 +516,10 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
stopAndUnbindFromFaceLock();
}
- @Override
- public void onScreenTurnedOn() {
- mScreenOn = true;
- show();
-
- // When screen is turned on, need to bind to FaceLock service if we are using FaceLock
- // But only if not dealing with a call
+ /** When screen is turned on and focused, need to bind to FaceLock service if we are using
+ * FaceLock, but only if we're not dealing with a call
+ */
+ private void activateFaceLockIfAble() {
final boolean transportInvisible = mTransportControlView == null ? true :
mTransportControlView.getVisibility() != View.VISIBLE;
if (mUpdateMonitor.getPhoneState() == TelephonyManager.CALL_STATE_IDLE
@@ -534,12 +533,34 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
}
}
- /** Unbind from facelock if something covers this window (such as an alarm) */
+ @Override
+ public void onScreenTurnedOn() {
+ boolean runFaceLock = false;
+ //Make sure to start facelock iff the screen is both on and focused
+ synchronized(mFaceLockStartupLock) {
+ mScreenOn = true;
+ runFaceLock = mWindowFocused;
+ }
+ show();
+ if(runFaceLock) activateFaceLockIfAble();
+ }
+
+ /** Unbind from facelock if something covers this window (such as an alarm)
+ * bind to facelock if the lockscreen window just came into focus, and the screen is on
+ */
@Override
public void onWindowFocusChanged (boolean hasWindowFocus) {
+ boolean runFaceLock = false;
+ //Make sure to start facelock iff the screen is both on and focused
+ synchronized(mFaceLockStartupLock) {
+ if(mScreenOn && !mWindowFocused) runFaceLock = hasWindowFocus;
+ mWindowFocused = hasWindowFocus;
+ }
if(!hasWindowFocus) {
stopAndUnbindFromFaceLock();
mHandler.sendEmptyMessage(MSG_HIDE_FACELOCK_AREA_VIEW);
+ } else if (runFaceLock) {
+ activateFaceLockIfAble();
}
}