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

Commit daa8f946 authored by Eric Biggers's avatar Eric Biggers Committed by Gerrit Code Review
Browse files

Merge "Always call tieProfileLockIfNecessary() under mSpManager lock" into main

parents af78422c 66c9fc0e
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -129,6 +129,16 @@ flag {
    bug: "323001115"
}

flag {
  name: "fix_race_condition_in_tie_profile_lock"
  namespace: "enterprise"
  description: "Fix race condition in tieProfileLockIfNecessary()"
  bug: "355905501"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}

flag {
  name: "quiet_mode_credential_bug_fix"
  namespace: "enterprise"
+15 −3
Original line number Diff line number Diff line
@@ -889,10 +889,16 @@ public class LockSettingsService extends ILockSettings.Stub {
                // Hide notification first, as tie profile lock takes time
                hideEncryptionNotification(new UserHandle(userId));

                if (android.app.admin.flags.Flags.fixRaceConditionInTieProfileLock()) {
                    synchronized (mSpManager) {
                        tieProfileLockIfNecessary(userId, LockscreenCredential.createNone());
                    }
                } else {
                    if (isCredentialSharableWithParent(userId)) {
                        tieProfileLockIfNecessary(userId, LockscreenCredential.createNone());
                    }
                }
            }
        });
    }

@@ -1287,8 +1293,14 @@ public class LockSettingsService extends ILockSettings.Stub {
                mStorage.removeChildProfileLock(userId);
                removeKeystoreProfileKey(userId);
            } else {
                if (android.app.admin.flags.Flags.fixRaceConditionInTieProfileLock()) {
                    synchronized (mSpManager) {
                        tieProfileLockIfNecessary(userId, profileUserPassword);
                    }
                } else {
                    tieProfileLockIfNecessary(userId, profileUserPassword);
                }
            }
        } catch (IllegalStateException e) {
            setBoolean(SEPARATE_PROFILE_CHALLENGE_KEY, old, userId);
            throw e;