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

Commit db700954 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Insert a check that keyguard is invisible into waitForLauncherCondition" into udc-dev

parents 19cd5df8 ee77946a
Loading
Loading
Loading
Loading
+16 −11
Original line number Diff line number Diff line
@@ -242,17 +242,7 @@ public abstract class AbstractLauncherUiTest {
    public void setUp() throws Exception {
        mLauncher.onTestStart();

        final boolean keyguardAlreadyVisible = sSeenKeygard;

        sSeenKeygard = sSeenKeygard
                || !TestHelpers.wait(
                Until.gone(By.res(SYSTEMUI_PACKAGE, "keyguard_status_view")), 60000);

        Assert.assertFalse(
                "Keyguard is visible, which is likely caused by a crash in SysUI, seeing keyguard"
                        + " for the first time = "
                        + !keyguardAlreadyVisible,
                sSeenKeygard);
        verifyKeyguardInvisible();

        final String launcherPackageName = mDevice.getLauncherPackageName();
        try {
@@ -285,6 +275,20 @@ public abstract class AbstractLauncherUiTest {
        }
    }

    private static void verifyKeyguardInvisible() {
        final boolean keyguardAlreadyVisible = sSeenKeygard;

        sSeenKeygard = sSeenKeygard
                || !TestHelpers.wait(
                Until.gone(By.res(SYSTEMUI_PACKAGE, "keyguard_status_view")), 60000);

        Assert.assertFalse(
                "Keyguard is visible, which is likely caused by a crash in SysUI, seeing keyguard"
                        + " for the first time = "
                        + !keyguardAlreadyVisible,
                sSeenKeygard);
    }

    @After
    public void verifyLauncherState() {
        try {
@@ -402,6 +406,7 @@ public abstract class AbstractLauncherUiTest {
    // flakiness.
    protected void waitForLauncherCondition(
            String message, Function<Launcher, Boolean> condition, long timeout) {
        verifyKeyguardInvisible();
        if (!TestHelpers.isInLauncherProcess()) return;
        Wait.atMost(message, () -> getFromLauncher(condition), timeout, mLauncher);
    }