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

Commit b0948db9 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Dumping TIS state on failures" into ub-launcher3-rvc-dev

parents fcfba815 835e612a
Loading
Loading
Loading
Loading
+19 −19
Original line number Diff line number Diff line
@@ -442,20 +442,30 @@ public final class LauncherInstrumentation {
            }
        }

        try {
        dumpDiagnostics();

        log("Hierarchy dump for: " + message);
        dumpViewHierarchy();

        return message;
    }

    private void dumpDiagnostics() {
        Log.e("b/156287114", "Input:");
            for (String line : mDevice.executeShellCommand("dumpsys input").split("\\n")) {
        logShellCommand("dumpsys input");
        Log.e("b/156287114", "TIS:");
        logShellCommand("dumpsys activity service TouchInteractionService");
    }

    private void logShellCommand(String command) {
        try {
            for (String line : mDevice.executeShellCommand(command).split("\\n")) {
                SystemClock.sleep(10);
                Log.d("b/156287114", line);
            }
        } catch (IOException e) {
            e.printStackTrace();
            Log.d("b/156287114", "Failed to execute " + command);
        }

        log("Hierarchy dump for: " + message);
        dumpViewHierarchy();

        return message;
    }

    private void fail(String message) {
@@ -1340,17 +1350,7 @@ public final class LauncherInstrumentation {
                if (mCheckEventsForSuccessfulGestures) {
                    final String message = sEventChecker.verify(WAIT_TIME_MS, true);
                    if (message != null) {
                        try {
                            Log.e("b/156287114", "Input:");
                            for (String line : mDevice.executeShellCommand("dumpsys input").split(
                                    "\\n")) {
                                SystemClock.sleep(10);
                                Log.d("b/156287114", line);
                            }
                        } catch (IOException e) {
                            e.printStackTrace();
                        }

                        dumpDiagnostics();
                        checkForAnomaly();
                        Assert.fail(formatSystemHealthMessage(
                                "http://go/tapl : successful gesture produced " + message));