From 39034b66cf11a596f9dfa854293492ff5fefa792 Mon Sep 17 00:00:00 2001 From: Marie Matheson Date: Thu, 10 Feb 2022 23:14:43 +0000 Subject: [PATCH] Add some functionality to Settings ShadowLockPatternUtils Test: make RunSettingsRoboTests Bug: 218885287 Change-Id: If8a28a1680f0fc62f2bff5a927ccf876441bafa5 --- .../shadow/ShadowLockPatternUtils.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowLockPatternUtils.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowLockPatternUtils.java index 20547d7a351..74e39715062 100644 --- a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowLockPatternUtils.java +++ b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowLockPatternUtils.java @@ -40,7 +40,7 @@ public class ShadowLockPatternUtils { private static Map sUserToProfileComplexityMap = new HashMap<>(); private static Map sUserToMetricsMap = new HashMap<>(); private static Map sUserToProfileMetricsMap = new HashMap<>(); - + private static Map sUserToIsSecureMap = new HashMap<>(); @Resetter public static void reset() { @@ -48,6 +48,7 @@ public class ShadowLockPatternUtils { sUserToProfileComplexityMap.clear(); sUserToMetricsMap.clear(); sUserToProfileMetricsMap.clear(); + sUserToIsSecureMap.clear(); sDeviceEncryptionEnabled = false; } @@ -57,8 +58,16 @@ public class ShadowLockPatternUtils { } @Implementation - protected boolean isSecure(int id) { - return true; + protected boolean isSecure(int userId) { + Boolean isSecure = sUserToIsSecureMap.get(userId); + if (isSecure == null) { + return true; + } + return isSecure; + } + + public static void setIsSecure(int userId, boolean isSecure) { + sUserToIsSecureMap.put(userId, isSecure); } @Implementation @@ -144,4 +153,13 @@ public class ShadowLockPatternUtils { sUserToProfileMetricsMap.put(UserHandle.myUserId(), metrics); } + @Implementation + public boolean isLockScreenDisabled(int userId) { + return false; + } + + @Implementation + public boolean isSeparateProfileChallengeEnabled(int userHandle) { + return false; + } }