Skip to content

Commit 2b61b85

Browse files
authored
Filter out FrameEvents/updateAcquireFence log spam from adb logcat (#179884)
## Problem When using platform views like Google Maps on Android, the console gets flooded with messages like: ``` E/FrameEvents(26685): updateAcquireFence: Did not find frame. E/FrameEvents(26685): updateAcquireFence: Did not find frame. E/FrameEvents(26685): updateAcquireFence: Did not find frame. ... (repeats many times) ``` This makes it hard to see actual errors and warnings in the console. ## Cause This is a HWUI bug in Android, not an actual error. The message doesn't indicate any problem with the application. ## Fix Add a regex filter to `_filteredMessagees` in `AdbLogReader` to suppress these messages, following the same pattern used for similar spam messages like `SurfaceSyncer` and `ViewPostIme pointer`. ## Fixes flutter/flutter#104268 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
1 parent 66002b2 commit 2b61b85

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

packages/flutter_tools/lib/src/android/android_device.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,6 +1154,11 @@ class AdbLogReader extends DeviceLogReader {
11541154
// Some versions of Android spew this out. It is inactionable to the end user
11551155
// and causes no problems for the application.
11561156
RegExp(r'^E/SurfaceSyncer\(\s*\d+\): Failed to find sync for id=\d+'),
1157+
// E/FrameEvents(26685): updateAcquireFence: Did not find frame.
1158+
// This is a HWUI bug that spams the console when using platform views like Google Maps.
1159+
// It is not an actual error and causes no problems for the application.
1160+
// See https://github.com/flutter/flutter/issues/104268
1161+
RegExp(r'^E/FrameEvents\(\s*\d+\): updateAcquireFence: Did not find frame\.$'),
11571162
// See https://github.com/flutter/flutter/issues/160598
11581163
RegExp(r'ViewPostIme pointer'),
11591164
RegExp(r'mali.instrumentation.graph.work'),

packages/flutter_tools/test/general.shard/android/adb_log_reader_test.dart

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,38 @@ void main() {
101101
expect(emittedLines, const <String>['W/flutter($appPid): Hello there!']);
102102
});
103103

104+
// Regression test for https://github.com/flutter/flutter/issues/104268
105+
testWithoutContext('AdbLogReader ignores spam from FrameEvents/updateAcquireFence', () async {
106+
const appPid = 1;
107+
final processManager = FakeProcessManager.list(<FakeCommand>[
108+
FakeCommand(
109+
command: const <String>['adb', '-s', '1234', 'shell', '-x', 'logcat', '-v', 'time'],
110+
completer: Completer<void>.sync(),
111+
stdout:
112+
'$kDummyLine'
113+
'05-11 12:54:46.665 W/flutter($appPid): Hello there!\n'
114+
'05-11 12:54:46.665 E/FrameEvents($appPid): updateAcquireFence: Did not find frame.\n'
115+
'05-11 12:54:46.666 E/FrameEvents($appPid): updateAcquireFence: Did not find frame.\n'
116+
'05-11 12:54:46.667 E/FrameEvents($appPid): updateAcquireFence: Did not find frame.\n',
117+
),
118+
]);
119+
final AdbLogReader logReader = await AdbLogReader.createLogReader(
120+
createFakeDevice(null),
121+
processManager,
122+
BufferLogger.test(),
123+
);
124+
await logReader.provideVmService(_FakeFlutterVmService(appPid));
125+
final onDone = Completer<void>.sync();
126+
final emittedLines = <String>[];
127+
logReader.logLines.listen((String line) {
128+
emittedLines.add(line);
129+
}, onDone: onDone.complete);
130+
await null;
131+
logReader.dispose();
132+
await onDone.future;
133+
expect(emittedLines, const <String>['W/flutter($appPid): Hello there!']);
134+
});
135+
104136
testWithoutContext('AdbLogReader calls adb logcat with expected flags apiVersion 21', () async {
105137
final processManager = FakeProcessManager.list(<FakeCommand>[
106138
const FakeCommand(

0 commit comments

Comments
 (0)