Commit Graph

85 Commits

Author SHA1 Message Date
Jarek Kobus
097b862712 AndroidDeviceManager: Connect to QtcProcess::done() signal
Instead of connecting to errorOccurred() and finished() signals.
Make some cleanup in usages of Utils:: namespace.

Change-Id: I5d784d1938d6aac1dd760c663b60c23378318096
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-04-06 15:48:15 +00:00
Jarek Kobus
9f3941cda3 AndroidDeviceManager: Remove the instance from plugin destructor
Delete the AndroidDeviceManager instance on shutdown from inside
android plugin destructor.

Implement AndroidDeviceManager destructor and wait for
futures currently running to finish. Don't do any special
handling for possibly still running m_adbDeviceWatcherProcess,
as it will be deleted automatically by the std::unique_ptr
and this will automatically initiate a proper termination of the
process running.

Change-Id: I5aad6f4fcfca23a0a37c3709efcdffad43a88203
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-28 11:54:51 +00:00
Assam Boudjelthia
20c0d93f7d Android: add option to connect physical device over wifi
Android's ADB allows connections over wifi, firstly, a port needs
to be opened from the device, then adb commands can be used to
connect the host to the device over an ip and port. Afer that,
a device can be disconnected from USB and the wifi connection
could be used to do all jobs that were done over USB.

The setup operation require the device to be connected via USB.
This can replace the manual process of dealing with ADB commands
to prepare the connection.

The "Setup Wifi" action is only added to Hardware USB devices,
and not AVDs nor physical devices that are already connected over
WiFi.

Change-Id: I37897a528b45cdeee2764071ec45ec1b3316cdbb
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-03-25 09:23:12 +00:00
Jarek Kobus
2d33425cd5 Revert "Android: Make the device watcher process terminate on shutdown"
This reverts commit e45e16d904.

Reason for revert: This one should look different in master

Change-Id: I4fbf3a9d046e5fe5a6a45d5ba93b685f5967498c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-03-18 08:13:25 +00:00
Eike Ziller
e914f42458 Merge remote-tracking branch 'origin/7.0'
Change-Id: I9c4ef46084fd392663c7c21c4ecdbc578ea28577
2022-03-18 08:42:02 +01:00
Alessandro Portale
e45e16d904 Android: Make the device watcher process terminate on shutdown
Terminate on IPlugin::aboutToShutdown instead of
QCoreApplication::aboutToQuit. If needed synchronously.

Added "ADB device watcher started" logging.

Fixes: QTCREATORBUG-27118
Change-Id: I483659b018c74d179b64a5a4f17cc2c27c9598a8
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-03-17 15:12:55 +00:00
Eike Ziller
9fd2a059f6 Merge remote-tracking branch 'origin/7.0'
Conflicts:
	src/plugins/android/androiddevice.cpp
	src/plugins/docker/dockerdevice.cpp

Change-Id: Id16ba0d9993c9f608242622aceae0a2a6691e05e
2022-03-17 08:48:28 +01:00
Alessandro Portale
c170e4fa57 Android: Use const & in a range-based for loop
Change-Id: Ib769d5133383ed30717e479107b6a74c53b72a58
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-03-16 18:33:25 +00:00
Assam Boudjelthia
a141d56991 Android: Don't call getDeviceState() on empty serial number
Avoid calling getDeviceState() if the serial is empty, which
won't give any useful info for emulators. This will avoid
multiple state checks at QC start as well.

Also, set the default new AndroidDevice state as Disconnected,
which reflects better the state of an empty newsly constructed
device which we don't know the state of.

Change-Id: I854e95e28b150f09c3eff6b8a75b2df6bd4aa1ce
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-03-15 09:03:49 +00:00
Assam Boudjelthia
851171f772 Android: rename avdname to avdName in AndroidDeviceInfo
Change-Id: I9f4743b0d9f953f1fa407acfea41345571cb9998
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-03-14 17:48:31 +00:00
Assam Boudjelthia
e5ce9e9e76 Android: Get rid of the avd info fields in AndroidDeviceInfo
The AVD specific fields don't need to be carried out by QtC settings,
these can be read from the AVD's config file when they are needed.

This also is good because those values can change at any time,
either manually or by some other IDE like Android Studio, and thus
we don't really need to manage them ourselves.

