Tweak the display name of emulators (#34785)

diff --git a/packages/flutter_tools/test/android/android_emulator_test.dart b/packages/flutter_tools/test/android/android_emulator_test.dart
index 7afdb1c..c82e9ebf 100644
--- a/packages/flutter_tools/test/android/android_emulator_test.dart
+++ b/packages/flutter_tools/test/android/android_emulator_test.dart
@@ -23,25 +23,43 @@
       expect(emulator.id, emulatorID);
       expect(emulator.hasConfig, true);
     });
-    testUsingContext('stores expected metadata', () {
+    testUsingContext('reads expected metadata', () {
       const String emulatorID = '1234';
-      const String name = 'My Test Name';
       const String manufacturer = 'Me';
-      const String label = 'The best one';
+      const String displayName = 'The best one';
       final Map<String, String> properties = <String, String>{
-        'hw.device.name': name,
         'hw.device.manufacturer': manufacturer,
-        'avd.ini.displayname': label,
+        'avd.ini.displayname': displayName,
       };
       final AndroidEmulator emulator =
           AndroidEmulator(emulatorID, properties);
       expect(emulator.id, emulatorID);
-      expect(emulator.name, name);
+      expect(emulator.name, displayName);
       expect(emulator.manufacturer, manufacturer);
-      expect(emulator.label, label);
       expect(emulator.category, Category.mobile);
       expect(emulator.platformType, PlatformType.android);
     });
+    testUsingContext('prefers displayname for name', () {
+      const String emulatorID = '1234';
+      const String displayName = 'The best one';
+      final Map<String, String> properties = <String, String>{
+        'avd.ini.displayname': displayName,
+      };
+      final AndroidEmulator emulator =
+          AndroidEmulator(emulatorID, properties);
+      expect(emulator.name, displayName);
+    });
+    testUsingContext('uses cleaned up ID if no displayname is set', () {
+      // Android Studio uses the ID with underscores replaced with spaces
+      // for the name if displayname is not set so we do the same.
+      const String emulatorID = 'This_is_my_ID';
+      final Map<String, String> properties = <String, String>{
+        'avd.ini.notadisplayname': 'this is not a display name',
+      };
+      final AndroidEmulator emulator =
+          AndroidEmulator(emulatorID, properties);
+      expect(emulator.name, 'This is my ID');
+    });
     testUsingContext('parses ini files', () {
       const String iniFile = '''
         hw.device.name=My Test Name
diff --git a/packages/flutter_tools/test/emulator_test.dart b/packages/flutter_tools/test/emulator_test.dart
index 25c24f3..59f6390 100644
--- a/packages/flutter_tools/test/emulator_test.dart
+++ b/packages/flutter_tools/test/emulator_test.dart
@@ -46,11 +46,11 @@
 
     testUsingContext('getEmulatorsById', () async {
       final _MockEmulator emulator1 =
-          _MockEmulator('Nexus_5', 'Nexus 5', 'Google', '');
+          _MockEmulator('Nexus_5', 'Nexus 5', 'Google');
       final _MockEmulator emulator2 =
-          _MockEmulator('Nexus_5X_API_27_x86', 'Nexus 5X', 'Google', '');
+          _MockEmulator('Nexus_5X_API_27_x86', 'Nexus 5X', 'Google');
       final _MockEmulator emulator3 =
-          _MockEmulator('iOS Simulator', 'iOS Simulator', 'Apple', '');
+          _MockEmulator('iOS Simulator', 'iOS Simulator', 'Apple');
       final List<Emulator> emulators = <Emulator>[
         emulator1,
         emulator2,
@@ -160,7 +160,7 @@
 }
 
 class _MockEmulator extends Emulator {
-  _MockEmulator(String id, this.name, this.manufacturer, this.label)
+  _MockEmulator(String id, this.name, this.manufacturer)
     : super(id, true);
 
   @override
@@ -170,9 +170,6 @@
   final String manufacturer;
 
   @override
-  final String label;
-
-  @override
   Category get category => Category.mobile;
 
   @override