Remove adb daemon logs

If adb daemon is not started, adb devices command will add two lines to
the output, messing up the devices list.

Change-Id: I40dcf586d2661df2de0a56aaac543c3b4739ab0d
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
BogDan Vatra
2013-10-22 13:51:17 +03:00
parent bdf8655376
commit d8aadac323

View File

@@ -457,7 +457,12 @@ QVector<AndroidDeviceInfo> AndroidConfigurations::connectedDevices(QString *erro
return devices;
}
QList<QByteArray> adbDevs = adbProc.readAll().trimmed().split('\n');
adbDevs.removeFirst();
if (adbDevs.empty())
return devices;
while (adbDevs.first().startsWith("* daemon"))
adbDevs.removeFirst(); // remove the daemon logs
adbDevs.removeFirst(); // remove "List of devices attached" header line
// workaround for '????????????' serial numbers:
// can use "adb -d" when only one usb device attached
@@ -578,7 +583,13 @@ QVector<AndroidDeviceInfo> AndroidConfigurations::androidVirtualDevices() const
return devices;
}
QList<QByteArray> avds = proc.readAll().trimmed().split('\n');
avds.removeFirst();
if (avds.empty())
return devices;
while (avds.first().startsWith("* daemon"))
avds.removeFirst(); // remove the daemon logs
avds.removeFirst(); // remove "List of devices attached" header line
AndroidDeviceInfo dev;
for (int i = 0; i < avds.size(); i++) {
QString line = QLatin1String(avds[i]);