From c753a1865ca049fb20fc5cea036c06ea77647ff1 Mon Sep 17 00:00:00 2001 From: Steven Ross Date: Tue, 15 Nov 2011 13:59:35 -0500 Subject: [PATCH] Not showing facelock when plugging/unplugging fixes 5438524 This will close down or prevent the start of FaceUnlock if the device is plugged in or unplugged, unless FaceUnlock is currently active. Change-Id: I216831964472da47fb24644070d1717dffe1b7f7 --- .../policy/impl/LockPatternKeyguardView.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java index 07ef95a01505e..0ef4ef3d2b3ac 100644 --- a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java +++ b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java @@ -150,6 +150,8 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler //True if a dialog is currently displaying on top of this window //Unlike other overlays, this does not close with a power button cycle private boolean mHasDialog = false; + //True if this device is currently plugged in + private boolean mPluggedIn; /** @@ -312,6 +314,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler mLockPatternUtils = lockPatternUtils; mWindowController = controller; mHasOverlay = false; + mPluggedIn = mUpdateMonitor.isDevicePluggedIn(); mUpdateMonitor.registerInfoCallback(this); @@ -717,10 +720,19 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler post(mRecreateRunnable); } - //Ignore these events; they are implemented only because they come from the same interface + /** When somebody plugs in or unplugs the device, we don't want to display faceunlock */ @Override - public void onRefreshBatteryInfo(boolean showBatteryInfo, boolean pluggedIn, int batteryLevel) - {} + public void onRefreshBatteryInfo(boolean showBatteryInfo, boolean pluggedIn, int batteryLevel) { + mHasOverlay |= mPluggedIn != pluggedIn; + mPluggedIn = pluggedIn; + //If it's already running, don't close it down: the unplug didn't start it + if (!mFaceLockServiceRunning) { + stopAndUnbindFromFaceLock(); + hideFaceLockArea(); + } + } + + //Ignore these events; they are implemented only because they come from the same interface @Override public void onTimeChanged() {} @Override