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

Commit 8c8cd58f authored by Matt Pietal's avatar Matt Pietal Committed by Android (Google) Code Review
Browse files

Merge "Password bouncer - Go back on first gesture"

parents 062abd62 9360c8e5
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -374,6 +374,17 @@ public class KeyguardHostViewController extends ViewController<KeyguardHostView>
        return !configDisabled || isTestHarness || fileOverride;
    }

    /**
     * @return true if the current bouncer is password
     */
    public boolean dispatchBackKeyEventPreIme() {
        if (mKeyguardSecurityContainerController.getCurrentSecurityMode()
                == SecurityMode.Password) {
            return true;
        }
        return false;
    }

    /**
     * Allows the media keys to work when the keyguard is showing.
     * The media keys should be of no interest to the actual keyguard view(s),
+8 −0
Original line number Diff line number Diff line
@@ -494,6 +494,14 @@ public class KeyguardBouncer {
        return mKeyguardViewController.interceptMediaKey(event);
    }

    /**
     * @return true if the pre IME back event should be handled
     */
    public boolean dispatchBackKeyEventPreIme() {
        ensureView();
        return mKeyguardViewController.dispatchBackKeyEventPreIme();
    }

    public void notifyKeyguardAuthenticated(boolean strongAuth) {
        ensureView();
        mKeyguardViewController.finish(strongAuth, KeyguardUpdateMonitor.getCurrentUser());
+7 −0
Original line number Diff line number Diff line
@@ -162,6 +162,11 @@ public class NotificationShadeWindowView extends FrameLayout {
        return mInteractionEventHandler.dispatchKeyEvent(event);
    }

    @Override
    public boolean dispatchKeyEventPreIme(KeyEvent event) {
        return mInteractionEventHandler.dispatchKeyEventPreIme(event);
    }

    protected void setInteractionEventHandler(InteractionEventHandler listener) {
        mInteractionEventHandler = listener;
    }
@@ -361,6 +366,8 @@ public class NotificationShadeWindowView extends FrameLayout {
        boolean interceptMediaKey(KeyEvent event);

        boolean dispatchKeyEvent(KeyEvent event);

        boolean dispatchKeyEventPreIme(KeyEvent event);
    }

    /**
+5 −0
Original line number Diff line number Diff line
@@ -347,6 +347,11 @@ public class NotificationShadeWindowViewController {
                return mService.interceptMediaKey(event);
            }

            @Override
            public boolean dispatchKeyEventPreIme(KeyEvent event) {
                return mService.dispatchKeyEventPreIme(event);
            }

            @Override
            public boolean dispatchKeyEvent(KeyEvent event) {
                boolean down = event.getAction() == KeyEvent.ACTION_DOWN;
+17 −0
Original line number Diff line number Diff line
@@ -3520,6 +3520,23 @@ public class StatusBar extends SystemUI implements DemoMode,
                && mStatusBarKeyguardViewManager.interceptMediaKey(event);
    }

    /**
     * While IME is active and a BACK event is detected, check with
     * {@link StatusBarKeyguardViewManager#dispatchBackKeyEventPreIme(KeyEvent)} to see if the event
     * should be handled before routing to IME, in order to prevent the user having to hit back
     * twice to exit bouncer.
     */
    public boolean dispatchKeyEventPreIme(KeyEvent event) {
        switch (event.getKeyCode()) {
            case KeyEvent.KEYCODE_BACK:
                if (mState == StatusBarState.KEYGUARD
                        && mStatusBarKeyguardViewManager.dispatchBackKeyEventPreIme()) {
                    return onBackPressed();
                }
        }
        return false;
    }

    protected boolean shouldUnlockOnMenuPressed() {
        return mDeviceInteractive && mState != StatusBarState.SHADE
            && mStatusBarKeyguardViewManager.shouldDismissOnMenuPressed();
Loading