Commit adc25d1e authored by Daniel Teske's avatar Daniel Teske

Android: findAvd() return serialNumber instead of bool

So that the function can be reused by waitForAvd.

Change-Id: I0b7a86a13bf6a5f5b16d1d1cab362e7200a9a26f
Reviewed-by: default avatarEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
parent f82bfeb4
......@@ -622,7 +622,7 @@ QVector<AndroidDeviceInfo> AndroidConfigurations::androidVirtualDevices() const
QString AndroidConfigurations::startAVD(const QString &name, int apiLevel, QString cpuAbi) const
{
if (findAvd(apiLevel, cpuAbi) || startAVDAsync(name))
if (!findAvd(apiLevel, cpuAbi).isEmpty() || startAVDAsync(name))
return waitForAvd(apiLevel, cpuAbi);
return QString();
}
......@@ -644,7 +644,7 @@ bool AndroidConfigurations::startAVDAsync(const QString &avdName) const
return true;
}
bool AndroidConfigurations::findAvd(int apiLevel, const QString &cpuAbi) const
QString AndroidConfigurations::findAvd(int apiLevel, const QString &cpuAbi) const
{
QVector<AndroidDeviceInfo> devices = connectedDevices();
foreach (AndroidDeviceInfo device, devices) {
......@@ -654,9 +654,9 @@ bool AndroidConfigurations::findAvd(int apiLevel, const QString &cpuAbi) const
continue;
if (device.sdk != apiLevel)
continue;
return true;
return device.serialNumber;
}
return false;
return QString();
}
QString AndroidConfigurations::waitForAvd(int apiLevel, const QString &cpuAbi) const
......
......@@ -106,7 +106,7 @@ public:
QVector<AndroidDeviceInfo> androidVirtualDevices() const;
QString startAVD(const QString &name, int apiLevel, QString cpuAbi) const;
bool startAVDAsync(const QString &avdName) const;
bool findAvd(int apiLevel, const QString &cpuAbi) const;
QString findAvd(int apiLevel, const QString &cpuAbi) const;
QString waitForAvd(int apiLevel, const QString &cpuAbi) const;
QString bestNdkPlatformMatch(const QString &targetAPI) const;
......
......@@ -287,7 +287,7 @@ bool AndroidDeployQtStep::init()
if (!result)
return false;
if (!AndroidConfigurations::instance().findAvd(m_deviceAPILevel, m_targetArch))
if (AndroidConfigurations::instance().findAvd(m_deviceAPILevel, m_targetArch).isEmpty())
AndroidConfigurations::instance().startAVDAsync(m_avdName);
return true;
}
......
......@@ -389,7 +389,7 @@ void AndroidDeployStep::deployFiles(QProcess *process, const QList<DeployItem> &
bool AndroidDeployStep::deployPackage()
{
if (!m_avdName.isEmpty()) {
if (!AndroidConfigurations::instance().findAvd(m_deviceAPILevel, m_targetArch)
if (AndroidConfigurations::instance().findAvd(m_deviceAPILevel, m_targetArch).isEmpty()
&& !AndroidConfigurations::instance().startAVDAsync(m_avdName))
return false;
m_deviceSerialNumber = AndroidConfigurations::instance().waitForAvd(m_deviceAPILevel, m_targetArch);
......
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