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

Commit d44f580e authored by Yasin Kilicdere's avatar Yasin Kilicdere Committed by Android (Google) Code Review
Browse files

Merge "Wait for broadcast idle before runThenWaits containing resumeTiming."

parents 60e04f42 f02cec74
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -208,6 +208,8 @@ public class UserLifecycleTests {
        while (mRunner.keepRunning()) {
            mRunner.pauseTiming();
            final int userId = createUserNoFlags();

            waitForBroadcastIdle();
            runThenWaitForBroadcasts(userId, () -> {
                mRunner.resumeTiming();
                Log.i(TAG, "Starting timer");
@@ -335,6 +337,7 @@ public class UserLifecycleTests {
            final int startUser = mAm.getCurrentUser();
            final int userId = createUserNoFlags();

            waitForBroadcastIdle();
            mUserSwitchWaiter.runThenWaitUntilBootCompleted(userId, () -> {
                mRunner.resumeTiming();
                Log.i(TAG, "Starting timer");
@@ -360,6 +363,7 @@ public class UserLifecycleTests {
                switchUser(userId);
            }, Intent.ACTION_MEDIA_MOUNTED);

            waitForBroadcastIdle();
            mUserSwitchWaiter.runThenWaitUntilSwitchCompleted(startUser, () -> {
                runThenWaitForBroadcasts(userId, () -> {
                    mRunner.resumeTiming();
@@ -685,7 +689,7 @@ public class UserLifecycleTests {
     */
    private void stopUserAfterWaitingForBroadcastIdle(int userId, boolean force)
            throws RemoteException {
        ShellHelper.runShellCommand("am wait-for-broadcast-idle");
        waitForBroadcastIdle();
        stopUser(userId, force);
    }

@@ -894,4 +898,8 @@ public class UserLifecycleTests {
        assertEquals("", ShellHelper.runShellCommand("setprop " + name + " " + value));
        return oldValue;
    }

    private void waitForBroadcastIdle() {
        ShellHelper.runShellCommand("am wait-for-broadcast-idle");
    }
}