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

Commit 28540199 authored by Selim Cinek's avatar Selim Cinek
Browse files

Fixed the usage of the menu key to unlock

The menu key was not unlocking the keyguard properly
and didn't hide the notifications.

Bug: 26539875
Change-Id: I9dd89767f00d29c15d1d4e840a1ab22d59e58c8d
parent ce2bd0fa
Loading
Loading
Loading
Loading
+1 −10
Original line number Diff line number Diff line
@@ -413,7 +413,7 @@ public class KeyguardHostView extends FrameLayout implements SecurityCallback {
     * @return true if the menu key should be enabled
     */
    private static final String ENABLE_MENU_KEY_FILE = "/data/local/enable_menu_key";
    private boolean shouldEnableMenuKey() {
    public boolean shouldEnableMenuKey() {
        final Resources res = getResources();
        final boolean configDisabled = res.getBoolean(R.bool.config_disableMenuKeyInLockScreen);
        final boolean isTestHarness = ActivityManager.isRunningInTestHarness();
@@ -421,15 +421,6 @@ public class KeyguardHostView extends FrameLayout implements SecurityCallback {
        return !configDisabled || isTestHarness || fileOverride;
    }

    public boolean handleMenuKey() {
        // The following enables the MENU key to work for testing automation
        if (shouldEnableMenuKey()) {
            dismiss();
            return true;
        }
        return false;
    }

    public void setViewMediatorCallback(ViewMediatorCallback viewMediatorCallback) {
        mViewMediatorCallback = viewMediatorCallback;
        // Update ViewMediator with the current input method requirements
+2 −13
Original line number Diff line number Diff line
@@ -276,19 +276,8 @@ public class KeyguardBouncer {
        return mKeyguardView == null || mKeyguardView.getSecurityMode() != SecurityMode.None;
    }

    public boolean onMenuPressed() {
        ensureView();
        if (mKeyguardView.handleMenuKey()) {

            // We need to show it in case it is secure. If not, it will get dismissed in any case.
            mRoot.setVisibility(View.VISIBLE);
            mFalsingManager.onBouncerShown();
            mKeyguardView.requestFocus();
            mKeyguardView.onResume();
            return true;
        } else {
            return false;
        }
    public boolean shouldDismissOnMenuPressed() {
        return mKeyguardView.shouldEnableMenuKey();
    }

    public boolean interceptMediaKey(KeyEvent event) {
+7 −1
Original line number Diff line number Diff line
@@ -3879,7 +3879,13 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
    }

    public boolean onMenuPressed() {
        return mState == StatusBarState.KEYGUARD && mStatusBarKeyguardViewManager.onMenuPressed();
        if (mDeviceInteractive && mState != StatusBarState.SHADE
                && mStatusBarKeyguardViewManager.shouldDismissOnMenuPressed()) {
            animateCollapsePanels(
                    CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL /* flags */, true /* force */);
            return true;
        }
        return false;
    }

    public void endAffordanceLaunch() {
+2 −2
Original line number Diff line number Diff line
@@ -509,8 +509,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
        return !(mLastShowing && !mLastOccluded) || mLastBouncerShowing || mLastRemoteInputActive;
    }

    public boolean onMenuPressed() {
        return mBouncer.onMenuPressed();
    public boolean shouldDismissOnMenuPressed() {
        return mBouncer.shouldDismissOnMenuPressed();
    }

    public boolean interceptMediaKey(KeyEvent event) {