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

Commit b652d9fb authored by Josep del Río's avatar Josep del Río Committed by Android (Google) Code Review
Browse files

Merge "Fix shade external keyboard user activity handling" into main

parents aab4db2c 5a0c8ead
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -74,6 +74,14 @@ constructor(
     * exit bouncer.
     */
    fun dispatchKeyEventPreIme(event: KeyEvent): Boolean {
        when (event.action) {
            KeyEvent.ACTION_DOWN -> {
                val device = event.getDevice()
                if (device != null && device.isFullKeyboard() && device.isExternal()) {
                    powerInteractor.onUserTouch()
                }
            }
        }
        when (event.keyCode) {
            KeyEvent.KEYCODE_BACK ->
                if (
+0 −24
Original line number Diff line number Diff line
@@ -69,8 +69,6 @@ import android.util.IndentingPrintWriter;
import android.util.Log;
import android.util.MathUtils;
import android.view.HapticFeedbackConstants;
import android.view.InputDevice;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.VelocityTracker;
@@ -356,7 +354,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
    private final QuickSettingsControllerImpl mQsController;
    private final NaturalScrollingSettingObserver mNaturalScrollingSettingObserver;
    private final TouchHandler mTouchHandler = new TouchHandler();
    private final KeyHandler mKeyHandler = new KeyHandler();

    private long mDownTime;
    private boolean mTouchSlopExceededBeforeDown;
@@ -816,7 +813,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump

        mView.addOnLayoutChangeListener(new ShadeLayoutChangeListener());
        mView.setOnTouchListener(getTouchHandler());
        mView.setOnKeyListener(getKeyHandler());
        mView.setOnConfigurationChangedListener(config -> loadDimens());

        mResources = mView.getResources();
@@ -3583,11 +3579,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
        return mTouchHandler;
    }

    @VisibleForTesting
    KeyHandler getKeyHandler() {
        return mKeyHandler;
    }

    @Override
    public boolean closeUserSwitcherIfOpen() {
        if (mKeyguardUserSwitcherController != null) {
@@ -5242,21 +5233,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
        }
    }

    /** Handles KeyEvents for the Shade. */
    public final class KeyHandler implements View.OnKeyListener {
        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            if (event.getAction() == KeyEvent.ACTION_DOWN) {
                final InputDevice d = event.getDevice();
                // Trigger user activity if the event comes from a full external keyboard
                if (d != null && d.isFullKeyboard() && d.isExternal()) {
                    mCentralSurfaces.userActivity();
                }
            }
            return false;
        }
    }

    private final class HeadsUpNotificationViewControllerImpl implements
            HeadsUpTouchHelper.HeadsUpNotificationViewController {
        @Override