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

Commit 2a7d0124 authored by Jonathan Scott's avatar Jonathan Scott Committed by Automerger Merge Worker
Browse files

[RESTRICT AUTOMERGE] Use userId instead of USER_CURRENT in shouldLockKeyguard. am: 7a974a54

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13451947

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I9030e81f5da23e0502575294d0c73d55cfda973a
parents ae64e2b7 7a974a54
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -512,7 +512,7 @@ public class LockTaskController {
            setStatusBarState(mLockTaskModeState, userId);
            setStatusBarState(mLockTaskModeState, userId);
            setKeyguardState(mLockTaskModeState, userId);
            setKeyguardState(mLockTaskModeState, userId);
            if (oldLockTaskModeState == LOCK_TASK_MODE_PINNED) {
            if (oldLockTaskModeState == LOCK_TASK_MODE_PINNED) {
                lockKeyguardIfNeeded();
                lockKeyguardIfNeeded(userId);
            }
            }
            if (getDevicePolicyManager() != null) {
            if (getDevicePolicyManager() != null) {
                getDevicePolicyManager().notifyLockTaskModeChanged(false, null, userId);
                getDevicePolicyManager().notifyLockTaskModeChanged(false, null, userId);
@@ -824,15 +824,15 @@ public class LockTaskController {
     * Helper method for locking the device immediately. This may be necessary when the device
     * Helper method for locking the device immediately. This may be necessary when the device
     * leaves the pinned mode.
     * leaves the pinned mode.
     */
     */
    private void lockKeyguardIfNeeded() {
    private void lockKeyguardIfNeeded(int userId) {
        if (shouldLockKeyguard()) {
        if (shouldLockKeyguard(userId)) {
            mWindowManager.lockNow(null);
            mWindowManager.lockNow(null);
            mWindowManager.dismissKeyguard(null /* callback */, null /* message */);
            mWindowManager.dismissKeyguard(null /* callback */, null /* message */);
            getLockPatternUtils().requireCredentialEntry(USER_ALL);
            getLockPatternUtils().requireCredentialEntry(USER_ALL);
        }
        }
    }
    }


    private boolean shouldLockKeyguard() {
    private boolean shouldLockKeyguard(int userId) {
        // This functionality should be kept consistent with
        // This functionality should be kept consistent with
        // com.android.settings.security.ScreenPinningSettings (see b/127605586)
        // com.android.settings.security.ScreenPinningSettings (see b/127605586)
        try {
        try {
@@ -842,7 +842,7 @@ public class LockTaskController {
        } catch (Settings.SettingNotFoundException e) {
        } catch (Settings.SettingNotFoundException e) {
            // Log to SafetyNet for b/127605586
            // Log to SafetyNet for b/127605586
            android.util.EventLog.writeEvent(0x534e4554, "127605586", -1, "");
            android.util.EventLog.writeEvent(0x534e4554, "127605586", -1, "");
            return getLockPatternUtils().isSecure(USER_CURRENT);
            return getLockPatternUtils().isSecure(userId);
        }
        }
    }
    }


+1 −1
Original line number Original line Diff line number Diff line
@@ -450,7 +450,7 @@ public class LockTaskControllerTest {
        Settings.Secure.clearProviderForTest();
        Settings.Secure.clearProviderForTest();


        // AND a password is set
        // AND a password is set
        when(mLockPatternUtils.isSecure(anyInt()))
        when(mLockPatternUtils.isSecure(TEST_USER_ID))
                .thenReturn(true);
                .thenReturn(true);


        // AND there is a task record
        // AND there is a task record