[flutter_tools] only restrict devices based on arch + buildMode, not emulator status (#58887)

instead of restricting profile/release mode based on whether the tool thinks the device is an emulator, restrict based on the device target architecture and the requested build mode. Notably, this enables release mode on x86_64 Android emulators, but not x86 emulators since we do not support that as an AOT target.

This does not add release mode support for simulators, since this requires us to build and upload artifacts for simulator/x86_64
This commit is contained in:
Jonah Williams
2020-06-08 11:20:15 -07:00
committed by GitHub
parent 206ccc3632
commit 4f88ed1d3c
21 changed files with 203 additions and 84 deletions

View File

@@ -227,6 +227,20 @@ class AndroidDevice extends Device {
return _applicationPlatform;
}
@override
Future<bool> supportsRuntimeMode(BuildMode buildMode) async {
switch (await targetPlatform) {
case TargetPlatform.android_arm:
case TargetPlatform.android_arm64:
case TargetPlatform.android_x64:
return buildMode != BuildMode.jitRelease;
case TargetPlatform.android_x86:
return buildMode == BuildMode.debug;
default:
throw UnsupportedError('Invalid target platform for Android');
}
}
@override
Future<String> get sdkNameAndVersion async =>
'Android ${await _sdkVersion} (API ${await apiVersion})';