summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Fengjiang Li <fengjial@google.com> 2024-07-23 22:08:31 +0000
committer Fengjiang Li <fengjial@google.com> 2024-07-23 22:14:14 +0000
commit6ec36c2205849f7eb2bcbe82c6fdd1a666fdbd9e (patch)
tree61c445da6347de460f38f8fe5feb384f72fd23aa
parent2e1af07f75624e4a1dcd109168e7b76f7cdc22a3 (diff)
Wait for BackgroundThread.getHandler() to be idle to run next
WindowManager related test Fix: 353460715 Test: This is the test Flag: NONE - This is the test Change-Id: I5bbfc7f52cd7b3d466e1cf43c0547aac6078aaee
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRule.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRule.java b/services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRule.java
index d5d284783978..b92af876ed22 100644
--- a/services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRule.java
+++ b/services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRule.java
@@ -77,6 +77,7 @@ import android.view.InputChannel;
import android.view.SurfaceControl;
import com.android.dx.mockito.inline.extended.StaticMockitoSession;
+import com.android.internal.os.BackgroundThread;
import com.android.server.AnimationThread;
import com.android.server.DisplayThread;
import com.android.server.LocalServices;
@@ -553,6 +554,9 @@ public class SystemServicesTestRule implements TestRule {
// This is a different handler object than the wm.mAnimationHandler above.
waitHandlerIdle(AnimationThread.getHandler());
waitHandlerIdle(SurfaceAnimationThread.getHandler());
+ // Some binder calls are posted to BackgroundThread.getHandler(), we should wait for them
+ // to finish to run next test.
+ waitHandlerIdle(BackgroundThread.getHandler());
}
static void waitHandlerIdle(Handler handler) {