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

Commit 800d811e authored by Roman Birg's avatar Roman Birg Committed by Scott Mertz
Browse files

Keyguard: reinflate security views after user change



Reinflate the security views after a user switch has completed so we
inflate the proper security view for the proper user.

Change-Id: I5fd865ce055ec0d157d1ff31ea76d03dfbd79e7e
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>
(cherry picked from commit b53bae0e)
parent 8d62b60d
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -44,6 +44,16 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe

    private final KeyguardUpdateMonitor mUpdateMonitor;

    private KeyguardUpdateMonitorCallback mUpdateMonitorCallbacks =
            new KeyguardUpdateMonitorCallback() {
                @Override
                public void onUserSwitchComplete(int userId) {
                    mSecurityViewFlipper.removeAllViews();
                    mCurrentSecuritySelection = SecurityMode.Invalid;
                    showPrimarySecurityScreen(false);
                }
            };

    // Used to notify the container when something interesting happens.
    public interface SecurityCallback {
        public boolean dismiss(boolean authenticated);
@@ -71,6 +81,18 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
        mSecurityCallback = callback;
    }

    @Override
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mUpdateMonitorCallbacks);
    }

    @Override
    protected void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        KeyguardUpdateMonitor.getInstance(mContext).removeCallback(mUpdateMonitorCallbacks);
    }

    @Override
    public void onResume(int reason) {
        if (mCurrentSecuritySelection != SecurityMode.None) {