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:
Daniel Teske
2015-09-09 17:53:37 +02:00
parent dec37e6df4
commit ac4b3f33d0
2 changed files with 21 additions and 26 deletions

View File

@@ -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);