Synchronize all WindowTestsBase and WindowTestUtils methods.

Several WindowManager tests access WindowManager code that assume the WM
lock is already held. This can cause crashes in native code and cause
unexpected behavior. Added synchronize blocks around all helper methods
to avoid adding synchronized blocks in all WM tests methods.

This does not guarantee that all WM tests are synchronized, but handles
a good bulk of them for now.

The largest number of failures were from ZOrderingTests since that tests
creates a lot of windows, making synchronicity issues more likely. Ran
that test class multiple times to ensure I was unable to get the
failure.

Test: ZOrderingTests
Bug: 73966377
Change-Id: I96f586e7ea91223589caef885c87ecded555ab13
Fixes: 72976082
diff --git a/services/tests/servicestests/src/com/android/server/wm/TaskStackTests.java b/services/tests/servicestests/src/com/android/server/wm/TaskStackTests.java
index 0ef78f4..eaf71f0 100644
--- a/services/tests/servicestests/src/com/android/server/wm/TaskStackTests.java
+++ b/services/tests/servicestests/src/com/android/server/wm/TaskStackTests.java
@@ -65,13 +65,13 @@
         final TaskStack stack = createTaskStackOnDisplay(mDisplayContent);
         final Task task1 = createTaskInStack(stack, 0 /* userId */);
         WindowTestUtils.TestAppWindowToken appWindowToken1 =
-                new WindowTestUtils.TestAppWindowToken(mDisplayContent);
+                WindowTestUtils.createTestAppWindowToken(mDisplayContent);
         task1.addChild(appWindowToken1, 0);
         appWindowToken1.setOrientation(SCREEN_ORIENTATION_LANDSCAPE);
 
         final Task task2 = createTaskInStack(stack, 1 /* userId */);
         WindowTestUtils.TestAppWindowToken appWindowToken2 =
-                new WindowTestUtils.TestAppWindowToken(mDisplayContent);
+                WindowTestUtils.createTestAppWindowToken(mDisplayContent);
         task2.addChild(appWindowToken2, 0);
         appWindowToken2.setOrientation(SCREEN_ORIENTATION_PORTRAIT);
 
@@ -85,13 +85,13 @@
         final TaskStack stack = createTaskStackOnDisplay(mDisplayContent);
         final Task task1 = createTaskInStack(stack, 0 /* userId */);
         WindowTestUtils.TestAppWindowToken appWindowToken1 =
-                new WindowTestUtils.TestAppWindowToken(mDisplayContent);
+                WindowTestUtils.createTestAppWindowToken(mDisplayContent);
         task1.addChild(appWindowToken1, 0);
         appWindowToken1.setOrientation(SCREEN_ORIENTATION_LANDSCAPE);
 
         final Task task2 = createTaskInStack(stack, 1 /* userId */);
         WindowTestUtils.TestAppWindowToken appWindowToken2 =
-                new WindowTestUtils.TestAppWindowToken(mDisplayContent);
+                WindowTestUtils.createTestAppWindowToken(mDisplayContent);
         task2.addChild(appWindowToken2, 0);
         appWindowToken2.setOrientation(SCREEN_ORIENTATION_PORTRAIT);