From 888208c1f4e0d779e8863997a12725e5ef32e0c0 Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Tue, 12 Apr 2022 14:39:07 -0700 Subject: [PATCH] Disallow `flutter run`-ing on 32-bit development devices (#97339) --- .../flutter_tools/lib/src/ios/devices.dart | 3 ++- .../test/general.shard/ios/devices_test.dart | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/packages/flutter_tools/lib/src/ios/devices.dart b/packages/flutter_tools/lib/src/ios/devices.dart index d47a270a82..b4780a3847 100644 --- a/packages/flutter_tools/lib/src/ios/devices.dart +++ b/packages/flutter_tools/lib/src/ios/devices.dart @@ -302,7 +302,8 @@ class IOSDevice extends Device { } @override - bool isSupported() => true; + // 32-bit devices are not supported. + bool isSupported() => cpuArchitecture == DarwinArch.arm64; @override Future startApp( 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 2f7d8ce8e7..9a892ef64d 100644 --- a/packages/flutter_tools/test/general.shard/ios/devices_test.dart +++ b/packages/flutter_tools/test/general.shard/ios/devices_test.dart @@ -64,7 +64,7 @@ void main() { }); testWithoutContext('successfully instantiates on Mac OS', () { - IOSDevice( + final IOSDevice device = IOSDevice( 'device-123', iProxy: IProxy.test(logger: logger, processManager: FakeProcessManager.any()), fileSystem: fileSystem, @@ -77,6 +77,23 @@ void main() { cpuArchitecture: DarwinArch.arm64, interfaceType: IOSDeviceConnectionInterface.usb, ); + expect(device.isSupported(), isTrue); + }); + + testWithoutContext('32-bit devices are unsupported', () { + final IOSDevice device = IOSDevice( + 'device-123', + iProxy: IProxy.test(logger: logger, processManager: FakeProcessManager.any()), + fileSystem: fileSystem, + logger: logger, + platform: macPlatform, + iosDeploy: iosDeploy, + iMobileDevice: iMobileDevice, + name: 'iPhone 1', + cpuArchitecture: DarwinArch.armv7, + interfaceType: IOSDeviceConnectionInterface.usb, + ); + expect(device.isSupported(), isFalse); }); testWithoutContext('parses major version', () {