MotionEvent: add safe dumping method

This method should allow us to log more details of an event in case of
validation failures, without potential for infinite recursion in getter
methods.

Bug: 379368465
Test: add a test to MotionEventTest that calls
      getHistoricalRawPointerCoords with an invalid pointer index, and
      check the logs when run with `atest --host`
Flag: EXEMPT logs only
Change-Id: I9c7084cedbc7e6f6834cd1b401da04d07d22ce35
diff --git a/include/input/Input.h b/include/input/Input.h
index a8684bd..0e330e4 100644
--- a/include/input/Input.h
+++ b/include/input/Input.h
@@ -994,6 +994,15 @@
     std::vector<PointerProperties> mPointerProperties;
     std::vector<nsecs_t> mSampleEventTimes;
     std::vector<PointerCoords> mSamplePointerCoords;
+
+private:
+    /**
+     * Create a human-readable string representation of the event's data for debugging purposes.
+     *
+     * Unlike operator<<, this method does not assume that the event data is valid or consistent, or
+     * call any accessor methods that might themselves call safeDump in the case of invalid data.
+     */
+    std::string safeDump() const;
 };
 
 std::ostream& operator<<(std::ostream& out, const MotionEvent& event);