Starting querying logcat events 1 min before start of the gesture
This is a temporary attempt to solve the supposed unreliability of the
"-t" parameter of logcat while the permanent solution (ag/10290062) is
being reviewed.
Bug: 149422395
Change-Id: I327a94de4349bb6cea32f9b8f66bb6e292725b8f
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index abd0f24..c5fbd7c 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -1251,13 +1251,14 @@
private Map<String, List<String>> getEvents() {
final Map<String, List<String>> events = new HashMap<>();
try {
- // Logcat may skip events after the specified time. Querying for events starting 1 sec
+ // Logcat may skip events after the specified time. Querying for events starting 1 min
// earlier.
- final Date startTime = new Date(mStartRecordingTime.getTime() - 10000);
- final String logcatEvents = mDevice.executeShellCommand(
- "logcat -d -v year --pid=" + getPid() + " -t "
- + DATE_TIME_FORMAT.format(startTime).replaceAll(" ", "")
- + " -s " + TestProtocol.TAPL_EVENTS_TAG);
+ final Date startTime = new Date(mStartRecordingTime.getTime() - 60000);
+ final String logcatCommand = "logcat -d -v year --pid=" + getPid() + " -t "
+ + DATE_TIME_FORMAT.format(startTime).replaceAll(" ", "")
+ + " -s " + TestProtocol.TAPL_EVENTS_TAG;
+ log("Events query command: " + logcatCommand);
+ final String logcatEvents = mDevice.executeShellCommand(logcatCommand);
final Matcher matcher = EVENT_LOG_ENTRY.matcher(logcatEvents);
while (matcher.find()) {
// Skip events before recording start time.