forked from qt-creator/qt-creator
Android: Change pulling of app_process binary to not use readLink
As apparently Samsung devices don't have it. The new algorithm is: - If it is a 64 bit device - Either pull /system/bin/app_process64 (64bit process) - or pull /system/bin/app_process32 (32bit process) - If it is a 32 bit device - First try /system/bin/app_process32 - If that doesn't exist try /system/bin/app_process The old code did a symlink resolution on one of app_process[32|64|], but I believe the symlink resolution was only needed for a symlink from app_process to app_process32, which is covered by this code. Change-Id: Iedeeb247c3059931e1ddf6d01e8b2aab13156470 Task-number: QTCREATORBUG-15006 Reviewed-by: BogDan Vatra <bogdan@kdab.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
This commit is contained in:
@@ -196,17 +196,21 @@ bool AndroidDeployQtStep::init()
|
|||||||
|
|
||||||
m_avdName = info.avdname;
|
m_avdName = info.avdname;
|
||||||
m_serialNumber = info.serialNumber;
|
m_serialNumber = info.serialNumber;
|
||||||
m_appProcess = QLatin1String("readlink -f /system/bin/app_process");
|
|
||||||
|
m_appProcessBinaries.clear();
|
||||||
m_libdir = QLatin1String("lib");
|
m_libdir = QLatin1String("lib");
|
||||||
if (info.cpuAbi.contains(QLatin1String("arm64-v8a")) ||
|
if (info.cpuAbi.contains(QLatin1String("arm64-v8a")) ||
|
||||||
info.cpuAbi.contains(QLatin1String("x86_64"))) {
|
info.cpuAbi.contains(QLatin1String("x86_64"))) {
|
||||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit());
|
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit());
|
||||||
if (tc && tc->targetAbi().wordWidth() == 64) {
|
if (tc && tc->targetAbi().wordWidth() == 64) {
|
||||||
m_appProcess += QLatin1String("64");
|
m_appProcessBinaries << QLatin1String("/system/bin/app_process64");
|
||||||
m_libdir += QLatin1String("64");
|
m_libdir += QLatin1String("64");
|
||||||
} else {
|
} else {
|
||||||
m_appProcess += QLatin1String("32");
|
m_appProcessBinaries << QLatin1String("/system/bin/app_process32");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
m_appProcessBinaries << QLatin1String("/system/bin/app_process32")
|
||||||
|
<< QLatin1String("/system/bin/app_process");
|
||||||
}
|
}
|
||||||
|
|
||||||
AndroidManager::setDeviceSerialNumber(target(), m_serialNumber);
|
AndroidManager::setDeviceSerialNumber(target(), m_serialNumber);
|
||||||
@@ -423,16 +427,23 @@ void AndroidDeployQtStep::run(QFutureInterface<bool> &fi)
|
|||||||
|
|
||||||
emit addOutput(tr("Pulling files necessary for debugging."), MessageOutput);
|
emit addOutput(tr("Pulling files necessary for debugging."), MessageOutput);
|
||||||
|
|
||||||
const QString remoteAppProcessFile = systemAppProcessFilePath();
|
|
||||||
QString localAppProcessFile = QString::fromLatin1("%1/app_process").arg(m_buildDirectory);
|
QString localAppProcessFile = QString::fromLatin1("%1/app_process").arg(m_buildDirectory);
|
||||||
|
QFile::remove(localAppProcessFile);
|
||||||
|
|
||||||
|
foreach (const QString &remoteAppProcessFile, m_appProcessBinaries) {
|
||||||
runCommand(m_adbPath,
|
runCommand(m_adbPath,
|
||||||
AndroidDeviceInfo::adbSelector(m_serialNumber)
|
AndroidDeviceInfo::adbSelector(m_serialNumber)
|
||||||
<< QLatin1String("pull") << remoteAppProcessFile
|
<< QLatin1String("pull") << remoteAppProcessFile
|
||||||
<< localAppProcessFile);
|
<< localAppProcessFile);
|
||||||
|
if (QFileInfo::exists(localAppProcessFile))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!QFileInfo::exists(localAppProcessFile)) {
|
if (!QFileInfo::exists(localAppProcessFile)) {
|
||||||
returnValue = Failure;
|
returnValue = Failure;
|
||||||
emit addOutput(tr("Package deploy: Failed to pull \"%1\" to \"%2\".")
|
emit addOutput(tr("Package deploy: Failed to pull \"%1\" to \"%2\".")
|
||||||
.arg(remoteAppProcessFile).arg(localAppProcessFile), ErrorMessageOutput);
|
.arg(m_appProcessBinaries.join(QLatin1String("\", \"")))
|
||||||
|
.arg(localAppProcessFile), ErrorMessageOutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
runCommand(m_adbPath,
|
runCommand(m_adbPath,
|
||||||
@@ -467,21 +478,6 @@ void AndroidDeployQtStep::runCommand(const QString &program, const QStringList &
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AndroidDeployQtStep::systemAppProcessFilePath() const
|
|
||||||
{
|
|
||||||
QProcess proc;
|
|
||||||
const QStringList args =
|
|
||||||
QStringList() << AndroidDeviceInfo::adbSelector(m_serialNumber) << QLatin1String("shell")
|
|
||||||
<< m_appProcess;
|
|
||||||
proc.start(m_adbPath, args);
|
|
||||||
proc.waitForFinished();
|
|
||||||
QString output = QString::fromUtf8(proc.readAll()).trimmed();
|
|
||||||
if (output.startsWith(QLatin1Char('/')))
|
|
||||||
return output;
|
|
||||||
else
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
ProjectExplorer::BuildStepConfigWidget *AndroidDeployQtStep::createConfigWidget()
|
ProjectExplorer::BuildStepConfigWidget *AndroidDeployQtStep::createConfigWidget()
|
||||||
{
|
{
|
||||||
return new AndroidDeployQtWidget(this);
|
return new AndroidDeployQtWidget(this);
|
||||||
|
|||||||
@@ -102,7 +102,6 @@ private:
|
|||||||
AndroidDeployQtStep *other);
|
AndroidDeployQtStep *other);
|
||||||
void ctor();
|
void ctor();
|
||||||
void runCommand(const QString &program, const QStringList &arguments);
|
void runCommand(const QString &program, const QStringList &arguments);
|
||||||
QString systemAppProcessFilePath() const;
|
|
||||||
|
|
||||||
bool init();
|
bool init();
|
||||||
void run(QFutureInterface<bool> &fi);
|
void run(QFutureInterface<bool> &fi);
|
||||||
@@ -127,7 +126,7 @@ private:
|
|||||||
QString m_buildDirectory;
|
QString m_buildDirectory;
|
||||||
QString m_avdName;
|
QString m_avdName;
|
||||||
QString m_apkPath;
|
QString m_apkPath;
|
||||||
QString m_appProcess;
|
QStringList m_appProcessBinaries;
|
||||||
QString m_libdir;
|
QString m_libdir;
|
||||||
|
|
||||||
QString m_targetArch;
|
QString m_targetArch;
|
||||||
|
|||||||
Reference in New Issue
Block a user