Merge "Fix modulo div by 0 in Choreographer." into tm-dev

This commit is contained in:
TreeHugger Robot
2022-06-03 19:03:33 +00:00
committed by Android (Google) Code Review

View File

@@ -765,10 +765,11 @@ public final class Choreographer {
startNanos = System.nanoTime();
final long jitterNanos = startNanos - frameTimeNanos;
if (jitterNanos >= frameIntervalNanos) {
final long lastFrameOffset = jitterNanos % frameIntervalNanos;
long lastFrameOffset = 0;
if (frameIntervalNanos == 0) {
Log.i(TAG, "Vsync data empty due to timeout");
} else {
lastFrameOffset = jitterNanos % frameIntervalNanos;
final long skippedFrames = jitterNanos / frameIntervalNanos;
if (skippedFrames >= SKIPPED_FRAME_WARNING_LIMIT) {
Log.i(TAG, "Skipped " + skippedFrames + " frames! "