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

Commit c37a22aa authored by Charles He's avatar Charles He
Browse files

SystemUI: fix incorrect redaction of profile notifications.

There is a race condition for devices with unified profile challenge
when the device unlocks:
1) StatusBar queries TrustManager and caches the locked/unlocked state
   of a managed profile, and
2) TrustManager updates its own record of the locked/unlocked state of
   the managed profile.

If 1) happens before 2), StatusBar will keep an out-of-date state for
the managed profile, resulting in notifications in the profile being
redacted incorrectly.

This CL avoids the race by removing the dependency on TrustManager for
the case of unified challenge.

Bug: 35951989
Test: manual, with logging
Change-Id: I5ce9df017e1de3aca5236d1207fe1867fa5a80c2
parent add77afe
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -4303,7 +4303,12 @@ public class StatusBar extends SystemUI implements DemoMode,
            final int userId = mCurrentProfiles.valueAt(i).id;
            boolean isProfilePublic = devicePublic;
            if (!devicePublic && userId != mCurrentUserId) {
                if (mStatusBarKeyguardViewManager.isSecure(userId)) {
                // We can't rely on KeyguardManager#isDeviceLocked() for unified profile challenge
                // due to a race condition where this code could be called before
                // TrustManagerService updates its internal records, resulting in an incorrect
                // state being cached in mLockscreenPublicMode. (b/35951989)
                if (mLockPatternUtils.isSeparateProfileChallengeEnabled(userId)
                        && mStatusBarKeyguardViewManager.isSecure(userId)) {
                    isProfilePublic = mKeyguardManager.isDeviceLocked(userId);
                }
            }