Commit 257c04b6 authored by Daniel Teske's avatar Daniel Teske

Android: Rework settings dialog

Make it possible to create multiple AndroidConfigs so that we can have
a different one in the settings dialog from the global one. Move pretty
much every method from AndroidConfigurations to AndroidConfig, so that
the settings dialog can work with its copy. Also add some additional
logic to the settings page around the java setting. To start the avd
manager we need both a sdk path and a java path. Also do some basic
additional checking of the java path.

Task-number: QTCREATORBUG-7724
Task-number: QTCREATORBUG-10936
Task-number: QTCREATORBUG-10937
Task-number: QTCREATORBUG-11059
Task-number: QTCREATORBUG-11218
Change-Id: I148c69b9c98a8a070d17d9b0e223d01db1750e69
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent 4dcb679e
......@@ -48,26 +48,9 @@ QT_END_NAMESPACE
namespace ProjectExplorer { class Project; }
namespace Android {
class AndroidPlugin;
namespace Internal {
class AndroidConfig
{
public:
AndroidConfig();
AndroidConfig(const QSettings &settings);
void save(QSettings &settings) const;
Utils::FileName sdkLocation;
Utils::FileName ndkLocation;
Utils::FileName antLocation;
Utils::FileName openJDKLocation;
Utils::FileName keystoreLocation;
QString toolchainHost;
QStringList makeExtraSearchDirectories;
unsigned partitionSize;
bool automaticKitCreation;
};
struct AndroidDeviceInfo
{
QString serialNumber;
......@@ -80,89 +63,138 @@ struct AndroidDeviceInfo
static QStringList adbSelector(const QString &serialNumber);
};
class AndroidConfigurations : public QObject
class AndroidConfig
{
Q_OBJECT
public:
static AndroidConfigurations &instance(QObject *parent = 0);
AndroidConfig config() const { return m_config; }
void setConfig(const AndroidConfig &config);
AndroidConfig();
void load(const QSettings &settings);
void save(QSettings &settings) const;
QStringList sdkTargets(int minApiLevel = 0) const;
Utils::FileName sdkLocation() const;
void setSdkLocation(const Utils::FileName &sdkLocation);
Utils::FileName ndkLocation() const;
void setNdkLocation(const Utils::FileName &ndkLocation);
Utils::FileName antLocation() const;
void setAntLocation(const Utils::FileName &antLocation);
Utils::FileName openJDKLocation() const;
void setOpenJDKLocation(const Utils::FileName &openJDKLocation);
Utils::FileName keystoreLocation() const;
void setKeystoreLocation(const Utils::FileName &keystoreLocation);
QString toolchainHost() const;
QStringList makeExtraSearchDirectories() const;
unsigned partitionSize() const;
void setPartitionSize(unsigned partitionSize);
bool automaticKitCreation() const;
void setAutomaticKitCreation(bool b);
Utils::FileName adbToolPath() const;
Utils::FileName androidToolPath() const;
Utils::Environment androidToolEnvironment() const;
Utils::FileName antToolPath() const;
Utils::FileName emulatorToolPath() const;
Utils::FileName gccPath(ProjectExplorer::Abi::Architecture architecture, const QString &ndkToolChainVersion) const;
Utils::FileName gdbPath(ProjectExplorer::Abi::Architecture architecture, const QString &ndkToolChainVersion) const;
Utils::FileName openJDKPath() const;
Utils::FileName keytoolPath() const;
Utils::FileName jarsignerPath() const;
Utils::FileName zipalignPath() const;
Utils::FileName stripPath(ProjectExplorer::Abi::Architecture architecture, const QString &ndkToolChainVersion) const;
Utils::FileName readelfPath(ProjectExplorer::Abi::Architecture architecture, const QString &ndkToolChainVersion) const;
QString createAVD(QWidget *parent, int minApiLevel = 0, QString targetArch = QString()) const;
QString createAVD(const QString &target, const QString &name, const QString &abi, int sdcardSize) const;
bool removeAVD(const QString &name) const;
QVector<AndroidDeviceInfo> connectedDevices(QString *error = 0) const;
QVector<AndroidDeviceInfo> androidVirtualDevices() const;
QString startAVD(const QString &name, int apiLevel, QString cpuAbi) const;
bool startAVDAsync(const QString &avdName) const;
QString findAvd(int apiLevel, const QString &cpuAbi) const;
QString waitForAvd(int apiLevel, const QString &cpuAbi, const QFutureInterface<bool> &fi = QFutureInterface<bool>()) const;
// special version for AndroidDeployQt::run
QString bestNdkPlatformMatch(const QString &targetAPI) const;
QStringList makeExtraSearchDirectories() const;
static ProjectExplorer::Abi::Architecture architectureForToolChainPrefix(const QString &toolchainprefix);
static QLatin1String toolchainPrefix(ProjectExplorer::Abi::Architecture architecture);
static QLatin1String toolsPrefix(ProjectExplorer::Abi::Architecture architecture);
// called from AndroidPlugin
void updateAndroidDevice();
QString getProductModel(const QString &device) const;
bool hasFinishedBooting(const QString &device) const;
bool waitForBooted(const QString &serialNumber, const QFutureInterface<bool> &fi) const;
bool isConnected(const QString &serialNumber) const;
AndroidDeviceInfo showDeviceDialog(ProjectExplorer::Project *project, int apiLevel, const QString &abi);
void setDefaultDevice(ProjectExplorer::Project *project, const QString &abi, const QString &serialNumber); // serial number or avd name
QString defaultDevice(ProjectExplorer::Project *project, const QString &abi) const; // serial number or avd name
QString highestAndroidSdk() const;
private:
Utils::FileName toolPath(ProjectExplorer::Abi::Architecture architecture, const QString &ndkToolChainVersion) const;
Utils::FileName openJDKBinPath() const;
int getSDKVersion(const QString &device) const;
QStringList getAbis(const QString &device) const;
bool isBootToQt(const QString &device) const;
void updateAvailableSdkPlatforms() const;
void updateNdkInformation() const;
Utils::FileName m_sdkLocation;
Utils::FileName m_ndkLocation;
Utils::FileName m_antLocation;
Utils::FileName m_openJDKLocation;
Utils::FileName m_keystoreLocation;
QStringList m_makeExtraSearchDirectories;
unsigned m_partitionSize;
bool m_automaticKitCreation;
//caches
mutable bool m_availableSdkPlatformsUpToDate;
mutable QVector<int> m_availableSdkPlatforms;
mutable bool m_NdkInformationUpToDate;
mutable QString m_toolchainHost;
mutable QVector<int> m_availableNdkPlatforms;
mutable QHash<QString, QString> m_serialNumberToDeviceName;
};
class AndroidConfigurations : public QObject
{
friend class Android::AndroidPlugin;
Q_OBJECT
public:
static AndroidConfig currentConfig();
static void setConfig(const AndroidConfig &config);
static AndroidConfigurations *instance();
static void updateAndroidDevice();
static AndroidDeviceInfo showDeviceDialog(ProjectExplorer::Project *project, int apiLevel, const QString &abi);
static void setDefaultDevice(ProjectExplorer::Project *project, const QString &abi, const QString &serialNumber); // serial number or avd name
static QString defaultDevice(ProjectExplorer::Project *project, const QString &abi); // serial number or avd name
public slots:
void clearDefaultDevices(ProjectExplorer::Project *project);
static void clearDefaultDevices(ProjectExplorer::Project *project);
static void updateAutomaticKitList();
signals:
void updated();
public slots:
void updateAutomaticKitList();
private:
Utils::FileName toolPath(ProjectExplorer::Abi::Architecture architecture, const QString &ndkToolChainVersion) const;
Utils::FileName openJDKBinPath() const;
void detectToolchainHost();
AndroidConfigurations(QObject *parent);
void load();
void save();
int getSDKVersion(const QString &device) const;
QStringList getAbis(const QString &device) const;
bool isBootToQt(const QString &device) const;
void updateAvailableNdkPlatforms();
void updateAvailableSdkPlatforms();
static AndroidConfigurations *m_instance;
AndroidConfig m_config;
QVector<int> m_availableNdkPlatforms;
QVector<int> m_availableSdkPlatforms;
mutable QHash<QString, QString> m_serialNumberToDeviceName;
QMap<ProjectExplorer::Project *, QMap<QString, QString> > m_defaultDeviceForAbi;
};
......
......@@ -177,7 +177,7 @@ void AndroidCreateKeystoreCertificate::on_buttonBox_accepted()
<< QLatin1String("-dname") << distinguishedNames;
QProcess genKeyCertProc;
genKeyCertProc.start(AndroidConfigurations::instance().keytoolPath().toString(), params );
genKeyCertProc.start(AndroidConfigurations::currentConfig().keytoolPath().toString(), params );
if (!genKeyCertProc.waitForStarted() || !genKeyCertProc.waitForFinished())
return;
......
......@@ -160,7 +160,7 @@ void AndroidDeployQtStep::ctor()
m_verbose = false;
// will be overwriten by settings if the user choose something different
m_buildTargetSdk = AndroidConfigurations::instance().highestAndroidSdk();
m_buildTargetSdk = AndroidConfigurations::currentConfig().highestAndroidSdk();
connect(project(), SIGNAL(proFilesEvaluated()),
this, SLOT(updateInputFile()));
......@@ -177,7 +177,7 @@ bool AndroidDeployQtStep::init()
return false;
}
m_deviceAPILevel = AndroidManager::minimumSDK(target());
AndroidDeviceInfo info = AndroidConfigurations::instance().showDeviceDialog(project(), m_deviceAPILevel, m_targetArch);
AndroidDeviceInfo info = AndroidConfigurations::showDeviceDialog(project(), m_deviceAPILevel, m_targetArch);
if (info.serialNumber.isEmpty()) // aborted
return false;
......@@ -256,11 +256,11 @@ bool AndroidDeployQtStep::init()
<< deploymentMethod
<< QLatin1String("--install")
<< QLatin1String("--ant")
<< AndroidConfigurations::instance().antToolPath().toString()
<< AndroidConfigurations::currentConfig().antToolPath().toString()
<< QLatin1String("--android-platform")
<< m_buildTargetSdk
<< QLatin1String("--jdk")
<< AndroidConfigurations::instance().openJDKPath().toString();
<< AndroidConfigurations::currentConfig().openJDKLocation().toString();
parser->setSourceDirectory(Utils::FileName::fromString(node->singleVariableValue(QmakeProjectManager::AndroidPackageSourceDir)));
parser->setBuildDirectory(Utils::FileName::fromString(outputDir));
......@@ -300,15 +300,15 @@ bool AndroidDeployQtStep::init()
if (!result)
return false;
if (AndroidConfigurations::instance().findAvd(m_deviceAPILevel, m_targetArch).isEmpty())
AndroidConfigurations::instance().startAVDAsync(m_avdName);
if (AndroidConfigurations::currentConfig().findAvd(m_deviceAPILevel, m_targetArch).isEmpty())
AndroidConfigurations::currentConfig().startAVDAsync(m_avdName);
return true;
}
void AndroidDeployQtStep::run(QFutureInterface<bool> &fi)
{
if (!m_avdName.isEmpty()) {
QString serialNumber = AndroidConfigurations::instance().waitForAvd(m_deviceAPILevel, m_targetArch, fi);
QString serialNumber = AndroidConfigurations::currentConfig().waitForAvd(m_deviceAPILevel, m_targetArch, fi);
if (serialNumber.isEmpty()) {
fi.reportResult(false);
emit finished();
......@@ -324,11 +324,11 @@ void AndroidDeployQtStep::run(QFutureInterface<bool> &fi)
AbstractProcessStep::run(fi);
emit addOutput(tr("Pulling files necessary for debugging."), MessageOutput);
runCommand(AndroidConfigurations::instance().adbToolPath().toString(),
runCommand(AndroidConfigurations::currentConfig().adbToolPath().toString(),
AndroidDeviceInfo::adbSelector(m_serialNumber)
<< QLatin1String("pull") << QLatin1String("/system/bin/app_process")
<< QString::fromLatin1("%1/app_process").arg(m_buildDirectory));
runCommand(AndroidConfigurations::instance().adbToolPath().toString(),
runCommand(AndroidConfigurations::currentConfig().adbToolPath().toString(),
AndroidDeviceInfo::adbSelector(m_serialNumber) << QLatin1String("pull")
<< QLatin1String("/system/lib/libc.so")
<< QString::fromLatin1("%1/libc.so").arg(m_buildDirectory));
......@@ -530,7 +530,7 @@ QAbstractItemModel *AndroidDeployQtStep::keystoreCertificates()
Utils::Environment env = Utils::Environment::systemEnvironment();
env.set(QLatin1String("LANG"), QLatin1String("C"));
keytoolProc.setProcessEnvironment(env.toProcessEnvironment());
keytoolProc.start(AndroidConfigurations::instance().keytoolPath().toString(), params);
keytoolProc.start(AndroidConfigurations::currentConfig().keytoolPath().toString(), params);
if (!keytoolProc.waitForStarted() || !keytoolProc.waitForFinished()) {
QMessageBox::critical(0, tr("Error"),
tr("Failed to run keytool."));
......
......@@ -61,7 +61,7 @@ AndroidDeployQtWidget::AndroidDeployQtWidget(AndroidDeployQtStep *step)
// Target sdk combobox
int minApiLevel = 9;
QStringList targets = AndroidConfigurations::instance().sdkTargets(minApiLevel);
QStringList targets = AndroidConfigurations::currentConfig().sdkTargets(minApiLevel);
m_ui->targetSDKComboBox->addItems(targets);
m_ui->targetSDKComboBox->setCurrentIndex(targets.indexOf(step->buildTargetSdk()));
......@@ -250,7 +250,7 @@ void AndroidDeployQtWidget::cleanLibsOnDevice()
void AndroidDeployQtWidget::resetDefaultDevices()
{
AndroidConfigurations::instance().clearDefaultDevices(m_step->project());
AndroidConfigurations::clearDefaultDevices(m_step->project());
}
void AndroidDeployQtWidget::signPackageCheckBoxToggled(bool checked)
......
......@@ -103,7 +103,7 @@ bool AndroidDeployStep::init()
m_deviceAPILevel = AndroidManager::minimumSDK(target());
m_targetArch = AndroidManager::targetArch(target());
AndroidDeviceInfo info = AndroidConfigurations::instance().showDeviceDialog(project(), m_deviceAPILevel, m_targetArch);
AndroidDeviceInfo info = AndroidConfigurations::showDeviceDialog(project(), m_deviceAPILevel, m_targetArch);
if (info.serialNumber.isEmpty()) // aborted
return false;
......@@ -280,7 +280,7 @@ unsigned int AndroidDeployStep::remoteModificationTime(const QString &fullDestin
return *it;
QStringList arguments = AndroidDeviceInfo::adbSelector(m_deviceSerialNumber);
arguments << QLatin1String("ls") << destination;
process.start(AndroidConfigurations::instance().adbToolPath().toString(), arguments);
process.start(AndroidConfigurations::currentConfig().adbToolPath().toString(), arguments);
if (!process.waitForFinished(5000)
|| process.exitCode() != 0)
return 0;
......@@ -367,7 +367,7 @@ void AndroidDeployStep::stripFiles(const QList<DeployItem> &deployList, Abi::Arc
{
QProcess stripProcess;
foreach (const DeployItem &item, deployList) {
stripProcess.start(AndroidConfigurations::instance().stripPath(architecture, ndkToolchainVersion).toString(),
stripProcess.start(AndroidConfigurations::currentConfig().stripPath(architecture, ndkToolchainVersion).toString(),
QStringList()<<QLatin1String("--strip-unneeded") << item.localFileName);
stripProcess.waitForStarted();
if (!stripProcess.waitForFinished())
......@@ -378,7 +378,7 @@ void AndroidDeployStep::stripFiles(const QList<DeployItem> &deployList, Abi::Arc
void AndroidDeployStep::deployFiles(QProcess *process, const QList<DeployItem> &deployList)
{
foreach (const DeployItem &item, deployList) {
runCommand(process, AndroidConfigurations::instance().adbToolPath().toString(),
runCommand(process, AndroidConfigurations::currentConfig().adbToolPath().toString(),
AndroidDeviceInfo::adbSelector(m_deviceSerialNumber)
<< QLatin1String("push") << item.localFileName
<< item.remoteFileName);
......@@ -388,10 +388,10 @@ void AndroidDeployStep::deployFiles(QProcess *process, const QList<DeployItem> &
bool AndroidDeployStep::deployPackage()
{
if (!m_avdName.isEmpty()) {
if (AndroidConfigurations::instance().findAvd(m_deviceAPILevel, m_targetArch).isEmpty()
&& !AndroidConfigurations::instance().startAVDAsync(m_avdName))
if (AndroidConfigurations::currentConfig().findAvd(m_deviceAPILevel, m_targetArch).isEmpty()
&& !AndroidConfigurations::currentConfig().startAVDAsync(m_avdName))
return false;
m_deviceSerialNumber = AndroidConfigurations::instance().waitForAvd(m_deviceAPILevel, m_targetArch);
m_deviceSerialNumber = AndroidConfigurations::currentConfig().waitForAvd(m_deviceAPILevel, m_targetArch);
}
QProcess *const deployProc = new QProcess;
......@@ -457,14 +457,14 @@ bool AndroidDeployStep::deployPackage()
deployProc->setWorkingDirectory(m_androidDirPath.toString());
writeOutput(tr("Installing package onto %1.").arg(m_deviceSerialNumber));
runCommand(deployProc, AndroidConfigurations::instance().adbToolPath().toString(),
runCommand(deployProc, AndroidConfigurations::currentConfig().adbToolPath().toString(),
AndroidDeviceInfo::adbSelector(m_deviceSerialNumber) << QLatin1String("uninstall") << m_packageName);
QString package = m_apkPathDebug;
if (m_signPackage && QFile::exists(m_apkPathRelease))
package = m_apkPathRelease;
if (!runCommand(deployProc, AndroidConfigurations::instance().adbToolPath().toString(),
if (!runCommand(deployProc, AndroidConfigurations::currentConfig().adbToolPath().toString(),
AndroidDeviceInfo::adbSelector(m_deviceSerialNumber) << QLatin1String("install") << package)) {
raiseError(tr("Package installation failed."));
disconnect(deployProc, 0, this, 0);
......@@ -473,11 +473,11 @@ bool AndroidDeployStep::deployPackage()
}
writeOutput(tr("Pulling files necessary for debugging."));
runCommand(deployProc, AndroidConfigurations::instance().adbToolPath().toString(),
runCommand(deployProc, AndroidConfigurations::currentConfig().adbToolPath().toString(),
AndroidDeviceInfo::adbSelector(m_deviceSerialNumber)
<< QLatin1String("pull") << QLatin1String("/system/bin/app_process")
<< QString::fromLatin1("%1/app_process").arg(m_buildDirectory));
runCommand(deployProc, AndroidConfigurations::instance().adbToolPath().toString(),
runCommand(deployProc, AndroidConfigurations::currentConfig().adbToolPath().toString(),
AndroidDeviceInfo::adbSelector(m_deviceSerialNumber) << QLatin1String("pull")
<< QLatin1String("/system/lib/libc.so")
<< QString::fromLatin1("%1/libc.so").arg(m_buildDirectory));
......
......@@ -129,7 +129,7 @@ void AndroidDeployStepWidget::cleanLibsOnDevice()
void AndroidDeployStepWidget::resetDefaultDevices()
{
AndroidConfigurations::instance().clearDefaultDevices(m_step->project());
AndroidConfigurations::clearDefaultDevices(m_step->project());
}
} // namespace Internal
......
......@@ -162,7 +162,7 @@ public:
// TopLeft
QString topLeft = device.serialNumber;
if (device.type == AndroidDeviceInfo::Hardware)
topLeft = AndroidConfigurations::instance().getProductModel(device.serialNumber);
topLeft = AndroidConfigurations::currentConfig().getProductModel(device.serialNumber);
painter->drawText(size + 12, 2 + opt.rect.top() + fm.ascent(), topLeft);
QString topRight = device.serialNumber;
......@@ -422,11 +422,11 @@ void AndroidDeviceDialog::refreshDeviceList()
serialNumber = m_model->device(currentIndex).serialNumber;
QVector<AndroidDeviceInfo> devices;
foreach (const AndroidDeviceInfo &info, AndroidConfigurations::instance().connectedDevices())
foreach (const AndroidDeviceInfo &info, AndroidConfigurations::currentConfig().connectedDevices())
if (info.type == AndroidDeviceInfo::Hardware)
devices << info;
devices += AndroidConfigurations::instance().androidVirtualDevices();
devices += AndroidConfigurations::currentConfig().androidVirtualDevices();
m_model->setDevices(devices);
m_ui->deviceView->expand(m_model->index(0, 0));
......@@ -446,7 +446,7 @@ void AndroidDeviceDialog::refreshDeviceList()
void AndroidDeviceDialog::createAvd()
{
QString avd = AndroidConfigurations::instance().createAVD(this, m_apiLevel, m_abi);
QString avd = AndroidConfigurations::currentConfig().createAVD(this, m_apiLevel, m_abi);
if (avd.isEmpty())
return;
refreshDeviceList();
......
......@@ -612,7 +612,7 @@ bool AndroidManager::createAndroidTemplatesIfNecessary(ProjectExplorer::Target *
if (qt->qtVersion() >= QtSupport::QtVersionNumber(5, 0, 0))
minApiLevel = 9;
QStringList sdks = AndroidConfigurations::instance().sdkTargets(minApiLevel);
QStringList sdks = AndroidConfigurations::currentConfig().sdkTargets(minApiLevel);
if (sdks.isEmpty()) {
raiseError(tr("No Qt for Android SDKs were found.\nPlease install at least one SDK."));
return false;
......@@ -645,14 +645,14 @@ void AndroidManager::updateTarget(ProjectExplorer::Target *target, const QString
QString androidDir = dirPath(target).toString();
Utils::Environment env = Utils::Environment::systemEnvironment();
QString javaHome = AndroidConfigurations::instance().config().openJDKLocation.toString();
QString javaHome = AndroidConfigurations::currentConfig().openJDKLocation().toString();
if (!javaHome.isEmpty())
env.set(QLatin1String("JAVA_HOME"), javaHome);
// clean previous build
QProcess androidProc;
androidProc.setWorkingDirectory(androidDir);
androidProc.setProcessEnvironment(env.toProcessEnvironment());
androidProc.start(AndroidConfigurations::instance().antToolPath().toString(),
androidProc.start(AndroidConfigurations::currentConfig().antToolPath().toString(),
QStringList() << QLatin1String("clean"));
if (!androidProc.waitForFinished(-1))
androidProc.terminate();
......@@ -706,8 +706,8 @@ void AndroidManager::updateTarget(ProjectExplorer::Target *target, const QString
params << QLatin1String("-t") << targetSDK;
if (!name.isEmpty())
params << QLatin1String("-n") << name;
androidProc.setProcessEnvironment(AndroidConfigurations::instance().androidToolEnvironment().toProcessEnvironment());
androidProc.start(AndroidConfigurations::instance().androidToolPath().toString(), params);
androidProc.setProcessEnvironment(AndroidConfigurations::currentConfig().androidToolEnvironment().toProcessEnvironment());
androidProc.start(AndroidConfigurations::currentConfig().androidToolPath().toString(), params);
if (!androidProc.waitForFinished(-1))
androidProc.terminate();
}
......@@ -811,7 +811,7 @@ QVector<AndroidManager::Library> AndroidManager::availableQtLibsWithDependencies
AndroidToolChain *atc = static_cast<AndroidToolChain *>(tc);
QString libgnustl = libGnuStl(arch, atc->ndkToolChainVersion());
Utils::FileName readelfPath = AndroidConfigurations::instance().readelfPath(target->activeRunConfiguration()->abi().architecture(),
Utils::FileName readelfPath = AndroidConfigurations::currentConfig().readelfPath(target->activeRunConfiguration()->abi().architecture(),
atc->ndkToolChainVersion());
const QmakeProjectManager::QmakeProject *const qmakeProject
= qobject_cast<const QmakeProjectManager::QmakeProject *>(target->project());
......@@ -1178,7 +1178,7 @@ bool AndroidManager::qtLibrariesLessThan(const Library &a, const Library &b)
QString AndroidManager::libGnuStl(const QString &arch, const QString &ndkToolChainVersion)
{
return AndroidConfigurations::instance().config().ndkLocation.toString()
return AndroidConfigurations::currentConfig().ndkLocation().toString()
+ QLatin1String("/sources/cxx-stl/gnu-libstdc++/")
+ ndkToolChainVersion + QLatin1String("/libs/")
+ arch
......@@ -1197,7 +1197,7 @@ void AndroidManager::cleanLibsOnDevice(ProjectExplorer::Target *target)
if (targetArch.isEmpty())
return;
int deviceAPILevel = AndroidManager::minimumSDK(target);
AndroidDeviceInfo info = AndroidConfigurations::instance().showDeviceDialog(target->project(), deviceAPILevel, targetArch);
AndroidDeviceInfo info = AndroidConfigurations::showDeviceDialog(target->project(), deviceAPILevel, targetArch);
if (info.serialNumber.isEmpty()) // aborted
return;
......@@ -1205,7 +1205,7 @@ void AndroidManager::cleanLibsOnDevice(ProjectExplorer::Target *target)
QString deviceSerialNumber = info.serialNumber;
if (info.type == AndroidDeviceInfo::Emulator) {
deviceSerialNumber = AndroidConfigurations::instance().startAVD(deviceSerialNumber, deviceAPILevel, targetArch);
deviceSerialNumber = AndroidConfigurations::currentConfig().startAVD(deviceSerialNumber, deviceAPILevel, targetArch);
if (deviceSerialNumber.isEmpty())
Core::MessageManager::write(tr("Starting Android virtual device failed."));
}
......@@ -1214,7 +1214,7 @@ void AndroidManager::cleanLibsOnDevice(ProjectExplorer::Target *target)
QStringList arguments = AndroidDeviceInfo::adbSelector(deviceSerialNumber);
arguments << QLatin1String("shell") << QLatin1String("rm") << QLatin1String("-r") << QLatin1String("/data/local/tmp/qt");
process->connect(process, SIGNAL(finished(int)), process, SLOT(deleteLater()));
const QString adb = AndroidConfigurations::instance().adbToolPath().toString();
const QString adb = AndroidConfigurations::currentConfig().adbToolPath().toString();
Core::MessageManager::write(adb + QLatin1Char(' ') + arguments.join(QLatin1String(" ")));
process->start(adb, arguments);
if (!process->waitForStarted(500))
......@@ -1227,14 +1227,14 @@ void AndroidManager::installQASIPackage(ProjectExplorer::Target *target, const Q
if (targetArch.isEmpty())
return;
int deviceAPILevel = AndroidManager::minimumSDK(target);
AndroidDeviceInfo info = AndroidConfigurations::instance().showDeviceDialog(target->project(), deviceAPILevel, targetArch);
AndroidDeviceInfo info = AndroidConfigurations::showDeviceDialog(target->project(), deviceAPILevel, targetArch);
if (info.serialNumber.isEmpty()) // aborted
return;
deviceAPILevel = info.sdk;
QString deviceSerialNumber = info.serialNumber;
if (info.type == AndroidDeviceInfo::Emulator) {
deviceSerialNumber = AndroidConfigurations::instance().startAVD(deviceSerialNumber, deviceAPILevel, targetArch);
deviceSerialNumber = AndroidConfigurations::currentConfig().startAVD(deviceSerialNumber, deviceAPILevel, targetArch);
if (deviceSerialNumber.isEmpty())
Core::MessageManager::write(tr("Starting Android virtual device failed."));
}
......@@ -1244,7 +1244,7 @@ void AndroidManager::installQASIPackage(ProjectExplorer::Target *target, const Q
arguments << QLatin1String("install") << QLatin1String("-r ") << packagePath;
process->connect(process, SIGNAL(finished(int)), process, SLOT(deleteLater()));
const QString adb = AndroidConfigurations::instance().adbToolPath().toString();
const QString adb = AndroidConfigurations::currentConfig().adbToolPath().toString();
Core::MessageManager::write(adb + QLatin1Char(' ') + arguments.join(QLatin1String(" ")));
process->start(adb, arguments);
if (!process->waitForFinished(500))
......@@ -1263,7 +1263,7 @@ bool AndroidManager::checkKeystorePassword(const QString &keystorePath, const QS
<< QLatin1String("--storepass")
<< keystorePasswd;
QProcess proc;
proc.start(AndroidConfigurations::instance().keytoolPath().toString(), arguments);
proc.start(AndroidConfigurations::currentConfig().keytoolPath().toString(), arguments);
if (!proc.waitForStarted(4000))
return false;
if (!proc.waitForFinished(4000)) {
......@@ -1292,7 +1292,7 @@ bool AndroidManager::checkCertificatePassword(const QString &keystorePath, const
arguments << certificatePasswd;
QProcess proc;
proc.start(AndroidConfigurations::instance().keytoolPath().toString(), arguments);
proc.start(AndroidConfigurations::currentConfig().keytoolPath().toString(), arguments);
if (!proc.waitForStarted(4000))
return false;
if (!proc.waitForFinished(4000)) {
......
......@@ -123,14 +123,14 @@ bool AndroidPackageCreationStep::init()
return false;
AndroidManager::updateTarget(target(), AndroidManager::buildTargetSDK(target()), AndroidManager::applicationName(target()));
m_antToolPath = AndroidConfigurations::instance().antToolPath();
m_antToolPath = AndroidConfigurations::currentConfig().antToolPath();
m_apkPathUnsigned = AndroidManager::apkPath(target(), AndroidManager::ReleaseBuildUnsigned);
m_apkPathSigned = AndroidManager::apkPath(target(), AndroidManager::ReleaseBuildSigned);
m_signPackageForRun = m_signPackage;
m_keystorePathForRun = m_keystorePath;
m_certificatePasswdForRun = m_certificatePasswd;
m_jarSigner = AndroidConfigurations::instance().jarsignerPath();
m_zipAligner = AndroidConfigurations::instance().zipalignPath();
m_jarSigner = AndroidConfigurations::currentConfig().jarsignerPath();
m_zipAligner = AndroidConfigurations::currentConfig().zipalignPath();
m_environment = bc->environment();
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit());
......@@ -247,7 +247,7 @@ void AndroidPackageCreationStep::checkRequiredLibraries()
return;
AndroidToolChain *atc = static_cast<AndroidToolChain *>(tc);
readelfProc.start(AndroidConfigurations::instance().readelfPath(target()->activeRunConfiguration()->abi().architecture(), atc->ndkToolChainVersion()).toString(),
readelfProc.start(AndroidConfigurations::currentConfig().readelfPath(target()->activeRunConfiguration()->abi().architecture(), atc->ndkToolChainVersion()).toString(),
QStringList() << QLatin1String("-d") << QLatin1String("-W") << appPath);
if (!readelfProc.waitForFinished(-1)) {
readelfProc.kill();
......@@ -268,7 +268,7 @@ void AndroidPackageCreationStep::initCheckRequiredLibrariesForRun()
AndroidToolChain *atc = static_cast<AndroidToolChain *>(tc);
m_appPath = Utils::FileName::fromString(AndroidManager::targetApplicationPath(target()));
m_readElf = AndroidConfigurations::instance().readelfPath(target()->activeRunConfiguration()->abi().architecture(),
m_readElf = AndroidConfigurations::currentConfig().readelfPath(target()->activeRunConfiguration()->abi().architecture(),
atc->ndkToolChainVersion());
m_qtLibs = AndroidManager::qtLibs(target());
m_availableQtLibs = AndroidManager::availableQtLibsWithDependencies(target());
......@@ -367,7 +367,7 @@ QAbstractItemModel *AndroidPackageCreationStep::keystoreCertificates()
Utils::Environment env = Utils::Environment::systemEnvironment();
env.set(QLatin1String("LANG"), QLatin1String("C"));
keytoolProc.setProcessEnvironment(env.toProcessEnvironment());
keytoolProc.start(AndroidConfigurations::instance().keytoolPath().toString(), params);
keytoolProc.start(AndroidConfigurations::currentConfig().keytoolPath().toString(), params);
if (!keytoolProc.waitForStarted() || !keytoolProc.waitForFinished()) {
QMessageBox::critical(0, tr("Error"),
tr("Failed to run keytool"));
......@@ -751,7 +751,7 @@ void AndroidPackageCreationStep::stripAndroidLibs(const QStringList & files, Abi
{
QProcess stripProcess;
foreach (const QString &file, files) {
stripProcess.start(AndroidConfigurations::instance().stripPath(architecture, ndkToolchainVersion).toString(),
stripProcess.start(AndroidConfigurations::currentConfig().stripPath(architecture, ndkToolchainVersion).toString(),
QStringList()<<QLatin1String("--strip-unneeded") << file);
stripProcess.waitForStarted();
if (!stripProcess.waitForFinished())
......