diff --git a/core/java/android/view/Choreographer.java b/core/java/android/view/Choreographer.java index d971a95859543..41a72786f9f0e 100644 --- a/core/java/android/view/Choreographer.java +++ b/core/java/android/view/Choreographer.java @@ -872,6 +872,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); + } + } + } } }