Copy FocusEventDebugView MotionEvent before it gets recycled

The MotionEvent used to be copied in the "post" runnable, which runs
async from the calling thread which might have recycled the MotionEvent
before it gets copied. This fixes avoids that by doing the copy in the
same/caller runnable to ensure that there is no copy attempt of a
MotionEvent that has been recycled.

Bug: 339426797
Test: n/a
Change-Id: I9f7e33a84ee2debf93b58a6ee69fd1aef963ffe5
diff --git a/services/core/java/com/android/server/input/debug/FocusEventDebugView.java b/services/core/java/com/android/server/input/debug/FocusEventDebugView.java
index 6eae9a4..d7d57df 100644
--- a/services/core/java/com/android/server/input/debug/FocusEventDebugView.java
+++ b/services/core/java/com/android/server/input/debug/FocusEventDebugView.java
@@ -240,7 +240,8 @@
             return;
         }
 
-        post(() -> handleRotaryInput(MotionEvent.obtain((MotionEvent) event)));
+        MotionEvent motionEvent = MotionEvent.obtain(event);
+        post(() -> handleRotaryInput(motionEvent));
     }
 
     private void handleKeyEvent(KeyEvent keyEvent) {