summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android
Commit message (Collapse)AuthorAgeFilesLines
* Android: Fix the offset of the EditPopupMenuPekka Gehör2022-06-291-3/+14
| | | | | | | | | | | Fix the offset of the EditPopupMenu on application window. Issue caused by a5bb7b3ca510c301baf84e1dd46d5aeeb4986eb2 Fixes: QTBUG-71900 Change-Id: Ib95e1544fe91c273bc5317bd338a50a74fb1090a Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 526d62ee90d549177920eb567cb951c4b553c630) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix tst_AndroidAssets, broken by recent changes on assets load speedLouis du Verdier2022-06-201-4/+5
| | | | | | | | | | | | | | | | | | | | | | | Recent changes on load speed of individual assets made AndroidAbstractFileEngine use a cache for basic information in order to avoid to have to open assets every time a QFileInfo is created, which was very expensive for older phones. However, size() method was forgotten and continued to expect that the asset would be opened first, and therefore QFileInfo().size() would always return -1. This change fixes this by caching as well the information about the size of the asset, and also reverts a part in open() to close() first in case asset would already be opened, in order to keep previous behavior (even if this did not cause any known issue). Fixes: QTBUG-104412 Change-Id: I992f31b8f9e14dfec44cec78d0c1a2a3e18bdb7f Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit d7068eaad7c180c814a766c91cebee25f04513a6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Android: Improve loading speed of individual assetsLouis du Verdier2022-06-151-18/+46
| | | | | | | | | | | | | | | | | | | | | | | This change improves the loading speed of files stored in Android assets folder by caching the information about files already opened. Prior to the change, when creating a QFile or QFileInfo to an asset file, the engine would first scan all the file's directory and parent directories in order to cache all this in FolderIterator::m_assetsCache. Due to the nature of Android assets, it might be very slow, depending on the number of images in this tree. In this patch, individual file accesses will stop using FolderIterator and will simply open what is asked, caching the information about the resource in order to avoid to have to call the expensive AAssetManager_open if the file is accessed again (e.g. by QFileInfo). Fixes: QTBUG-101161 Change-Id: Iaedf4cdf83d5116053b51895a6795d43bc60f942 Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> (cherry picked from commit edd983071e0a90ee8665d2f45916fb575fc25857) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Replace QT_NO_ACCESSIBILITY with QT_CONFIG(accessibility)Allan Sandfeld Jensen2022-06-152-8/+8
| | | | | | | | Change-Id: Iee4bd8970810be1b23bdba65a74de912401dca65 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Marc Mutz <marc.mutz@qt.io> (cherry picked from commit f53f7095044275767e389d16aabad5ff7144ec9f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Return specific types for frequently used Java objectsVolker Hilsheimer2022-05-172-6/+7
| | | | | | | | | | | | | | | | | | This allows us to specialize JNI type signature templates for e.g. the context object, which in Java signatures is "android/content/Context". Introduce a Q_DECLARE_JNI_TYPE macro that takes care of the plumbing. The types declared this way live in the QtJniTypes namespace, and transparently convert from and to jobject. Since jobject is a typedef to _jobject* we cannot create a subclass. Use a "Object" superclass that we can provide a QJniObject constructor for so that we don't require the QJniObject declaration to be able to use the macro. The APIs in the QNativeInterface namespace doesn't provide source or binary compatibility guarantees, so we can change the return types. Change-Id: I4cf9fa734ec9a5550b6fddeb14ef0ffd72663f29 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-1665-2495/+155
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Android A11Y: handle LocationChanged event only for focused elementIvan Solovev2022-05-165-7/+8
| | | | | | | | | | | | | | | | | | LocationChanged event unconditionally triggered invalidateVirtualViewId call. That call results in TYPE_WINDOW_CONTENT_CHANGED Android event, which causes a lot of background processing. That is not correct, because LocationChanged event is generated by every accessible element, not only the one that has A11Y focus. This patch checks event->uniqueId(), and processes only events that come from the focused accessible element. Done-with: Mike Achtelik <mike.achtelik@gmail.com> Task-number: QTBUG-102594 Pick-to: 6.3 6.2 5.15 Change-Id: I6b941733c9d215fed5ee5a7aeeb5be234add9ebe Reviewed-by: Mike Achtelik <mike.achtelik@gmail.com> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Remove noop calls to QPlatformInputContext base classTor Arne Vestbø2022-04-291-1/+0
| | | | | | | | | | | | | | Like most QPlatformFoo base classes the default implementations are empty, or have default behavior that should be completely replaced by subclasses. By making it consistent across all the platform plugins when we call base class methods, we avoid confusion of whether a base class call is needed or not. Change-Id: Idd8e4a6fa0e24a1dffd21b63471c9b1c2348691f Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Android: fix A11Y object descriptionIvan Solovev2022-04-211-4/+7
| | | | | | | | | | | | | | | | | This patch amends a374d59abc415eee1866322176b7762158f48abd. That commit introduced refactoring of A11Y object description announcements that also took a value into account. However for the elements without values (like QPushButton), an unused space is added at the end of the description. This patch fixes the issue by explicitly checking that the value interface exists and that the value string is not empty. Fixes: QTBUG-102744 Pick-to: 6.3 6.2 5.15 Change-Id: Ic1ba50859fb91c871c242189967dcce35723a0b2 Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
* Replace uses of _qs with _s in sources and examplesSona Kurazyan2022-04-191-2/+4
| | | | | | Task-number: QTBUG-101408 Change-Id: I48360ba3b23965cd3d90ac243c100a0656a4cde8 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Android: replace remaining uses of QLatin1String with QLatin1StringViewSona Kurazyan2022-04-141-2/+2
| | | | | | | | Task-number: QTBUG-98434 Change-Id: I35a97eef61746039738b4a5f2271c3bffd5711b4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-04-149-62/+78
| | | | | | Task-number: QTBUG-98434 Change-Id: I5ee5fe079c9a4530f636e59f6171abfa523591f4 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: stop using QLatin1Char constructor for creating char literalsSona Kurazyan2022-04-148-30/+30
| | | | | | | | | | | Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. As a drive-by, fix qsizetype -> int narrowing conversion warnings for the touched lines. Change-Id: Iebcbdbd7cecac09d0a7039e3ef6a4509d33039ba Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: Don't assert in add/removeWindowAssam Boudjelthia2022-04-121-4/+6
| | | | | | | | | | | | No need to assert, returning when the window is already added or not removed is enough. Pick-to: 6.2 6.3 Fixes: QTBUG-100173 Change-Id: Id491f17612ce42c4e26e9d41ad38f0a6372775bd Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Android: wrap QAndroidInputContext's m_focusObject in a QPointerAssam Boudjelthia2022-04-121-1/+1
| | | | | | | | | | | To make sure we don't end up use a dangling pointer for m_focusObject. Pick-to: 6.2 6.3 5.15 Task-number: QTBUG-102447 Change-Id: I75058040be109a39f830bc706efe85969ffbc8ec Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix crash in tst_qmltc_examples on AndroidAndreas Buhr2022-04-081-1/+1
| | | | | | | | | | | | | | | tst_qmltc_examples failed because m_accessibilityContext could become a dangling pointer if the object in points to gets deleted. This resulted in a crash. Amends e0c61193ea8f6462192d2ef7f1d48d8fa3e38c99. Task-number: QTBUG-101865 Task-number: QTBUG-95764 Pick-to: 6.3 6.2 5.15 Change-Id: Ie85118429b1afa6e4a41f899ca065f493e166570 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: Fix deadlock caused by a race between permissions query and IMJarkko Koivikko2022-04-053-54/+5
| | | | | | | | | | | | | | | | Android permissions query blocks Qt main thread. If the input method was activated before the permissions query started, android would try to invoke input method before returning back to permissions query. This will cause a deadlock. Fix the issue by moving the deadlock counter to Qt core and incrementing the value before the permissions query. This will prevent the input method queries to enter Qt main thread. Fixes: QTBUG-99484 Pick-to: 6.2 6.3 6.3.0 Change-Id: I54ea59578880cde4095c26fa2a6a264c4dc1b7ff Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: minor code refactorings for QAndroidPlatformMessageDialogHelperAssam Boudjelthia2022-04-012-30/+36
| | | | | Change-Id: Ia42450a5c3ebc2f608bae599f03246464136ca06 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Android: hide() in the QAndroidPlatformMessageDialogHelper destructorAssam Boudjelthia2022-04-012-0/+7
| | | | | | | | | | | | The native dialog window is not being hidden or destroyed when the QAndroidPlatformMessageDialogHelper object is destroyed. This makes sure to not leave any native dialogs open. Pick-to: 6.2 6.3 6.3.0 Task-number: QTBUG-97482 Fixes: QTBUG-101758 Change-Id: I2e50caebd286ea6abd3e948a4873dc3c971626a4 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Android A11Y: Add supported role infos to A11yNodeInfoMike Achtelik2022-03-281-1/+9
| | | | | | | | | | This allows the screen reader to pick up on them and give additional info e.g. that text links which are now added automatically since QTBUG-67878 are clickable. Pick-to: 6.3 6.2 5.15 Change-Id: I96d8dd628d10b26b4c9ffee15dfa01a9abef61b1 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: Keep the ParcelFileDescriptor open for content urisJarkko Koivikko2022-03-252-5/+26
| | | | | | | | | | | | | | Detaching fd and closing the ParcelFileDescriptor prevents IO with the services like Google Drive on Android. Instead, the file system should keep the ParcelFileDescriptor open while the IO operations take place and close it manually. Also, prevent Qt from closing the handle for us. Pick-to: 6.2 6.3 Fixes: QTBUG-101996 Change-Id: Ie54c04ad5aa1e7ee5444a04c30ac1323f73047bb Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Misc: Do not depend on transitive includesFabian Kosmale2022-03-172-0/+3
| | | | | | | | As a drive-by, remove superfluous includes from qnetworkmanagerservice.h and obey the coding conventions for includes in a few more places. Change-Id: I65b68c0cef7598d06a125e97637040392d4be9ff Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Android: guard against potential null pointer accessAssam Boudjelthia2022-03-152-18/+24
| | | | | | | | | | | | androidPlatformIntegration might be called before setAndroidPlatformIntegration() is called, and also all other uses of androidPlatformIntegration is already guarded in our code. Pick-to: 6.2 6.3 Task-number: QTBUG-100470 Change-Id: Ifd7d36ba7f2f3b55652466825d7fd84c87ec5e19 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Fix quick file dialog on androidSamuel Mira2022-03-091-0/+2
| | | | | | | | | | | | | | | | Patch 13399bd54d084ed837ec061ca9315dbd173f3b48 removed the accept handler on QQuickFileDialog, which was triggering setSelectFiles on android. So changed qandroidplatformfiledialoghelper to also emit currentChanged which will trigger the QQuickFileDialog to setSelectFiles since there is a connect to that signal. Emitting currentChanged signal is also the signal used in others QPlatformFileDialogHelpers. Fixes: QTBUG-101013 Pick-to: 6.3 Change-Id: I22f2d583f4be26a83e1c19190458fb5011e40095 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Android: terminate argv passed to main() with nullptrAssam Boudjelthia2022-03-051-4/+6
| | | | | | | | | | | | the char array of argv passed to the app's main() function need to be null terminated [*] and argv to be **char. [*] http://eel.is/c++draft/basic.start.main#2 Fixes: QTBUG-101028 Pick-to: 6.2 6.3 5.15 Change-Id: I6e3a685f092a92a94f60d166357b75d2538af74c Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Android: make sure that orientationChange is reported after resizeIvan Solovev2022-03-043-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Android orientation changes are reported from the DisplayListener.onDisplayChanged() method, while the screen size changes are reported from QtLayout.onSizeChanged(). In practice these callbacks come in random order, so rotating the screen multiple times might result in inconsistent order of signals and events. This patch makes sure that size change events always happen before orientation changes. This is done by caching the new orientation values and reporting them only when needed. At this point we also need to use QMetaObject::invokeMethod() for orientation change, like it is done for geometry change. Otherwise the orientation update can still be processed earlier than the geometry change. Also note that at some point we might get an orientation change without a size change (for example Qt::LandscapeOrientation -> Qt::InvertedLandscapeOrientation). That is the reason for isSimilarRotation() helper function. As a drive-by: ignore size changes with inconsistent values when window size is reported to have old orientation, while the screen has already been rotated. In such cases a new size change will be triggered shortly with normal value. Task-number: QTBUG-94459 Pick-to: 6.3 6.2 5.15 Change-Id: I5c98e526d0370d380344b2297169d5e0c0ee8ea7 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: set all QScreen's geometry-related parameters togetherIvan Solovev2022-03-045-11/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | Screen has 3 parameters: - physical size - screen size (or screen geometry) - available geometry Before this patch, they were reported in 3 different methods. Screen size update and available geometry update both were generating the "screen geometry changed" event, that updated the user-visible parameters. As a result, at some point we could end up in an intermediate state, when screen size was already updated, but available geometry was not yet updated. This was specially visible while changing the screen orientation: at some point screen geometry could be reported for the new orientation, while the available geometry - still for old orientation. This patch introduces a new method to set all geometry-related parameters together and generate only one "screen geometry changed" event. This allows to maintain consistency between 'geometry' and 'availableGeometry' properties of QScreen. Task-number: QTBUG-94459 Pick-to: 6.3 6.2 5.15 Change-Id: I844f6d0db87df8d5e6e9bcce5d27126384a5a0de Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: Fix issue in loading multimedia Android pluginSamuel Mira2022-03-021-13/+2
| | | | | | | | | | | | | | Qt projects on Android were failing to correctly load the plugin lib. The main reason is missing environment variables when the media integration starts. To make sure that the variables are loaded, I have change the setenv to be done in the java side instead of c++ side. Fixes: QTBUG-100299 Pick-to: 6.3 Change-Id: Iba0b6af40574be2d88824ebdcfb1626335cecf09 Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android A11Y: Fix value roundingIvan Solovev2022-02-151-2/+44
| | | | | | | | | | | | | | | | | | | | | | | QAccessibleInterface stores values as QVariants. When dealing with double values, as a result of some calculation (for example, Slider value update), rounding errors can be introduced. When converting double values to QString using QVariant::toString(), these rounding errors result in strings like 0.30000000000000004 instead of 0.3 or 2.7755575615628914e-17 instead of 0.3 - 3 * 0.1 and similar zeroes. To fix this issue, this patch introduces a custom conversion for floating-point values. The idea is to convert QVariant to double, and then convert double to QString using 'f' format and a suitable precision, determined from the UI element's minimumStepSize(), if it has one, otherwise falling back to QString::number()'s default (which is 6). Task-number: QTBUG-93396 Pick-to: 6.3 6.2 5.15 Change-Id: Ia5ca7345812e39629e9c191b6d8b896a8f51de80 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android A11Y: Announce value together with element name when focusedIvan Solovev2022-02-151-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this patch when we focus a new element, only its description was announced. For elements like Slider that means that if it had no accessible name or description, its value would be announced (all is fine here). But if the slider is defined like that: Slider { Accessible.name: "int slider" value: 5 from: 0 to: 20 stepSize: 1 } only the name ("int slider") will be announced, but not the actual value. This patch fixes the logic of content description generation. If the element has value, then it is added to the description and announced as well. Task-number: QTBUG-93396 Pick-to: 6.3 6.2 5.15 Change-Id: Ia8667149ebd867945c5f57d951fd6ade0f382598 Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android A11Y: handle valueChanged eventsIvan Solovev2022-02-155-3/+40
| | | | | | | | | | | | | | | | | | | | | Before this patch Android A11Y implementation was missing ValueChanged event handling. As a result, no update was given when the element's value was changed. Handling these events allows us to announce value changes on such objects like Slider, SpinBox, etc... This is a universal method of value-change announcement, so it supports all sorts of A11Y gestures. On the Java side a new function was introduced to announce the values, because we need to use the actual element's *value*, not its accessible name or description. Task-number: QTBUG-93396 Pick-to: 6.3 6.2 5.15 Change-Id: Ic44abd5f01b9b6f5468962131466edaf6a49d498 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
* Make Droid Sans Mono available as fixed font for all Android stylesAndreas Buhr2022-02-141-0/+5
| | | | | | | Fixes: QTBUG-87405 Change-Id: I54ebc06c82c32acd0383ea5fedf78acce4e11977 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Set Roboto as the default font on AndroidAndreas Buhr2022-02-102-0/+6
| | | | | | | | | Roboto is the default font on Android. So far, Helvetica was used, which is usually unavailable on Android. Task-number: QTBUG-87405 Change-Id: I53332403a43f6a005ce73ece68b8dddc41b4b58c Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android A11Y: execute C++ code on main Qt threadIvan Solovev2022-02-094-47/+191
| | | | | | | | | | | | | | | | | | | | | | The C++ code, which is called from Java, was executed on Java thread. However Qt has its own main GUI thread, where all GUI elements and their accessibility instances are created. As a result we have threading issues when accessing A11Y objects from Java thread. This patch uses QMetaObject::invokeMethod calls to dispatch all the critical parts of the C++ code to the main thread. It uses BlockingQueuedConnection, so that Java thread can still use these methods synchronously. The proper context is based on the m_accessibilityContext object, which is created as a child of the base accessibility QObject of the application (which is the QGuiApplication instance in most cases). Task-number: QTBUG-95764 Pick-to: 6.3 6.2 5.15 Change-Id: Iff4f3f2645657f6aca426fa19ccc86a2cbe4d4d0 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
* Android: extract parentId for hidden object in advanceIvan Solovev2022-02-093-4/+9
| | | | | | | | | | | | | | | | | | This commit amends 850a7f1238e84b6960a84e12687e40cf939a44d9. We can't extract the parentId for the hidden object on Java side, because the Java call is executed in a separate thread, so the original hidden object can be destroyed somewhere in the middle of parentId() call. As a workaround, we get the parentId in advance, on C++ side, and pass it as a parameter to JNI function. Task-number: QTBUG-95764 Pick-to: 6.3 6.2 5.15 Change-Id: Ied2ab4ab39b947f3f582575cf77cc76fbac9e274 Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* [Android]: Handle the screen name, modes and refreshRate properlyBogDan Vatra2022-01-285-45/+108
| | | | | | | | | Fixes: QTBUG-87136 Fixes: QTBUG-93823 Fixes: QTBUG-94959 Pick-to: 6.3 6.2 5.15 Change-Id: Id480e22611ec949b5e3ee780fc695fb502a5950c Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* QAbstractFileEngine: Add permission argument to open()Ievgenii Meshcheriakov2021-12-043-4/+8
| | | | | | | | | The new argument allows atomic creation of files with non-default permissions. Task-number: QTBUG-79750 Change-Id: I4c49455b41f924ba87148302c8d0f77f5de0832b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QPA: Set focus reason when window activation changes focusVolker Hilsheimer2021-12-031-4/+4
| | | | | | | | | | | | | | | QApplication hides the fact that the reason is never set by several QPA plugins, but Quick items don't receive the correct reason on Windows, Android, the offscreen plugin, and other platforms. Add relevant scenario to the QFocusEvent test case, and fix the plugins to always set the focus reason when handling window activation changes. Exclude the minimal plugin from the test, it seems largely unmaintained anyway. Task-number: QTBUG-75862 Change-Id: I5404a225b387fc9a3851b6968d0777c687127ed1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Use Android's View.generateViewId() for generating ids for views/surfacesMichał Cieślak2021-12-021-3/+7
| | | | | | | | | | | Qt Android was using consecutive numbers starting from 1 as ids for View.setId(int). The ids are used internally with an assumption that they are unique. It was potentially leading to collisions and unexpected behavior when adding custom views with id generated by View.generateViewId(). Task-number: QTBUG-98649 Pick-to: 5.15 6.2 Change-Id: I5bf2fe1d196c7adafeec544d8d945ebd82ba5cb6 Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* android: Fix typo in source code commentJonas Kvinge2021-12-021-1/+1
| | | | | Change-Id: Ieeab35d51588cf247c3d9626d0291e2983720873 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Android: Set sem_wait m_terminateSemaphore behind an atomic flagRami Potinkara2021-11-261-1/+7
| | | | | | | | | | | Prevents QML app using QtActivity never calling AndroidJniMain::startQt..'s to jam as ANR Pick-to: 6.2 5.15 Task-number: QTBUG-97115 Change-Id: Ibfe8579dbb701068f4896b6d826ff487094bdf56 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* QAbstractFileEngine: Remove useless method overridesIevgenii Meshcheriakov2021-11-031-10/+0
| | | | | | | | | | | | Remove useless overrides of QAbstractFileEngine methods from the derived classes. Also remove "This virtual function must be reimplemented by all subclasses" passages from the QAbstractFileEngine's documentation. There are pure virtual methods for such use cases. QAbstractFileEngine already contains useful defaults for classes not supporting all the functionality. Change-Id: Ia25965854f3809b15d7502da3749cc2f3414bbc3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Android: Treat ACTION_CANCEL as TouchCancelEventMike Achtelik2021-10-291-6/+30
| | | | | | | | | | | | | | | | | | | | Change 64d62c53c1e92a1cc07449a0ea3c71501592c1e7 started treating an ACTION_CANCEL as a TouchPointReleased. This leads to unintentional presses, if e.g. an edge swipe for the android back gesture starts on a MouseArea. When Android takes possession of the motion, an ACTION_CANCEL is delivered, which needs to be handled as such. It should not be treated as a normal up event that triggers a press. Otherwise, we get the above-mentioned issue, where an unintentional action is performed. So let's use QWindowSystemInterface::handleTouchCancelEvent to treat it as a canceled touch in Qt. Task-number: QTBUG-72110 Pick-to: 6.2 5.15 Change-Id: I68650a180130501568e5a1e9a7f20ea469461e97 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Revert "Android: Place cursor correctly on screen when editing"Rami Potinkara2021-10-264-63/+9
| | | | | | | | | | | | | | | This reverts commit 5c6b10c3cee5737dbc041d0463220898c8120807. It caused a regression such that the main window no longer resized or panned when the VKB is shown, in spite of android:windowSoftInputMode being set. Pick-to: 6.2 5.15 Task-number: QTBUG-95300 Task-number: QTBUG-96117 Task-number: QTBUG-97503 Change-Id: If56e1113eea69a940f6760bdb2ad06a93a0759c1 Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: set EXTRA_TITLE to the initially selected file in save dialogAssam Boudjelthia2021-10-252-4/+9
| | | | | | | | | | | | | | | The extra data EXTRA_TITLE is only documented to be used to provide the initially selected file name in the context of file dialog [1]. So, let's stick to setting it only in save mode. This also now allows the save dialog to set an initial file name which wasn't possible before. [1] https://developer.android.com/reference/kotlin/android/content/ Intent#action_create_document Pick-to: 6.2 5.15 Change-Id: Ib55191a7269bfad28af4928f4e74d87981bdd574 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Android: Fix handling of cursor position when stop composingAndreas Buhr2021-10-141-7/+15
| | | | | | | | | | | | | | | | | | | | | | This is a workaround for a problem in TextEdit. The symptom is that when the user places the cursor inside of a word and hits backspace, the last letter of the word is removed instead of the letter just before the cursor. The reason is as follows. When stopping composing, the current cursor position has to be maintained. To that end, QAndroidInputContext sends an event containing the text to be committed and the cursor position to the editor. But the resulting cursor position is wrong. This patch adapts QAndroidInputContext to send two events: One to commit the text, the second to place the cursor. A real fix would fix the editor to correctly handle the event containing both the committed text and the cursor position. Fixes: QTBUG-97491 Pick-to: 6.2 5.15 Change-Id: Idd00e5afcbfe29c9cb77356f9add2e881c51b9bb Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Revert "[Android] Remove signal and slot mechanism to listen states in editor's"Andreas Buhr2021-10-132-37/+8
| | | | | | | | | | | | | | | | | This reverts commit a40a512dec0f34e84eb63812af556608f03713ff. It caused UI freezes and cursor position inconsistencies. See the linked bugs. Pick-to: 6.2 6.2.1 5.15 Task-number: QTBUG-58013 Task-number: QTBUG-93414 Task-number: QTBUG-95669 Task-number: QTBUG-96671 Task-number: QTBUG-96675 Task-number: QTBUG-96769 Change-Id: Ie8100538609a1460713ca9115cdbe329654d0772 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* android: Implement nativeResourceForContextLaszlo Agocs2021-09-172-0/+14
| | | | | | | | | | | | | | | | | | To bring the plugin on par with xcb and eglfs in this regard. New code has a better way to query these via QOpenGLContext::nativeInterface() (or, more correctly, will have a better way once the ability to query the config and display is added in a follow up patch), but having some symmetry between the EGL-based plugins won't hurt. This is relevant in particular with OpenXR: not knowing the EGLConfig makes it impossible to use the API on Android: https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrGraphicsBindingOpenGLESAndroidKHR Pick-to: 6.2 Change-Id: I163aed070096a4b58d3f650906c2f70ea31b3231 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* QAndroidSystemLocale: add missing day and month format handlingIvan Solovev2021-09-151-0/+12
| | | | | | | | | | | This patch adds support for previously missing Narrow format, as well as standalone day name handling for QAndroidSystemLocale Task-number: QTBUG-84877 Pick-to: 6.2 Change-Id: Ib74fb8f0e12f03ab96022abaf26ac9039ffaa60b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: Enable QDesktopServiceLars Schmertmann2021-09-102-2/+49
| | | | | | | | | | | | QDesktopServices::openUrl(const QUrl &url) is already implemented on Android. But even if it is possible to set an URL handler, the mechanism to invoke it is missing. With this commit the URL handler will work on Android like it is already working on iOS. Task-number: QTBUG-84382 Pick-to: 6.2 Change-Id: Ic560bd380f1cc59586861aa1a6a3ea064276a39e Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>