Skip to content

adb logcat filtering sometimes picks up the wrong Flutter process #144346

@matanlurey

Description

@matanlurey

For example:

-> Configuring emulator...
--------- beginning of main
--------- beginning of kernel
--------- beginning of system
02-28 21:35:54.132 [I] ActivityManager: Start proc 4248:com.google.android.settings.intelligence/u0a118 for broadcast {com.google.android.settings.intelligence/com.google.android.settings.intelligence.modules.batterywidget.impl.BatteryWidgetBootBroadcastReceiver}
02-28 21:35:54.132 [W] ActivityManager: Slow operation: 66ms so far, now at startProcess: starting to update pids map
02-28 21:35:54.133 [W] ActivityManager: Slow operation: 67ms so far, now at startProcess: done updating pids map
02-28 21:35:54.207 [I] gs.intelligence: Using CollectorTypeCC GC.
02-28 21:35:54.209 [W] gs.intelligence: Unexpected CPU variant for x86: x86_64.
02-28 21:35:54.209 [W] gs.intelligence: Known variants: atom, sandybridge, silvermont, goldmont, goldmont-plus, tremont, kabylake, default

Oops!

The flaw is in tryParseProcess:

/// Tries to parse the process that was started, if the log line is about it.
String? tryParseProcess() {
  if (name == 'ActivityManager' && message.startsWith('Start proc')) {
    // Start proc 6840:d
    final RegExpMatch? match = RegExp(r'Start proc (\d+):').firstMatch(message);
    return match?.group(1);
  }
  return null;
}

... this should be more specific and check for dev.flutter.scenarios being launched:

02-28 21:29:33.033   553   583 I ActivityManager: Start proc 4475:dev.flutter.scenarios/u0a190 for added application dev.flutter.scenarios

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work liste: scenario-appThe `testing/scenario_app` fixture in the engineplatform-androidAndroid applications specificallyteam-engineOwned by Engine team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions