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

Commit 03eca859 authored by John Spurlock's avatar John Spurlock
Browse files

Enable back button in keyguard security account mode.

Otherwise hitting "Forgot Pattern" traps you in account mode.
Avoid the known case where account is not backup (if permanently
locked).

Bug: 8381295
Change-Id: Ifda28eec6d0609e822b210831ff0ea0ec6cb22b1
parent 7534707b
Loading
Loading
Loading
Loading
+18 −3
Original line number Diff line number Diff line
@@ -310,9 +310,7 @@ public class KeyguardHostView extends KeyguardViewBase {
        mKeyguardSelectorView = (KeyguardSelectorView) findViewById(R.id.keyguard_selector_view);
        mViewStateManager.setSecurityViewContainer(mSecurityViewContainer);

        if (!(mContext instanceof Activity)) {
            setSystemUiVisibility(getSystemUiVisibility() | View.STATUS_BAR_DISABLE_BACK);
        }
        setBackButtonEnabled(false);

        addDefaultWidgets();

@@ -329,6 +327,13 @@ public class KeyguardHostView extends KeyguardViewBase {
        updateSecurityViews();
    }

    private void setBackButtonEnabled(boolean enabled) {
        if (mContext instanceof Activity) return;  // always enabled in activity mode
        setSystemUiVisibility(enabled ?
                getSystemUiVisibility() & ~View.STATUS_BAR_DISABLE_BACK :
                getSystemUiVisibility() | View.STATUS_BAR_DISABLE_BACK);
    }

    private boolean shouldEnableAddWidget() {
        return numWidgets() < MAX_WIDGETS && mUserSetupCompleted;
    }
@@ -907,6 +912,10 @@ public class KeyguardHostView extends KeyguardViewBase {
            // Discard current runnable if we're switching back to the selector view
            setOnDismissAction(null);
        }
        if (securityMode == SecurityMode.Account && !mLockPatternUtils.isPermanentlyLocked()) {
            // we're showing account as a backup, provide a way to get back to primary
            setBackButtonEnabled(true);
        }
        mCurrentSecuritySelection = securityMode;
    }

@@ -1579,6 +1588,12 @@ public class KeyguardHostView extends KeyguardViewBase {
    }

    public boolean handleBackKey() {
        if (mCurrentSecuritySelection == SecurityMode.Account) {
            // go back to primary screen and re-disable back
            setBackButtonEnabled(false);
            showPrimarySecurityScreen(false /*turningOff*/);
            return true;
        }
        if (mCurrentSecuritySelection != SecurityMode.None) {
            mCallback.dismiss(false);
            return true;