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

Commit c597177a authored by Eghosa Ewansiha-Vlachavas's avatar Eghosa Ewansiha-Vlachavas
Browse files

Store a copy of the motion event

Motion events that are recycled and then re-used can result in bad
behaviour (i.e crashes) if they are not initialised correctly - see
b/273963331. The guidance is to reinitialise these events before use to
ensure they are initialised correctly.

Flag: EXEMPT bug fix
Fixes: 423744011
Test: atest WMShellUnitTests:DragDetectorTest,
      atest WMShellUnitTests:DragResizeInputListenerTest
Change-Id: I731af1ae311dfa6f8697655de19bd4151bc78241
parent ef2ca3a1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -642,7 +642,7 @@ class DragResizeInputListener implements AutoCloseable {
                                "%s: Handling action down, update ctrlType to %d", TAG, ctrlType);
                        mDragStartTaskBounds = mCallback.onDragPositioningStart(ctrlType,
                                e.getDisplayId(), rawX, rawY);
                        mLastMotionEventOnDown = e;
                        mLastMotionEventOnDown = MotionEvent.obtain(e);
                        mResizeTrigger = (ctrlType == CTRL_TYPE_BOTTOM || ctrlType == CTRL_TYPE_TOP
                                || ctrlType == CTRL_TYPE_RIGHT || ctrlType == CTRL_TYPE_LEFT)
                                ? ResizeTrigger.EDGE : ResizeTrigger.CORNER;