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

Commit 5a0a5e72 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Only wait for animations to complete when injecting a DOWN event."

parents 67244aea 9d29030c
Loading
Loading
Loading
Loading
+18 −5
Original line number Diff line number Diff line
@@ -7472,6 +7472,18 @@ public class WindowManagerService extends IWindowManager.Stub

    @Override
    public boolean injectInputAfterTransactionsApplied(InputEvent ev, int mode) {
        boolean shouldWaitForAnimComplete = false;
        if (ev instanceof KeyEvent) {
            KeyEvent keyEvent = (KeyEvent) ev;
            shouldWaitForAnimComplete = keyEvent.getSource() == InputDevice.SOURCE_MOUSE
                    || keyEvent.getAction() == KeyEvent.ACTION_DOWN;
        } else if (ev instanceof MotionEvent) {
            MotionEvent motionEvent = (MotionEvent) ev;
            shouldWaitForAnimComplete = motionEvent.getSource() == InputDevice.SOURCE_MOUSE
                    || motionEvent.getAction() == MotionEvent.ACTION_DOWN;
        }

        if (shouldWaitForAnimComplete) {
            waitForAnimationsToComplete();

            synchronized (mGlobalLock) {
@@ -7479,6 +7491,7 @@ public class WindowManagerService extends IWindowManager.Stub
            }

            new SurfaceControl.Transaction().syncInputWindows().apply(true);
        }

        return LocalServices.getService(InputManagerInternal.class).injectInputEvent(ev, mode);
    }