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

Commit bc3347fa authored by Kevin Chyn's avatar Kevin Chyn
Browse files

Fix stealth mode for managed profiles

Stealth mode should not use effectiveUserId. Instead, it needs to use
the original userId.

Secondly, the pattern view should be setting stealth mode only after
the configuration is received (e.g. onFinishInflate is too early, and
the params are not passed in from its owner yet).

Fixes: 148382970

Test: 1) Make pattern visible for managed profile
      2) Reboot device
      3) Open work profile app - pattern is shown when entered
      4) Enter pattern
      5) Lock screen, unlock screen
      6) Open work profile app - pattern is shown when entered
      7) Repeat 1-6 with pattern set to not be visible. pattern should not
         be shown during 3) and 6)

Change-Id: I3e81cd31484fb0b7a99d554c3c274e8088df5ec7
parent e49a3294
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -340,6 +340,7 @@ public class AuthContainerView extends LinearLayout
        mBackgroundView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);

        mCredentialView.setContainerView(this);
        mCredentialView.setUserId(mConfig.mUserId);
        mCredentialView.setEffectiveUserId(mEffectiveUserId);
        mCredentialView.setCredentialType(credentialType);
        mCredentialView.setCallback(mCredentialCallback);
+1 −1
Original line number Diff line number Diff line
@@ -376,7 +376,7 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
        }

        if (DEBUG) {
            Log.d(TAG, "showDialog: " + args
            Log.d(TAG, "userId: " + userId
                    + " savedState: " + savedState
                    + " mCurrentDialog: " + mCurrentDialog
                    + " newDialog: " + newDialog
+3 −3
Original line number Diff line number Diff line
@@ -95,12 +95,12 @@ public class AuthCredentialPatternView extends AuthCredentialView {
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        mLockPatternView = findViewById(R.id.lockPattern);
        mLockPatternView.setOnPatternListener(new UnlockPatternListener());
        mLockPatternView.setInStealthMode(
                !mLockPatternUtils.isVisiblePatternEnabled(mEffectiveUserId));
                !mLockPatternUtils.isVisiblePatternEnabled(mUserId));
        mLockPatternView.setTactileFeedbackEnabled(mLockPatternUtils.isTactileFeedbackEnabled());
    }
}
+5 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ public abstract class AuthCredentialView extends LinearLayout {
    protected AuthContainerView mContainerView;
    protected Callback mCallback;
    protected AsyncTask<?, ?, ?> mPendingLockCheck;
    protected int mUserId;
    protected int mEffectiveUserId;
    protected ErrorTimer mErrorTimer;

@@ -143,6 +144,10 @@ public abstract class AuthCredentialView extends LinearLayout {
        view.setText(text);
    }

    void setUserId(int userId) {
        mUserId = userId;
    }

    void setEffectiveUserId(int effectiveUserId) {
        mEffectiveUserId = effectiveUserId;
    }