2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 BogDan Vatra <bog_dan_ro@yahoo.com>
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2012-04-18 20:30:57 +03:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2012-04-18 20:30:57 +03:00
|
|
|
|
|
|
|
|
#include "androidconfigurations.h"
|
|
|
|
|
|
2019-03-13 08:06:08 +01:00
|
|
|
#include <projectexplorer/runcontrol.h>
|
2015-08-10 17:43:58 +02:00
|
|
|
#include <qmldebug/qmldebugcommandlinearguments.h>
|
2017-06-14 14:59:23 +02:00
|
|
|
#include <qmldebug/qmloutputparser.h>
|
2013-05-03 12:41:58 +02:00
|
|
|
|
2012-04-18 20:30:57 +03:00
|
|
|
#include <QObject>
|
2014-11-18 15:14:40 +01:00
|
|
|
#include <QTcpSocket>
|
2012-04-18 20:30:57 +03:00
|
|
|
#include <QThread>
|
2021-11-01 23:42:55 +01:00
|
|
|
#include <QTimer>
|
2012-04-18 20:30:57 +03:00
|
|
|
|
|
|
|
|
namespace Android {
|
|
|
|
|
namespace Internal {
|
2012-08-09 01:56:51 +02:00
|
|
|
|
2018-05-09 12:20:54 +02:00
|
|
|
class AndroidRunnerWorker;
|
2017-05-19 14:40:49 +02:00
|
|
|
|
|
|
|
|
class AndroidRunner : public ProjectExplorer::RunWorker
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2018-01-30 18:28:23 +01:00
|
|
|
explicit AndroidRunner(ProjectExplorer::RunControl *runControl,
|
2018-08-02 11:00:06 +02:00
|
|
|
const QString &intentName = QString());
|
2017-05-19 14:40:49 +02:00
|
|
|
~AndroidRunner() override;
|
2012-04-18 20:30:57 +03:00
|
|
|
|
2020-04-15 04:33:06 +02:00
|
|
|
Utils::Port debugServerPort() const { return m_debugServerPort; } // GDB or LLDB
|
2017-08-18 12:23:42 +02:00
|
|
|
QUrl qmlServer() const { return m_qmlServer; }
|
2017-05-19 14:40:49 +02:00
|
|
|
Utils::ProcessHandle pid() const { return m_pid; }
|
2012-04-18 20:30:57 +03:00
|
|
|
|
2017-05-19 14:40:49 +02:00
|
|
|
void start() override;
|
|
|
|
|
void stop() override;
|
2012-04-18 20:30:57 +03:00
|
|
|
|
2017-05-19 14:40:49 +02:00
|
|
|
signals:
|
2017-06-08 14:57:09 +02:00
|
|
|
void asyncStart();
|
|
|
|
|
void asyncStop();
|
2017-06-14 14:59:23 +02:00
|
|
|
void qmlServerReady(const QUrl &serverUrl);
|
2018-05-18 14:37:11 +02:00
|
|
|
void androidDeviceInfoChanged(const Android::AndroidDeviceInfo &deviceInfo);
|
2016-08-05 15:40:33 +02:00
|
|
|
void avdDetected();
|
|
|
|
|
|
2016-06-26 22:52:59 +03:00
|
|
|
private:
|
2017-06-14 14:59:23 +02:00
|
|
|
void qmlServerPortReady(Utils::Port port);
|
|
|
|
|
void remoteOutput(const QString &output);
|
|
|
|
|
void remoteErrorOutput(const QString &output);
|
|
|
|
|
void gotRemoteOutput(const QString &output);
|
2020-04-15 04:33:06 +02:00
|
|
|
void handleRemoteProcessStarted(Utils::Port debugServerPort, const QUrl &qmlServer, qint64 pid);
|
2017-05-19 14:40:49 +02:00
|
|
|
void handleRemoteProcessFinished(const QString &errString = QString());
|
2016-08-05 15:40:33 +02:00
|
|
|
void checkAVD();
|
2016-06-08 16:57:32 +02:00
|
|
|
void launchAVD();
|
2016-08-05 15:40:33 +02:00
|
|
|
|
2018-05-15 12:50:41 +02:00
|
|
|
QString m_packageName;
|
2016-06-08 16:57:32 +02:00
|
|
|
QString m_launchedAVDName;
|
2016-08-05 15:40:33 +02:00
|
|
|
QThread m_thread;
|
|
|
|
|
QTimer m_checkAVDTimer;
|
2018-05-09 12:20:54 +02:00
|
|
|
QScopedPointer<AndroidRunnerWorker> m_worker;
|
2017-05-19 14:40:49 +02:00
|
|
|
QPointer<ProjectExplorer::Target> m_target;
|
2020-04-15 04:33:06 +02:00
|
|
|
Utils::Port m_debugServerPort;
|
2017-08-18 12:23:42 +02:00
|
|
|
QUrl m_qmlServer;
|
2017-05-19 14:40:49 +02:00
|
|
|
Utils::ProcessHandle m_pid;
|
2017-06-14 14:59:23 +02:00
|
|
|
QmlDebug::QmlOutputParser m_outputParser;
|
2012-04-18 20:30:57 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Android
|