summaryrefslogtreecommitdiff
path: root/src/com/android/launcher3/testing/TestLogging.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/launcher3/testing/TestLogging.java')
-rw-r--r--src/com/android/launcher3/testing/TestLogging.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/com/android/launcher3/testing/TestLogging.java b/src/com/android/launcher3/testing/TestLogging.java
index 51e081972f..103b565140 100644
--- a/src/com/android/launcher3/testing/TestLogging.java
+++ b/src/com/android/launcher3/testing/TestLogging.java
@@ -17,6 +17,8 @@
package com.android.launcher3.testing;
import android.util.Log;
+import android.view.InputEvent;
+import android.view.KeyEvent;
import android.view.MotionEvent;
import com.android.launcher3.Utilities;
@@ -25,6 +27,7 @@ import java.util.function.BiConsumer;
public final class TestLogging {
private static BiConsumer<String, String> sEventConsumer;
+ public static boolean sHadEventsNotFromTest;
private static void recordEventSlow(String sequence, String event) {
Log.d(TestProtocol.TAPL_EVENTS_TAG, sequence + " / " + event);
@@ -46,9 +49,24 @@ public final class TestLogging {
}
}
+ private static void registerEventNotFromTest(InputEvent event) {
+ if (!sHadEventsNotFromTest && event.getDeviceId() != -1) {
+ sHadEventsNotFromTest = true;
+ Log.d(TestProtocol.PERMANENT_DIAG_TAG, "First event not from test: " + event);
+ }
+ }
+
+ public static void recordKeyEvent(String sequence, String message, KeyEvent event) {
+ if (Utilities.IS_RUNNING_IN_TEST_HARNESS) {
+ recordEventSlow(sequence, message + ": " + event);
+ registerEventNotFromTest(event);
+ }
+ }
+
public static void recordMotionEvent(String sequence, String message, MotionEvent event) {
if (Utilities.IS_RUNNING_IN_TEST_HARNESS && event.getAction() != MotionEvent.ACTION_MOVE) {
recordEventSlow(sequence, message + ": " + event);
+ registerEventNotFromTest(event);
}
}