Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions shell/platform/android/io/flutter/view/VsyncWaiter.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ public void asyncWaitForVsync(long cookie) {
new Choreographer.FrameCallback() {
@Override
public void doFrame(long frameTimeNanos) {
// Some device is calling doFrame with a timestamp that is greater than
// System.nanoTime. We should ensure that frameTimeNanos passed to
// VsyncWaiterAndroid is not greater than System.nanoTime.
long now = System.nanoTime();
if (frameTimeNanos > now) {
frameTimeNanos = now;
}
long refreshPeriodNanos = (long) (1000000000.0 / fps);
FlutterJNI.nativeOnVsync(
frameTimeNanos, frameTimeNanos + refreshPeriodNanos, cookie);
Expand Down