Credential FRP: Add ACTION_CONFIRM_FRP_CREDENTIAL to ConfirmCredential
Bug: 36814845 Test: adb shell settings put global device_provisioned 0 && adb shell am start -a android.app.action.CONFIRM_FRP_CREDENTIAL Change-Id: Id6ce6bc5ebd9c9e2a88790cc800678aff50e580f
This commit is contained in:
@@ -1012,7 +1012,24 @@ public final class Utils extends com.android.settingslib.Utils {
|
||||
return getCredentialOwnerUserId(context);
|
||||
}
|
||||
int userId = bundle.getInt(Intent.EXTRA_USER_ID, UserHandle.myUserId());
|
||||
return enforceSameOwner(context, userId);
|
||||
if (userId == LockPatternUtils.USER_FRP) {
|
||||
return enforceSystemUser(context, userId);
|
||||
} else {
|
||||
return enforceSameOwner(context, userId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the given user id if the current user is the system user.
|
||||
*
|
||||
* @throws SecurityException if the current user is not the system user.
|
||||
*/
|
||||
public static int enforceSystemUser(Context context, int userId) {
|
||||
if (UserHandle.myUserId() == UserHandle.USER_SYSTEM) {
|
||||
return userId;
|
||||
}
|
||||
throw new SecurityException("Given user id " + userId + " must only be used from "
|
||||
+ "USER_SYSTEM, but current user is " + UserHandle.myUserId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user