mirror of
https://github.com/flutter/flutter.git
synced 2026-02-05 19:28:51 +08:00
[ Tool ] Report Android x86 target devices as unsupported (#170282)
This commit is contained in:
parent
1ec94f9572
commit
b6ea64bee4
@ -193,7 +193,8 @@ class AndroidDevice extends Device {
|
||||
@override
|
||||
late final Future<TargetPlatform> 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<bool> 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;
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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',
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -133,6 +133,9 @@ class ShaderCompiler {
|
||||
|
||||
case TargetPlatform.web_javascript:
|
||||
return <String>['--sksl'];
|
||||
|
||||
case TargetPlatform.unsupported:
|
||||
TargetPlatform.throwUnsupportedTarget();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -668,7 +668,7 @@ class CustomDevice extends Device {
|
||||
}
|
||||
|
||||
@override
|
||||
bool isSupported() {
|
||||
Future<bool> isSupported() async {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -325,9 +325,9 @@ class DeviceDiscoverySupportFilter {
|
||||
final bool _excludeDevicesNotSupportedByAll;
|
||||
|
||||
Future<bool> 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<bool> 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<bool> isDeviceSupportedForProject(Device device) async {
|
||||
if (!await device.isSupported()) {
|
||||
return false;
|
||||
}
|
||||
if (_flutterProject == null) {
|
||||
@ -667,11 +667,11 @@ abstract class Device {
|
||||
Future<bool> uninstallApp(ApplicationPackage app, {String? userIdentifier});
|
||||
|
||||
/// Check if the device is supported by Flutter.
|
||||
bool isSupported();
|
||||
Future<bool> 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<String> supportMessage() async => await isSupported() ? 'Supported' : 'Unsupported';
|
||||
|
||||
/// The device's platform.
|
||||
Future<TargetPlatform> get targetPlatform;
|
||||
@ -813,7 +813,7 @@ abstract class Device {
|
||||
// Extract device information
|
||||
final List<List<String>> table = <List<String>>[];
|
||||
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 <String, Object>{
|
||||
'name': name,
|
||||
'id': id,
|
||||
'isSupported': isSupported(),
|
||||
'isSupported': await isSupported(),
|
||||
'targetPlatform': getNameForTargetPlatform(await targetPlatform),
|
||||
'emulator': isLocalEmu,
|
||||
'sdk': await sdkNameAndVersion,
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -446,7 +446,7 @@ class IOSDevice extends Device {
|
||||
|
||||
@override
|
||||
// 32-bit devices are not supported.
|
||||
bool isSupported() => cpuArchitecture == DarwinArch.arm64;
|
||||
Future<bool> isSupported() async => cpuArchitecture == DarwinArch.arm64;
|
||||
|
||||
@override
|
||||
Future<LaunchResult> startApp(
|
||||
|
||||
@ -413,7 +413,7 @@ class IOSSimulator extends Device {
|
||||
}
|
||||
|
||||
@override
|
||||
bool isSupported() {
|
||||
Future<bool> 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<String> supportMessage() async {
|
||||
if (await isSupported()) {
|
||||
return 'Supported';
|
||||
}
|
||||
|
||||
|
||||
@ -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<AndroidArch> _androidArchs(TargetPlatform targetPlatform, String? androidAr
|
||||
case TargetPlatform.windows_x64:
|
||||
case TargetPlatform.windows_arm64:
|
||||
throwToolExit('Unsupported Android target platform: $targetPlatform.');
|
||||
case TargetPlatform.unsupported:
|
||||
TargetPlatform.throwUnsupportedTarget();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ class LinuxDevice extends DesktopDevice {
|
||||
final Logger _logger;
|
||||
|
||||
@override
|
||||
bool isSupported() => true;
|
||||
Future<bool> isSupported() async => true;
|
||||
|
||||
@override
|
||||
String get name => 'Linux';
|
||||
|
||||
@ -42,7 +42,7 @@ class MacOSDevice extends DesktopDevice {
|
||||
final OperatingSystemUtils _operatingSystemUtils;
|
||||
|
||||
@override
|
||||
bool isSupported() => true;
|
||||
Future<bool> isSupported() async => true;
|
||||
|
||||
@override
|
||||
String get name => 'macOS';
|
||||
|
||||
@ -47,7 +47,8 @@ class MacOSDesignedForIPadDevice extends DesktopDevice {
|
||||
Future<TargetPlatform> get targetPlatform async => TargetPlatform.darwin;
|
||||
|
||||
@override
|
||||
bool isSupported() => _operatingSystemUtils.hostPlatform == HostPlatform.darwin_arm64;
|
||||
Future<bool> isSupported() async =>
|
||||
_operatingSystemUtils.hostPlatform == HostPlatform.darwin_arm64;
|
||||
|
||||
@override
|
||||
bool get supportsFlavors => true;
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -263,7 +263,7 @@ class ProxiedDevice extends Device {
|
||||
throw UnimplementedError();
|
||||
|
||||
@override
|
||||
bool isSupported() => true;
|
||||
Future<bool> isSupported() async => true;
|
||||
|
||||
final TargetPlatform _targetPlatform;
|
||||
@override
|
||||
|
||||
@ -1558,6 +1558,8 @@ Future<String?> getMissingPackageHintForPlatform(TargetPlatform platform) async
|
||||
case TargetPlatform.windows_x64:
|
||||
case TargetPlatform.windows_arm64:
|
||||
return null;
|
||||
case TargetPlatform.unsupported:
|
||||
TargetPlatform.throwUnsupportedTarget();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2082,6 +2082,7 @@ DevelopmentArtifact? artifactFromTargetPlatform(TargetPlatform targetPlatform) {
|
||||
case TargetPlatform.fuchsia_arm64:
|
||||
case TargetPlatform.fuchsia_x64:
|
||||
case TargetPlatform.tester:
|
||||
case TargetPlatform.unsupported:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ class FlutterTesterDevice extends Device {
|
||||
Future<bool> isLatestBuildInstalled(ApplicationPackage app) async => false;
|
||||
|
||||
@override
|
||||
bool isSupported() => true;
|
||||
Future<bool> isSupported() async => true;
|
||||
|
||||
@override
|
||||
Future<LaunchResult> startApp(
|
||||
|
||||
@ -97,7 +97,7 @@ abstract class ChromiumDevice extends Device {
|
||||
Future<String?> get emulatorId async => null;
|
||||
|
||||
@override
|
||||
bool isSupported() => chromeLauncher.canFindExecutable();
|
||||
Future<bool> isSupported() async => chromeLauncher.canFindExecutable();
|
||||
|
||||
@override
|
||||
DevicePortForwarder? get portForwarder => const NoOpDevicePortForwarder();
|
||||
@ -191,7 +191,7 @@ class GoogleChromeDevice extends ChromiumDevice {
|
||||
late final Future<String> sdkNameAndVersion = _computeSdkNameAndVersion();
|
||||
|
||||
Future<String> _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 <Device>[
|
||||
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<bool> get isLocalEmulator async => false;
|
||||
|
||||
@override
|
||||
bool isSupported() => true;
|
||||
Future<bool> isSupported() async => true;
|
||||
|
||||
@override
|
||||
bool isSupportedForProject(FlutterProject flutterProject) {
|
||||
|
||||
@ -38,7 +38,7 @@ class WindowsDevice extends DesktopDevice {
|
||||
final OperatingSystemUtils _operatingSystemUtils;
|
||||
|
||||
@override
|
||||
bool isSupported() => true;
|
||||
Future<bool> isSupported() async => true;
|
||||
|
||||
@override
|
||||
String get name => 'Windows';
|
||||
|
||||
@ -1854,7 +1854,7 @@ class FakeAndroidDevice extends Fake implements AndroidDevice {
|
||||
DeviceConnectionInterface get connectionInterface => DeviceConnectionInterface.attached;
|
||||
|
||||
@override
|
||||
bool isSupported() => true;
|
||||
Future<bool> 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<bool> 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<bool> isSupported() async => true;
|
||||
|
||||
@override
|
||||
bool isSupportedForProject(FlutterProject flutterProject) => true;
|
||||
|
||||
@ -1482,7 +1482,7 @@ class FakeDevice extends Fake implements Device {
|
||||
Category get category => Category.mobile;
|
||||
|
||||
@override
|
||||
bool isSupported() => true;
|
||||
Future<bool> isSupported() async => true;
|
||||
|
||||
@override
|
||||
Future<bool> get isLocalEmulator async => false;
|
||||
|
||||
@ -1475,7 +1475,7 @@ class FakeDevice extends Fake implements Device {
|
||||
bool isSupportedForProject(FlutterProject flutterProject) => _isSupported;
|
||||
|
||||
@override
|
||||
bool isSupported() => supported;
|
||||
Future<bool> isSupported() async => supported;
|
||||
|
||||
@override
|
||||
Future<String> get sdkNameAndVersion => Future<String>.value(_sdkNameAndVersion);
|
||||
|
||||
@ -225,7 +225,7 @@ class _ScreenshotDevice extends Fake implements Device {
|
||||
bool get isConnected => true;
|
||||
|
||||
@override
|
||||
bool isSupported() => true;
|
||||
Future<bool> isSupported() async => true;
|
||||
|
||||
@override
|
||||
bool ephemeral = true;
|
||||
|
||||
@ -150,7 +150,10 @@ void main() {
|
||||
processManager.addCommand(kAdbVersionCommand);
|
||||
processManager.addCommand(kStartServer);
|
||||
processManager.addCommand(
|
||||
const FakeCommand(command: <String>['adb', '-s', '1234', 'shell', 'getprop']),
|
||||
const FakeCommand(
|
||||
command: <String>['adb', '-s', '1234', 'shell', 'getprop'],
|
||||
stdout: '[ro.product.cpu.abi]: [x86_64]',
|
||||
),
|
||||
);
|
||||
processManager.addCommand(
|
||||
const FakeCommand(
|
||||
|
||||
@ -78,8 +78,7 @@ void main() {
|
||||
// The format is [ABI, ABI list]: expected target platform.
|
||||
final Map<List<String>, TargetPlatform> values = <List<String>, TargetPlatform>{
|
||||
<String>['x86_64', 'unknown']: TargetPlatform.android_x64,
|
||||
// The default ABI is arm32
|
||||
<String>['???', 'unknown']: TargetPlatform.android_arm,
|
||||
<String>['armeabi-v7a', 'unknown']: TargetPlatform.android_arm,
|
||||
<String>['arm64-v8a', 'arm64-v8a,']: TargetPlatform.android_arm64,
|
||||
// The Kindle Fire runs 32 bit apps on 64 bit hardware.
|
||||
<String>['arm64-v8a', 'arm']: TargetPlatform.android_arm,
|
||||
@ -106,8 +105,7 @@ void main() {
|
||||
// The format is [ABI, ABI list]: expected release mode support.
|
||||
final Map<List<String>, bool> values = <List<String>, bool>{
|
||||
<String>['x86_64', 'unknown']: true,
|
||||
// The default ABI is arm32
|
||||
<String>['???', 'unknown']: true,
|
||||
<String>['armeabi-v7a', 'unknown']: true,
|
||||
<String>['arm64-v8a', 'arm64-v8a,']: true,
|
||||
// The Kindle Fire runs 32 bit apps on 64 bit hardware.
|
||||
<String>['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(<FakeCommand>[
|
||||
const FakeCommand(
|
||||
command: <String>['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')
|
||||
|
||||
@ -195,7 +195,7 @@ class FakeFlutterDevice extends Fake implements FlutterDevice {
|
||||
|
||||
class FakeDevice extends Fake implements Device {
|
||||
@override
|
||||
bool isSupported() => true;
|
||||
Future<bool> isSupported() async => true;
|
||||
|
||||
@override
|
||||
bool supportsHotReload = false;
|
||||
|
||||
@ -446,7 +446,7 @@ class FakeDesktopDevice extends DesktopDevice {
|
||||
Future<TargetPlatform> get targetPlatform async => TargetPlatform.tester;
|
||||
|
||||
@override
|
||||
bool isSupported() => true;
|
||||
Future<bool> isSupported() async => true;
|
||||
|
||||
@override
|
||||
bool isSupportedForProject(FlutterProject flutterProject) => true;
|
||||
@ -493,7 +493,7 @@ class FakeMacOSDevice extends MacOSDevice {
|
||||
Future<TargetPlatform> get targetPlatform async => TargetPlatform.tester;
|
||||
|
||||
@override
|
||||
bool isSupported() => true;
|
||||
Future<bool> isSupported() async => true;
|
||||
|
||||
@override
|
||||
bool isSupportedForProject(FlutterProject flutterProject) => true;
|
||||
|
||||
@ -1072,7 +1072,7 @@ class TestDeviceDiscoverySupportFilter extends DeviceDiscoverySupportFilter {
|
||||
bool? isAlwaysSupportedForProjectOverride;
|
||||
|
||||
@override
|
||||
bool isDeviceSupportedForProject(Device device) {
|
||||
Future<bool> isDeviceSupportedForProject(Device device) async {
|
||||
return isAlwaysSupportedForProjectOverride ?? super.isDeviceSupportedForProject(device);
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ class FakeDevice extends Fake implements Device {
|
||||
final DartDevelopmentService dds = FakeDartDevelopmentService();
|
||||
|
||||
@override
|
||||
bool isSupported() => true;
|
||||
Future<bool> isSupported() async => true;
|
||||
|
||||
@override
|
||||
bool supportsHotReload = true;
|
||||
|
||||
@ -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', () {
|
||||
|
||||
@ -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: <Type, Generator>{
|
||||
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,
|
||||
|
||||
@ -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<DesktopLogReader>());
|
||||
|
||||
expect(await device.stopApp(FakeIOSApp()), isFalse);
|
||||
|
||||
@ -1285,7 +1285,7 @@ class FakeIOSDevice extends Fake implements IOSDevice {
|
||||
Future<TargetPlatform> get targetPlatform async => TargetPlatform.ios;
|
||||
|
||||
@override
|
||||
bool isSupported() => true;
|
||||
Future<bool> isSupported() async => true;
|
||||
|
||||
@override
|
||||
bool isSupportedForProject(FlutterProject flutterProject) => true;
|
||||
|
||||
@ -3205,7 +3205,7 @@ class FakeDevice extends Fake implements Device {
|
||||
String id;
|
||||
|
||||
@override
|
||||
bool isSupported() => _isSupported;
|
||||
Future<bool> 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<bool> isSupported() async => _isSupported;
|
||||
|
||||
@override
|
||||
bool isSupportedForProject(FlutterProject project) => _isSupportedForProject;
|
||||
|
||||
@ -1298,7 +1298,7 @@ class FakeResidentDevtoolsHandler extends Fake implements ResidentDevtoolsHandle
|
||||
|
||||
class FakeDevice extends Fake implements Device {
|
||||
@override
|
||||
bool isSupported() => true;
|
||||
Future<bool> isSupported() async => true;
|
||||
|
||||
@override
|
||||
bool supportsScreenshot = false;
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -246,7 +246,7 @@ void main() {
|
||||
final GoogleChromeDevice chromeDevice =
|
||||
(await webDevices.pollingGetDevices()).whereType<GoogleChromeDevice>().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<GoogleChromeDevice>().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');
|
||||
});
|
||||
|
||||
|
||||
@ -180,7 +180,7 @@ class FakeDevice extends Device {
|
||||
bool isSupportedForProject(FlutterProject flutterProject) => _isSupportedForProject;
|
||||
|
||||
@override
|
||||
bool isSupported() => _isSupported;
|
||||
Future<bool> isSupported() async => _isSupported;
|
||||
|
||||
@override
|
||||
bool get supportsFlavors => _supportsFlavors;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user