The fields in question are: skin name, target name, sdcard size,
openGL status.

Change-Id: I86163500ec2fed035e32ec02ed17e182778db4a7
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-03-14 17:47:55 +00:00
Assam Boudjelthia
0586418f83 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 <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-02-23 17:21:36 +00:00
Eike Ziller
fff5944e65 Fix lupdate issues
When updating translations with
cmake --build . --target ts_de
(or other language ID)

- Qualifying with unknown namespace/class ::PluginSpecPrivate
- <class> lacks Q_OBJECT macro

Change-Id: Ic42d8dffea935e6b10e59223bdedb9a8a4dcf446
Reviewed-by: hjk <hjk@qt.io>
2022-02-23 16:53:00 +00:00
Christian Kandeler
52e26a360b Fix newly introduced warnings
Change-Id: I0b9cf3496d536e1173fbd6587e5b491305eb876c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-02-23 15:26:31 +00:00
Alessandro Portale
477ebd3b61 Android: Fix crash on exit
m_adbDeviceWatcherProcess can be 0 if Android is not set up.

Amends: c43ba1ae32

Change-Id: I90aef197c098f279a6bd3adb0485df74b8be1961
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-02-23 09:03:16 +00:00
Assam Boudjelthia
c43ba1ae32 Monitor Android devices in non-polling method
Use ADB's track-devices command to watch for device
events which would replace the current polling method
with a timer. For AVDs, a QFileSystemWatcher is used
to watch for changes in the AVDs home folder which
would allow updating the AVDs only when a change is done
like edition, deletion, start, stop, even from outside
Qt Creator.

This method would also make device updates faster,
instead of unexpected waits due to timer use.

Task-number: QTCREATORBUG-23991
Change-Id: I08a92252c99c02bc111e597d671f2350817458c7
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-02-22 21:21:53 +00:00
hjk
75ef67615d ProjectExplorer: Remove IDeviceFactory::setCanCreate
That's implicit now by using setCreator()

The Android case looks odd as this is (and was) effectively static
information at startup. This will be addressed in a follow-up patch,
for now keep it functionally equivalent.

Change-Id: I4e6082f88dcd21379186340189acb581caef172a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-02-04 12:10:07 +00:00
hjk
2b6f26dee2 ProjectExplorer: Use a lambda for DeviceFactory::create()
Somewhat slimmer interface on the user code side and follows
existing practice.

Change-Id: I20ed8f5a00591265d32ea9ce93e1f1bbc76d2437
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-01-26 14:51:09 +00:00
Alessandro Portale
9c7b1d39d3 Android: Fix compatibility check in AndroidDevice::canSupportAbis
A typo prevented to check whether a non-armeabi device supports running
armeabi applications.

Change-Id: Ibfdf76f69c1bdf5f4dc1ba73147328a8f7f6ae3f
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-01-15 12:08:18 +00:00
Alessandro Portale
1e693bcc67 Android: Skip device list update no Android Kit is active
This adds workaround to reduce the load added by the update of the
Android device list, which currently happens in a polling style. Skip
an update if (*):
- The current open project is configured with a non-Android kit
- No project is open
- the current project target is null

To summarize the timeline of the timer used here:
- AndroidDeviceManager::setupDevicesWatcher() is called when Creator
is started or when settings are changed. The setup makes the connections
for the timeout and for AVD list future watcher. This will be done once.
If the timer is active it won't be done again, so no duplicate
connections.
- In the setup, the list of devices in updated once.
- On timer timeout, we attempt to update the list, however with
conditions listed in (*) as well as only when an Android adb path is
found.

Fixes: QTCREATORBUG-26547
Change-Id: I13312c4b507ce4e4064adb1c1342f4648f915394
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-11-11 22:31:46 +00:00
Assam Boudjelthia
0079b64b69 Android: don't recreate a new AvdManger
Change-Id: Icc4f2bb2df34aa3497441d6fbd64c6c8fe1394b3
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-11-09 13:16:48 +00:00
Eike Ziller
1a00bb50d4 Android: Fix lupdate issues
Change-Id: I08bdc81eabb082a091f27d2dea44369573946c49
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-10-28 09:41:08 +00:00
Assam Boudjelthia
d5a3435798 Android: drop const from AndroidConfigurations::currentConfig()
Since the config can be expected to modify configuration values
(e.g. setEmulatorArgs()) it shouldn't be const, but can be set
to const whenever creating a reference that is not meant for
modifying the config.

