Commit 9c1aba2a authored by Todd Volkert's avatar Todd Volkert Committed by GitHub

Skip adb server restarts during device discovery (#9693)

parent c6b0f833
...@@ -64,12 +64,14 @@ class AndroidDevice extends Device { ...@@ -64,12 +64,14 @@ class AndroidDevice extends Device {
// `adb shell getprop` result as UTF8. // `adb shell getprop` result as UTF8.
final ProcessResult result = await processManager.run( final ProcessResult result = await processManager.run(
propCommand, propCommand,
stdoutEncoding: LATIN1 stdoutEncoding: LATIN1,
stderrEncoding: LATIN1,
).timeout(const Duration(seconds: 5)); ).timeout(const Duration(seconds: 5));
if (result.exitCode == 0) { if (result.exitCode == 0) {
_properties = parseAdbDeviceProperties(result.stdout); _properties = parseAdbDeviceProperties(result.stdout);
} else { } else {
printError('Error retrieving device properties for $name.'); printError('Error retrieving device properties for $name:');
printError(result.stderr);
} }
} on TimeoutException catch (_) { } on TimeoutException catch (_) {
throwToolExit('adb not responding'); throwToolExit('adb not responding');
...@@ -515,6 +517,7 @@ List<AndroidDevice> getAdbDevices({ String mockAdbOutput }) { ...@@ -515,6 +517,7 @@ List<AndroidDevice> getAdbDevices({ String mockAdbOutput }) {
if (mockAdbOutput == null) { if (mockAdbOutput == null) {
final String adbPath = getAdbPath(androidSdk); final String adbPath = getAdbPath(androidSdk);
printTrace('Listing devices using $adbPath');
if (adbPath == null) if (adbPath == null)
return <AndroidDevice>[]; return <AndroidDevice>[];
text = runSync(<String>[adbPath, 'devices', '-l']); text = runSync(<String>[adbPath, 'devices', '-l']);
...@@ -533,6 +536,12 @@ List<AndroidDevice> getAdbDevices({ String mockAdbOutput }) { ...@@ -533,6 +536,12 @@ List<AndroidDevice> getAdbDevices({ String mockAdbOutput }) {
if (line.startsWith('* daemon ')) if (line.startsWith('* daemon '))
continue; continue;
// Skip lines about adb server and client version not matching
if (line.startsWith('adb server version')) {
printStatus(line);
continue;
}
if (line.startsWith('List of devices')) if (line.startsWith('List of devices'))
continue; continue;
......
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