The new way is much reliable and now we can debug all the libs from very
first start, including static constructors, JNI_OnLoad, etc.
The downside is that the startup is a little bit slower then before.
On a Ryzen 1700X is 2 to 5 seconds slower.
Task-number: QTCREATORBUG-19081
Change-Id: Iacedf7b8aa84de5026f9c81eeca35dd377cf4640
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: hjk <hjk@qt.io>
The Qt/Android runtime does support passing parameters to the
application. We have to pass '-e extraappparams <base64 string>' and
'-e extraenvvars <base64 strings, concatenated by ";">'. This is very
handy and should actually be exposed in the GUI.
Change-Id: I8c84a53ab8f6f07ea5b6e01c902f53385df8b35f
Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
Host and port reasonably belong together, using a QUrl makes that more
explicit and follows the lead of the Qml profiler in that area.
Change-Id: I754cb17d165ce6b2f25c655eeebfd8ac8f5a93c7
Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
Specify the qml server address and use correct default loop back
address in qmlengine
Change-Id: I9b77cb3385041bbe79900e7f7a188ca26124bacc
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Let user specify list of shell commands to run before app starts
and after app quits.
Change-Id: I9794fb96180530ca6c28ce6581fda51a25be28d4
Reviewed-by: hjk <hjk@qt.io>
This moves all of the RunControl implementation into a single
RunWorker, not yet splitting it up into separate RunWorkers
which is the final goal of this series.
Change-Id: I7373105603505aa4fffd7fe5ff0145f0128b34bc
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
- allow the user to choose the visible log levels
- allow the user to choose which activities/service(s) logs are visible
- wakeup the device (API 20+)
- use only the most recent logs (API 21+ add "-T 0" to logcat params)
- use logcat -v time format, which is the same on all Android versions
In the future we can even allow the user to choose which parts of the
log line are visible, e.g. time, log level, TAG, PID, Message
Task-number: QTCREATORBUG-16887
Change-Id: I07ce00aff59a479660f5ac6da75eef973ba3f627
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
This removes the need for blocking queued connections and runAsync(),
reducing the risk of deadlocks and eliminating unguarded concurrent
access to various members of AndroidRunner. No mutex locking is
necessary anymore as all communication between the two threads is
either done on initialization, before the worker thread starts, or
via queued signals.
Change-Id: Icc2fcc2c0ce73d1c226bc4740413e57490d1cbc6
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
We're not using it as QThread.
Change-Id: Ib277325179a46fe7d153ff9d37043f54d0d41037
Reviewed-by: Vikas Pachdha <vikas.pachdha@theqtcompany.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Running SynchronousProcess (for adb) on the GUI thread is dangerous as
it might process unrelated events without returning, breaking
assumptions in other parts of Qt Creator. Rather run those things on a
worker thread, with a separate event loop, like we already do it when
starting processes.
Furthermore, returning, from start() or stop() while a thread is
running that accesses internals of AndroidRunner is also dangerous,
because most methods of AndroidRunner are not protected by relevant
mutexes and especially the destructor might get invoked while the
worker thread is still runnig. Thus, wait for the worker threads to
finish, in start() and stop().
This is a crutch, of course, as with proper locking we could keep the
GUI thread responsive while the adb commands are running, but just
serializing the execution reduces the risk of further breakage for now.
Change-Id: Ife92dc19aa8111374413590c3156027ba759746f
Task-number: QTCREATORBUG-16667
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
If ps is run from a different thread than the GUI thread, then we are
obviously not dealing with the "checkPID" function that's running every
second. We don't need to be overly prudent about starting another
process then. On the other hand, the blocking queued connection relies
on the ps shell not getting closed from a different thread in between
and it is generally a risk for creating dead locks.
Change-Id: Ief49fb18cc3199dc345c4d9ca0ee24b66d33343c
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
waitForFinish returns false if the process is no longer running at
the time of the call. Handle that throughout the codebase.
Change-Id: Ia7194095454e82efbd4eb88f2d55926bdd09e094
Reviewed-by: hjk <hjk@theqtcompany.com>
Don't try to write from another thread into a process stdin. Fixes
"QSocketNotifier: Socket notifiers cannot be enabled or disabled from
another thread" warnings.
Change-Id: Id93a40a6bee6d4042cf600c8fabb06bf965d8ccc
Reviewed-by: hjk <hjk@theqtcompany.com>
This solves the ambiguity between 0 and -1 being the "invalid" port.
Change-Id: I3bac11dd4117bb1820fbd58186699925b73df1c5
Reviewed-by: hjk <hjk@theqtcompany.com>
Creating a QProcess every second is very VERY expensive, making the QtCreator UI
experience pretty bad, the UI was not responsive when debugging or even when
running an Android application from QtCreator.
Thanks to Intel's VTUNE I could spot and fix the problem in minutes.
Change-Id: I6d3dc71db93e91d9846101a1877bab017df41aba
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Using the AndroidRunnable is easy for other plugins to run custom adb
commands before intent is started and after it's stopped.
Change-Id: I012ae87c92cea16aa8074dce2dc6f2b0c4ebeb30
Reviewed-by: hjk <hjk@theqtcompany.com>
The start point is the if (m_useLocalQtLibs) block in AndroidRunner
constructor which seems to be effectless since 8d27ec6 (Android: Fix
debugging applications that link many modules)
Change-Id: I7850c1f53a003553ae1b3fdf0881f4c9fedf7b15
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Android SDK Tools 24.x ship an adb that requires in the 'adb shell'
command an additional level of quotes for parameters with spaces
compared to previous versions. That broke the passing of the
gdbserver start command and consequently debugger startup.
Task-number: QTCREATORBUG-15032
Change-Id: I442355821641d4c6a632b50d1065c442736711aa
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
The services need to be loaded before the first QML engine is created.
The first QML engine may be created before a client connects. When the
JavaScript debug service is loaded the engine is put into interpreter
mode as we don't support debugging in JIT mode. Profiling, however
should be done in JIT mode, whenever possible.
Thus, in order to avoid the loading of unnecessary plugins and to get
better results from the QML profiler we tell the debug server which
services we expect, even before the client connects. Qt 5.6 will support
additional command line arguments to specify the services and this
change uses them.
Change-Id: I6dcee016c39995e9adada6eaf0e39d8299c9b7e7
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Reviewed-by: hjk <hjk@theqtcompany.com>
This provides a way for third-party plugins to implement run
modes without the need to add a value to the central enum or
using manual workarounds like RunMode(*(int*)&someUniqueObject).
Instead of centrally defined enum values this uses Core::Id that could
be defined anywhere.
Change-Id: Ic350e3d8dbb8042c61b2d4ffec993ca151f53099
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Security permissions prevent access to files not owned by the current
process. This patch replaces the file based handshake protocol with
a local server based implementation. The server waits for QTC to connect
to it and sends back the current process ID. This new mechanism works
on pre 5.0 devices as well.
The existing file based handshake remains and can be activiated via the
env variable QTC_ANDROID_USE_FILE_HANDSHAKE.
Task-number: QTCREATORBUG-13418
Change-Id: Ie40ec801f265a9e13c3220f300798c27abd97ae2
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Reviewed-by: BogDan Vatra <bogdan@kde.org>
Use one less signal for result passing.
Change-Id: I6209d248fb01056835ef65b91981b9b2747d6f7f
Reviewed-by: Ulf Hermann <ulf.hermann@digia.com>
Reviewed-by: BogDan Vatra <bogdan@kde.org>
- Split up androiddeployqt into two steps: One building the apk,
and one deploying it to the device.
- The build apk step base class AndroidBuildApkStep is ihneritaged by
the qmake specific class QmakeAndroidBuildApkStep.
- The deployment step is still called androiddeployqt
- Move all qmake specific code to the qmakeprojectmanager plguin
- Flip the depencency between the android and qmake plugin, now
the qmake plugin depends on the android plugin, implementing
a interface the android plugin provides.
- Note: This removes the debug deployment for now.
Change-Id: I1c386640159ed14b637668abde8eb3b9009ab803
Reviewed-by: BogDan Vatra <bogdan@kde.org>
The plan is to eventually move the qmake specific class into the
qmake plugin.
Change-Id: I5653c45ed88b1be296f4963ab4117bbfa791fb85
Reviewed-by: BogDan Vatra <bogdan@kde.org>
There are two different ways we used to stop a application:
am force-stop $packageName or kill -9 applicationPid. As far as I
remember that's because on some devices some one of them didn't work.
The code wasn't consistently using both though. Fix that by making it
one function, which uses both and use that one consistently.
Task-number: QTCREATORBUG-10557
Change-Id: Ib09a51e2bddae8d28a5d234e792906cc03606fda
Reviewed-by: BogDan Vatra <bogdan@kde.org>