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

Commit 7a71de78 authored by Rafael Prado's avatar Rafael Prado Committed by Android (Google) Code Review
Browse files

Merge "Verify reset password token activity using DPE when coexistence is enabled." into main

parents 951209dc 10662b3f
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -19148,6 +19148,14 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
        }
    }
    private boolean isAnyResetPasswordTokenActiveForUser(int userId) {
        return mDevicePolicyEngine
                .getLocalPoliciesSetByAdmins(PolicyDefinition.RESET_PASSWORD_TOKEN, userId)
                .values()
                .stream()
                .anyMatch((p) -> isResetPasswordTokenActiveForUserLocked(p.getValue(), userId));
    }
    private boolean isResetPasswordTokenActiveForUserLocked(
            long passwordTokenHandle, int userHandle) {
        if (passwordTokenHandle != 0) {
@@ -21003,6 +21011,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
        Preconditions.checkCallAuthorization(isSystemUid(getCallerIdentity()),
                String.format(NOT_SYSTEM_CALLER_MSG,
                        "call canProfileOwnerResetPasswordWhenLocked"));
        if (Flags.resetPasswordWithTokenCoexistence()) {
            return isAnyResetPasswordTokenActiveForUser(userId);
        }
        synchronized (getLockObject()) {
            final ActiveAdmin poAdmin = getProfileOwnerAdminLocked(userId);
            DevicePolicyData policy = getUserData(userId);