解决adb devices crash问题

This commit is contained in:
Barry 2018-11-18 13:02:48 +08:00
parent aac1fa3fea
commit c0015b4f63
4 changed files with 13 additions and 11 deletions

View file

@ -97,6 +97,14 @@ bool AdbProcess::isRuning()
}
}
void AdbProcess::setShowTouchesEnabled(const QString &serial, bool enabled)
{
QStringList adbArgs;
adbArgs << "shell" << "settings" << "put" << "system" << "show_touches";
adbArgs << (enabled ? "1" : "0");
execute(serial, adbArgs);
}
void AdbProcess::forward(const QString& serial, quint16 localPort, const QString& deviceSocketName)
{
QStringList adbArgs;

View file

@ -28,6 +28,7 @@ public:
void install(const QString& serial, const QString& local);
void removePath(const QString& serial, const QString& path);
bool isRuning();
void setShowTouchesEnabled(const QString& serial, bool enabled);
static const QString& getAdbPath();

View file

@ -25,10 +25,12 @@ void Dialog::on_adbProcess_clicked()
{
AdbProcess* adb = new AdbProcess();
connect(adb, &AdbProcess::adbProcessResult, this, [this](AdbProcess::ADB_EXEC_RESULT processResult){
Q_UNUSED(processResult);
sender()->deleteLater();
if (AdbProcess::AER_SUCCESS_START != processResult) {
sender()->deleteLater();
}
});
adb->execute("", QStringList() << "devices");
//adb->setShowTouchesEnabled("P7C0218510000537", true);
}
void Dialog::on_startServerBtn_clicked()
@ -45,9 +47,3 @@ void Dialog::on_stopServerBtn_clicked()
m_videoForm->close();
}
}
void Dialog::keyPressEvent(QKeyEvent *event)
{
qDebug() << event->key();
return QDialog::keyPressEvent(event);
}

View file

@ -26,9 +26,6 @@ private slots:
void on_stopServerBtn_clicked();
protected:
void keyPressEvent(QKeyEvent *event);
private:
Ui::Dialog *ui;