[flutter_tools] flutter logs no longer requires supported device (#66696)
Flutter logs should not attempt to filter the device list based on the current project, because it does not require a current project. Also fix disabled polling test
Fixes #47996
Fixes #63550
diff --git a/packages/flutter_tools/lib/src/device.dart b/packages/flutter_tools/lib/src/device.dart
index 2e7b219..cdc2c70 100644
--- a/packages/flutter_tools/lib/src/device.dart
+++ b/packages/flutter_tools/lib/src/device.dart
@@ -77,7 +77,7 @@
String toString() => value;
}
-/// A class to get all available devices.
+/// A disovery mechanism for flutter-supported development devices.
abstract class DeviceManager {
/// Constructing DeviceManagers is cheap; they only do expensive work if some
@@ -210,6 +210,9 @@
/// * If the user did not specify a device id and there is more than one
/// device connected, then filter out unsupported devices and prioritize
/// ephemeral devices.
+ ///
+ /// * If [flutterProject] is null, then assume the project supports all
+ /// device types.
Future<List<Device>> findTargetDevices(FlutterProject flutterProject, { Duration timeout }) async {
if (timeout != null) {
// Reset the cache with the specified timeout.
@@ -310,8 +313,12 @@
/// Returns whether the device is supported for the project.
///
- /// This exists to allow the check to be overridden for google3 clients.
+ /// This exists to allow the check to be overridden for google3 clients. If
+ /// [flutterProject] is null then return true.
bool isDeviceSupportedForProject(Device device, FlutterProject flutterProject) {
+ if (flutterProject == null) {
+ return true;
+ }
return device.isSupportedForProject(flutterProject);
}
}
@@ -428,7 +435,7 @@
Future<List<Device>> pollingGetDevices({ Duration timeout });
- Future<void> startPolling() async {
+ void startPolling() {
if (_timer == null) {
deviceNotifier ??= ItemListNotifier<Device>();
// Make initial population the default, fast polling timeout.
@@ -449,18 +456,18 @@
});
}
- Future<void> stopPolling() async {
+ void stopPolling() {
_timer?.cancel();
_timer = null;
}
@override
- Future<List<Device>> get devices async {
+ Future<List<Device>> get devices {
return _populateDevices();
}
@override
- Future<List<Device>> discoverDevices({ Duration timeout }) async {
+ Future<List<Device>> discoverDevices({ Duration timeout }) {
deviceNotifier = null;
return _populateDevices(timeout: timeout);
}
@@ -480,7 +487,7 @@
return deviceNotifier.onRemoved;
}
- Future<void> dispose() async => await stopPolling();
+ void dispose() => stopPolling();
@override
String toString() => '$name device discovery';