Events: moving logcat filter 1 sec back
I saw flakes when logcat didn't return records that are 300ms after the
specified time. I hope that moving the start time 1 sec back will
workaround this.
Change-Id: I6a4b66094d38f555d10284f19a71152a8be47b2e
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index ebf48a2..da1f907 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -1213,9 +1213,12 @@
private List<String> getEvents() {
final ArrayList<String> events = new ArrayList<>();
try {
+ // Logcat may skip events after the specified time. Querying for events starting 1 sec
+ // earlier.
+ final Date startTime = new Date(mStartRecordingTime.getTime() - 1000);
final String logcatEvents = mDevice.executeShellCommand(
"logcat -d -v year --pid=" + getPid() + " -t "
- + DATE_TIME_FORMAT.format(mStartRecordingTime).replaceAll(" ", "")
+ + DATE_TIME_FORMAT.format(startTime).replaceAll(" ", "")
+ " -s " + TestProtocol.TAPL_EVENTS_TAG);
final Matcher matcher = EVENT_LOG_ENTRY.matcher(logcatEvents);
while (matcher.find()) {