diff options
author | Assam Boudjelthia <[email protected]> | 2022-02-22 21:31:12 +0200 |
---|---|---|
committer | Assam Boudjelthia <[email protected]> | 2022-02-23 17:21:36 +0000 |
commit | 0586418f8349f3ed5b36dfdc7efec75b4b17a284 (patch) | |
tree | ffeb8712ee2929c51bc546a75e0c8161d464a466 /src/plugins/android/androiddevice.cpp | |
parent | ef6fbe373fb1463a341f1c88da32c0aa05c3ba39 (diff) |
Android: Differentiate between same devices connected via usb and wifi
ADB allows connecting the same device via USB or WiFi, so we need
to make sure the name of the wifi which appears as a different device,
make sure it does mean something instead of "Name2" as proposed by
default by QC. So this adds the term wifi to the name to make it clear.
Change-Id: I5923ca2430c8b51ae2525744dcc1f803ab976b35
Reviewed-by: Alessandro Portale <[email protected]>
Reviewed-by: <[email protected]>
Diffstat (limited to 'src/plugins/android/androiddevice.cpp')
-rw-r--r-- | src/plugins/android/androiddevice.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/plugins/android/androiddevice.cpp b/src/plugins/android/androiddevice.cpp index 1ede608bdd1..fbecdc14033 100644 --- a/src/plugins/android/androiddevice.cpp +++ b/src/plugins/android/androiddevice.cpp @@ -53,6 +53,7 @@ #include <QMessageBox> #include <QPushButton> #include <QTimer> +#include <QRegularExpression> #include <utils/qtcprocess.h> @@ -716,7 +717,14 @@ void AndroidDeviceManager::HandleDevicesListChange(const QString &serialNumber) devMgr->setDeviceState(avdId, state); } else { const Utils::Id id = Utils::Id(Constants::ANDROID_DEVICE_ID).withSuffix(':' + serial); - const QString displayName = AndroidConfigurations::currentConfig().getProductModel(serial); + QString displayName = AndroidConfigurations::currentConfig().getProductModel(serial); + // Check if the device is connected via WiFi. A sample serial of such devices can be + // like: "192.168.1.190:5555" + const QRegularExpression wifiSerialRegExp( + QLatin1String("(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}):(\\d{1,5})")); + if (wifiSerialRegExp.match(serial).hasMatch()) + displayName += QLatin1String(" (WiFi)"); + if (IDevice::ConstPtr dev = devMgr->find(id)) { // DeviceManager doens't seem to have a way to directly update the name, if the name // of the device has changed, remove it and register it again with the new name. |