diff options
Diffstat (limited to 'packages/Keyguard')
4 files changed, 47 insertions, 12 deletions
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java index b4308c6..98122fc 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java @@ -231,15 +231,6 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit mLockPatternView.setOnPatternListener(null); } - @Override - public void onWindowFocusChanged(boolean hasWindowFocus) { - super.onWindowFocusChanged(hasWindowFocus); - if (hasWindowFocus) { - // when timeout dialog closes we want to update our state - reset(); - } - } - private class UnlockPatternListener implements LockPatternView.OnPatternListener { public void onPatternStart() { diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java index ba67a82..d6351df 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -99,6 +99,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { private static final int MSG_SCREEN_TURNED_ON = 319; private static final int MSG_SCREEN_TURNED_OFF = 320; private static final int MSG_NFC_UNLOCK = 321; + private static final int MSG_KEYGUARD_BOUNCER_CHANGED = 322; private static KeyguardUpdateMonitor sInstance; @@ -111,6 +112,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { private int mRingMode; private int mPhoneState; private boolean mKeyguardIsVisible; + private boolean mBouncer; private boolean mBootCompleted; // Device provisioning state @@ -155,7 +157,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { handleRingerModeChange(msg.arg1); break; case MSG_PHONE_STATE_CHANGED: - handlePhoneStateChanged((String)msg.obj); + handlePhoneStateChanged((String) msg.obj); break; case MSG_CLOCK_VISIBILITY_CHANGED: handleClockVisibilityChanged(); @@ -167,7 +169,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { handleDevicePolicyManagerStateChanged(); break; case MSG_USER_SWITCHING: - handleUserSwitching(msg.arg1, (IRemoteCallback)msg.obj); + handleUserSwitching(msg.arg1, (IRemoteCallback) msg.obj); break; case MSG_USER_SWITCH_COMPLETE: handleUserSwitchComplete(msg.arg1); @@ -178,6 +180,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { case MSG_KEYGUARD_VISIBILITY_CHANGED: handleKeyguardVisibilityChanged(msg.arg1); break; + case MSG_KEYGUARD_BOUNCER_CHANGED: + handleKeyguardBouncerChanged(msg.arg1); + break; case MSG_BOOT_COMPLETED: handleBootCompleted(); break; @@ -887,6 +892,22 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { } /** + * Handle {@link #MSG_KEYGUARD_BOUNCER_CHANGED} + * @see #sendKeyguardBouncerChanged(boolean) + */ + private void handleKeyguardBouncerChanged(int bouncer) { + if (DEBUG) Log.d(TAG, "handleKeyguardBouncerChanged(" + bouncer + ")"); + boolean isBouncer = (bouncer == 1); + mBouncer = isBouncer; + for (int i = 0; i < mCallbacks.size(); i++) { + KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); + if (cb != null) { + cb.onKeyguardBouncerChanged(isBouncer); + } + } + } + + /** * Handle {@link #MSG_REPORT_EMERGENCY_CALL_ACTION} */ private void handleReportEmergencyCallAction() { @@ -902,6 +923,13 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { return mKeyguardIsVisible; } + /** + * @return if the keyguard is currently in bouncer mode. + */ + public boolean isKeyguardBouncer() { + return mBouncer; + } + public boolean isSwitchingUser() { return mSwitchingUser; } @@ -1021,6 +1049,16 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { message.sendToTarget(); } + /** + * @see #handleKeyguardBouncerChanged(int) + */ + public void sendKeyguardBouncerChanged(boolean showingBouncer) { + if (DEBUG) Log.d(TAG, "sendKeyguardBouncerChanged(" + showingBouncer + ")"); + Message message = mHandler.obtainMessage(MSG_KEYGUARD_BOUNCER_CHANGED); + message.arg1 = showingBouncer ? 1 : 0; + message.sendToTarget(); + } + public void reportClockVisible(boolean visible) { mClockVisible = visible; mHandler.obtainMessage(MSG_CLOCK_VISIBILITY_CHANGED).sendToTarget(); diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java index 7be4cec..91a024f 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java @@ -87,6 +87,12 @@ public class KeyguardUpdateMonitorCallback { } /** + * Called when the keyguard enters or leaves bouncer mode. + * @param bouncer if true, keyguard is now in bouncer mode. + */ + public void onKeyguardBouncerChanged(boolean bouncer) { } + + /** * Called when visibility of lockscreen clock changes, such as when * obscured by a widget. */ diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java b/packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java index d8e5b8a..a9206e7 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java @@ -297,7 +297,7 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa * @param event The key event * @return whether the event was consumed as a media key. */ - private boolean interceptMediaKey(KeyEvent event) { + public boolean interceptMediaKey(KeyEvent event) { final int keyCode = event.getKeyCode(); if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (keyCode) { |