mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Add category/platformType to emulators (#34721)
This commit is contained in:
parent
b798b27bbd
commit
d9983e1be7
@ -199,7 +199,7 @@ This is sent when a device is disconnected (and polling has been enabled via `en
|
||||
|
||||
#### emulator.getEmulators
|
||||
|
||||
Return a list of all available emulators. The `params` field will be a List; each item is a map with the fields `id` and `name`.
|
||||
Return a list of all available emulators. The `params` field will be a List; each item is a map with the fields `id`, `name`, `category` and `platformType`. `category` and `platformType` values match the values described in `device.getDevices`.
|
||||
|
||||
#### emulator.launch
|
||||
|
||||
@ -258,7 +258,8 @@ See the [source](https://github.com/flutter/flutter/blob/master/packages/flutter
|
||||
|
||||
## Changelog
|
||||
|
||||
- 0.5.1: Added `platformType`, `ephemeral`, and `category` field to device.
|
||||
- 0.5.2: Added `platformType` and `category` fields to emulator.
|
||||
- 0.5.1: Added `platformType`, `ephemeral`, and `category` fields to device.
|
||||
- 0.5.0: Added `daemon.getSupportedPlatforms` command
|
||||
- 0.4.2: Added `app.detach` command
|
||||
- 0.4.1: Added `flutter attach --machine`
|
||||
|
@ -11,6 +11,7 @@ import '../android/android_workflow.dart';
|
||||
import '../base/file_system.dart';
|
||||
import '../base/io.dart';
|
||||
import '../base/process_manager.dart';
|
||||
import '../device.dart';
|
||||
import '../emulator.dart';
|
||||
import 'android_sdk.dart';
|
||||
|
||||
@ -40,6 +41,12 @@ class AndroidEmulator extends Emulator {
|
||||
@override
|
||||
String get label => _prop('avd.ini.displayname');
|
||||
|
||||
@override
|
||||
Category get category => Category.mobile;
|
||||
|
||||
@override
|
||||
PlatformType get platformType => PlatformType.android;
|
||||
|
||||
String _prop(String name) => _properties != null ? _properties[name] : null;
|
||||
|
||||
@override
|
||||
|
@ -26,7 +26,7 @@ import '../run_hot.dart';
|
||||
import '../runner/flutter_command.dart';
|
||||
import '../vmservice.dart';
|
||||
|
||||
const String protocolVersion = '0.5.1';
|
||||
const String protocolVersion = '0.5.2';
|
||||
|
||||
/// A server process command. This command will start up a long-lived server.
|
||||
/// It reads JSON-RPC based commands from stdin, executes them, and returns
|
||||
@ -783,6 +783,8 @@ Map<String, dynamic> _emulatorToMap(Emulator emulator) {
|
||||
return <String, dynamic>{
|
||||
'id': emulator.id,
|
||||
'name': emulator.name,
|
||||
'category': emulator.category?.toString(),
|
||||
'platformType': emulator.platformType?.toString(),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@ import 'android/android_sdk.dart';
|
||||
import 'base/context.dart';
|
||||
import 'base/io.dart' show ProcessResult;
|
||||
import 'base/process_manager.dart';
|
||||
import 'device.dart';
|
||||
import 'globals.dart';
|
||||
import 'ios/ios_emulators.dart';
|
||||
|
||||
@ -218,6 +219,8 @@ abstract class Emulator {
|
||||
String get name;
|
||||
String get manufacturer;
|
||||
String get label;
|
||||
Category get category;
|
||||
PlatformType get platformType;
|
||||
|
||||
@override
|
||||
int get hashCode => id.hashCode;
|
||||
|
@ -6,6 +6,7 @@ import 'dart:async';
|
||||
|
||||
import '../base/platform.dart';
|
||||
import '../base/process.dart';
|
||||
import '../device.dart';
|
||||
import '../emulator.dart';
|
||||
import '../globals.dart';
|
||||
import '../macos/xcode.dart';
|
||||
@ -34,6 +35,12 @@ class IOSEmulator extends Emulator {
|
||||
@override
|
||||
String get label => null;
|
||||
|
||||
@override
|
||||
Category get category => Category.mobile;
|
||||
|
||||
@override
|
||||
PlatformType get platformType => PlatformType.ios;
|
||||
|
||||
@override
|
||||
Future<void> launch() async {
|
||||
Future<bool> launchSimulator(List<String> additionalArgs) async {
|
||||
|
@ -3,6 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter_tools/src/android/android_emulator.dart';
|
||||
import 'package:flutter_tools/src/device.dart';
|
||||
|
||||
import '../src/common.dart';
|
||||
import '../src/context.dart';
|
||||
@ -38,6 +39,8 @@ void main() {
|
||||
expect(emulator.name, name);
|
||||
expect(emulator.manufacturer, manufacturer);
|
||||
expect(emulator.label, label);
|
||||
expect(emulator.category, Category.mobile);
|
||||
expect(emulator.platformType, PlatformType.android);
|
||||
});
|
||||
testUsingContext('parses ini files', () {
|
||||
const String iniFile = '''
|
||||
|
@ -9,6 +9,7 @@ import 'package:collection/collection.dart' show ListEquality;
|
||||
import 'package:flutter_tools/src/android/android_sdk.dart';
|
||||
import 'package:flutter_tools/src/base/config.dart';
|
||||
import 'package:flutter_tools/src/base/io.dart';
|
||||
import 'package:flutter_tools/src/device.dart';
|
||||
import 'package:flutter_tools/src/emulator.dart';
|
||||
import 'package:flutter_tools/src/ios/ios_emulators.dart';
|
||||
import 'package:flutter_tools/src/macos/xcode.dart';
|
||||
@ -171,6 +172,12 @@ class _MockEmulator extends Emulator {
|
||||
@override
|
||||
final String label;
|
||||
|
||||
@override
|
||||
Category get category => Category.mobile;
|
||||
|
||||
@override
|
||||
PlatformType get platformType => PlatformType.android;
|
||||
|
||||
@override
|
||||
Future<void> launch() {
|
||||
throw UnimplementedError('Not implemented in Mock');
|
||||
|
Loading…
Reference in New Issue
Block a user