Reduce layer assignment and placement for intermediate state

There may be no need to request traversal for all hierarchy changes.
Such as even if there is a z-order change, but if the client has
not drawn yet, the displayed content may not show visible changes
by the traversal because there is nothing to show or the transaction needs to be synchronized.

So instead of requesting to update surface/focus on intermediate
changes, let the existing signals: "relayout, add/remove window,
destroy surface, lifecycle callback, window container transaction,
significant changes detected in deferWindowLayout~continueWindowLayout"
trigger the update. In other words, focus more on dealing with
changes that are actually visible.

For example, this can reduce the number of passed for layoutAndAssignWindowLayers by 3 times and surface placement by 1 time
for startActivityInner.

Some tests depended on the setup in WindowTestsBase.ActivityBuilder
to dispatch pending organizer events. Since this change no longer
triggers traversal to dispatch them in the builder, refine the tests
to send the events by themselves.

Bug: 159103089
Test: CtsWindowManagerDeviceTestCases
Change-Id: Ib9c008994dbbc4d6e1dd1ca3e37b9aa0ccaba997
9 files changed