-
Notifications
You must be signed in to change notification settings - Fork 24.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't use MotionEvent timestamp for touch events
Differential Revision: D2554905 fb-gh-sync-id: 7f83e94948cc9ac1024e249764d445fb056f400e
- Loading branch information
1 parent
e3f33ea
commit 716f7e8
Showing
2 changed files
with
22 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
716f7e8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some background on this diff:
Since v1, the highest firing crash in ads manager android was related to JS processing
touch end
events beforetouch start
. This diff finally fixes that.TLDR: android was supplying timestamps for
touch end
events that came beforetouch start
events. ReactNative sorted these events by their timestamps, so JS got thetouch end
event before thetouch start
event of the same touch event, and crashed. The fix: generate our own timestamp when dispatching touch events.Long dramatic story:
touch end
event that had notouch start
. WAT.touch end
event that would crash the app, there was atouch start
event sitting next in the dispatch queue. And these touch events were ordered correctly because the timestamp fortouch end
was smaller than the one fortouch start
. WAT.MotionEvent#getEventTime()
supplied by android, since we thought those were the most reliable timestamps we could get. So we changed them to use the dispatch timestamp of the events instead. The problem immediately disappeared.Lessons learned: question everything, especially android.