diff options
| author | Jim Miller <jaggies@google.com> | 2012-01-10 10:34:51 -0800 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2012-01-10 10:34:51 -0800 |
| commit | 5437c220e239dc6276942990bc81c1388cfb176c (patch) | |
| tree | e7324a7a036e03808450d39970e2586dae43cac8 /policy | |
| parent | 251f0485440cc8202308ce6c00cbc56b207ded55 (diff) | |
| parent | d3872f55045b7ce7be7dd7ae5fff37d7988bdcb2 (diff) | |
| download | frameworks_base-5437c220e239dc6276942990bc81c1388cfb176c.zip frameworks_base-5437c220e239dc6276942990bc81c1388cfb176c.tar.gz frameworks_base-5437c220e239dc6276942990bc81c1388cfb176c.tar.bz2 | |
am d3872f55: am 62fad768: Merge "Fix 4560303: Add setting to lock later when power button pressed" into ics-mr1
* commit 'd3872f55045b7ce7be7dd7ae5fff37d7988bdcb2':
Fix 4560303: Add setting to lock later when power button pressed
Diffstat (limited to 'policy')
| -rw-r--r-- | policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java index b514689..52d6d24 100644 --- a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java +++ b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java @@ -350,6 +350,12 @@ public class KeyguardViewMediator implements KeyguardViewCallback, mScreenOn = false; if (DEBUG) Log.d(TAG, "onScreenTurnedOff(" + why + ")"); + // Lock immediately based on setting if secure (user has a pin/pattern/password). + // This also "locks" the device when not secure to provide easy access to the + // camera while preventing unwanted input. + final boolean lockImmediately = + mLockPatternUtils.getPowerButtonInstantlyLocks() || !mLockPatternUtils.isSecure(); + if (mExitSecureCallback != null) { if (DEBUG) Log.d(TAG, "pending exit secure callback cancelled"); mExitSecureCallback.onKeyguardExitResult(false); @@ -360,8 +366,10 @@ public class KeyguardViewMediator implements KeyguardViewCallback, } else if (mShowing) { notifyScreenOffLocked(); resetStateLocked(); - } else if (why == WindowManagerPolicy.OFF_BECAUSE_OF_TIMEOUT) { - // if the screen turned off because of timeout, set an alarm + } else if (why == WindowManagerPolicy.OFF_BECAUSE_OF_TIMEOUT + || (why == WindowManagerPolicy.OFF_BECAUSE_OF_USER && !lockImmediately)) { + // if the screen turned off because of timeout or the user hit the power button + // and we don't need to lock immediately, set an alarm // to enable it a little bit later (i.e, give the user a chance // to turn the screen back on within a certain window without // having to unlock the screen) @@ -400,8 +408,7 @@ public class KeyguardViewMediator implements KeyguardViewCallback, intent.putExtra("seq", mDelayedShowingSequence); PendingIntent sender = PendingIntent.getBroadcast(mContext, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT); - mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, when, - sender); + mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, when, sender); if (DEBUG) Log.d(TAG, "setting alarm to turn off keyguard, seq = " + mDelayedShowingSequence); } |
