Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 05f3a21f authored by vadimt's avatar vadimt
Browse files

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
parent a7c931dd
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -1251,13 +1251,14 @@ public final class LauncherInstrumentation {
    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 "
            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);
                    + " -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.