Check events for launching split from Launchable

* Previously we weren't waiting for any events check,
which was terminating the test too early before any
split cleanup was happening, causing errors in the
following test.

Test: atest NexusLauncherOutOfProcTests:com.android.quickstep.TaplTestsSplitscreen
Bug: 297135374
Change-Id: I635a1de1381932e6545fc0fc7bf7567c9f6ebe67
This commit is contained in:
Vinit Nayak
2023-08-26 18:27:04 +00:00
parent 29428d406e
commit f2da6d8fbc
@@ -16,10 +16,14 @@
package com.android.launcher3.tapl;
import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
import static com.android.launcher3.testing.shared.TestProtocol.SPRING_LOADED_STATE_ORDINAL;
import android.app.UiAutomation;
import android.graphics.Point;
import android.view.MotionEvent;
import android.view.accessibility.AccessibilityEvent;
import androidx.test.uiautomator.By;
import androidx.test.uiautomator.BySelector;
@@ -83,12 +87,18 @@ public abstract class Launchable {
* fired when the click is executed.
*/
public LaunchedAppState launchIntoSplitScreen() {
try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(
"want to launch split tasks from " + launchableType())) {
try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck();
LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(
"want to launch split tasks from " + launchableType())) {
LauncherInstrumentation.log("Launchable.launch before click "
+ mObject.getVisibleCenter() + " in " + mLauncher.getVisibleBounds(mObject));
mLauncher.clickLauncherObject(mObject);
+ mObject.getVisibleCenter() + " in " + mLauncher.getVisibleBounds(
mObject));
mLauncher.executeAndWaitForLauncherEvent(
() -> mLauncher.clickLauncherObject(mObject),
accessibilityEvent ->
accessibilityEvent.getEventType() == TYPE_WINDOW_STATE_CHANGED,
() -> "Unable to click object to launch split",
"Click launcher object to launch split");
try (LauncherInstrumentation.Closable c2 = mLauncher.addContextLayer("clicked")) {
mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, OverviewTask.SPLIT_START_EVENT);