From 43f759a6b0e1e8311d43a750c46b8257d62a9b5e Mon Sep 17 00:00:00 2001 From: Assam Boudjelthia Date: Thu, 7 Oct 2021 11:10:47 +0300 Subject: [PATCH] Android: remove unauthorized field form AndroidDeviceInfo This is not really needed anymore, it was mainly used for physical devices to report whether they need user authorization to be used via adb. This is now handled by IDevice::DeviceState, where a Connected device is unauthorized, otherwise any physical device is ReadyToUse if authorization is good. Change-Id: If5c1e49b98063eabe4205cd8adb5b11515e1e1de Reviewed-by: Alessandro Portale --- src/plugins/android/androiddevice.cpp | 6 ++++++ src/plugins/android/androiddeviceinfo.cpp | 4 ++-- src/plugins/android/androiddeviceinfo.h | 2 -- tests/auto/android/tst_avdmanageroutputparser.cpp | 3 --- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/plugins/android/androiddevice.cpp b/src/plugins/android/androiddevice.cpp index c09966bb19b..a5674313ee6 100644 --- a/src/plugins/android/androiddevice.cpp +++ b/src/plugins/android/androiddevice.cpp @@ -99,6 +99,12 @@ AndroidDeviceWidget::AndroidDeviceWidget(const IDevice::Ptr &device) const auto osString = QString("%1 (SDK %2)").arg(dev->androidVersion()).arg(dev->sdkLevel()); formLayout->addRow(AndroidDevice::tr("OS version:"), new QLabel(osString)); + if (dev->machineType() == IDevice::Hardware) { + const QString authorizedStr = dev->deviceState() == IDevice::DeviceReadyToUse ? tr("Yes") + : tr("No"); + formLayout->addRow(AndroidDevice::tr("Authorized:"), new QLabel(authorizedStr)); + } + if (dev->machineType() == IDevice::Emulator) { const QString targetName = dev->androidTargetName(); formLayout->addRow(AndroidDevice::tr("Android target flavor:"), new QLabel(targetName)); diff --git a/src/plugins/android/androiddeviceinfo.cpp b/src/plugins/android/androiddeviceinfo.cpp index 707ee3a6885..752a710c14d 100644 --- a/src/plugins/android/androiddeviceinfo.cpp +++ b/src/plugins/android/androiddeviceinfo.cpp @@ -57,7 +57,7 @@ bool AndroidDeviceInfo::operator==(const AndroidDeviceInfo &other) const return serialNumber == other.serialNumber && avdname == other.avdname && cpuAbi == other.cpuAbi && avdTarget == other.avdTarget && avdDevice == other.avdDevice && avdSkin == other.avdSkin && avdSdcardSize == other.avdSdcardSize && sdk == other.sdk - && state == other.state && unauthorized == other.unauthorized && type == other.type; + && state == other.state && type == other.type; } QDebug &operator<<(QDebug &stream, const AndroidDeviceInfo &device) @@ -65,7 +65,7 @@ QDebug &operator<<(QDebug &stream, const AndroidDeviceInfo &device) stream << "Type:" << (device.type == ProjectExplorer::IDevice::Emulator ? "Emulator" : "Device") << ", ABI:" << device.cpuAbi << ", Serial:" << device.serialNumber << ", Name:" << device.avdname << ", API:" << device.sdk - << ", Authorised:" << !device.unauthorized; + << ", Authorised:" << (device.state == IDevice::DeviceReadyToUse); return stream; } diff --git a/src/plugins/android/androiddeviceinfo.h b/src/plugins/android/androiddeviceinfo.h index ff4b662191c..b43cbc63426 100644 --- a/src/plugins/android/androiddeviceinfo.h +++ b/src/plugins/android/androiddeviceinfo.h @@ -46,10 +46,8 @@ public: QString avdDevice; QString avdSkin; QString avdSdcardSize; - int sdk = -1; IDevice::DeviceState state = IDevice::DeviceDisconnected; - bool unauthorized = false; IDevice::MachineType type = IDevice::Emulator; static QStringList adbSelector(const QString &serialNumber); diff --git a/tests/auto/android/tst_avdmanageroutputparser.cpp b/tests/auto/android/tst_avdmanageroutputparser.cpp index 059f479fea4..ca3dcda19c5 100644 --- a/tests/auto/android/tst_avdmanageroutputparser.cpp +++ b/tests/auto/android/tst_avdmanageroutputparser.cpp @@ -64,7 +64,6 @@ void tst_AvdManagerOutputParser::parse_data() "512 MB", -1, IDevice::DeviceConnected, - false, IDevice::Emulator}}) << QStringList(); @@ -91,7 +90,6 @@ void tst_AvdManagerOutputParser::parse_data() "512 MB", -1, IDevice::DeviceConnected, - false, IDevice::Emulator}, {"", "TestTablet", @@ -102,7 +100,6 @@ void tst_AvdManagerOutputParser::parse_data() "256 MB", -1, IDevice::DeviceConnected, - false, IDevice::Emulator}}) << QStringList(); }