Allowing ACTION_CANCEL events to come from device 0

Tests assert that input events come to Launcher only from tests, which
sets deviceId to 0. This way, we spot when a cable touches a lab device
and breaks the tests, in which case deviceId will be != -1.

But CANCEL event, which is programmatic, now can legitimately come from
device 0.

Bug: 308489875
Test: presubmit
Flag: N/A
Change-Id: I84ee9ed8e008043f83e82d57b17b64a10677ee8d
This commit is contained in:
Vadim Tryshev
2023-11-08 13:20:57 -08:00
parent 38dc539f84
commit 7a1beb559f
2 changed files with 4 additions and 3 deletions

View File

@@ -76,7 +76,7 @@ public final class TestLogging {
// be more useful.
// That's why we pass false as the value for the 'reportToTapl' parameter.
recordEventSlow(sequence, message + ": " + event, false);
registerEventNotFromTest(event);
if (action != MotionEvent.ACTION_CANCEL) registerEventNotFromTest(event);
}
}

View File

@@ -59,8 +59,9 @@ public class FailureWatcher extends TestWatcher {
throw new AssertionError(
"Launcher received events not sent by the test. This may mean "
+ "that the touch screen of the lab device has sent false"
+ " events. See the logcat for TaplEvents tag and look "
+ "for events with deviceId != -1");
+ " events. See the logcat for "
+ "TaplEvents|LauncherEvents|TaplTarget tag and look for "
+ "events with deviceId != -1");
}
}
}