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

Commit 42df15e9 authored by Jim Miller's avatar Jim Miller
Browse files

Fix password field focus in keyguard

This fixes a bug introduced in Change-Id: I34b7db402401a824f463d35d7546c05dc2979243 where
the top-most view was allowed to capture focus in order to ensure the device handled volume
key events.

This resolves the issue by restoring previous behavior and ensures we still handle media keys,
regardless of focus.

Fixes bug 7676996

Change-Id: Id2d1200be81640e4b4b7b5e3a0af099d6fc2d259
parent 7b085571
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -288,11 +288,6 @@ public class KeyguardHostView extends KeyguardViewBase {

        showPrimarySecurityScreen(false);
        updateSecurityViews();

        // Make sure at least this view is focusable in case nothing below it is. Otherwise,
        // requestFocus() on this view will fail and allow events, such as volume keys, to be
        // handled by the fallback handler.  See bug 7546960 for details.
        setFocusableInTouchMode(true);
    }

    private boolean shouldEnableAddWidget() {
+12 −5
Original line number Diff line number Diff line
@@ -153,7 +153,9 @@ public class KeyguardViewManager {

        @Override
        public boolean dispatchKeyEvent(KeyEvent event) {
            if (event.getAction() == KeyEvent.ACTION_DOWN && mKeyguardView != null) {
            if (mKeyguardView != null) {
                // Always process back and menu keys, regardless of focus
                if (event.getAction() == KeyEvent.ACTION_DOWN) {
                    int keyCode = event.getKeyCode();
                    if (keyCode == KeyEvent.KEYCODE_BACK && mKeyguardView.handleBackKey()) {
                        return true;
@@ -161,6 +163,11 @@ public class KeyguardViewManager {
                        return true;
                    }
                }
                // Always process media keys, regardless of focus
                if (mKeyguardView.dispatchKeyEvent(event)) {
                    return true;
                }
            }
            return super.dispatchKeyEvent(event);
        }
    }