Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 983bc707 authored by Clara Bayarri's avatar Clara Bayarri Committed by Android (Google) Code Review
Browse files

Merge "Lock Work Profile immediately when user presses power button" into nyc-dev

parents 8c98d2b2 3dc575f1
Loading
Loading
Loading
Loading
+23 −16
Original line number Diff line number Diff line
@@ -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,13 +814,12 @@ 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);
@@ -834,6 +832,15 @@ public class KeyguardViewMediator extends SystemUI {
            }
        }
    }

    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);
            }
        }
    }

    private void cancelDoKeyguardLaterLocked() {