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

Commit 1ed95cb0 authored by Pavel Grafov's avatar Pavel Grafov Committed by android-build-merger
Browse files

Restore separate challenge state on error

am: f10ae7e7

Change-Id: I70957dae31bbe98f8286d9c96bccd002f0acdf01
parents 0226df64 f10ae7e7
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -955,13 +955,19 @@ public class LockSettingsService extends ILockSettings.Stub {
    @GuardedBy("mSeparateChallengeLock")
    private void setSeparateProfileChallengeEnabledLocked(@UserIdInt int userId, boolean enabled,
            String managedUserPassword) {
        final boolean old = getBoolean(SEPARATE_PROFILE_CHALLENGE_KEY, false, userId);
        setBoolean(SEPARATE_PROFILE_CHALLENGE_KEY, enabled, userId);
        try {
            if (enabled) {
                mStorage.removeChildProfileLock(userId);
                removeKeystoreProfileKey(userId);
            } else {
                tieManagedProfileLockIfNecessary(userId, managedUserPassword);
            }
        } catch (IllegalStateException e) {
            setBoolean(SEPARATE_PROFILE_CHALLENGE_KEY, old, userId);
            throw e;
        }
    }

    private void notifySeparateProfileChallengeChanged(int userId) {