Commit c89c62c6 authored by Daniel Teske's avatar Daniel Teske
Browse files

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: default avatarBogDan Vatra <bogdan@kde.org>
parent fc6386be
......@@ -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);
......
......@@ -71,7 +71,6 @@ signals:
void remoteErrorOutput(const QByteArray &output);
private slots:
void killPID();
void checkPID();
void logcatReadStandardError();
void logcatReadStandardOutput();
......
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