/** * Handle message sent by {@link #verifyUnlock} * * @see #RESET */ private void handleVerifyUnlock() { synchronized (KeyguardViewMediator.this) { if (DEBUG) Log.d(TAG, "handleVerifyUnlock"); mKeyguardViewManager.verifyUnlock(); mShowing = true; } }
/** * Handle message sent by {@link #wakeWhenReadyLocked(int)} * * @param keyCode The key that woke the device. * @see #WAKE_WHEN_READY */ private void handleWakeWhenReady(int keyCode) { synchronized (KeyguardViewMediator.this) { if (DBG_WAKE) Log.d(TAG, "handleWakeWhenReady(" + keyCode + ")"); // this should result in a call to 'poke wakelock' which will set a timeout // on releasing the wakelock if (!mKeyguardViewManager.wakeWhenReadyTq(keyCode)) { // poke wakelock ourselves if keyguard is no longer active Log.w( TAG, "mKeyguardViewManager.wakeWhenReadyTq did not poke wake lock, so poke it ourselves"); pokeWakelock(); } /** * Now that the keyguard is ready and has poked the wake lock, we can release the handoff * wakelock */ mWakeAndHandOff.release(); if (!mWakeLock.isHeld()) { Log.w(TAG, "mWakeLock not held in mKeyguardViewManager.wakeWhenReadyTq"); } } }
/** * Enable the keyguard if the settings are appropriate. Return true if all work that will happen * is done; returns false if the caller can wait for the keyguard to be shown. */ private void doKeyguardLocked() { boolean bEnableKeyguard = SystemProperties.getBoolean("keyguard.enable", true); if (!bEnableKeyguard) return; // if another app is disabling us, don't show if (!mExternallyEnabled) { if (DEBUG) Log.d(TAG, "doKeyguard: not showing because externally disabled"); // note: we *should* set mNeedToReshowWhenReenabled=true here, but that makes // for an occasional ugly flicker in this situation: // 1) receive a call with the screen on (no keyguard) or make a call // 2) screen times out // 3) user hits key to turn screen back on // instead, we reenable the keyguard when we know the screen is off and the call // ends (see the broadcast receiver below) // TODO: clean this up when we have better support at the window manager level // for apps that wish to be on top of the keyguard return; } // if the keyguard is already showing, don't bother if (mKeyguardViewManager.isShowing()) { if (DEBUG) Log.d(TAG, "doKeyguard: not showing because it is already showing"); return; } // if the setup wizard hasn't run yet, don't show final boolean requireSim = !SystemProperties.getBoolean("keyguard.no_require_sim", false); final boolean provisioned = mUpdateMonitor.isDeviceProvisioned(); final IccCard.State state = mUpdateMonitor.getSimState(); final boolean lockedOrMissing = state.isPinLocked() || ((state == IccCard.State.ABSENT || state == IccCard.State.PERM_DISABLED) && requireSim); if (!lockedOrMissing && !provisioned) { if (DEBUG) Log.d( TAG, "doKeyguard: not showing because device isn't provisioned" + " and the sim is not locked or missing"); return; } if (mLockPatternUtils.isLockScreenDisabled() && !lockedOrMissing) { if (DEBUG) Log.d(TAG, "doKeyguard: not showing because lockscreen is off"); return; } if (DEBUG) Log.d(TAG, "doKeyguard: showing the lock screen"); showLocked(); }
/** * Returns true if the change is resulting in the keyguard beign dismissed, meaning the screen can * turn on immediately. Otherwise returns false. */ public boolean doLidChangeTq(boolean isLidOpen) { mKeyboardOpen = isLidOpen; if (mUpdateMonitor.isKeyguardBypassEnabled() && mKeyboardOpen && !mKeyguardViewProperties.isSecure() && mKeyguardViewManager.isShowing()) { if (DEBUG) Log.d(TAG, "bypassing keyguard on sliding open of keyboard with non-secure keyguard"); mHandler.sendEmptyMessage(KEYGUARD_DONE_AUTHENTICATING); return true; } return false; }
/** * Handle message sent by {@link #showLocked}. * * @see #SHOW */ private void handleShow() { synchronized (KeyguardViewMediator.this) { if (DEBUG) Log.d(TAG, "handleShow"); if (!mSystemReady) return; playSounds(true); mKeyguardViewManager.show(); mShowing = true; adjustUserActivityLocked(); adjustStatusBarLocked(); try { ActivityManagerNative.getDefault().closeSystemDialogs("lock"); } catch (RemoteException e) { } mShowKeyguardWakeLock.release(); } }
/** * Handle message sent by {@link #hideLocked()} * * @see #HIDE */ private void handleHide() { synchronized (KeyguardViewMediator.this) { if (DEBUG) Log.d(TAG, "handleHide"); if (mWakeAndHandOff.isHeld()) { Log.w(TAG, "attempt to hide the keyguard while waking, ignored"); return; } // only play "unlock" noises if not on a call (since the incall UI // disables the keyguard) if (TelephonyManager.EXTRA_STATE_IDLE.equals(mPhoneState)) { playSounds(false); } mKeyguardViewManager.hide(); mShowing = false; adjustUserActivityLocked(); adjustStatusBarLocked(); } }
/** * Handle message sent by {@link #notifyScreenOnLocked()} * * @see #NOTIFY_SCREEN_ON */ private void handleNotifyScreenOn() { synchronized (KeyguardViewMediator.this) { if (DEBUG) Log.d(TAG, "handleNotifyScreenOn"); mKeyguardViewManager.onScreenTurnedOn(); } }
/** * Handle message sent by {@link #resetStateLocked()} * * @see #RESET */ private void handleReset() { synchronized (KeyguardViewMediator.this) { if (DEBUG) Log.d(TAG, "handleReset"); mKeyguardViewManager.reset(); } }