From 42a62a3a5ded2cfe07af60dbfab4e162c1d9a4d4 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Sun, 25 Jun 2023 22:42:15 +0200 Subject: [PATCH] Android: Obtain values for AndroidRunnerWorker from settings data The members of AndroidRunnerWorker are supposed to be initialized with aspect values from the AndroidRunConfiguration. But they were instead unsuccessfully obtained from the RunControl's aspects. This obtains the values from the RunControl's settings, instead. Fixes: QTCREATORBUG-29160 Change-Id: I124184c32d158e0648a0ee1d23dfe8707d18eab8 Reviewed-by: hjk --- src/plugins/android/androidrunnerworker.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/plugins/android/androidrunnerworker.cpp b/src/plugins/android/androidrunnerworker.cpp index 2f52d694f3c..c50129aac25 100644 --- a/src/plugins/android/androidrunnerworker.cpp +++ b/src/plugins/android/androidrunnerworker.cpp @@ -263,15 +263,17 @@ AndroidRunnerWorker::AndroidRunnerWorker(RunWorker *runner, const QString &packa if (target->buildConfigurations().first()->buildType() != BuildConfiguration::BuildType::Release) m_extraAppParams = runControl->commandLine().arguments(); - if (auto aspect = runControl->aspect(Constants::ANDROID_AM_START_ARGS)) { - QTC_CHECK(aspect->value.typeId() == QVariant::String); - const QString startArgs = aspect->value.toString(); + if (const QVariantMap sd = runControl->settingsData(Constants::ANDROID_AM_START_ARGS); + !sd.values().isEmpty()) { + QTC_CHECK(sd.first().type() == QVariant::String); + const QString startArgs = sd.first().toString(); m_amStartExtraArgs = ProcessArgs::splitArgs(startArgs, OsTypeOtherUnix); } - if (auto aspect = runControl->aspect(Constants::ANDROID_PRESTARTSHELLCMDLIST)) { - QTC_CHECK(aspect->value.typeId() == QVariant::String); - const QStringList commands = aspect->value.toString().split('\n', Qt::SkipEmptyParts); + if (const QVariantMap sd = runControl->settingsData(Constants::ANDROID_PRESTARTSHELLCMDLIST); + !sd.values().isEmpty()) { + QTC_CHECK(sd.first().type() == QVariant::String); + const QStringList commands = sd.first().toString().split('\n', Qt::SkipEmptyParts); for (const QString &shellCmd : commands) m_beforeStartAdbCommands.append(QString("shell %1").arg(shellCmd)); } @@ -279,9 +281,10 @@ AndroidRunnerWorker::AndroidRunnerWorker(RunWorker *runner, const QString &packa for (const QString &shellCmd : preStartCmdList.toStringList()) m_beforeStartAdbCommands.append(QString("shell %1").arg(shellCmd)); - if (auto aspect = runControl->aspect(Constants::ANDROID_POSTFINISHSHELLCMDLIST)) { - QTC_CHECK(aspect->value.typeId() == QVariant::String); - const QStringList commands = aspect->value.toString().split('\n', Qt::SkipEmptyParts); + if (const QVariantMap sd = runControl->settingsData(Constants::ANDROID_POSTFINISHSHELLCMDLIST); + !sd.values().isEmpty()) { + QTC_CHECK(sd.first().type() == QVariant::String); + const QStringList commands = sd.first().toString().split('\n', Qt::SkipEmptyParts); for (const QString &shellCmd : commands) m_afterFinishAdbCommands.append(QString("shell %1").arg(shellCmd)); }