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

Commit 78b287e9 authored by Roman Birg's avatar Roman Birg
Browse files

SystemUI: fix "directly show bouncer" conflicting with smart unlock



If the user had "directly show pattern view" selected with a pattern
unlock for instance, then the assumption is that the lock screen always
opens to the pattern view, or the bouncer.

If smart lock is currently enabled and putting the keyguard in a
'trusted' environment, e.g. not requiring security, then we shouldn't
try to show the bouncer, because there is none. Currently when smart
lock is putting the keyguard in an insecure mode, it will basically
disable the lock screen if this option is selected. This is not the
desired result and we should still have a lock screen.

OSS Ref: BACON-4449
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>

Change-Id: Ie7a2326bf06e64c171e16fec5dde1179fe975450
parent eedcc4f1
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -201,14 +201,18 @@ public class KeyguardBouncer {
    public int needsFullscreenBouncer() {
        if (mKeyguardView != null) {
            SecurityMode mode = mKeyguardView.getSecurityMode();
            if (mode == SecurityMode.SimPin || mode == SecurityMode.SimPuk)
            if (mode == SecurityMode.SimPin || mode == SecurityMode.SimPuk) {
                return UNLOCK_SEQUENCE_FORCE_BOUNCER;
            // "Bouncer first" mode currently only available to some security methods.
            else if ((mode == SecurityMode.Pattern || mode == SecurityMode.Password
                    || mode == SecurityMode.PIN) && (mLockPatternUtils != null &&
                    mLockPatternUtils.shouldPassToSecurityView()))
            } else if ((mode == SecurityMode.Pattern || mode == SecurityMode.Password
                    || mode == SecurityMode.PIN) && (mLockPatternUtils != null
                    && mLockPatternUtils.shouldPassToSecurityView()
                    && !UnlockMethodCache.getInstance(mContext).isCurrentlyInsecure())) {
                // "Bouncer first" mode currently only available to some security methods, and
                // only when the lock screen method is secure. Otherwise if we are in a 'trusted'
                // mode or insecure, bypassing the bouncer is the same as disabling the keyguard.
                return UNLOCK_SEQUENCE_BOUNCER_FIRST;
            }
        }
        return UNLOCK_SEQUENCE_DEFAULT;
    }

@@ -224,7 +228,8 @@ public class KeyguardBouncer {
            // "Bouncer first" mode currently only available to some security methods.
            else if ((mode == SecurityMode.Pattern || mode == SecurityMode.Password
                    || mode == SecurityMode.PIN) && (mLockPatternUtils != null &&
                    mLockPatternUtils.shouldPassToSecurityView()))
                    mLockPatternUtils.shouldPassToSecurityView() &&
                    !UnlockMethodCache.getInstance(mContext).isCurrentlyInsecure()))
                return UNLOCK_SEQUENCE_BOUNCER_FIRST;
        }
        return UNLOCK_SEQUENCE_DEFAULT;