diff options
author | Eike Ziller <[email protected]> | 2015-09-25 10:35:42 +0200 |
---|---|---|
committer | Eike Ziller <[email protected]> | 2015-09-25 10:35:42 +0200 |
commit | 0ba4781bfc0a23d6f2b7f597274c2bbc62c48c1a (patch) | |
tree | 3cbff9325fba3b802360ccc8aaf1cac813e50172 /src/plugins/android/androidrunner.cpp | |
parent | a5952658b240e1d2761b943ed7514e4589b986fe (diff) | |
parent | f229f0dbe51be6a8b0c4fb0a1948bde935f7b423 (diff) |
Merge remote-tracking branch 'origin/3.5'
Change-Id: I889b93611d1762121548fb71d1d3493e4adba313
Diffstat (limited to 'src/plugins/android/androidrunner.cpp')
-rw-r--r-- | src/plugins/android/androidrunner.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/plugins/android/androidrunner.cpp b/src/plugins/android/androidrunner.cpp index 4edb4df9ad2..6747bd89a23 100644 --- a/src/plugins/android/androidrunner.cpp +++ b/src/plugins/android/androidrunner.cpp @@ -180,7 +180,6 @@ AndroidRunner::AndroidRunner(QObject *parent, m_gdbserverPath = packageDir + _("/lib/gdbserver"); - m_gdbserverCommand = m_gdbserverPath + _(" --multi +") + m_gdbserverSocket; // Detect busybox, as we need to pass -w to ps to get wide output. QProcess psProc; psProc.start(m_adb, selector() << _("shell") << _("readlink") << _("$(which ps)")); @@ -375,7 +374,10 @@ void AndroidRunner::asyncStart() args << _("-e") << _("ping_file") << m_pingFile; args << _("-e") << _("pong_file") << m_pongFile; } - args << _("-e") << _("gdbserver_command") << m_gdbserverCommand; + + QString gdbserverCommand = QString::fromLatin1(adbShellAmNeedsQuotes() ? "\"%1 --multi +%2\"" : "%1 --multi +%2") + .arg(m_gdbserverPath).arg(m_gdbserverSocket); + args << _("-e") << _("gdbserver_command") << gdbserverCommand; args << _("-e") << _("gdbserver_socket") << m_gdbserverSocket; if (m_handShakeMethod == SocketHandShake) { @@ -501,6 +503,28 @@ void AndroidRunner::asyncStart() QMetaObject::invokeMethod(&m_checkPIDTimer, "start"); } +bool AndroidRunner::adbShellAmNeedsQuotes() +{ + // Between Android SDK Tools version 24.3.1 and 24.3.4 the quoting + // needs for the 'adb shell am start ...' parameters changed. + // Run a test to find out on what side of the fence we live. + // The command will fail with a complaint about the "--dummy" + // option on newer SDKs, and with "No intent supplied" on older ones. + // In case the test itself fails assume a new SDK. + QProcess adb; + adb.start(m_adb, selector() << _("shell") << _("am") << _("start") + << _("-e") << _("dummy") <<_("dummy --dummy")); + if (!adb.waitForStarted()) + return true; + + if (!adb.waitForFinished(10000)) + return true; + + QByteArray output = adb.readAllStandardError() + adb.readAllStandardOutput(); + bool oldSdk = output.contains("Error: No intent supplied"); + return !oldSdk; +} + void AndroidRunner::handleRemoteDebuggerRunning() { if (m_useCppDebugger) { |