Call layoutAndAssignWindowLayersIfNeeded while holding mGlobalLock

This method should be protected by the lock because itself or its
downstream methods access fields which need to be protected by
mGlobalLock.

Bug: 118118435
Test: 1. Replace the pending transaction in WindowContainer with
         LockDebuggingTransaction in ag/9944628.
      2. Switch to the new insets mode.
      3. Let an app to control the system bars and see if system
         crashes.

Change-Id: I08b0fb88d6ceb51139d24f161269017312c0cd5f
2 files changed