Check current user owns a frp credential
In Android U+ tablet device, Android introduces headless mode which running on a main user instead of system user. Therefore, device throw a security error in HSUM build now. For now, we check whether current user owns a frp credential instead. This way also works on non HSUM build. Test: robo test + run FRP mode in Suw flow. Fix: 262438904 Change-Id: Ie4c7c470b13b9de8d532e61e9984521cebe7adff
This commit is contained in:
@@ -19,6 +19,8 @@ package com.android.settings.testutils.shadow;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.app.admin.PasswordMetrics;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.os.UserHandle;
|
||||
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
@@ -42,6 +44,8 @@ public class ShadowLockPatternUtils {
|
||||
private static Map<Integer, PasswordMetrics> sUserToProfileMetricsMap = new HashMap<>();
|
||||
private static Map<Integer, Boolean> sUserToIsSecureMap = new HashMap<>();
|
||||
|
||||
private static boolean sIsUserOwnsFrpCredential;
|
||||
|
||||
@Resetter
|
||||
public static void reset() {
|
||||
sUserToComplexityMap.clear();
|
||||
@@ -50,6 +54,7 @@ public class ShadowLockPatternUtils {
|
||||
sUserToProfileMetricsMap.clear();
|
||||
sUserToIsSecureMap.clear();
|
||||
sDeviceEncryptionEnabled = false;
|
||||
sIsUserOwnsFrpCredential = false;
|
||||
}
|
||||
|
||||
@Implementation
|
||||
@@ -122,6 +127,15 @@ public class ShadowLockPatternUtils {
|
||||
return complexity;
|
||||
}
|
||||
|
||||
@Implementation
|
||||
public static boolean userOwnsFrpCredential(Context context, UserInfo info) {
|
||||
return sIsUserOwnsFrpCredential;
|
||||
}
|
||||
|
||||
public static void setUserOwnsFrpCredential(boolean isUserOwnsFrpCredential) {
|
||||
sIsUserOwnsFrpCredential = isUserOwnsFrpCredential;
|
||||
}
|
||||
|
||||
public static void setRequiredPasswordComplexity(int userHandle, int complexity) {
|
||||
sUserToComplexityMap.put(userHandle, complexity);
|
||||
}
|
||||
|
Reference in New Issue
Block a user