File tree Expand file tree Collapse file tree
test/general.shard/android Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1096,6 +1096,11 @@ class AdbLogReader extends DeviceLogReader {
10961096 RegExp (r'^[F]\/[\S^:]+:\s+' ),
10971097 ];
10981098
1099+ // E/SurfaceSyncer(22636): Failed to find sync for id=9
1100+ // Some versions of Android spew this out. It is inactionable to the end user
1101+ // and causes no problems for the application.
1102+ static final RegExp _surfaceSyncerSpam = RegExp (r'^E/SurfaceSyncer\(\s*\d+\): Failed to find sync for id=\d+' );
1103+
10991104 // 'F/libc(pid): Fatal signal 11'
11001105 static final RegExp _fatalLog = RegExp (r'^F\/libc\s*\(\s*\d+\):\sFatal signal (\d+)' );
11011106
@@ -1150,7 +1155,7 @@ class AdbLogReader extends DeviceLogReader {
11501155 }
11511156 }
11521157 } else if (appPid != null && int .parse (logMatch.group (1 )! ) == appPid) {
1153- acceptLine = true ;
1158+ acceptLine = ! _surfaceSyncerSpam. hasMatch (line) ;
11541159
11551160 if (_fatalLog.hasMatch (line)) {
11561161 // Hit fatal signal, app is now crashing
Original file line number Diff line number Diff line change @@ -19,6 +19,43 @@ const String kLastLogcatTimestamp = '11-27 15:39:04.506';
1919const String kDummyLine = 'Contents are not important\n ' ;
2020
2121void main () {
22+ testWithoutContext ('AdbLogReader ignores spam from SurfaceSyncer' , () async {
23+ const int appPid = 1 ;
24+ final FakeProcessManager processManager = FakeProcessManager .list (< FakeCommand > [
25+ FakeCommand (
26+ command: const < String > [
27+ 'adb' ,
28+ '-s' ,
29+ '1234' ,
30+ 'shell' ,
31+ '-x' ,
32+ 'logcat' ,
33+ '-v' ,
34+ 'time' ,
35+ ],
36+ completer: Completer <void >.sync (),
37+ stdout:
38+ '$kDummyLine '
39+ '05-11 12:54:46.665 W/flutter($appPid ): Hello there!\n '
40+ '05-11 12:54:46.665 E/SurfaceSyncer($appPid ): Failed to find sync for id=9\n '
41+ '05-11 12:54:46.665 E/SurfaceSyncer($appPid ): Failed to find sync for id=10\n '
42+ ),
43+ ]);
44+ final AdbLogReader logReader = await AdbLogReader .createLogReader (
45+ createFakeDevice (null ),
46+ processManager,
47+ )..appPid = appPid;
48+ final Completer <void > onDone = Completer <void >.sync ();
49+ final List <String > emittedLines = < String > [];
50+ logReader.logLines.listen ((String line) {
51+ emittedLines.add (line);
52+ }, onDone: onDone.complete);
53+ await null ;
54+ logReader.dispose ();
55+ await onDone.future;
56+ expect (emittedLines, const < String > ['W/flutter($appPid ): Hello there!' ]);
57+ });
58+
2259 testWithoutContext ('AdbLogReader calls adb logcat with expected flags apiVersion 21' , () async {
2360 final FakeProcessManager processManager = FakeProcessManager .list (< FakeCommand > [
2461 const FakeCommand (
You can’t perform that action at this time.
0 commit comments