Skip to content

Commit 4e9c63a

Browse files
authored
[flutter_tools] Add device log streaming support to DeviceService and ExtensionBackedDevice (flutter#194964)
Adds device log streaming support for tool-extension-backed target devices (`flutter logs` and `flutter run` console output): - Adds `startLogStreamMethod` (`device.startLogStream`), `stopLogStreamMethod` (`device.stopLogStream`), `logEntryNotificationMethod` (`device.logEntry`), `lineKey`, `startLogStream`, `stopLogStream`, and `emitLogLine` to `DeviceService` (`package:flutter_tools_extension`). - Implements `startLogStream` and `stopLogStream` on `ExtensionDeviceClient`, introduces `ExtensionDeviceLogReader`, and updates `ExtensionBackedDevice.getLogReader` to cache and dispose a per-device log reader. - Updates `LogsCommand.runCommand()` to skip `applicationPackages.getPackageForPlatform` when `targetPlatform == TargetPlatform.unsupported` (such as custom-platform extension devices). - Adds hermetic unit and isolate RPC tests in `test/general.shard/extension_protocol/extension_device_test.dart` and an end-to-end `LogsCommand` integration test in `test/commands.shard/hermetic/tool_extensions_device_test.dart`. Part of flutter#190755 Part of flutter#190750 ## 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.
1 parent 3490ec8 commit 4e9c63a

5 files changed

Lines changed: 1030 additions & 38 deletions

File tree

‎packages/flutter_tools/lib/src/commands/logs.dart‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import '../application_package.dart';
99
import '../base/common.dart';
1010
import '../base/io.dart';
1111
import '../base/logger.dart';
12+
import '../build_info.dart';
1213
import '../context/tool_context.dart';
1314
import '../device.dart';
1415
import '../runner/flutter_command.dart';
@@ -73,9 +74,10 @@ class LogsCommand extends FlutterCommand {
7374
cachedDevice.clearLogs();
7475
}
7576

76-
final ApplicationPackage? app = await applicationPackages?.getPackageForPlatform(
77-
await cachedDevice.targetPlatform,
78-
);
77+
final TargetPlatform targetPlatform = await cachedDevice.targetPlatform;
78+
final ApplicationPackage? app = targetPlatform == .unsupported
79+
? null
80+
: await applicationPackages?.getPackageForPlatform(targetPlatform);
7981

8082
final bool filtering =
8183
argParser.options.containsKey('adb-log-filtering') && boolArg('adb-log-filtering');

0 commit comments

Comments
 (0)