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

Commit caf5958e authored by Vadim Tryshev's avatar Vadim Tryshev
Browse files

Waiting for Launcher activity to stop when starting an overview task

This will help to ensure that Launcher state has settled before continuing the test.

Bug: 313926097
Flag: N/A
Test: presubmit
Change-Id: Ie72853a9d289b2688fdfbdf5220ce86808ac2da1
parent 6edb70f7
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -18,9 +18,11 @@ package com.android.quickstep;
import static android.os.Trace.TRACE_TAG_APP;
import static android.view.RemoteAnimationTarget.MODE_CLOSING;
import static android.view.RemoteAnimationTarget.MODE_OPENING;

import static com.android.launcher3.QuickstepTransitionManager.RECENTS_LAUNCH_DURATION;
import static com.android.launcher3.QuickstepTransitionManager.STATUS_BAR_TRANSITION_DURATION;
import static com.android.launcher3.QuickstepTransitionManager.STATUS_BAR_TRANSITION_PRE_DELAY;
import static com.android.launcher3.testing.shared.TestProtocol.LAUNCHER_ACTIVITY_STOPPED_MESSAGE;
import static com.android.launcher3.testing.shared.TestProtocol.OVERVIEW_STATE_ORDINAL;
import static com.android.quickstep.OverviewComponentObserver.startHomeIntentSafely;
import static com.android.quickstep.TaskUtils.taskIsATargetWithMode;
@@ -344,6 +346,8 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> {
        // Workaround for b/78520668, explicitly trim memory once UI is hidden
        onTrimMemory(TRIM_MEMORY_UI_HIDDEN);
        mFallbackRecentsView.updateLocusId();
        AccessibilityManagerCompat.sendTestProtocolEventToTest(
                this, LAUNCHER_ACTIVITY_STOPPED_MESSAGE);
    }

    @Override
+6 −8
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package com.android.launcher3.tapl;

import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;

import android.graphics.Rect;

import androidx.annotation.NonNull;
@@ -203,11 +201,11 @@ public final class OverviewTask {
    public LaunchedAppState open() {
        try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck()) {
            verifyActiveContainer();
            mLauncher.executeAndWaitForEvent(
            mLauncher.executeAndWaitForLauncherEvent(
                    () -> mLauncher.clickLauncherObject(mTask),
                    event -> event.getEventType() == TYPE_WINDOW_STATE_CHANGED,
                    () -> "Launching task didn't open a new window: "
                            + mTask.getParent().getContentDescription(),
                    event -> TestProtocol.LAUNCHER_ACTIVITY_STOPPED_MESSAGE
                            .equals(event.getClassName().toString()),
                    () -> "Launcher activity didn't stop",
                    "clicking an overview task");
            if (mOverview.getContainerType()
                    == LauncherInstrumentation.ContainerType.SPLIT_SCREEN_SELECT) {