Change-Id: I8c816a5422d4d57afa158c723d908e3a9a9a0db8
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-10-26 18:34:58 +00:00
Assam Boudjelthia
f4db436a7b Android: remove Virtual from the AndroidDeviceFactory
Keep it only Android Device since this title is used in many places
around Qt Creator in different contexts it is better to make it
"Android Device" to not give any unintentional hint that only virtual
devices are covered. Such cases are the project creation wizard and the
kit target device settings.

Task-number: QTCREATORBUG-26477
Change-Id: I8c7224243aec6b8f5b5bf95db8d23b9aecbafca6
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-10-25 10:31:18 +00:00
Assam Boudjelthia
43f759a6b0 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>
2021-10-25 09:22:08 +00:00
Assam Boudjelthia
ec55b1a483 Android: remove AndroidDeviceType and State from AndroidDeviceInfo
No need to have these enums which are now only a duplication of
IDevice::MachineType and IDevice::DeviceState.

Change-Id: Icc3f112f2670c7354bb282b36fad0f0631b9e047
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2021-10-25 09:21:37 +00:00
Assam Boudjelthia
affe3ccf51 Android: Make refresh action device specific
Change-Id: I18386ad88e04696068f5f127cadb7ffcc6f25a56
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-10-25 09:21:22 +00:00
Assam Boudjelthia
6e4d829a40 Android: handle return correct serialNumber for a running avd
AVDs don't get a serial number until they are started, and avdmanager
don't make it easy to get their serial either, so we need to check
the running devices with adb "emu avd name" command and compare.

Change-Id: I3253d25a3461a36eb9918b3c796062bf9e82e0c6
Reviewed-by: hjk <hjk@qt.io>
2021-10-13 14:58:27 +00:00
Christian Kandeler
38b97b404a Fix various compiler warnings
Change-Id: I59db57e8501bbd0d0293ccce1b520df8acc07413
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-10-13 13:56:11 +00:00
Assam Boudjelthia
2de32e3aa8 Android: make sure emulator device actions are emulator specific
Actions like start, erase, and avd arguments are specific to emulator
type devices, so make sure such actions are only in that case.

Task-number: QTCREATORBUG-23991
Change-Id: I9d5ffbd733c31540ab4e3d2a617cad54e70f8f8e
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-10-04 12:19:22 +00:00
Assam Boudjelthia
ba672d1334 Android: Do some refactoring for AvdDialog class
Move some logic for avd creation to the AvdDialog, and some
refactoring and simplification.

Change-Id: Id65e586ab1c0e9e898a04f07d7707371f20da649
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-09-29 10:27:32 +00:00
Assam Boudjelthia
e860871d2a Move AVD Manager from Android Settings to Device Settings
Move AVD management and creation to Qt Creator's DeviceManager
facilities. This allows AVDs to be created from the Devices settings
page and their details and control/action buttons for starting/stopping,
etc. are added there as well. This makes the process similar to other
device types that Qt Creator supports, to get a similar experience.

Task-number: QTCREATORBUG-23991
Change-Id: I16c52b3cc73035e0ee12fd54ae9dad4595c8cda5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-09-27 19:09:05 +00:00
Christian Kandeler
49569574de Fix some warnings about unused variables and functions
Change-Id: I5f0acd9598bc7f3a79963cc4e1b255e2b6fb2e5d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-09-27 08:47:36 +00:00
Assam Boudjelthia
75854d57ef Add Android device details under Devices settings
Add an AndroidDeviceWidget to handle showing details of detected
Android devices, things like name, serial number, api level,
and more specific info for AVDs.

Task-number: QTCREATORBUG-23991
Change-Id: I97637aa0ced78ebd34c37f2b874802914ce44578
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-09-22 08:18:10 +00:00
Assam Boudjelthia
96255208a5 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>
2021-09-21 15:33:40 +00:00
hjk
d08c0f31c4 De-Q_OBJECT-ify most DeviceFactories
WinRt is the odd one out.

