Merge "Making some TAPL members public so that tests could use them directly" into ub-launcher3-master
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index e52f687..f7b4f2b 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -1220,9 +1220,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()) {