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

Commit 47482969 authored by Adam Powell's avatar Adam Powell
Browse files

Recycle MotionEvents for ACTION_OUTSIDE in WindowManagerService

Change-Id: I648e5ad780cad285f190e06cfff1780c6dad0117
parent afd52a0b
Loading
Loading
Loading
Loading
+18 −13
Original line number Diff line number Diff line
@@ -5185,6 +5185,7 @@ public class WindowManagerService extends IWindowManager.Stub
                    WindowState out = mKeyWaiter.mOutsideTouchTargets;
                    if (out != null) {
                        MotionEvent oev = MotionEvent.obtain(ev);
                        try {
                            oev.setAction(MotionEvent.ACTION_OUTSIDE);
                            do {
                                final Rect frame = out.mFrame;
@@ -5192,12 +5193,16 @@ public class WindowManagerService extends IWindowManager.Stub
                                try {
                                    out.mClient.dispatchPointer(oev, eventTime, false);
                                } catch (android.os.RemoteException e) {
                                Slog.i(TAG, "WINDOW DIED during outside motion dispatch: " + out);
                                    Slog.i(TAG,
                                            "WINDOW DIED during outside motion dispatch: " + out);
                                }
                                oev.offsetLocation((float)frame.left, (float)frame.top);
                                out = out.mNextOutsideTouch;
                            } while (out != null);
                            mKeyWaiter.mOutsideTouchTargets = null;
                        } finally {
                            oev.recycle();
                        }
                    }
                }