Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ec36c22 authored by Fengjiang Li's avatar Fengjiang Li
Browse files

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
parent 2e1af07f
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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) {