Make insets source window stable while resizing

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

This CL defers the setPosition transaction until the new frame is drawn,
which can make the window stable if the content is drawn at the same
location on the display.

This CL also fixes WindowState#mGivenInsetsPending. If the given insets
will be sent to window manager, the provided insets won't be changed
during relayoutWindow until the given insets are sent.

Bug: 171965103
Test: steps in the bug
Change-Id: I4684c03e8def6fa33980e6c10e444f7377c306f8
6 files changed