Removing high-level events mismatch diagnostics.

They hide actual sequences, are not necessary for Tigers who are power users and require maintenance.

Bug: 187761685
Test: presubmit
Flag: NONE for test
Change-Id: I5d4b3d80a916845fcf8c08a0ecd135527466fa5a
This commit is contained in:
Vadim Tryshev
2024-05-28 13:34:56 -07:00
parent ff728284b4
commit 314c35c410
2 changed files with 4 additions and 58 deletions

View File

@@ -711,7 +711,7 @@ public final class LauncherInstrumentation {
final LogEventChecker eventChecker = mEventChecker;
mEventChecker = null;
if (checkEvents) {
final String eventMismatch = eventChecker.verify(0, false);
final String eventMismatch = eventChecker.verify(0);
if (eventMismatch != null) {
message = message + ";\n" + eventMismatch;
}
@@ -2408,7 +2408,7 @@ public final class LauncherInstrumentation {
if (mEventChecker != null) {
mEventChecker = null;
if (mCheckEventsForSuccessfulGestures) {
final String message = eventChecker.verify(WAIT_TIME_MS, true);
final String message = eventChecker.verify(WAIT_TIME_MS);
if (message != null) {
dumpDiagnostics(message);
checkForAnomaly();

View File

@@ -15,10 +15,6 @@
*/
package com.android.launcher3.tapl;
import static com.android.launcher3.testing.shared.TestProtocol.SEQUENCE_MAIN;
import static com.android.launcher3.testing.shared.TestProtocol.SEQUENCE_PILFER;
import static com.android.launcher3.testing.shared.TestProtocol.SEQUENCE_TIS;
import android.os.SystemClock;
import com.android.launcher3.testing.shared.TestProtocol;
@@ -87,25 +83,11 @@ public class LogEventChecker {
mLauncher.getTestInfo(TestProtocol.REQUEST_STOP_EVENT_LOGGING);
}
String verify(long waitForExpectedCountMs, boolean successfulGesture) {
String verify(long waitForExpectedCountMs) {
final ListMap<String> actualEvents = finishSync(waitForExpectedCountMs);
if (actualEvents == null) return "null event sequences because launcher likely died";
final String lowLevelDiags = lowLevelMismatchDiagnostics(actualEvents);
// If we have a sequence mismatch for a successful gesture, we want to provide all low-level
// details.
if (successfulGesture) {
return lowLevelDiags;
}
final String sequenceMismatchInEnglish = highLevelMismatchDiagnostics(actualEvents);
if (sequenceMismatchInEnglish != null) {
LauncherInstrumentation.log(lowLevelDiags);
return "Hint: " + sequenceMismatchInEnglish;
} else {
return lowLevelDiags;
}
return lowLevelMismatchDiagnostics(actualEvents);
}
private String lowLevelMismatchDiagnostics(ListMap<String> actualEvents) {
@@ -140,42 +122,6 @@ public class LogEventChecker {
return hasMismatches ? "Mismatching events: " + sb.toString() : null;
}
private String highLevelMismatchDiagnostics(ListMap<String> actualEvents) {
if (!mExpectedEvents.getNonNull(SEQUENCE_TIS).isEmpty()
&& actualEvents.getNonNull(SEQUENCE_TIS).isEmpty()) {
return "TouchInteractionService didn't receive any of the touch events sent by the "
+ "test";
}
if (getMismatchPosition(mExpectedEvents.getNonNull(SEQUENCE_TIS),
actualEvents.getNonNull(SEQUENCE_TIS)) != -1) {
// If TIS has a mismatch that we can't convert to high-level diags, don't convert
// other sequences either.
return null;
}
if (mExpectedEvents.getNonNull(SEQUENCE_PILFER).size() == 1
&& actualEvents.getNonNull(SEQUENCE_PILFER).isEmpty()) {
return "Launcher didn't detect the navigation gesture sent by the test";
}
if (mExpectedEvents.getNonNull(SEQUENCE_PILFER).isEmpty()
&& actualEvents.getNonNull(SEQUENCE_PILFER).size() == 1) {
return "Launcher detected a navigation gesture, but the test didn't send one";
}
if (getMismatchPosition(mExpectedEvents.getNonNull(SEQUENCE_PILFER),
actualEvents.getNonNull(SEQUENCE_PILFER)) != -1) {
// If Pilfer has a mismatch that we can't convert to high-level diags, don't analyze
// other sequences.
return null;
}
if (!mExpectedEvents.getNonNull(SEQUENCE_MAIN).isEmpty()
&& actualEvents.getNonNull(SEQUENCE_MAIN).isEmpty()) {
return "None of the touch or keyboard events sent by the test was received by "
+ "Launcher's main thread";
}
return null;
}
// If the list of actual events matches the list of expected events, returns -1, otherwise
// the position of the mismatch.
private static int getMismatchPosition(List<Pattern> expected, List<String> actual) {