Commit ac4b3f33 authored by Daniel Teske's avatar Daniel Teske

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: default avatarBogDan Vatra <bogdan@kdab.com>
Reviewed-by: default avatarEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
parent dec37e6d
......@@ -196,17 +196,21 @@ bool AndroidDeployQtStep::init()
m_avdName = info.avdname;
m_serialNumber = info.serialNumber;
m_appProcess = QLatin1String("readlink -f /system/bin/app_process");
m_appProcessBinaries.clear();
m_libdir = QLatin1String("lib");
if (info.cpuAbi.contains(QLatin1String("arm64-v8a")) ||
info.cpuAbi.contains(QLatin1String("x86_64"))) {
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit());
if (tc && tc->targetAbi().wordWidth() == 64) {
m_appProcess += QLatin1String("64");
m_appProcessBinaries << QLatin1String("/system/bin/app_process64");
m_libdir += QLatin1String("64");
} 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);
......@@ -423,16 +427,23 @@ void AndroidDeployQtStep::run(QFutureInterface<bool> &fi)
emit addOutput(tr("Pulling files necessary for debugging."), MessageOutput);
const QString remoteAppProcessFile = systemAppProcessFilePath();
QString localAppProcessFile = QString::fromLatin1("%1/app_process").arg(m_buildDirectory);
runCommand(m_adbPath,
AndroidDeviceInfo::adbSelector(m_serialNumber)
<< QLatin1String("pull") << remoteAppProcessFile
<< localAppProcessFile);
QFile::remove(localAppProcessFile);
foreach (const QString &remoteAppProcessFile, m_appProcessBinaries) {
runCommand(m_adbPath,
AndroidDeviceInfo::adbSelector(m_serialNumber)
<< QLatin1String("pull") << remoteAppProcessFile
<< localAppProcessFile);
if (QFileInfo::exists(localAppProcessFile))
break;
}
if (!QFileInfo::exists(localAppProcessFile)) {
returnValue = Failure;
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,
......@@ -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()
{
return new AndroidDeployQtWidget(this);
......
......@@ -102,7 +102,6 @@ private:
AndroidDeployQtStep *other);
void ctor();
void runCommand(const QString &program, const QStringList &arguments);
QString systemAppProcessFilePath() const;
bool init();
void run(QFutureInterface<bool> &fi);
......@@ -127,7 +126,7 @@ private:
QString m_buildDirectory;
QString m_avdName;
QString m_apkPath;
QString m_appProcess;
QStringList m_appProcessBinaries;
QString m_libdir;
QString 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