[InputVizard] Relax CHECK for same downtime in all events of sequence.

We already know this is not true in some cases, due to Android platform
bug(b/395610162), where we see the downtime is different for some of the
touch moves. We see the CHECK failing in field which means this must be
true for some other cases as well. For now we can relax the check until
the platform side bugs are identified and fixed.

Bug: 401233890
Change-Id: I810e940bc7d2208a182a871c109f0ba3e7718ee1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6403095
Reviewed-by: Jonathan Ross <[email protected]>
Commit-Queue: Kartar Singh <[email protected]>
Reviewed-by: Petr Cermak <[email protected]>
Reviewed-by: Andrew Grieve <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1439706}
diff --git a/base/android/scoped_input_event.cc b/base/android/scoped_input_event.cc
index 5ec8767..10d2fe4e 100644
--- a/base/android/scoped_input_event.cc
+++ b/base/android/scoped_input_event.cc
@@ -40,6 +40,38 @@
   return *this;
 }
 
+#if BUILDFLAG(ENABLE_BASE_TRACING)
+void ScopedInputEvent::WriteIntoTrace(
+    perfetto::TracedProto<perfetto::protos::pbzero::EventForwarder> forwarder)
+    const {
+  if (!a_input_event_) {
+    return;
+  }
+
+  const int history_size =
+      static_cast<const int>(AMotionEvent_getHistorySize(a_input_event_));
+  forwarder->set_history_size(history_size);
+
+  forwarder->set_latest_time_ns(AMotionEvent_getEventTime(a_input_event_));
+  if (history_size > 0) {
+    forwarder->set_oldest_time_ns(AMotionEvent_getHistoricalEventTime(
+        a_input_event_, /* history_index= */ 0));
+  }
+  forwarder->set_down_time_ns(AMotionEvent_getDownTime(a_input_event_));
+
+  forwarder->set_x_pixel(
+      AMotionEvent_getX(a_input_event_, /* pointer_index= */ 0));
+  forwarder->set_y_pixel(
+      AMotionEvent_getY(a_input_event_, /* pointer_index= */ 0));
+
+  const int action =
+      AMotionEvent_getAction(a_input_event_) & AMOTION_EVENT_ACTION_MASK;
+  forwarder->set_action(
+      static_cast<perfetto::protos::pbzero::EventForwarder::AMotionEventAction>(
+          action));
+}
+#endif  // BUILDFLAG(ENABLE_BASE_TRACING)
+
 void ScopedInputEvent::DestroyIfNeeded() {
   if (a_input_event_ == nullptr) {
     return;