From 0586418f8349f3ed5b36dfdc7efec75b4b17a284 Mon Sep 17 00:00:00 2001 From: Assam Boudjelthia Date: Tue, 22 Feb 2022 21:31:12 +0200 Subject: 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 Reviewed-by: --- src/plugins/android/androiddevice.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/plugins/android/androiddevice.cpp b/src/plugins/android/androiddevice.cpp index 1ede608bdd..fbecdc1403 100644 --- a/src/plugins/android/androiddevice.cpp +++ b/src/plugins/android/androiddevice.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include @@ -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. -- cgit v1.2.3