diff --git a/packages/flutter_tools/lib/src/android/android_device.dart b/packages/flutter_tools/lib/src/android/android_device.dart index d24c23018c3d8..dae43b59e4fad 100644 --- a/packages/flutter_tools/lib/src/android/android_device.dart +++ b/packages/flutter_tools/lib/src/android/android_device.dart @@ -193,7 +193,8 @@ class AndroidDevice extends Device { @override late final Future targetPlatform = () async { // http://developer.android.com/ndk/guides/abis.html (x86, armeabi-v7a, ...) - switch (await _getProperty('ro.product.cpu.abi')) { + final String? abi = await _getProperty('ro.product.cpu.abi'); + switch (abi) { case 'arm64-v8a': // Perform additional verification for 64 bit ABI. Some devices, // like the Kindle Fire 8, misreport the abilist. We might not @@ -205,10 +206,12 @@ class AndroidDevice extends Device { } else { return TargetPlatform.android_arm; } + case 'armeabi-v7a': + return TargetPlatform.android_arm; case 'x86_64': return TargetPlatform.android_x64; default: - return TargetPlatform.android_arm; + return TargetPlatform.unsupported; } }(); @@ -230,6 +233,7 @@ class AndroidDevice extends Device { case TargetPlatform.web_javascript: case TargetPlatform.windows_x64: case TargetPlatform.windows_arm64: + case TargetPlatform.unsupported: throw UnsupportedError('Invalid target platform for Android'); } } @@ -552,6 +556,7 @@ class AndroidDevice extends Device { case TargetPlatform.web_javascript: case TargetPlatform.windows_arm64: case TargetPlatform.windows_x64: + case TargetPlatform.unsupported: _logger.printError('Android platforms are only supported.'); return LaunchResult.failed(); } @@ -851,7 +856,16 @@ class AndroidDevice extends Device { } @override - bool isSupported() => true; + Future isSupported() async { + final TargetPlatform platform = await targetPlatform; + return switch (platform) { + TargetPlatform.android || + TargetPlatform.android_arm || + TargetPlatform.android_arm64 || + TargetPlatform.android_x64 => true, + _ => false, + }; + } @override bool get supportsScreenshot => true; diff --git a/packages/flutter_tools/lib/src/artifacts.dart b/packages/flutter_tools/lib/src/artifacts.dart index 24ef98cadd00d..cde1911252d39 100644 --- a/packages/flutter_tools/lib/src/artifacts.dart +++ b/packages/flutter_tools/lib/src/artifacts.dart @@ -164,6 +164,7 @@ TargetPlatform? _mapTargetPlatform(TargetPlatform? targetPlatform) { case TargetPlatform.android_arm: case TargetPlatform.android_arm64: case TargetPlatform.android_x64: + case TargetPlatform.unsupported: case null: return targetPlatform; } @@ -531,6 +532,8 @@ class CachedArtifacts implements Artifacts { platform ?? _currentHostPlatform(_platform, _operatingSystemUtils), mode, ); + case TargetPlatform.unsupported: + TargetPlatform.throwUnsupportedTarget(); } } @@ -901,6 +904,8 @@ class CachedArtifacts implements Artifacts { case TargetPlatform.android: assert(false, 'cannot use TargetPlatform.android to look up artifacts'); return null; + case TargetPlatform.unsupported: + TargetPlatform.throwUnsupportedTarget(); } } @@ -1350,6 +1355,8 @@ class CachedLocalEngineArtifacts implements Artifacts { case TargetPlatform.web_javascript: case TargetPlatform.tester: throwToolExit('Unsupported host platform: $hostPlatform'); + case TargetPlatform.unsupported: + TargetPlatform.throwUnsupportedTarget(); } } @@ -1578,6 +1585,8 @@ class CachedLocalWebSdkArtifacts implements Artifacts { case TargetPlatform.web_javascript: case TargetPlatform.tester: throwToolExit('Unsupported host platform: $hostPlatform'); + case TargetPlatform.unsupported: + TargetPlatform.throwUnsupportedTarget(); } } diff --git a/packages/flutter_tools/lib/src/build_info.dart b/packages/flutter_tools/lib/src/build_info.dart index 1aea1d389c56b..5b1c19aacda41 100644 --- a/packages/flutter_tools/lib/src/build_info.dart +++ b/packages/flutter_tools/lib/src/build_info.dart @@ -585,7 +585,8 @@ enum TargetPlatform { // and [AndroidArch]. android_arm, android_arm64, - android_x64; + android_x64, + unsupported; String get fuchsiaArchForTargetPlatform { switch (this) { @@ -605,6 +606,7 @@ enum TargetPlatform { case TargetPlatform.web_javascript: case TargetPlatform.windows_x64: case TargetPlatform.windows_arm64: + case TargetPlatform.unsupported: throw UnsupportedError('Unexpected Fuchsia platform $this'); } } @@ -627,9 +629,13 @@ enum TargetPlatform { case TargetPlatform.ios: case TargetPlatform.tester: case TargetPlatform.web_javascript: + case TargetPlatform.unsupported: throw UnsupportedError('Unexpected target platform $this'); } } + + static Never throwUnsupportedTarget() => + throw UnsupportedError('Target platform is unsupported.'); } /// iOS and macOS target device architecture. @@ -749,6 +755,7 @@ String getNameForTargetPlatform(TargetPlatform platform, {DarwinArch? darwinArch TargetPlatform.tester => 'flutter-tester', TargetPlatform.web_javascript => 'web-javascript', TargetPlatform.android => 'android', + TargetPlatform.unsupported => 'unsupported', }; } diff --git a/packages/flutter_tools/lib/src/build_system/targets/common.dart b/packages/flutter_tools/lib/src/build_system/targets/common.dart index 832d83060d99e..be0aec1a497f7 100644 --- a/packages/flutter_tools/lib/src/build_system/targets/common.dart +++ b/packages/flutter_tools/lib/src/build_system/targets/common.dart @@ -224,6 +224,8 @@ class KernelSnapshot extends Target { case TargetPlatform.tester: case TargetPlatform.web_javascript: forceLinkPlatform = false; + case TargetPlatform.unsupported: + TargetPlatform.throwUnsupportedTarget(); } final String? targetOS = switch (targetPlatform) { @@ -237,6 +239,7 @@ class KernelSnapshot extends Target { TargetPlatform.linux_arm64 || TargetPlatform.linux_x64 => 'linux', TargetPlatform.windows_arm64 || TargetPlatform.windows_x64 => 'windows', TargetPlatform.tester || TargetPlatform.web_javascript => null, + TargetPlatform.unsupported => TargetPlatform.throwUnsupportedTarget(), }; final PackageConfig packageConfig = await loadPackageConfigWithLogging( diff --git a/packages/flutter_tools/lib/src/build_system/tools/shader_compiler.dart b/packages/flutter_tools/lib/src/build_system/tools/shader_compiler.dart index 3916182837ef3..2cf433173f6f0 100644 --- a/packages/flutter_tools/lib/src/build_system/tools/shader_compiler.dart +++ b/packages/flutter_tools/lib/src/build_system/tools/shader_compiler.dart @@ -133,6 +133,9 @@ class ShaderCompiler { case TargetPlatform.web_javascript: return ['--sksl']; + + case TargetPlatform.unsupported: + TargetPlatform.throwUnsupportedTarget(); } } diff --git a/packages/flutter_tools/lib/src/commands/build_bundle.dart b/packages/flutter_tools/lib/src/commands/build_bundle.dart index 4e0decb1c3f20..1286f738d833b 100644 --- a/packages/flutter_tools/lib/src/commands/build_bundle.dart +++ b/packages/flutter_tools/lib/src/commands/build_bundle.dart @@ -135,6 +135,8 @@ class BuildBundleCommand extends BuildSubCommand { case TargetPlatform.tester: case TargetPlatform.web_javascript: break; + case TargetPlatform.unsupported: + TargetPlatform.throwUnsupportedTarget(); } final BuildInfo buildInfo = await getBuildInfo(); diff --git a/packages/flutter_tools/lib/src/custom_devices/custom_device.dart b/packages/flutter_tools/lib/src/custom_devices/custom_device.dart index 130d92c051a9b..7ae88b2f998d8 100644 --- a/packages/flutter_tools/lib/src/custom_devices/custom_device.dart +++ b/packages/flutter_tools/lib/src/custom_devices/custom_device.dart @@ -668,7 +668,7 @@ class CustomDevice extends Device { } @override - bool isSupported() { + Future isSupported() async { return true; } diff --git a/packages/flutter_tools/lib/src/device.dart b/packages/flutter_tools/lib/src/device.dart index 8bf3ebda6cef4..9aab9fc51c77c 100644 --- a/packages/flutter_tools/lib/src/device.dart +++ b/packages/flutter_tools/lib/src/device.dart @@ -325,9 +325,9 @@ class DeviceDiscoverySupportFilter { final bool _excludeDevicesNotSupportedByAll; Future matchesRequirements(Device device) async { - final bool meetsSupportByFlutterRequirement = device.isSupported(); + final bool meetsSupportByFlutterRequirement = await device.isSupported(); final bool meetsSupportForProjectRequirement = - !_excludeDevicesNotSupportedByProject || isDeviceSupportedForProject(device); + !_excludeDevicesNotSupportedByProject || await isDeviceSupportedForProject(device); final bool meetsSupportForAllRequirement = !_excludeDevicesNotSupportedByAll || await isDeviceSupportedForAll(device); @@ -344,11 +344,11 @@ class DeviceDiscoverySupportFilter { /// compilers, and web requires an entirely different resident runner. Future isDeviceSupportedForAll(Device device) async { final TargetPlatform devicePlatform = await device.targetPlatform; - return device.isSupported() && + return await device.isSupported() && devicePlatform != TargetPlatform.fuchsia_arm64 && devicePlatform != TargetPlatform.fuchsia_x64 && devicePlatform != TargetPlatform.web_javascript && - isDeviceSupportedForProject(device); + await isDeviceSupportedForProject(device); } /// Returns whether the device is supported for the project. @@ -358,8 +358,8 @@ class DeviceDiscoverySupportFilter { /// /// This also exists to allow the check to be overridden for google3 clients. If /// [_flutterProject] is null then return true. - bool isDeviceSupportedForProject(Device device) { - if (!device.isSupported()) { + Future isDeviceSupportedForProject(Device device) async { + if (!await device.isSupported()) { return false; } if (_flutterProject == null) { @@ -667,11 +667,11 @@ abstract class Device { Future uninstallApp(ApplicationPackage app, {String? userIdentifier}); /// Check if the device is supported by Flutter. - bool isSupported(); + Future isSupported(); // String meant to be displayed to the user indicating if the device is // supported by Flutter, and, if not, why. - String supportMessage() => isSupported() ? 'Supported' : 'Unsupported'; + Future supportMessage() async => await isSupported() ? 'Supported' : 'Unsupported'; /// The device's platform. Future get targetPlatform; @@ -813,7 +813,7 @@ abstract class Device { // Extract device information final List> table = >[]; for (final Device device in devices) { - String supportIndicator = device.isSupported() ? '' : ' (unsupported)'; + String supportIndicator = await device.isSupported() ? '' : ' (unsupported)'; final TargetPlatform targetPlatform = await device.targetPlatform; if (await device.isLocalEmulator) { final String type = targetPlatform == TargetPlatform.ios ? 'simulator' : 'emulator'; @@ -864,7 +864,7 @@ abstract class Device { return { 'name': name, 'id': id, - 'isSupported': isSupported(), + 'isSupported': await isSupported(), 'targetPlatform': getNameForTargetPlatform(await targetPlatform), 'emulator': isLocalEmu, 'sdk': await sdkNameAndVersion, diff --git a/packages/flutter_tools/lib/src/flutter_application_package.dart b/packages/flutter_tools/lib/src/flutter_application_package.dart index 5c8adf4db438c..75eaeea481e82 100644 --- a/packages/flutter_tools/lib/src/flutter_application_package.dart +++ b/packages/flutter_tools/lib/src/flutter_application_package.dart @@ -101,8 +101,8 @@ class FlutterApplicationPackageFactory extends ApplicationPackageFactory { : WindowsApp.fromPrebuiltApp(applicationBinary); case TargetPlatform.fuchsia_arm64: case TargetPlatform.fuchsia_x64: - // Unsupported yet. - throw UnimplementedError(); + case TargetPlatform.unsupported: + TargetPlatform.throwUnsupportedTarget(); } } } diff --git a/packages/flutter_tools/lib/src/ios/devices.dart b/packages/flutter_tools/lib/src/ios/devices.dart index fb8aeec4b5a72..798fd99fdce7e 100644 --- a/packages/flutter_tools/lib/src/ios/devices.dart +++ b/packages/flutter_tools/lib/src/ios/devices.dart @@ -446,7 +446,7 @@ class IOSDevice extends Device { @override // 32-bit devices are not supported. - bool isSupported() => cpuArchitecture == DarwinArch.arm64; + Future isSupported() async => cpuArchitecture == DarwinArch.arm64; @override Future startApp( diff --git a/packages/flutter_tools/lib/src/ios/simulators.dart b/packages/flutter_tools/lib/src/ios/simulators.dart index 5cdf012ba7d97..5de807f468397 100644 --- a/packages/flutter_tools/lib/src/ios/simulators.dart +++ b/packages/flutter_tools/lib/src/ios/simulators.dart @@ -413,7 +413,7 @@ class IOSSimulator extends Device { } @override - bool isSupported() { + Future isSupported() async { if (!globals.platform.isMacOS) { _supportMessage = 'iOS devices require a Mac host machine.'; return false; @@ -432,8 +432,8 @@ class IOSSimulator extends Device { String? _supportMessage; @override - String supportMessage() { - if (isSupported()) { + Future supportMessage() async { + if (await isSupported()) { return 'Supported'; } diff --git a/packages/flutter_tools/lib/src/isolated/native_assets/native_assets.dart b/packages/flutter_tools/lib/src/isolated/native_assets/native_assets.dart index fad0c7cb99437..0718046fdf1ca 100644 --- a/packages/flutter_tools/lib/src/isolated/native_assets/native_assets.dart +++ b/packages/flutter_tools/lib/src/isolated/native_assets/native_assets.dart @@ -733,6 +733,7 @@ Architecture _getNativeArchitecture(TargetPlatform targetPlatform) { case TargetPlatform.android_arm: case TargetPlatform.android_arm64: case TargetPlatform.android_x64: + case TargetPlatform.unsupported: throw Exception('Unknown targetPlatform: $targetPlatform.'); } } @@ -798,6 +799,8 @@ OS getNativeOSFromTargetPlatform(TargetPlatform platform) { } case TargetPlatform.web_javascript: throw StateError('No dart builds for web yet.'); + case TargetPlatform.unsupported: + TargetPlatform.throwUnsupportedTarget(); } } @@ -825,6 +828,8 @@ List _androidArchs(TargetPlatform targetPlatform, String? androidAr case TargetPlatform.windows_x64: case TargetPlatform.windows_arm64: throwToolExit('Unsupported Android target platform: $targetPlatform.'); + case TargetPlatform.unsupported: + TargetPlatform.throwUnsupportedTarget(); } } diff --git a/packages/flutter_tools/lib/src/linux/linux_device.dart b/packages/flutter_tools/lib/src/linux/linux_device.dart index 5088a143ab20a..a42d783ed092f 100644 --- a/packages/flutter_tools/lib/src/linux/linux_device.dart +++ b/packages/flutter_tools/lib/src/linux/linux_device.dart @@ -40,7 +40,7 @@ class LinuxDevice extends DesktopDevice { final Logger _logger; @override - bool isSupported() => true; + Future isSupported() async => true; @override String get name => 'Linux'; diff --git a/packages/flutter_tools/lib/src/macos/macos_device.dart b/packages/flutter_tools/lib/src/macos/macos_device.dart index 3592db58fc4a3..4b54f08590427 100644 --- a/packages/flutter_tools/lib/src/macos/macos_device.dart +++ b/packages/flutter_tools/lib/src/macos/macos_device.dart @@ -42,7 +42,7 @@ class MacOSDevice extends DesktopDevice { final OperatingSystemUtils _operatingSystemUtils; @override - bool isSupported() => true; + Future isSupported() async => true; @override String get name => 'macOS'; diff --git a/packages/flutter_tools/lib/src/macos/macos_ipad_device.dart b/packages/flutter_tools/lib/src/macos/macos_ipad_device.dart index 6afbd0b729fbe..b134107011f2a 100644 --- a/packages/flutter_tools/lib/src/macos/macos_ipad_device.dart +++ b/packages/flutter_tools/lib/src/macos/macos_ipad_device.dart @@ -47,7 +47,8 @@ class MacOSDesignedForIPadDevice extends DesktopDevice { Future get targetPlatform async => TargetPlatform.darwin; @override - bool isSupported() => _operatingSystemUtils.hostPlatform == HostPlatform.darwin_arm64; + Future isSupported() async => + _operatingSystemUtils.hostPlatform == HostPlatform.darwin_arm64; @override bool get supportsFlavors => true; diff --git a/packages/flutter_tools/lib/src/mdns_discovery.dart b/packages/flutter_tools/lib/src/mdns_discovery.dart index 659c44f89d9fa..8896f7361c9b0 100644 --- a/packages/flutter_tools/lib/src/mdns_discovery.dart +++ b/packages/flutter_tools/lib/src/mdns_discovery.dart @@ -607,6 +607,8 @@ class MDnsVmServiceDiscovery { case TargetPlatform.windows_x64: case TargetPlatform.windows_arm64: _logger.printTrace('No interface with an ipv4 link local address was found.'); + case TargetPlatform.unsupported: + TargetPlatform.throwUnsupportedTarget(); } } diff --git a/packages/flutter_tools/lib/src/proxied_devices/devices.dart b/packages/flutter_tools/lib/src/proxied_devices/devices.dart index 121ad9f331872..3f84d4b515276 100644 --- a/packages/flutter_tools/lib/src/proxied_devices/devices.dart +++ b/packages/flutter_tools/lib/src/proxied_devices/devices.dart @@ -263,7 +263,7 @@ class ProxiedDevice extends Device { throw UnimplementedError(); @override - bool isSupported() => true; + Future isSupported() async => true; final TargetPlatform _targetPlatform; @override diff --git a/packages/flutter_tools/lib/src/resident_runner.dart b/packages/flutter_tools/lib/src/resident_runner.dart index 0f996a3ab0575..8badf32a5f069 100644 --- a/packages/flutter_tools/lib/src/resident_runner.dart +++ b/packages/flutter_tools/lib/src/resident_runner.dart @@ -1558,6 +1558,8 @@ Future getMissingPackageHintForPlatform(TargetPlatform platform) async case TargetPlatform.windows_x64: case TargetPlatform.windows_arm64: return null; + case TargetPlatform.unsupported: + TargetPlatform.throwUnsupportedTarget(); } } diff --git a/packages/flutter_tools/lib/src/runner/flutter_command.dart b/packages/flutter_tools/lib/src/runner/flutter_command.dart index 83db45bbd81ba..fad798f37333d 100644 --- a/packages/flutter_tools/lib/src/runner/flutter_command.dart +++ b/packages/flutter_tools/lib/src/runner/flutter_command.dart @@ -2082,6 +2082,7 @@ DevelopmentArtifact? artifactFromTargetPlatform(TargetPlatform targetPlatform) { case TargetPlatform.fuchsia_arm64: case TargetPlatform.fuchsia_x64: case TargetPlatform.tester: + case TargetPlatform.unsupported: return null; } } diff --git a/packages/flutter_tools/lib/src/tester/flutter_tester.dart b/packages/flutter_tools/lib/src/tester/flutter_tester.dart index fc091816fecdb..8d112d52a63b3 100644 --- a/packages/flutter_tools/lib/src/tester/flutter_tester.dart +++ b/packages/flutter_tools/lib/src/tester/flutter_tester.dart @@ -116,7 +116,7 @@ class FlutterTesterDevice extends Device { Future isLatestBuildInstalled(ApplicationPackage app) async => false; @override - bool isSupported() => true; + Future isSupported() async => true; @override Future startApp( diff --git a/packages/flutter_tools/lib/src/web/web_device.dart b/packages/flutter_tools/lib/src/web/web_device.dart index 7edc3f6748b80..f66cb1ffb9f98 100644 --- a/packages/flutter_tools/lib/src/web/web_device.dart +++ b/packages/flutter_tools/lib/src/web/web_device.dart @@ -97,7 +97,7 @@ abstract class ChromiumDevice extends Device { Future get emulatorId async => null; @override - bool isSupported() => chromeLauncher.canFindExecutable(); + Future isSupported() async => chromeLauncher.canFindExecutable(); @override DevicePortForwarder? get portForwarder => const NoOpDevicePortForwarder(); @@ -191,7 +191,7 @@ class GoogleChromeDevice extends ChromiumDevice { late final Future sdkNameAndVersion = _computeSdkNameAndVersion(); Future _computeSdkNameAndVersion() async { - if (!isSupported()) { + if (!await isSupported()) { return 'unknown'; } // See https://bugs.chromium.org/p/chromium/issues/detail?id=158372 @@ -340,7 +340,7 @@ class WebDevices extends PollingDeviceDiscovery { final MicrosoftEdgeDevice? edgeDevice = _edgeDevice; return [ if (WebServerDevice.showWebServerDevice) _webServerDevice, - if (_chromeDevice.isSupported()) _chromeDevice, + if (await _chromeDevice.isSupported()) _chromeDevice, if (edgeDevice != null && await edgeDevice._meetsVersionConstraint()) edgeDevice, ]; } @@ -400,7 +400,7 @@ class WebServerDevice extends Device { Future get isLocalEmulator async => false; @override - bool isSupported() => true; + Future isSupported() async => true; @override bool isSupportedForProject(FlutterProject flutterProject) { diff --git a/packages/flutter_tools/lib/src/windows/windows_device.dart b/packages/flutter_tools/lib/src/windows/windows_device.dart index ef6d3ef1fb403..73107fcc9ec18 100644 --- a/packages/flutter_tools/lib/src/windows/windows_device.dart +++ b/packages/flutter_tools/lib/src/windows/windows_device.dart @@ -38,7 +38,7 @@ class WindowsDevice extends DesktopDevice { final OperatingSystemUtils _operatingSystemUtils; @override - bool isSupported() => true; + Future isSupported() async => true; @override String get name => 'Windows'; diff --git a/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart index 12e7fb52e677d..568f9406ac7c0 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart @@ -1854,7 +1854,7 @@ class FakeAndroidDevice extends Fake implements AndroidDevice { DeviceConnectionInterface get connectionInterface => DeviceConnectionInterface.attached; @override - bool isSupported() => true; + Future isSupported() async => true; @override bool get isConnected => true; @@ -1963,7 +1963,7 @@ class FakeIOSDevice extends Fake implements IOSDevice { final PlatformType platformType = PlatformType.ios; @override - bool isSupported() => true; + Future isSupported() async => true; @override bool isSupportedForProject(FlutterProject project) => true; @@ -2022,7 +2022,7 @@ class FakeIOSSimulator extends Fake implements IOSSimulator { String get displayName => name; @override - bool isSupported() => true; + Future isSupported() async => true; @override bool isSupportedForProject(FlutterProject flutterProject) => true; diff --git a/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart index 6f88794342453..1b27667ebe48b 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart @@ -1482,7 +1482,7 @@ class FakeDevice extends Fake implements Device { Category get category => Category.mobile; @override - bool isSupported() => true; + Future isSupported() async => true; @override Future get isLocalEmulator async => false; diff --git a/packages/flutter_tools/test/commands.shard/hermetic/run_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/run_test.dart index a024acf085043..ef7757ad42c7e 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/run_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/run_test.dart @@ -1475,7 +1475,7 @@ class FakeDevice extends Fake implements Device { bool isSupportedForProject(FlutterProject flutterProject) => _isSupported; @override - bool isSupported() => supported; + Future isSupported() async => supported; @override Future get sdkNameAndVersion => Future.value(_sdkNameAndVersion); diff --git a/packages/flutter_tools/test/commands.shard/hermetic/screenshot_command_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/screenshot_command_test.dart index a5a072eeb94ad..9ab2ab7d24fec 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/screenshot_command_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/screenshot_command_test.dart @@ -225,7 +225,7 @@ class _ScreenshotDevice extends Fake implements Device { bool get isConnected => true; @override - bool isSupported() => true; + Future isSupported() async => true; @override bool ephemeral = true; diff --git a/packages/flutter_tools/test/general.shard/android/android_device_start_test.dart b/packages/flutter_tools/test/general.shard/android/android_device_start_test.dart index 104f04f7dd5aa..05eb15c1471d4 100644 --- a/packages/flutter_tools/test/general.shard/android/android_device_start_test.dart +++ b/packages/flutter_tools/test/general.shard/android/android_device_start_test.dart @@ -150,7 +150,10 @@ void main() { processManager.addCommand(kAdbVersionCommand); processManager.addCommand(kStartServer); processManager.addCommand( - const FakeCommand(command: ['adb', '-s', '1234', 'shell', 'getprop']), + const FakeCommand( + command: ['adb', '-s', '1234', 'shell', 'getprop'], + stdout: '[ro.product.cpu.abi]: [x86_64]', + ), ); processManager.addCommand( const FakeCommand( diff --git a/packages/flutter_tools/test/general.shard/android/android_device_test.dart b/packages/flutter_tools/test/general.shard/android/android_device_test.dart index a9bc4c3cb2834..7e2045a0c88da 100644 --- a/packages/flutter_tools/test/general.shard/android/android_device_test.dart +++ b/packages/flutter_tools/test/general.shard/android/android_device_test.dart @@ -78,8 +78,7 @@ void main() { // The format is [ABI, ABI list]: expected target platform. final Map, TargetPlatform> values = , TargetPlatform>{ ['x86_64', 'unknown']: TargetPlatform.android_x64, - // The default ABI is arm32 - ['???', 'unknown']: TargetPlatform.android_arm, + ['armeabi-v7a', 'unknown']: TargetPlatform.android_arm, ['arm64-v8a', 'arm64-v8a,']: TargetPlatform.android_arm64, // The Kindle Fire runs 32 bit apps on 64 bit hardware. ['arm64-v8a', 'arm']: TargetPlatform.android_arm, @@ -106,8 +105,7 @@ void main() { // The format is [ABI, ABI list]: expected release mode support. final Map, bool> values = , bool>{ ['x86_64', 'unknown']: true, - // The default ABI is arm32 - ['???', 'unknown']: true, + ['armeabi-v7a', 'unknown']: true, ['arm64-v8a', 'arm64-v8a,']: true, // The Kindle Fire runs 32 bit apps on 64 bit hardware. ['arm64-v8a', 'arm']: true, @@ -180,6 +178,17 @@ void main() { expect(await device.isLocalEmulator, true); }); + testWithoutContext('isSupported is false for x86 devices', () async { + final FakeProcessManager processManager = FakeProcessManager.list([ + const FakeCommand( + command: ['adb', '-s', '1234', 'shell', 'getprop'], + stdout: '[ro.product.cpu.abi]: [x86]', + ), + ]); + final AndroidDevice device = setUpAndroidDevice(processManager: processManager); + expect(await device.isSupported(), false); + }); + testWithoutContext('isSupportedForProject is true on module project', () async { final FileSystem fileSystem = MemoryFileSystem.test(); fileSystem.file('pubspec.yaml') diff --git a/packages/flutter_tools/test/general.shard/cold_test.dart b/packages/flutter_tools/test/general.shard/cold_test.dart index 24e5c8cb866f4..d73fb4f9f9a89 100644 --- a/packages/flutter_tools/test/general.shard/cold_test.dart +++ b/packages/flutter_tools/test/general.shard/cold_test.dart @@ -195,7 +195,7 @@ class FakeFlutterDevice extends Fake implements FlutterDevice { class FakeDevice extends Fake implements Device { @override - bool isSupported() => true; + Future isSupported() async => true; @override bool supportsHotReload = false; diff --git a/packages/flutter_tools/test/general.shard/desktop_device_test.dart b/packages/flutter_tools/test/general.shard/desktop_device_test.dart index c637b70adb964..f9b2cc9d585ff 100644 --- a/packages/flutter_tools/test/general.shard/desktop_device_test.dart +++ b/packages/flutter_tools/test/general.shard/desktop_device_test.dart @@ -446,7 +446,7 @@ class FakeDesktopDevice extends DesktopDevice { Future get targetPlatform async => TargetPlatform.tester; @override - bool isSupported() => true; + Future isSupported() async => true; @override bool isSupportedForProject(FlutterProject flutterProject) => true; @@ -493,7 +493,7 @@ class FakeMacOSDevice extends MacOSDevice { Future get targetPlatform async => TargetPlatform.tester; @override - bool isSupported() => true; + Future isSupported() async => true; @override bool isSupportedForProject(FlutterProject flutterProject) => true; diff --git a/packages/flutter_tools/test/general.shard/device_test.dart b/packages/flutter_tools/test/general.shard/device_test.dart index eb8cce1c1a205..e2f467cf27177 100644 --- a/packages/flutter_tools/test/general.shard/device_test.dart +++ b/packages/flutter_tools/test/general.shard/device_test.dart @@ -1072,7 +1072,7 @@ class TestDeviceDiscoverySupportFilter extends DeviceDiscoverySupportFilter { bool? isAlwaysSupportedForProjectOverride; @override - bool isDeviceSupportedForProject(Device device) { + Future isDeviceSupportedForProject(Device device) async { return isAlwaysSupportedForProjectOverride ?? super.isDeviceSupportedForProject(device); } } diff --git a/packages/flutter_tools/test/general.shard/hot_shared.dart b/packages/flutter_tools/test/general.shard/hot_shared.dart index 55856027ac46b..565bd7e0191c9 100644 --- a/packages/flutter_tools/test/general.shard/hot_shared.dart +++ b/packages/flutter_tools/test/general.shard/hot_shared.dart @@ -53,7 +53,7 @@ class FakeDevice extends Fake implements Device { final DartDevelopmentService dds = FakeDartDevelopmentService(); @override - bool isSupported() => true; + Future isSupported() async => true; @override bool supportsHotReload = true; diff --git a/packages/flutter_tools/test/general.shard/ios/devices_test.dart b/packages/flutter_tools/test/general.shard/ios/devices_test.dart index ef6d30d791d98..ca5ec8968e171 100644 --- a/packages/flutter_tools/test/general.shard/ios/devices_test.dart +++ b/packages/flutter_tools/test/general.shard/ios/devices_test.dart @@ -69,7 +69,7 @@ void main() { xcodeDebug = FakeXcodeDebug(); }); - testWithoutContext('successfully instantiates on Mac OS', () { + testWithoutContext('successfully instantiates on Mac OS', () async { final IOSDevice device = IOSDevice( 'device-123', iProxy: IProxy.test(logger: logger, processManager: FakeProcessManager.any()), @@ -89,10 +89,10 @@ void main() { devModeEnabled: true, isCoreDevice: false, ); - expect(device.isSupported(), isTrue); + expect(await device.isSupported(), isTrue); }); - testWithoutContext('32-bit devices are unsupported', () { + testWithoutContext('32-bit devices are unsupported', () async { final IOSDevice device = IOSDevice( 'device-123', iProxy: IProxy.test(logger: logger, processManager: FakeProcessManager.any()), @@ -111,7 +111,7 @@ void main() { devModeEnabled: true, isCoreDevice: false, ); - expect(device.isSupported(), isFalse); + expect(await device.isSupported(), isFalse); }); testWithoutContext('parses major version', () { diff --git a/packages/flutter_tools/test/general.shard/ios/simulators_test.dart b/packages/flutter_tools/test/general.shard/ios/simulators_test.dart index 0afeec4eaf039..e6321b0cbf766 100644 --- a/packages/flutter_tools/test/general.shard/ios/simulators_test.dart +++ b/packages/flutter_tools/test/general.shard/ios/simulators_test.dart @@ -212,7 +212,7 @@ void main() { testUsingContext( 'Apple TV is unsupported', - () { + () async { final IOSSimulator simulator = IOSSimulator( 'x', name: 'Apple TV', @@ -220,7 +220,7 @@ void main() { simulatorCategory: 'com.apple.CoreSimulator.SimRuntime.tvOS-14-5', logger: logger, ); - expect(simulator.isSupported(), false); + expect(await simulator.isSupported(), false); }, overrides: { Platform: () => osx, @@ -231,9 +231,9 @@ void main() { testUsingContext( 'Apple Watch is unsupported', - () { + () async { expect( - IOSSimulator( + await IOSSimulator( 'x', name: 'Apple Watch', simControl: simControl, @@ -252,9 +252,9 @@ void main() { testUsingContext( 'iPad 2 is supported', - () { + () async { expect( - IOSSimulator( + await IOSSimulator( 'x', name: 'iPad 2', simControl: simControl, @@ -273,9 +273,9 @@ void main() { testUsingContext( 'iPad Retina is supported', - () { + () async { expect( - IOSSimulator( + await IOSSimulator( 'x', name: 'iPad Retina', simControl: simControl, @@ -294,9 +294,9 @@ void main() { testUsingContext( 'iPhone 5 is supported', - () { + () async { expect( - IOSSimulator( + await IOSSimulator( 'x', name: 'iPhone 5', simControl: simControl, @@ -315,9 +315,9 @@ void main() { testUsingContext( 'iPhone 5s is supported', - () { + () async { expect( - IOSSimulator( + await IOSSimulator( 'x', name: 'iPhone 5s', simControl: simControl, @@ -336,9 +336,9 @@ void main() { testUsingContext( 'iPhone SE is supported', - () { + () async { expect( - IOSSimulator( + await IOSSimulator( 'x', name: 'iPhone SE', simControl: simControl, @@ -357,9 +357,9 @@ void main() { testUsingContext( 'iPhone 7 Plus is supported', - () { + () async { expect( - IOSSimulator( + await IOSSimulator( 'x', name: 'iPhone 7 Plus', simControl: simControl, @@ -378,9 +378,9 @@ void main() { testUsingContext( 'iPhone X is supported', - () { + () async { expect( - IOSSimulator( + await IOSSimulator( 'x', name: 'iPhone X', simControl: simControl, diff --git a/packages/flutter_tools/test/general.shard/macos/macos_ipad_device_test.dart b/packages/flutter_tools/test/general.shard/macos/macos_ipad_device_test.dart index 3f547ff37fbf0..218929456ab82 100644 --- a/packages/flutter_tools/test/general.shard/macos/macos_ipad_device_test.dart +++ b/packages/flutter_tools/test/general.shard/macos/macos_ipad_device_test.dart @@ -129,7 +129,7 @@ void main() { expect(await device.isLatestBuildInstalled(FakeApplicationPackage()), isTrue); expect(await device.uninstallApp(FakeApplicationPackage()), isTrue); - expect(device.isSupported(), isTrue); + expect(await device.isSupported(), isTrue); expect(device.getLogReader(), isA()); expect(await device.stopApp(FakeIOSApp()), isFalse); diff --git a/packages/flutter_tools/test/general.shard/mdns_discovery_test.dart b/packages/flutter_tools/test/general.shard/mdns_discovery_test.dart index 42b4995e4f909..bac303ca95847 100644 --- a/packages/flutter_tools/test/general.shard/mdns_discovery_test.dart +++ b/packages/flutter_tools/test/general.shard/mdns_discovery_test.dart @@ -1285,7 +1285,7 @@ class FakeIOSDevice extends Fake implements IOSDevice { Future get targetPlatform async => TargetPlatform.ios; @override - bool isSupported() => true; + Future isSupported() async => true; @override bool isSupportedForProject(FlutterProject flutterProject) => true; diff --git a/packages/flutter_tools/test/general.shard/runner/target_devices_test.dart b/packages/flutter_tools/test/general.shard/runner/target_devices_test.dart index 66de89b75684d..1e7cd2c0a552c 100644 --- a/packages/flutter_tools/test/general.shard/runner/target_devices_test.dart +++ b/packages/flutter_tools/test/general.shard/runner/target_devices_test.dart @@ -3205,7 +3205,7 @@ class FakeDevice extends Fake implements Device { String id; @override - bool isSupported() => _isSupported; + Future isSupported() async => _isSupported; @override bool isSupportedForProject(FlutterProject project) => _isSupportedForProject; @@ -3316,7 +3316,7 @@ class FakeIOSDevice extends Fake implements IOSDevice { String id; @override - bool isSupported() => _isSupported; + Future isSupported() async => _isSupported; @override bool isSupportedForProject(FlutterProject project) => _isSupportedForProject; diff --git a/packages/flutter_tools/test/general.shard/terminal_handler_test.dart b/packages/flutter_tools/test/general.shard/terminal_handler_test.dart index 8a1868a924b34..d35703deb8c7b 100644 --- a/packages/flutter_tools/test/general.shard/terminal_handler_test.dart +++ b/packages/flutter_tools/test/general.shard/terminal_handler_test.dart @@ -1298,7 +1298,7 @@ class FakeResidentDevtoolsHandler extends Fake implements ResidentDevtoolsHandle class FakeDevice extends Fake implements Device { @override - bool isSupported() => true; + Future isSupported() async => true; @override bool supportsScreenshot = false; diff --git a/packages/flutter_tools/test/general.shard/tester/flutter_tester_test.dart b/packages/flutter_tools/test/general.shard/tester/flutter_tester_test.dart index 25c9f70ba3f24..2e62dcd7e7a8f 100644 --- a/packages/flutter_tools/test/general.shard/tester/flutter_tester_test.dart +++ b/packages/flutter_tools/test/general.shard/tester/flutter_tester_test.dart @@ -118,7 +118,7 @@ void main() { expect(await device.isLatestBuildInstalled(FakeApplicationPackage()), isFalse); expect(await device.uninstallApp(FakeApplicationPackage()), isTrue); - expect(device.isSupported(), isTrue); + expect(await device.isSupported(), isTrue); }); testWithoutContext('does not accept profile, release, or jit-release builds', () async { diff --git a/packages/flutter_tools/test/general.shard/web/devices_test.dart b/packages/flutter_tools/test/general.shard/web/devices_test.dart index 775c20e209401..109f52d1032af 100644 --- a/packages/flutter_tools/test/general.shard/web/devices_test.dart +++ b/packages/flutter_tools/test/general.shard/web/devices_test.dart @@ -246,7 +246,7 @@ void main() { final GoogleChromeDevice chromeDevice = (await webDevices.pollingGetDevices()).whereType().first; - expect(chromeDevice.isSupported(), true); + expect(await chromeDevice.isSupported(), true); expect(await chromeDevice.sdkNameAndVersion, 'ABC'); // Verify caching works correctly. @@ -288,7 +288,7 @@ void main() { final GoogleChromeDevice chromeDevice = (await webDevices.pollingGetDevices()).whereType().first; - expect(chromeDevice.isSupported(), true); + expect(await chromeDevice.isSupported(), true); expect(await chromeDevice.sdkNameAndVersion, 'Google Chrome 74.0.0'); // Verify caching works correctly. @@ -319,7 +319,7 @@ void main() { processManager: processManager, ); - expect(edgeDevice.isSupported(), true); + expect(await edgeDevice.isSupported(), true); expect(await edgeDevice.sdkNameAndVersion, ''); final GoogleChromeDevice chromeDevice = GoogleChromeDevice( @@ -330,7 +330,7 @@ void main() { platform: platform, ); - expect(chromeDevice.isSupported(), true); + expect(await chromeDevice.isSupported(), true); expect(await chromeDevice.sdkNameAndVersion, 'unknown'); }); diff --git a/packages/flutter_tools/test/src/fake_devices.dart b/packages/flutter_tools/test/src/fake_devices.dart index 65cfa78c25fd2..2b08abef1dafe 100644 --- a/packages/flutter_tools/test/src/fake_devices.dart +++ b/packages/flutter_tools/test/src/fake_devices.dart @@ -180,7 +180,7 @@ class FakeDevice extends Device { bool isSupportedForProject(FlutterProject flutterProject) => _isSupportedForProject; @override - bool isSupported() => _isSupported; + Future isSupported() async => _isSupported; @override bool get supportsFlavors => _supportsFlavors; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy