[flutter_tools] ignore viewpost ime and samsung spam messages. (#161199)
Fixes https://github.com/flutter/flutter/issues/160598
This commit is contained in:
@@ -1152,12 +1152,15 @@ class AdbLogReader extends DeviceLogReader {
|
||||
RegExp(r'^[F]\/[\S^:]+:\s+'),
|
||||
];
|
||||
|
||||
// E/SurfaceSyncer(22636): Failed to find sync for id=9
|
||||
// Some versions of Android spew this out. It is inactionable to the end user
|
||||
// and causes no problems for the application.
|
||||
static final RegExp _surfaceSyncerSpam = RegExp(
|
||||
r'^E/SurfaceSyncer\(\s*\d+\): Failed to find sync for id=\d+',
|
||||
);
|
||||
static final List<RegExp> _filteredMessagees = <RegExp>[
|
||||
// E/SurfaceSyncer(22636): Failed to find sync for id=9
|
||||
// Some versions of Android spew this out. It is inactionable to the end user
|
||||
// and causes no problems for the application.
|
||||
RegExp(r'^E/SurfaceSyncer\(\s*\d+\): Failed to find sync for id=\d+'),
|
||||
// See https://github.com/flutter/flutter/issues/160598
|
||||
RegExp(r'ViewPostIme pointer'),
|
||||
RegExp(r'mali.instrumentation.graph.work'),
|
||||
];
|
||||
|
||||
// 'F/libc(pid): Fatal signal 11'
|
||||
static final RegExp _fatalLog = RegExp(r'^F\/libc\s*\(\s*\d+\):\sFatal signal (\d+)');
|
||||
@@ -1213,7 +1216,7 @@ class AdbLogReader extends DeviceLogReader {
|
||||
}
|
||||
}
|
||||
} else if (_appPid != null && int.parse(logMatch.group(1)!) == _appPid) {
|
||||
acceptLine = !_surfaceSyncerSpam.hasMatch(line);
|
||||
acceptLine = !_filteredMessagees.any((RegExp e) => e.hasMatch(line));
|
||||
|
||||
if (_fatalLog.hasMatch(line)) {
|
||||
// Hit fatal signal, app is now crashing
|
||||
|
||||
@@ -70,6 +70,37 @@ void main() {
|
||||
expect(emittedLines, const <String>['W/flutter($appPid): Hello there!']);
|
||||
});
|
||||
|
||||
testWithoutContext('AdbLogReader ignores spam from Samsung/Mali', () async {
|
||||
const int appPid = 1;
|
||||
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
|
||||
FakeCommand(
|
||||
command: const <String>['adb', '-s', '1234', 'shell', '-x', 'logcat', '-v', 'time'],
|
||||
completer: Completer<void>.sync(),
|
||||
stdout:
|
||||
'$kDummyLine'
|
||||
'05-11 12:54:46.665 W/flutter($appPid): Hello there!\n'
|
||||
'05-11 12:54:46.665 I/ViewRootImpl@bd2a991[MainActivity]($appPid): ViewPostIme pointer 0\n'
|
||||
'05-11 12:54:46.665 I/ViewRootImpl@bd2a991[MainActivity]($appPid): ViewPostIme pointer 1\n'
|
||||
'05-11 12:54:46.665 D/mali.instrumentation.graph.work($appPid): key already added\n',
|
||||
),
|
||||
]);
|
||||
final AdbLogReader logReader = await AdbLogReader.createLogReader(
|
||||
createFakeDevice(null),
|
||||
processManager,
|
||||
BufferLogger.test(),
|
||||
);
|
||||
await logReader.provideVmService(_FakeFlutterVmService(appPid));
|
||||
final Completer<void> onDone = Completer<void>.sync();
|
||||
final List<String> emittedLines = <String>[];
|
||||
logReader.logLines.listen((String line) {
|
||||
emittedLines.add(line);
|
||||
}, onDone: onDone.complete);
|
||||
await null;
|
||||
logReader.dispose();
|
||||
await onDone.future;
|
||||
expect(emittedLines, const <String>['W/flutter($appPid): Hello there!']);
|
||||
});
|
||||
|
||||
testWithoutContext('AdbLogReader calls adb logcat with expected flags apiVersion 21', () async {
|
||||
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
|
||||
const FakeCommand(
|
||||
|
||||
Reference in New Issue
Block a user