Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 03c729f

Browse files
author
Kaushik Iska
committed
Propoagate Tap events on Android hybrid views
We are modifying the pointer properties on the framework side during gesture disambiguation, this requires us to construct a new motion event which is a clone except for these fields. One item is to investigate if this can be avoided.
1 parent d0d6a4c commit 03c729f

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,19 +309,38 @@ private MotionEvent toMotionEvent(float density, PlatformViewsChannel.PlatformVi
309309
MotionEventTracker.MotionEventId motionEventId =
310310
MotionEventTracker.MotionEventId.from(touch.motionEventId);
311311
MotionEvent trackedEvent = motionEventTracker.pop(motionEventId);
312-
if (trackedEvent != null) {
313-
return trackedEvent;
314-
}
315312

316-
// TODO (kaushikiska) : warn that we are potentially using an untracked
317-
// event in the platform views.
313+
// TODO (kaushikiska): We are mucking with these on the framework during
314+
// gesture disambiguation which are resulting in us having to overrite
315+
// the tracked event. See if this can be avoided.
316+
// see: https://github.com/flutter/flutter/issues/61116
318317
PointerProperties[] pointerProperties =
319318
parsePointerPropertiesList(touch.rawPointerPropertiesList)
320319
.toArray(new PointerProperties[touch.pointerCount]);
321320
PointerCoords[] pointerCoords =
322321
parsePointerCoordsList(touch.rawPointerCoords, density)
323322
.toArray(new PointerCoords[touch.pointerCount]);
324323

324+
if (trackedEvent != null) {
325+
return MotionEvent.obtain(
326+
trackedEvent.getDownTime(),
327+
trackedEvent.getEventTime(),
328+
trackedEvent.getAction(),
329+
touch.pointerCount,
330+
pointerProperties,
331+
pointerCoords,
332+
trackedEvent.getMetaState(),
333+
trackedEvent.getButtonState(),
334+
trackedEvent.getXPrecision(),
335+
trackedEvent.getYPrecision(),
336+
trackedEvent.getDeviceId(),
337+
trackedEvent.getEdgeFlags(),
338+
trackedEvent.getSource(),
339+
trackedEvent.getFlags());
340+
}
341+
342+
// TODO (kaushikiska) : warn that we are potentially using an untracked
343+
// event in the platform views.
325344
return MotionEvent.obtain(
326345
touch.downTime.longValue(),
327346
touch.eventTime.longValue(),

0 commit comments

Comments
 (0)