diff --git a/core/java/android/view/Choreographer.java b/core/java/android/view/Choreographer.java index 3a2ec91b3b207..bc85b7f21926b 100644 --- a/core/java/android/view/Choreographer.java +++ b/core/java/android/view/Choreographer.java @@ -867,6 +867,19 @@ public final class Choreographer { msg.setAsynchronous(true); mHandler.sendMessageAtTime(msg, nextFrameTime); } + } else { + if (USE_VSYNC) { + if (mHandler.hasMessages(MSG_DO_SCHEDULE_VSYNC)) { + // If running on the Looper thread, then schedule the vsync immediately. + if (isRunningOnLooperThreadLocked()) { + if (DEBUG_FRAMES) { + Log.d(TAG, "Scheduling next frame on vsync."); + } + scheduleVsyncLocked(); + mHandler.removeMessages(MSG_DO_SCHEDULE_VSYNC); + } + } + } } }