Removing verifying touch events in TAPL

They are perceived to produce too much noise and maintenance.

Bug: 187761685
Test: presubmit
Flag: N/A
Change-Id: I062eb5670a92a2ccc7039108829b09ca9d9127ae
This commit is contained in:
Vadim Tryshev
2023-08-29 12:04:26 -07:00
parent 41d269a43b
commit 0e97dff0da
6 changed files with 23 additions and 115 deletions

View File

@@ -27,26 +27,29 @@ import com.android.launcher3.testing.shared.TestProtocol;
import java.util.function.BiConsumer;
public final class TestLogging {
private static final String TAPL_EVENTS_TAG = "TaplEvents";
private static final String LAUNCHER_EVENTS_TAG = "LauncherEvents";
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);
private static void recordEventSlow(String sequence, String event, boolean reportToTapl) {
Log.d(reportToTapl ? TAPL_EVENTS_TAG : LAUNCHER_EVENTS_TAG,
sequence + " / " + event);
final BiConsumer<String, String> eventConsumer = sEventConsumer;
if (eventConsumer != null) {
if (reportToTapl && eventConsumer != null) {
eventConsumer.accept(sequence, event);
}
}
public static void recordEvent(String sequence, String event) {
if (Utilities.isRunningInTestHarness()) {
recordEventSlow(sequence, event);
recordEventSlow(sequence, event, true);
}
}
public static void recordEvent(String sequence, String message, Object parameter) {
if (Utilities.isRunningInTestHarness()) {
recordEventSlow(sequence, message + ": " + parameter);
recordEventSlow(sequence, message + ": " + parameter, true);
}
}
@@ -59,14 +62,23 @@ public final class TestLogging {
public static void recordKeyEvent(String sequence, String message, KeyEvent event) {
if (Utilities.isRunningInTestHarness()) {
recordEventSlow(sequence, message + ": " + event);
recordEventSlow(sequence, message + ": " + event, true);
registerEventNotFromTest(event);
}
}
public static void recordMotionEvent(String sequence, String message, MotionEvent event) {
if (Utilities.isRunningInTestHarness() && event.getAction() != MotionEvent.ACTION_MOVE) {
recordEventSlow(sequence, message + ": " + event);
final int action = event.getAction();
if (Utilities.isRunningInTestHarness() && action != MotionEvent.ACTION_MOVE) {
// "Expecting" in TAPL ACTION_DOWN, UP and CANCEL events was thought to be producing
// considerable noise in tests due to failed checks for expected events. So we are not
// sending them to TAPL.
// Other events, such as EVENT_PILFER_POINTERS produce less noise and are thought to
// be more useful.
final boolean reportToTapl = action != MotionEvent.ACTION_DOWN
&& action != MotionEvent.ACTION_UP
&& action != MotionEvent.ACTION_CANCEL;
recordEventSlow(sequence, message + ": " + event, reportToTapl);
registerEventNotFromTest(event);
}
}