mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-05 10:26:52 +00:00
Merge "Temporary workaround for UIAutomator not recognizing a new window" into ub-launcher3-qt-qpr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
68f5d6bf76
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.launcher3.tapl;
|
||||
|
||||
import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
|
||||
|
||||
import android.graphics.Point;
|
||||
|
||||
import androidx.test.uiautomator.By;
|
||||
@@ -23,13 +25,10 @@ import androidx.test.uiautomator.BySelector;
|
||||
import androidx.test.uiautomator.UiObject2;
|
||||
import androidx.test.uiautomator.Until;
|
||||
|
||||
import com.android.launcher3.testing.TestProtocol;
|
||||
|
||||
/**
|
||||
* Ancestor for AppIcon and AppMenuItem.
|
||||
*/
|
||||
abstract class Launchable {
|
||||
private static final int WAIT_TIME_MS = 60000;
|
||||
protected final LauncherInstrumentation mLauncher;
|
||||
|
||||
protected final UiObject2 mObject;
|
||||
@@ -53,9 +52,12 @@ abstract class Launchable {
|
||||
private Background launch(BySelector selector) {
|
||||
LauncherInstrumentation.log("Launchable.launch before click " +
|
||||
mObject.getVisibleCenter() + " in " + mObject.getVisibleBounds());
|
||||
mLauncher.assertTrue(
|
||||
"Launching an app didn't open a new window: " + mObject.getText(),
|
||||
mObject.clickAndWait(Until.newWindow(), WAIT_TIME_MS));
|
||||
|
||||
mLauncher.executeAndWaitForEvent(
|
||||
() -> mObject.click(),
|
||||
event -> event.getEventType() == TYPE_WINDOW_STATE_CHANGED,
|
||||
"Launching an app didn't open a new window: " + mObject.getText());
|
||||
|
||||
mLauncher.assertTrue(
|
||||
"App didn't start: " + selector,
|
||||
mLauncher.getDevice().wait(Until.hasObject(selector),
|
||||
|
||||
@@ -124,7 +124,7 @@ public final class LauncherInstrumentation {
|
||||
private static final String APPS_RES_ID = "apps_view";
|
||||
private static final String OVERVIEW_RES_ID = "overview_panel";
|
||||
private static final String WIDGETS_RES_ID = "widgets_list_view";
|
||||
public static final int WAIT_TIME_MS = 60000;
|
||||
public static final int WAIT_TIME_MS = 10000;
|
||||
private static final String SYSTEMUI_PACKAGE = "com.android.systemui";
|
||||
|
||||
private static WeakReference<VisibleContainer> sActiveContainer = new WeakReference<>(null);
|
||||
|
||||
@@ -16,18 +16,16 @@
|
||||
|
||||
package com.android.launcher3.tapl;
|
||||
|
||||
import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
|
||||
|
||||
import android.graphics.Rect;
|
||||
|
||||
import androidx.test.uiautomator.UiObject2;
|
||||
import androidx.test.uiautomator.Until;
|
||||
|
||||
import com.android.launcher3.testing.TestProtocol;
|
||||
|
||||
/**
|
||||
* A recent task in the overview panel carousel.
|
||||
*/
|
||||
public final class OverviewTask {
|
||||
private static final long WAIT_TIME_MS = 60000;
|
||||
private final LauncherInstrumentation mLauncher;
|
||||
private final UiObject2 mTask;
|
||||
private final BaseOverview mOverview;
|
||||
@@ -66,9 +64,11 @@ public final class OverviewTask {
|
||||
verifyActiveContainer();
|
||||
try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
|
||||
"clicking an overview task")) {
|
||||
mLauncher.assertTrue("Launching task didn't open a new window: " +
|
||||
mTask.getParent().getContentDescription(),
|
||||
mTask.clickAndWait(Until.newWindow(), WAIT_TIME_MS));
|
||||
mLauncher.executeAndWaitForEvent(
|
||||
() -> mTask.click(),
|
||||
event -> event.getEventType() == TYPE_WINDOW_STATE_CHANGED,
|
||||
"Launching task didn't open a new window: " +
|
||||
mTask.getParent().getContentDescription());
|
||||
}
|
||||
return new Background(mLauncher);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user