Loading policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java +35 −12 Original line number Diff line number Diff line Loading @@ -122,7 +122,6 @@ public class KeyguardViewMediator implements KeyguardViewCallback, */ protected static final int AWAKE_INTERVAL_DEFAULT_MS = 10000; /** * The default amount of time we stay awake (used for all key input) when * the keyboard is open Loading Loading @@ -356,11 +355,21 @@ 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(); // Prepare for handling Lock/Slide lock delay and timeout boolean lockImmediately = false; final ContentResolver cr = mContext.getContentResolver(); boolean separateSlideLockTimeoutEnabled = Settings.System.getInt(cr, Settings.System.SCREEN_LOCK_SLIDE_DELAY_TOGGLE, 0) == 1; if (mLockPatternUtils.isSecure()) { // Lock immediately based on setting if secure (user has a pin/pattern/password) // This is retained as-is to ensue AOSP security integrity is maintained lockImmediately = true; } else { // Unless a separate slide lock timeout is enabled, this "locks" the device when // not secure to provide easy access to the camera while preventing unwanted input lockImmediately = separateSlideLockTimeoutEnabled ? false : mLockPatternUtils.getPowerButtonInstantlyLocks(); } if (mExitSecureCallback != null) { if (DEBUG) Log.d(TAG, "pending exit secure callback cancelled"); Loading @@ -375,11 +384,9 @@ public class KeyguardViewMediator implements KeyguardViewCallback, } 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) final ContentResolver cr = mContext.getContentResolver(); // 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) // From DisplaySettings long displayTimeout = Settings.System.getInt(cr, SCREEN_OFF_TIMEOUT, Loading @@ -390,17 +397,33 @@ public class KeyguardViewMediator implements KeyguardViewCallback, Settings.Secure.LOCK_SCREEN_LOCK_AFTER_TIMEOUT, KEYGUARD_LOCK_AFTER_DELAY_DEFAULT); // From CyanogenMod specific Settings int slideLockTimeoutDelay = (why == WindowManagerPolicy.OFF_BECAUSE_OF_TIMEOUT ? Settings.System .getInt(cr, Settings.System.SCREEN_LOCK_SLIDE_TIMEOUT_DELAY, KEYGUARD_LOCK_AFTER_DELAY_DEFAULT) : Settings.System.getInt(cr, Settings.System.SCREEN_LOCK_SLIDE_SCREENOFF_DELAY, 0)); // From DevicePolicyAdmin final long policyTimeout = mLockPatternUtils.getDevicePolicyManager() .getMaximumTimeToLock(null); if (DEBUG) Log.d(TAG, "Security lock screen timeout delay is " + lockAfterTimeout + " ms; slide lock screen timeout delay is " + slideLockTimeoutDelay + " ms; Separate slide lock delay settings considered: " + separateSlideLockTimeoutEnabled + "; Policy timeout is " + policyTimeout + " ms"); long timeout; if (policyTimeout > 0) { // policy in effect. Make sure we don't go beyond policy limit. displayTimeout = Math.max(displayTimeout, 0); // ignore negative values timeout = Math.min(policyTimeout - displayTimeout, lockAfterTimeout); } else { timeout = lockAfterTimeout; // Not sure lockAfterTimeout is needed any more but keeping it for AOSP compatibility timeout = separateSlideLockTimeoutEnabled ? slideLockTimeoutDelay : lockAfterTimeout; } if (timeout <= 0) { Loading Loading
policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java +35 −12 Original line number Diff line number Diff line Loading @@ -122,7 +122,6 @@ public class KeyguardViewMediator implements KeyguardViewCallback, */ protected static final int AWAKE_INTERVAL_DEFAULT_MS = 10000; /** * The default amount of time we stay awake (used for all key input) when * the keyboard is open Loading Loading @@ -356,11 +355,21 @@ 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(); // Prepare for handling Lock/Slide lock delay and timeout boolean lockImmediately = false; final ContentResolver cr = mContext.getContentResolver(); boolean separateSlideLockTimeoutEnabled = Settings.System.getInt(cr, Settings.System.SCREEN_LOCK_SLIDE_DELAY_TOGGLE, 0) == 1; if (mLockPatternUtils.isSecure()) { // Lock immediately based on setting if secure (user has a pin/pattern/password) // This is retained as-is to ensue AOSP security integrity is maintained lockImmediately = true; } else { // Unless a separate slide lock timeout is enabled, this "locks" the device when // not secure to provide easy access to the camera while preventing unwanted input lockImmediately = separateSlideLockTimeoutEnabled ? false : mLockPatternUtils.getPowerButtonInstantlyLocks(); } if (mExitSecureCallback != null) { if (DEBUG) Log.d(TAG, "pending exit secure callback cancelled"); Loading @@ -375,11 +384,9 @@ public class KeyguardViewMediator implements KeyguardViewCallback, } 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) final ContentResolver cr = mContext.getContentResolver(); // 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) // From DisplaySettings long displayTimeout = Settings.System.getInt(cr, SCREEN_OFF_TIMEOUT, Loading @@ -390,17 +397,33 @@ public class KeyguardViewMediator implements KeyguardViewCallback, Settings.Secure.LOCK_SCREEN_LOCK_AFTER_TIMEOUT, KEYGUARD_LOCK_AFTER_DELAY_DEFAULT); // From CyanogenMod specific Settings int slideLockTimeoutDelay = (why == WindowManagerPolicy.OFF_BECAUSE_OF_TIMEOUT ? Settings.System .getInt(cr, Settings.System.SCREEN_LOCK_SLIDE_TIMEOUT_DELAY, KEYGUARD_LOCK_AFTER_DELAY_DEFAULT) : Settings.System.getInt(cr, Settings.System.SCREEN_LOCK_SLIDE_SCREENOFF_DELAY, 0)); // From DevicePolicyAdmin final long policyTimeout = mLockPatternUtils.getDevicePolicyManager() .getMaximumTimeToLock(null); if (DEBUG) Log.d(TAG, "Security lock screen timeout delay is " + lockAfterTimeout + " ms; slide lock screen timeout delay is " + slideLockTimeoutDelay + " ms; Separate slide lock delay settings considered: " + separateSlideLockTimeoutEnabled + "; Policy timeout is " + policyTimeout + " ms"); long timeout; if (policyTimeout > 0) { // policy in effect. Make sure we don't go beyond policy limit. displayTimeout = Math.max(displayTimeout, 0); // ignore negative values timeout = Math.min(policyTimeout - displayTimeout, lockAfterTimeout); } else { timeout = lockAfterTimeout; // Not sure lockAfterTimeout is needed any more but keeping it for AOSP compatibility timeout = separateSlideLockTimeoutEnabled ? slideLockTimeoutDelay : lockAfterTimeout; } if (timeout <= 0) { Loading