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

Commit 0dbe03a2 authored by Rubin Xu's avatar Rubin Xu
Browse files

Demote SecurityException in DPMS.reportPasswordChanged

reportPasswordChanged is called on a handler thread so it might
be invoked much later than a password change, in which case the
original assumption about the device state might not be satisfied
any more. Demote a precondition check to a mere warning in case
reportPasswordChanged is called on an unexpected user.

Bug: 394991242
Test: ManagedProfilePasswordTest
Flag: EXEMPT bugfix
Change-Id: I29a1df3b12512f76225a602cf990b2ec76486af8
parent 4851fade
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -8288,8 +8288,11 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
        Preconditions.checkCallAuthorization(isSystemUid(caller));
        // Managed Profile password can only be changed when it has a separate challenge.
        if (!isSeparateProfileChallengeEnabled(userId)) {
            Preconditions.checkCallAuthorization(!isManagedProfile(userId), "You can "
                    + "not set the active password for a managed profile, userId = %d", userId);
            if (isManagedProfile(userId)) {
                Slogf.i(LOG_TAG, "You can not set the active password for a managed profile,"
                        + " userId = %d", userId);
                return;
            }
        }
        DevicePolicyData policy = getUserData(userId);