From 1ac403bacbe05d056c67fa7cb187382670cc20d1 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 28 Oct 2024 18:32:46 +0100 Subject: [PATCH] Android: Implement portsgatherer This seems to make Qml profiling work again. Change-Id: I3169e9dcfc30b72e520afca8fd24ddc59562bf5a Reviewed-by: Jarek Kobus --- src/plugins/android/androiddevice.cpp | 16 ++++++++++++++++ src/plugins/android/androiddevice.h | 1 + 2 files changed, 17 insertions(+) diff --git a/src/plugins/android/androiddevice.cpp b/src/plugins/android/androiddevice.cpp index 6a0779202b4..ffcd74b2be1 100644 --- a/src/plugins/android/androiddevice.cpp +++ b/src/plugins/android/androiddevice.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -624,6 +625,21 @@ DeviceProcessSignalOperation::Ptr AndroidDevice::signalOperation() const return DeviceProcessSignalOperation::Ptr(new AndroidSignalOperation()); } +PortsGatheringMethod AndroidDevice::portsGatheringMethod() const +{ + return { + // Triggered for QmlProfiler + [this](QAbstractSocket::NetworkLayerProtocol protocol) -> CommandLine { + Q_UNUSED(protocol); + return {AndroidConfig::adbToolPath(), { + AndroidDeviceInfo::adbSelector(serialNumber()), + "shell" , "netstat", "-a", "-n" + }}; + }, + &Port::parseFromCommandOutput + }; +} + QUrl AndroidDevice::toolControlChannel(const ControlChannelHint &) const { QUrl url; diff --git a/src/plugins/android/androiddevice.h b/src/plugins/android/androiddevice.h index a5f4997dbd4..7896fbc9705 100644 --- a/src/plugins/android/androiddevice.h +++ b/src/plugins/android/androiddevice.h @@ -59,6 +59,7 @@ private: ProjectExplorer::IDeviceWidget *createWidget() override; ProjectExplorer::DeviceProcessSignalOperation::Ptr signalOperation() const override; QUrl toolControlChannel(const ControlChannelHint &) const override; + ProjectExplorer::PortsGatheringMethod portsGatheringMethod() const override; QSettings *avdSettings() const; void initAvdSettings();