summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jonathan Scott <scottjonathan@google.com> 2021-02-01 17:51:13 +0000
committer Jonathan Scott <scottjonathan@google.com> 2021-02-01 17:51:13 +0000
commit7a974a5468b8760daeae1890a9c8c52eeed19d87 (patch)
tree42ac6560c52241702fc853b09faf9007367585b6
parent03ca6d9014dc9d34a3c9e329d2e2b7d69f8ae004 (diff)
[RESTRICT AUTOMERGE] Use userId instead of USER_CURRENT in shouldLockKeyguard.
USER_CURRENT is not an acceptable input to isSecure(). The test has also been updated as the use of any() for the mock hid this bug. Test: atest LockTaskControllerTest Bug: 176801033 Change-Id: Ic080eddb04ce9c20ebb6118abe8a48d28c7f67e5
-rw-r--r--services/core/java/com/android/server/wm/LockTaskController.java10
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/LockTaskControllerTest.java2
2 files changed, 6 insertions, 6 deletions
diff --git a/services/core/java/com/android/server/wm/LockTaskController.java b/services/core/java/com/android/server/wm/LockTaskController.java
index 892ee717e21f..998e134e0a98 100644
--- a/services/core/java/com/android/server/wm/LockTaskController.java
+++ b/services/core/java/com/android/server/wm/LockTaskController.java
@@ -512,7 +512,7 @@ public class LockTaskController {
setStatusBarState(mLockTaskModeState, userId);
setKeyguardState(mLockTaskModeState, userId);
if (oldLockTaskModeState == LOCK_TASK_MODE_PINNED) {
- lockKeyguardIfNeeded();
+ lockKeyguardIfNeeded(userId);
}
if (getDevicePolicyManager() != null) {
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
* leaves the pinned mode.
*/
- private void lockKeyguardIfNeeded() {
- if (shouldLockKeyguard()) {
+ private void lockKeyguardIfNeeded(int userId) {
+ if (shouldLockKeyguard(userId)) {
mWindowManager.lockNow(null);
mWindowManager.dismissKeyguard(null /* callback */, null /* message */);
getLockPatternUtils().requireCredentialEntry(USER_ALL);
}
}
- private boolean shouldLockKeyguard() {
+ private boolean shouldLockKeyguard(int userId) {
// This functionality should be kept consistent with
// com.android.settings.security.ScreenPinningSettings (see b/127605586)
try {
@@ -842,7 +842,7 @@ public class LockTaskController {
} catch (Settings.SettingNotFoundException e) {
// Log to SafetyNet for b/127605586
android.util.EventLog.writeEvent(0x534e4554, "127605586", -1, "");
- return getLockPatternUtils().isSecure(USER_CURRENT);
+ return getLockPatternUtils().isSecure(userId);
}
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/LockTaskControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/LockTaskControllerTest.java
index a137cde2d351..1ca32e304fc4 100644
--- a/services/tests/wmtests/src/com/android/server/wm/LockTaskControllerTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/LockTaskControllerTest.java
@@ -450,7 +450,7 @@ public class LockTaskControllerTest {
Settings.Secure.clearProviderForTest();
// AND a password is set
- when(mLockPatternUtils.isSecure(anyInt()))
+ when(mLockPatternUtils.isSecure(TEST_USER_ID))
.thenReturn(true);
// AND there is a task record