Remove getLatestVsyncEventData in Choreographer.

Manually "revert" ag/17188552 due to jank caused by
getLatestVsyncEventData as new blocking binder call on the main thread.

Test: manual open and close app to/from home.
Test: perfetto trace
Test: atest ChoreographerTest
Bug: 229987086
Change-Id: Idcab776f3f249cc9fd609a6438e29a50a1edaaf2
This commit is contained in:
Rachel Lee
2022-04-26 16:12:22 -07:00
parent 75fb4d3021
commit ab7a63680a

View File

@@ -785,9 +785,7 @@ public final class Choreographer {
}
}
frameTimeNanos = startNanos - lastFrameOffset;
DisplayEventReceiver.VsyncEventData latestVsyncEventData =
mDisplayEventReceiver.getLatestVsyncEventData();
frameData.updateFrameData(frameTimeNanos, latestVsyncEventData);
frameData.updateFrameData(frameTimeNanos);
}
if (frameTimeNanos < mLastFrameTimeNanos) {
@@ -885,9 +883,7 @@ public final class Choreographer {
}
frameTimeNanos = now - lastFrameOffset;
mLastFrameTimeNanos = frameTimeNanos;
DisplayEventReceiver.VsyncEventData latestVsyncEventData =
mDisplayEventReceiver.getLatestVsyncEventData();
frameData.updateFrameData(frameTimeNanos, latestVsyncEventData);
frameData.updateFrameData(frameTimeNanos);
}
}
}
@@ -1022,6 +1018,11 @@ public final class Choreographer {
return mVsyncId;
}
/** Reset the vsync ID to invalid. */
void resetVsyncId() {
mVsyncId = FrameInfo.INVALID_VSYNC_ID;
}
/**
* The time in {@link System#nanoTime()} timebase which this frame is expected to be
* presented.
@@ -1069,12 +1070,14 @@ public final class Choreographer {
private FrameTimeline[] mFrameTimelines;
private FrameTimeline mPreferredFrameTimeline;
void updateFrameData(long frameTimeNanos,
DisplayEventReceiver.VsyncEventData latestVsyncEventData) {
void updateFrameData(long frameTimeNanos) {
mFrameTimeNanos = frameTimeNanos;
mFrameTimelines = convertFrameTimelines(latestVsyncEventData);
mPreferredFrameTimeline =
mFrameTimelines[latestVsyncEventData.preferredFrameTimelineIndex];
for (FrameTimeline ft : mFrameTimelines) {
// The ID is no longer valid because the frame time that was registered with the ID
// no longer matches.
// TODO(b/205721584): Ask SF for valid vsync information.
ft.resetVsyncId();
}
}
/** The time in nanoseconds when the frame started being rendered. */