mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 23:36:47 +00:00
Merge "Not checking for some anomalies when switching nav modes" into sc-v2-dev am: 907c22ca14
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15643600 Change-Id: I8ad44f2d016cf6ea8daa8d9c6c7d9e8e9e7e5d5f
This commit is contained in:
@@ -30,7 +30,6 @@ import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.test.uiautomator.By;
|
||||
import androidx.test.uiautomator.UiDevice;
|
||||
|
||||
import com.android.launcher3.tapl.LauncherInstrumentation;
|
||||
@@ -217,12 +216,7 @@ public class NavigationModeSwitchRule implements TestRule {
|
||||
|
||||
private static void assertTrue(LauncherInstrumentation launcher, String message,
|
||||
boolean condition, Description description) {
|
||||
if (launcher.getDevice().hasObject(By.textStartsWith(""))) {
|
||||
// The condition above is "screen is not empty". We are not treating
|
||||
// "Screen is empty" as an anomaly here. It's an acceptable state when
|
||||
// Launcher just starts under instrumentation.
|
||||
launcher.checkForAnomaly();
|
||||
}
|
||||
launcher.checkForAnomaly(true);
|
||||
if (!condition) {
|
||||
final AssertionError assertionError = new AssertionError(message);
|
||||
if (description != null) {
|
||||
|
||||
@@ -52,7 +52,7 @@ public class Wait {
|
||||
throw new RuntimeException(t);
|
||||
}
|
||||
Log.d("Wait", "atMost: timed out: " + SystemClock.uptimeMillis());
|
||||
launcher.checkForAnomaly();
|
||||
launcher.checkForAnomaly(false);
|
||||
Assert.fail(message.get());
|
||||
}
|
||||
|
||||
|
||||
@@ -390,7 +390,7 @@ public final class LauncherInstrumentation {
|
||||
}
|
||||
}
|
||||
|
||||
private String getSystemAnomalyMessage() {
|
||||
private String getSystemAnomalyMessage(boolean ignoreNavmodeChangeStates) {
|
||||
try {
|
||||
{
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
@@ -413,16 +413,18 @@ public final class LauncherInstrumentation {
|
||||
|
||||
if (hasSystemUiObject("keyguard_status_view")) return "Phone is locked";
|
||||
|
||||
final String visibleApps = mDevice.findObjects(getAnyObjectSelector())
|
||||
.stream()
|
||||
.map(LauncherInstrumentation::getApplicationPackageSafe)
|
||||
.distinct()
|
||||
.filter(pkg -> pkg != null)
|
||||
.collect(Collectors.joining(","));
|
||||
if (SYSTEMUI_PACKAGE.equals(visibleApps)) return "Only System UI views are visible";
|
||||
if (!ignoreNavmodeChangeStates) {
|
||||
final String visibleApps = mDevice.findObjects(getAnyObjectSelector())
|
||||
.stream()
|
||||
.map(LauncherInstrumentation::getApplicationPackageSafe)
|
||||
.distinct()
|
||||
.filter(pkg -> pkg != null)
|
||||
.collect(Collectors.joining(","));
|
||||
if (SYSTEMUI_PACKAGE.equals(visibleApps)) return "Only System UI views are visible";
|
||||
|
||||
if (!mDevice.wait(Until.hasObject(getAnyObjectSelector()), WAIT_TIME_MS)) {
|
||||
return "Screen is empty";
|
||||
if (!mDevice.wait(Until.hasObject(getAnyObjectSelector()), WAIT_TIME_MS)) {
|
||||
return "Screen is empty";
|
||||
}
|
||||
}
|
||||
|
||||
final String navigationModeError = getNavigationModeMismatchError(true);
|
||||
@@ -434,8 +436,12 @@ public final class LauncherInstrumentation {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void checkForAnomaly() {
|
||||
final String systemAnomalyMessage = getSystemAnomalyMessage();
|
||||
private void checkForAnomaly() {
|
||||
checkForAnomaly(false);
|
||||
}
|
||||
|
||||
public void checkForAnomaly(boolean ignoreNavmodeChangeStates) {
|
||||
final String systemAnomalyMessage = getSystemAnomalyMessage(ignoreNavmodeChangeStates);
|
||||
if (systemAnomalyMessage != null) {
|
||||
Assert.fail(formatSystemHealthMessage(formatErrorWithEvents(
|
||||
"http://go/tapl : Tests are broken by a non-Launcher system error: "
|
||||
@@ -767,7 +773,7 @@ public final class LauncherInstrumentation {
|
||||
|
||||
if (hasLauncherObject(CONTEXT_MENU_RES_ID)) {
|
||||
GestureScope gestureScope = gestureStartFromLauncher
|
||||
? (isTablet()? GestureScope.INSIDE : GestureScope.INSIDE_TO_OUTSIDE)
|
||||
? (isTablet() ? GestureScope.INSIDE : GestureScope.INSIDE_TO_OUTSIDE)
|
||||
: GestureScope.OUTSIDE_WITH_PILFER;
|
||||
linearGesture(
|
||||
displaySize.x / 2, displaySize.y - 1,
|
||||
|
||||
Reference in New Issue
Block a user