diff options
| author | 2016-02-17 15:17:14 +0000 | |
|---|---|---|
| committer | 2016-02-18 11:20:35 +0000 | |
| commit | 3dc575f1358112b232bd74bcd0d102401ef7549e (patch) | |
| tree | c88f314d3289208e6682a52706b1285b8e638d17 | |
| parent | 9496df19ae7552370ec37cfb62cce3d919b0b116 (diff) | |
Lock Work Profile immediately when user presses power button
Bug: 26579952
Change-Id: I6e4e0fc2a4f41c72f0d940006f6ceb17e7852682
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 90d56f78697e..6029c23ab30b 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -758,7 +758,7 @@ public class KeyguardViewMediator extends SystemUI { mPendingLock = false; } } - doKeyguardLaterLockedForChildProfiles(); + doKeyguardForChildProfilesLocked(); KeyguardUpdateMonitor.getInstance(mContext).dispatchFinishedGoingToSleep(why); } @@ -781,8 +781,7 @@ public class KeyguardViewMediator extends SystemUI { long timeout; - if ((mLockPatternUtils.isSeparateProfileChallengeEnabled(userId)) - || policyTimeout <= 0) { + if (policyTimeout <= 0) { timeout = lockAfterTimeout; } else { // From DisplaySettings @@ -815,23 +814,31 @@ public class KeyguardViewMediator extends SystemUI { mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, when, sender); if (DEBUG) Log.d(TAG, "setting alarm to turn off keyguard, seq = " + mDelayedShowingSequence); - doKeyguardLaterLockedForChildProfiles(); + doKeyguardLaterForChildProfilesLocked(); } - private void doKeyguardLaterLockedForChildProfiles() { + private void doKeyguardLaterForChildProfilesLocked() { UserManager um = UserManager.get(mContext); List<UserInfo> profiles = um.getEnabledProfiles(UserHandle.myUserId()); - if (profiles.size() > 1) { - for (UserInfo info : profiles) { - if (mLockPatternUtils.isSeparateProfileChallengeEnabled(info.id)) { - long userTimeout = getLockTimeout(info.id); - long userWhen = SystemClock.elapsedRealtime() + userTimeout; - Intent lockIntent = new Intent(DELAYED_LOCK_PROFILE_ACTION); - lockIntent.putExtra(Intent.EXTRA_USER_ID, info.id); - PendingIntent lockSender = PendingIntent.getBroadcast( - mContext, 0, lockIntent, PendingIntent.FLAG_CANCEL_CURRENT); - mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, userWhen, lockSender); - } + for (UserInfo info : profiles) { + if (mLockPatternUtils.isSeparateProfileChallengeEnabled(info.id)) { + long userTimeout = getLockTimeout(info.id); + long userWhen = SystemClock.elapsedRealtime() + userTimeout; + Intent lockIntent = new Intent(DELAYED_LOCK_PROFILE_ACTION); + lockIntent.putExtra(Intent.EXTRA_USER_ID, info.id); + PendingIntent lockSender = PendingIntent.getBroadcast( + mContext, 0, lockIntent, PendingIntent.FLAG_CANCEL_CURRENT); + mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, userWhen, lockSender); + } + } + } + + private void doKeyguardForChildProfilesLocked() { + UserManager um = UserManager.get(mContext); + List<UserInfo> profiles = um.getEnabledProfiles(UserHandle.myUserId()); + for (UserInfo info : profiles) { + if (mLockPatternUtils.isSeparateProfileChallengeEnabled(info.id)) { + lockProfile(info.id); } } } |