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

Commit c4c5257e authored by Chad Brubaker's avatar Chad Brubaker
Browse files

Fix extend unlock logic when locked

If the device is showing the keyguard but unlocked a call to
updateTrusted with unlocked flags should not cause the device to lock.

Test: Manual
Bug: 124121600
Change-Id: I6c8a84361d639738f6e70708c92b8fa16c744f63
parent 1dc37e96
Loading
Loading
Loading
Loading
+14 −9
Original line number Diff line number Diff line
@@ -366,17 +366,22 @@ public class TrustManagerService extends SystemService {
        } catch (RemoteException e) {
        }

        boolean changed;
        synchronized (mUserIsTrusted) {
            if (mSettingsObserver.getTrustAgentsExtendUnlock()) {
            trusted = trusted && (!showingKeyguard || isFromUnlock) && userId == mCurrentUser;
                // In extend unlock trust agents can only set the device to trusted if it already
                // trusted or the device is unlocked. Attempting to set the device as trusted
                // when the device is locked will be ignored.
                changed = mUserIsTrusted.get(userId) != trusted;
                trusted = trusted
                        && (!showingKeyguard || isFromUnlock || !changed)
                        && userId == mCurrentUser;
                if (DEBUG) {
                    Slog.d(TAG, "Extend unlock setting trusted as " + Boolean.toString(trusted)
                            + " && " + Boolean.toString(!showingKeyguard)
                            + " && " + Boolean.toString(userId == mCurrentUser));
                }
            }

        boolean changed;
        synchronized (mUserIsTrusted) {
            changed = mUserIsTrusted.get(userId) != trusted;
            mUserIsTrusted.put(userId, trusted);
        }