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

Commit 05965706 authored by Vadim Tryshev's avatar Vadim Tryshev Committed by Android (Google) Code Review
Browse files

Merge "Tapl: diagnosing anomalies" into ub-launcher3-qt-r1-dev

parents 0b20a11d e8a72681
Loading
Loading
Loading
Loading
+18 −2
Original line number Original line Diff line number Diff line
@@ -263,10 +263,26 @@ public final class LauncherInstrumentation {
        }
        }
    }
    }


    private String getAnomalyMessage() {
        final UiObject2 object = mDevice.findObject(By.res("android", "alertTitle"));
        if (object != null) {
            return "System alert popup is visible: " + object.getText();
        }

        if (!mDevice.hasObject(By.textStartsWith(""))) return "Screen is empty";

        return null;
    }

    private void fail(String message) {
    private void fail(String message) {
        log("Hierarchy dump for: " + getContextDescription() + message);
        message = "http://go/tapl : " + getContextDescription() + message;

        final String anomaly = getAnomalyMessage();
        if (anomaly != null) message = anomaly + ", which causes:\n" + message;

        log("Hierarchy dump for: " + message);
        dumpViewHierarchy();
        dumpViewHierarchy();
        Assert.fail("http://go/tapl : " + getContextDescription() + message);
        Assert.fail(message);
    }
    }


    private String getContextDescription() {
    private String getContextDescription() {