Change device selection mechanism on Android

Currently, on deploy/debug steps on Android, an AndroidDeviceDialog
is popped up each time a deployement is done to select a device. This
can be avoidable by using Qt Creator DeviceKitAspect to have the list
of devices easily selectable from the project mini-menu.

This is better than the current way because it:
* reduces the time from deployment to running the app
* reduces the number of clicks
* avoids having to select the same device each time or
* if a default device is selected, this avoids having to go to project
settings to reset the default device to be able to deploy to a new
device.
* it looks cleaner and more compatible with Creator.

Task-number: QTCREATORBUG-23991
Change-Id: Ida4ab7245c1a3b0ca26c5ccdc9a21a072edf0725
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Assam Boudjelthia
2021-08-22 01:51:57 +03:00
parent 15b6eaa47b
commit 96255208a5
19 changed files with 420 additions and 1074 deletions

View File

@@ -26,12 +26,13 @@
#include "androidrunner.h"
#include "androidavdmanager.h"
#include "androidconfigurations.h"
#include "androidconstants.h"
#include "androiddeployqtstep.h"
#include "androidconfigurations.h"
#include "androidrunconfiguration.h"
#include "androiddevice.h"
#include "androidmanager.h"
#include "androidavdmanager.h"
#include "androidrunconfiguration.h"
#include "androidrunnerworker.h"
#include <coreplugin/messagemanager.h>
@@ -39,6 +40,7 @@
#include <projectexplorer/projectexplorersettings.h>
#include <projectexplorer/runconfigurationaspects.h>
#include <projectexplorer/target.h>
#include <qtsupport/qtkitinformation.h>
#include <utils/url.h>
#include <QHostAddress>
@@ -185,9 +187,9 @@ void AndroidRunner::launchAVD()
int deviceAPILevel = AndroidManager::minimumSDK(m_target);
QStringList androidAbis = AndroidManager::applicationAbis(m_target);
// Get AVD info.
AndroidDeviceInfo info = AndroidConfigurations::showDeviceDialog(
m_target->project(), deviceAPILevel, androidAbis);
// Get AVD info
const IDevice::ConstPtr device = DeviceKitAspect::device(m_target->kit());
AndroidDeviceInfo info = AndroidDevice::androidDeviceInfoFromIDevice(device.data());
AndroidManager::setDeviceSerialNumber(m_target, info.serialNumber);
emit androidDeviceInfoChanged(info);
if (info.isValid()) {