Some were using setObjectName, but only used for debug reasons,
not really needed.

Change-Id: I4a370e4694443bc1c455fda4337ef3acfb9259b8
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-01-23 13:32:12 +00:00
Christian Stenger
52106ecfef Android: Remove unused variable and function
Change-Id: I435bbd35c65a099fc202869a674431c11c76b0b9
Reviewed-by: hjk <hjk@qt.io>
2019-12-19 10:12:45 +00:00
Alessandro Portale
b7acfc37b5 Android: Remove "qtlive" support
Productization of Qt Live preview for Android didn't happen.

Change-Id: Ie69d8193afec9b59d859bc65c45d36028247e2b9
Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
2019-12-18 05:46:53 +00:00
Alessandro Portale
b5499f0360 Android: Don't attempt to handle a non-existing qt_live_viewer.apk
This remove 4 failed adb calls if the qt_live_viewer.apk is missing
(which it always is).

Task-number: QTCREATORBUG-23313
Change-Id: I8dbf833b35a9386d8d87f72c043dd019c62b4467
Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
2019-12-04 11:56:19 +00:00
hjk
36d98d4af7 ProjectExplorer: Base IDevice::osType on a data member
Change-Id: I969563e6e62895a51fb4692c8eb0bab278f0ecae
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-08-19 07:44:45 +00:00
Christian Kandeler
45f9c178e1 ProjectExplorer::IDevice: Add a default display name
Task-number: QTCREATORBUG-16281
Change-Id: Ieff929343b5dc3a84d9ecf5f4f0a032cb4ae4076
Reviewed-by: hjk <hjk@qt.io>
2019-08-02 12:23:12 +00:00
hjk
f420788465 ProjectExplorer: Make Device::displayType a data member
Change-Id: If650f660e3b10bc28d575ded07a854f59be26f87
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-06-19 13:44:30 +00:00
hjk
555360c1d4 ProjectExplorer: Use the fromMap(toMap()) pattern to clone devices
Change-Id: Ie6e73f5ef1019907dd311aac116d71f08b5a5202
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-10 12:35:59 +00:00
hjk
9e965409d1 Move IDeviceFactory closer to IDevice implementation
Except for the DesktopDevice, which is kind of special. Also try
a bit to make (and partially fail at doing so) naming and code
structure (#include, use of namespaces) more similar to each other.

Change-Id: I9fe266e706b72c14f59ff03ca1ae02dba3adcc71
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-02-21 13:20:16 +00:00
hjk
da4d395ff4 Android: Cosmetics for AndroidDevice interface
Change-Id: I291f51a3baeb3768428485c63914627c0d91037b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-01-17 16:27:59 +00:00
hjk
3f3eb40417 ProjectExplorer: Introduce a setter for IDevice origin and id
They are not completely orthogonal, so use one function for
now.

This is the step towards streamlining the IDevice::ctor/create
lines of functions.

Change-Id: I1fe9144c45c7da0c9dcbda3bf424e976e0519cd6
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-01-15 13:02:28 +00:00
hjk
09c1c170d2 ProjectExplorer: Use setter for IDevice::type
Second step towards streamlining the IDevice::ctor/create lines
of functions.

Change-Id: I8b0f2270a9f6545ff9419ef8cf44b456c2233223
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-01-14 15:45:00 +00:00
hjk
75bce4332d ProjectExplorer: Use setter for IDevice::machineType
First step towards streamlining the IDevice::ctor/create lines
of functions.

Change-Id: I44226f8a05902cadd40c8820ab67752070d186c0
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-01-14 15:10:51 +00:00
hjk
a3c6d30b75 ProjectExplorer: Simplify IDevice extra device action setup
Function objects are easy nowadays.

Change-Id: Iec2b770b99d8f11b7a090fb3bd51af8aa60f6fe0
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-01-14 12:55:51 +00:00
Orgad Shaneh
bdc2b4b59f Remove hard-coded disabling of debug logs
Instead, set the default level of all logs to QtWarningMsg.

The call to setFilterRules overrides the user preferences in qtlogging.ini.

Change-Id: Id5f6cd550d14ff7f45ae04c5d3110e0bafb0f072
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-10-13 16:36:58 +00:00