Unverified Commit 31a4ff80 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

add samsungexynos7570 to list of known physical devices (#43042)

parent 83878683
...@@ -32,7 +32,7 @@ import 'android_sdk.dart'; ...@@ -32,7 +32,7 @@ import 'android_sdk.dart';
enum _HardwareType { emulator, physical } enum _HardwareType { emulator, physical }
/// Map to help our `isLocalEmulator` detection. /// Map to help our `isLocalEmulator` detection.
const Map<String, _HardwareType> _knownHardware = <String, _HardwareType>{ const Map<String, _HardwareType> _kKnownHardware = <String, _HardwareType>{
'goldfish': _HardwareType.emulator, 'goldfish': _HardwareType.emulator,
'qcom': _HardwareType.physical, 'qcom': _HardwareType.physical,
'ranchu': _HardwareType.emulator, 'ranchu': _HardwareType.emulator,
...@@ -42,6 +42,7 @@ const Map<String, _HardwareType> _knownHardware = <String, _HardwareType>{ ...@@ -42,6 +42,7 @@ const Map<String, _HardwareType> _knownHardware = <String, _HardwareType>{
'samsungexynos8890': _HardwareType.physical, 'samsungexynos8890': _HardwareType.physical,
'samsungexynos8895': _HardwareType.physical, 'samsungexynos8895': _HardwareType.physical,
'samsungexynos9810': _HardwareType.physical, 'samsungexynos9810': _HardwareType.physical,
'samsungexynos7570': _HardwareType.physical,
}; };
bool allowHeapCorruptionOnWindows(int exitCode) { bool allowHeapCorruptionOnWindows(int exitCode) {
...@@ -122,9 +123,9 @@ class AndroidDevice extends Device { ...@@ -122,9 +123,9 @@ class AndroidDevice extends Device {
if (_isLocalEmulator == null) { if (_isLocalEmulator == null) {
final String hardware = await _getProperty('ro.hardware'); final String hardware = await _getProperty('ro.hardware');
printTrace('ro.hardware = $hardware'); printTrace('ro.hardware = $hardware');
if (_knownHardware.containsKey(hardware)) { if (_kKnownHardware.containsKey(hardware)) {
// Look for known hardware models. // Look for known hardware models.
_isLocalEmulator = _knownHardware[hardware] == _HardwareType.emulator; _isLocalEmulator = _kKnownHardware[hardware] == _HardwareType.emulator;
} else { } else {
// Fall back to a best-effort heuristic-based approach. // Fall back to a best-effort heuristic-based approach.
final String characteristics = await _getProperty('ro.build.characteristics'); final String characteristics = await _getProperty('ro.build.characteristics');
......
...@@ -348,6 +348,14 @@ Use the 'android' tool to install them: ...@@ -348,6 +348,14 @@ Use the 'android' tool to install them:
ProcessManager: () => mockProcessManager, ProcessManager: () => mockProcessManager,
}); });
testUsingContext('knownPhysical Samsung SM G570M', () async {
hardware = 'samsungexynos7570';
final AndroidDevice device = AndroidDevice('test');
expect(await device.isLocalEmulator, false);
}, overrides: <Type, Generator>{
ProcessManager: () => mockProcessManager,
});
testUsingContext('knownEmulator', () async { testUsingContext('knownEmulator', () async {
hardware = 'goldfish'; hardware = 'goldfish';
final AndroidDevice device = AndroidDevice('test'); final AndroidDevice device = AndroidDevice('test');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment