aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/android/androiddevice.cpp36
-rw-r--r--src/plugins/android/androiddevice.h9
-rw-r--r--src/plugins/android/androidplugin.cpp13
-rw-r--r--src/plugins/android/androidplugin.h3
4 files changed, 10 insertions, 51 deletions
diff --git a/src/plugins/android/androiddevice.cpp b/src/plugins/android/androiddevice.cpp
index d0b782df442..8609fc7a89f 100644
--- a/src/plugins/android/androiddevice.cpp
+++ b/src/plugins/android/androiddevice.cpp
@@ -35,8 +35,6 @@
#include <coreplugin/icore.h>
-#include <extensionsystem/iplugin.h>
-
#include <projectexplorer/devicesupport/devicemanager.h>
#include <projectexplorer/devicesupport/idevicewidget.h>
#include <projectexplorer/kitinformation.h>
@@ -590,8 +588,6 @@ void AndroidDeviceManager::setupDevicesWatcher()
m_adbDeviceWatcherProcess->setCommand(command);
m_adbDeviceWatcherProcess->setEnvironment(AndroidConfigurations::toolsEnvironment(m_androidConfig));
m_adbDeviceWatcherProcess->start();
- qCDebug(androidDeviceLog).noquote() << "ADB device watcher started:"
- << command.toUserOutput();
// Setup AVD filesystem watcher to listen for changes when an avd is created/deleted,
// or started/stopped
@@ -615,28 +611,6 @@ void AndroidDeviceManager::setupDevicesWatcher()
updateAvdsList();
}
-void AndroidDeviceManager::shutdownDevicesWatcher()
-{
- m_avdsFutureWatcher.waitForFinished();
- m_removeAvdFutureWatcher.waitForFinished();
-
- if (m_adbDeviceWatcherProcess) {
- m_adbDeviceWatcherProcess->terminate();
- m_adbDeviceWatcherProcess->waitForFinished();
- m_adbDeviceWatcherProcess.reset();
-
- // Despite terminate/waitForFinished, the process may still
- // be around and remain if Qt Creator finishes too early.
- QTimer::singleShot(1000, this, [this] { emit devicesWatcherShutdownFinished(); });
- }
-}
-
-ExtensionSystem::IPlugin::ShutdownFlag AndroidDeviceManager::devicesShutdownFlag() const
-{
- return m_adbDeviceWatcherProcess ? ExtensionSystem::IPlugin::AsynchronousShutdown
- : ExtensionSystem::IPlugin::SynchronousShutdown;
-}
-
void AndroidDeviceManager::HandleAvdsListChange()
{
DeviceManager *const devMgr = DeviceManager::instance();
@@ -790,6 +764,16 @@ AndroidDeviceManager::AndroidDeviceManager(QObject *parent)
m_androidConfig(AndroidConfigurations::currentConfig()),
m_avdManager(m_androidConfig)
{
+ connect(qApp, &QCoreApplication::aboutToQuit, this, [this]() {
+ if (m_adbDeviceWatcherProcess) {
+ m_adbDeviceWatcherProcess->terminate();
+ m_adbDeviceWatcherProcess->waitForFinished();
+ m_adbDeviceWatcherProcess.reset();
+ }
+ m_avdsFutureWatcher.waitForFinished();
+ m_removeAvdFutureWatcher.waitForFinished();
+ });
+
connect(&m_removeAvdFutureWatcher, &QFutureWatcherBase::finished,
this, &AndroidDeviceManager::handleAvdRemoved);
}
diff --git a/src/plugins/android/androiddevice.h b/src/plugins/android/androiddevice.h
index 574e2756f1a..d10663e1590 100644
--- a/src/plugins/android/androiddevice.h
+++ b/src/plugins/android/androiddevice.h
@@ -30,8 +30,6 @@
#include "androidconfigurations.h"
#include "androiddeviceinfo.h"
-#include <extensionsystem/iplugin.h>
-
#include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/devicesupport/idevicefactory.h>
@@ -108,13 +106,9 @@ private:
class AndroidDeviceManager : public QObject
{
- Q_OBJECT
-
public:
static AndroidDeviceManager *instance();
void setupDevicesWatcher();
- void shutdownDevicesWatcher();
- ExtensionSystem::IPlugin::ShutdownFlag devicesShutdownFlag() const;
void updateAvdsList();
IDevice::DeviceState getDeviceState(const QString &serial, IDevice::MachineType type) const;
void updateDeviceState(const ProjectExplorer::IDevice::ConstPtr &device);
@@ -126,9 +120,6 @@ public:
QString getRunningAvdsSerialNumber(const QString &name) const;
-signals:
- void devicesWatcherShutdownFinished();
-
private:
AndroidDeviceManager(QObject *parent = nullptr);
void HandleDevicesListChange(const QString &serialNumber);
diff --git a/src/plugins/android/androidplugin.cpp b/src/plugins/android/androidplugin.cpp
index bda2f80587e..3207b0c38a4 100644
--- a/src/plugins/android/androidplugin.cpp
+++ b/src/plugins/android/androidplugin.cpp
@@ -160,19 +160,6 @@ bool AndroidPlugin::initialize(const QStringList &arguments, QString *errorMessa
return true;
}
-AndroidPlugin::ShutdownFlag AndroidPlugin::aboutToShutdown()
-{
- AndroidDeviceManager *dm = AndroidDeviceManager::instance();
- const IPlugin::ShutdownFlag sf = dm->devicesShutdownFlag();
-
- if (sf == AsynchronousShutdown)
- connect(dm, &AndroidDeviceManager::devicesWatcherShutdownFinished,
- this, &ExtensionSystem::IPlugin::asynchronousShutdownFinished);
-
- dm->shutdownDevicesWatcher();
- return sf;
-}
-
void AndroidPlugin::kitsRestored()
{
const bool qtForAndroidInstalled
diff --git a/src/plugins/android/androidplugin.h b/src/plugins/android/androidplugin.h
index 3d46ca08674..d4ad726cf05 100644
--- a/src/plugins/android/androidplugin.h
+++ b/src/plugins/android/androidplugin.h
@@ -44,9 +44,6 @@ class AndroidPlugin final : public ExtensionSystem::IPlugin
class AndroidPluginPrivate *d = nullptr;
-public:
- ShutdownFlag aboutToShutdown() final;
-
#ifdef WITH_TESTS
private slots:
void testAndroidSdkManagerProgressParser_data();