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

Commit 86e7acc6 authored by Kholoud Mohamed's avatar Kholoud Mohamed
Browse files

Pass correct userId in resetPasswordToken

Bug: 273494642
Test: btest a.d.c.DeviceManagementCoexistenceTest
Test: btest a.d.c.ResetPasswordWithTokenTest
Change-Id: I6b1739760db4daabfba8610db01ef0b8d2b434b7
parent 39911c80
Loading
Loading
Loading
Loading
+15 −10
Original line number Original line Diff line number Diff line
@@ -13804,8 +13804,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                        admin,
                        admin,
                        new BooleanPolicyValue(hidden),
                        new BooleanPolicyValue(hidden),
                        userId);
                        userId);
                Boolean resolvedPolicy = mDevicePolicyEngine.getResolvedPolicy(
                        PolicyDefinition.APPLICATION_HIDDEN(packageName), userId);
                result = mInjector.binderWithCleanCallingIdentity(() -> {
                result = mInjector.binderWithCleanCallingIdentity(() -> {
                    try {
                    try {
                        // This is a best effort to continue returning the same value that was
                        // This is a best effort to continue returning the same value that was
@@ -18976,7 +18974,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                    admin,
                    admin,
                    MANAGE_DEVICE_POLICY_RESET_PASSWORD,
                    MANAGE_DEVICE_POLICY_RESET_PASSWORD,
                    caller.getPackageName(),
                    caller.getPackageName(),
                    UserHandle.USER_ALL);
                    userId);
            Long currentTokenHandle = mDevicePolicyEngine.getLocalPolicySetByAdmin(
            Long currentTokenHandle = mDevicePolicyEngine.getLocalPolicySetByAdmin(
                    PolicyDefinition.RESET_PASSWORD_TOKEN,
                    PolicyDefinition.RESET_PASSWORD_TOKEN,
                    enforcingAdmin,
                    enforcingAdmin,
@@ -19040,7 +19038,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                    admin,
                    admin,
                    MANAGE_DEVICE_POLICY_RESET_PASSWORD,
                    MANAGE_DEVICE_POLICY_RESET_PASSWORD,
                    caller.getPackageName(),
                    caller.getPackageName(),
                    UserHandle.USER_ALL);
                    userId);
            Long currentTokenHandle = mDevicePolicyEngine.getLocalPolicySetByAdmin(
            Long currentTokenHandle = mDevicePolicyEngine.getLocalPolicySetByAdmin(
                    PolicyDefinition.RESET_PASSWORD_TOKEN,
                    PolicyDefinition.RESET_PASSWORD_TOKEN,
                    enforcingAdmin,
                    enforcingAdmin,
@@ -19086,7 +19084,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                    admin,
                    admin,
                    MANAGE_DEVICE_POLICY_RESET_PASSWORD,
                    MANAGE_DEVICE_POLICY_RESET_PASSWORD,
                    caller.getPackageName(),
                    caller.getPackageName(),
                    UserHandle.USER_ALL);
                    userId);
            Long currentTokenHandle = mDevicePolicyEngine.getLocalPolicySetByAdmin(
            Long currentTokenHandle = mDevicePolicyEngine.getLocalPolicySetByAdmin(
                    PolicyDefinition.RESET_PASSWORD_TOKEN,
                    PolicyDefinition.RESET_PASSWORD_TOKEN,
                    enforcingAdmin,
                    enforcingAdmin,
@@ -19138,7 +19136,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                    admin,
                    admin,
                    MANAGE_DEVICE_POLICY_RESET_PASSWORD,
                    MANAGE_DEVICE_POLICY_RESET_PASSWORD,
                    caller.getPackageName(),
                    caller.getPackageName(),
                    UserHandle.USER_ALL);
                    userId);
            Long currentTokenHandle = mDevicePolicyEngine.getLocalPolicySetByAdmin(
            Long currentTokenHandle = mDevicePolicyEngine.getLocalPolicySetByAdmin(
                    PolicyDefinition.RESET_PASSWORD_TOKEN,
                    PolicyDefinition.RESET_PASSWORD_TOKEN,
                    enforcingAdmin,
                    enforcingAdmin,
@@ -19164,11 +19162,18 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
        }
        }
        if (result) {
        if (result) {
            if (isPermissionCheckFlagEnabled()) {
                DevicePolicyEventLogger
                        .createEvent(DevicePolicyEnums.RESET_PASSWORD_WITH_TOKEN)
                        .setAdmin(callerPackageName)
                        .write();
            } else {
                DevicePolicyEventLogger
                DevicePolicyEventLogger
                        .createEvent(DevicePolicyEnums.RESET_PASSWORD_WITH_TOKEN)
                        .createEvent(DevicePolicyEnums.RESET_PASSWORD_WITH_TOKEN)
                        .setAdmin(caller.getComponentName())
                        .setAdmin(caller.getComponentName())
                        .write();
                        .write();
            }
            }
        }
        return result;
        return result;
    }
    }