Make window stable while resizing

When the frame size and the frame position of the window are changed at
the same time, setPosition to the surface will be applied first, and
the client will draw on the new-size buffer later, which makes the
window flicker.

This CL uses applyWithNextDraw to make the new surface position can be
applied while the new frame is drawn.

Bug: 176874720
Test: steps in the bug
Change-Id: If599488d2ced78fb51a0e0c32b21738172bfe16e
4 files changed