Android: Make avd name extraction even more robust

The console output changed even more and now it add one more "OK", in
order to get the right avd name we should stop searching at last "OK".

Task-number: QTCREATORBUG-16783
Change-Id: I2b69763bba740b739e3573fdfae6b6ac9ed16e95
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
BogDan Vatra
2016-08-25 15:46:50 +03:00
parent 00a8573502
commit 1ca42e24cb

View File

@@ -922,8 +922,10 @@ QString AndroidConfig::getAvdName(const QString &serialnumber)
// The input "avd name" might not be echoed as-is, but contain ASCII // The input "avd name" might not be echoed as-is, but contain ASCII
// control sequences. // control sequences.
for (int i = response.size() - 1; i > 1; --i) { for (int i = response.size() - 1; i > 1; --i) {
if (response.at(i).startsWith("OK")) if (response.at(i).startsWith("OK")) {
name = response.at(i - 1); name = response.at(i - 1);
break;
}
} }
return QString::fromLatin1(name).trimmed(); return QString::fromLatin1(name).trimmed();
} }