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 <alessandro.portale@qt.io>
This commit is contained in:
Assam Boudjelthia
2021-10-07 11:10:47 +03:00
parent ec55b1a483
commit 43f759a6b0
4 changed files with 8 additions and 7 deletions

View File

@@ -99,6 +99,12 @@ AndroidDeviceWidget::AndroidDeviceWidget(const IDevice::Ptr &device)
const auto osString = QString("%1 (SDK %2)").arg(dev->androidVersion()).arg(dev->sdkLevel()); const auto osString = QString("%1 (SDK %2)").arg(dev->androidVersion()).arg(dev->sdkLevel());
formLayout->addRow(AndroidDevice::tr("OS version:"), new QLabel(osString)); 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) { if (dev->machineType() == IDevice::Emulator) {
const QString targetName = dev->androidTargetName(); const QString targetName = dev->androidTargetName();
formLayout->addRow(AndroidDevice::tr("Android target flavor:"), new QLabel(targetName)); formLayout->addRow(AndroidDevice::tr("Android target flavor:"), new QLabel(targetName));

View File

@@ -57,7 +57,7 @@ bool AndroidDeviceInfo::operator==(const AndroidDeviceInfo &other) const
return serialNumber == other.serialNumber && avdname == other.avdname && cpuAbi == other.cpuAbi return serialNumber == other.serialNumber && avdname == other.avdname && cpuAbi == other.cpuAbi
&& avdTarget == other.avdTarget && avdDevice == other.avdDevice && avdTarget == other.avdTarget && avdDevice == other.avdDevice
&& avdSkin == other.avdSkin && avdSdcardSize == other.avdSdcardSize && sdk == other.sdk && 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) 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") stream << "Type:" << (device.type == ProjectExplorer::IDevice::Emulator ? "Emulator" : "Device")
<< ", ABI:" << device.cpuAbi << ", Serial:" << device.serialNumber << ", ABI:" << device.cpuAbi << ", Serial:" << device.serialNumber
<< ", Name:" << device.avdname << ", API:" << device.sdk << ", Name:" << device.avdname << ", API:" << device.sdk
<< ", Authorised:" << !device.unauthorized; << ", Authorised:" << (device.state == IDevice::DeviceReadyToUse);
return stream; return stream;
} }

View File

@@ -46,10 +46,8 @@ public:
QString avdDevice; QString avdDevice;
QString avdSkin; QString avdSkin;
QString avdSdcardSize; QString avdSdcardSize;
int sdk = -1; int sdk = -1;
IDevice::DeviceState state = IDevice::DeviceDisconnected; IDevice::DeviceState state = IDevice::DeviceDisconnected;
bool unauthorized = false;
IDevice::MachineType type = IDevice::Emulator; IDevice::MachineType type = IDevice::Emulator;
static QStringList adbSelector(const QString &serialNumber); static QStringList adbSelector(const QString &serialNumber);

View File

@@ -64,7 +64,6 @@ void tst_AvdManagerOutputParser::parse_data()
"512 MB", "512 MB",
-1, -1,
IDevice::DeviceConnected, IDevice::DeviceConnected,
false,
IDevice::Emulator}}) IDevice::Emulator}})
<< QStringList(); << QStringList();
@@ -91,7 +90,6 @@ void tst_AvdManagerOutputParser::parse_data()
"512 MB", "512 MB",
-1, -1,
IDevice::DeviceConnected, IDevice::DeviceConnected,
false,
IDevice::Emulator}, IDevice::Emulator},
{"", {"",
"TestTablet", "TestTablet",
@@ -102,7 +100,6 @@ void tst_AvdManagerOutputParser::parse_data()
"256 MB", "256 MB",
-1, -1,
IDevice::DeviceConnected, IDevice::DeviceConnected,
false,
IDevice::Emulator}}) IDevice::Emulator}})
<< QStringList(); << QStringList();
} }