From 835e612aeeae43f543d47fa962bc734cbe99fc99 Mon Sep 17 00:00:00 2001 From: vadimt Date: Wed, 27 May 2020 13:48:58 -0700 Subject: [PATCH] Dumping TIS state on failures Bug: 156287114 Change-Id: Ib438aae3cc4682b1f1c958e59337c095480d910a --- .../tapl/LauncherInstrumentation.java | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index 9c92a26972..ef6944801a 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -437,15 +437,7 @@ public final class LauncherInstrumentation { } } - 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(); log("Hierarchy dump for: " + message); dumpViewHierarchy(); @@ -453,6 +445,24 @@ public final class LauncherInstrumentation { return message; } + private void dumpDiagnostics() { + Log.e("b/156287114", "Input:"); + 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) { + Log.d("b/156287114", "Failed to execute " + command); + } + } + private void fail(String message) { checkForAnomaly(); Assert.fail(formatSystemHealthMessage(formatErrorWithEvents( @@ -1335,17 +1345,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));