aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/android/androidrunner.cpp
diff options
context:
space:
mode:
authorDaniel Teske <[email protected]>2013-10-30 15:39:05 +0100
committerDaniel Teske <[email protected]>2013-11-01 11:36:47 +0100
commitc89c62c62fb85bb25ee124b00734f41db188c120 (patch)
tree8be26899b19a4d9dcc453eaab1d5b3ae9c600d2c /src/plugins/android/androidrunner.cpp
parentfc6386be809ecdfccd9751232d51c2d08e7970b0 (diff)
Android: Make AndroidRunner::stop() work
There are two different ways we used to stop a application: am force-stop $packageName or kill -9 applicationPid. As far as I remember that's because on some devices some one of them didn't work. The code wasn't consistently using both though. Fix that by making it one function, which uses both and use that one consistently. Task-number: QTCREATORBUG-10557 Change-Id: Ib09a51e2bddae8d28a5d234e792906cc03606fda Reviewed-by: BogDan Vatra <[email protected]>
Diffstat (limited to 'src/plugins/android/androidrunner.cpp')
-rw-r--r--src/plugins/android/androidrunner.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/plugins/android/androidrunner.cpp b/src/plugins/android/androidrunner.cpp
index 74e63ed0233..881d61cc822 100644
--- a/src/plugins/android/androidrunner.cpp
+++ b/src/plugins/android/androidrunner.cpp
@@ -166,12 +166,11 @@ void AndroidRunner::checkPID()
void AndroidRunner::forceStop()
{
QProcess proc;
- proc.start(m_adb, selector() << _("shell") << _("am") << _("force-stop"));
+ proc.start(m_adb, selector() << _("shell") << _("am") << _("force-stop")
+ << m_packageName);
proc.waitForFinished();
-}
-void AndroidRunner::killPID()
-{
+ // try killing it via kill -9
const QByteArray out = runPs();
int from = 0;
while (1) {
@@ -198,7 +197,6 @@ void AndroidRunner::asyncStart()
{
QMutexLocker locker(&m_mutex);
forceStop();
- killPID();
if (m_useCppDebugger) {
// Remove pong file.
@@ -345,7 +343,7 @@ void AndroidRunner::stop()
QMutexLocker locker(&m_mutex);
m_checkPIDTimer.stop();
if (m_processPID != -1) {
- killPID();
+ forceStop();
emit remoteProcessFinished(tr("\n\n'%1' terminated.").arg(m_packageName));
}
//QObject::disconnect(&m_adbLogcatProcess, 0, this, 0);