Introduce ADB utilities for executing commands like taking XML dumps from connected devices. Refactor the `takeXmlDump` method to dynamically determine the ADB path based on the platform. Include ADB tools and necessary files for both Windows and macOS in the build system.
44 lines
1.3 KiB
C++
44 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <QList>
|
|
#include <QObject>
|
|
|
|
class AdbUtils final : public QObject {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit AdbUtils(QObject *parent = nullptr);
|
|
|
|
static QString adbPath();
|
|
|
|
static QList<QPair<QString, QString> > getListDevices();
|
|
|
|
static QString tryToGetRunningAppPid(const QString &deviceId, const QString &packageName);
|
|
|
|
static bool tryToStartApplication(const QString &deviceId, const QString &packageName);
|
|
|
|
static bool tryToKillApplication(const QString &deviceId, const QString &packageName);
|
|
|
|
static QString getScreenDumpAsXml(const QString &deviceId, int idx, bool screenshot = false);
|
|
|
|
static bool takeScreenshot(const QString &deviceId, const QString &name);
|
|
|
|
static bool takeXmlDump(const QString &deviceId, const QString &name);
|
|
|
|
static bool makeTap(const QString &deviceId, int x, int y);
|
|
|
|
static bool enableAdbIMEKeyboard(const QString &deviceId);
|
|
|
|
static bool inputAdbIMEText(const QString &deviceId, const QString &text);
|
|
|
|
static bool disableAdbIMEKeyboard(const QString &deviceId);
|
|
|
|
static bool makeSwipe(const QString &deviceId, int x1, int y1, int x2, int y2);
|
|
|
|
static bool inputText(const QString &deviceId, const QString &text);
|
|
|
|
static bool goBack(const QString &deviceId);
|
|
|
|
static QSet<QString> getListApps(const QString &deviceId);
|
|
};
|