summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android
Commit message (Collapse)AuthorAgeFilesLines
* Replace QPlatformTheme::Appearance by Qt:AppearanceAxel Spoerl2022-09-205-8/+8
| | | | | | | | | | | | | With the introduction of Qt:Appearance, its predecessor in QPlatformTheme has become redundant. This patch replaces all occurrences of QPlatformTheme::Appearance with the new enum class. Task-number: QTBUG-106381 Change-Id: I5406f1b7c19f68571f074617c681318c96a6517e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Android: Fix flickering on window resize and show keyboardSamuel Mira2022-09-171-9/+12
| | | | | | | | | | | | | | | Changed to use display getMetrics which will return the size of the application window, and use getRealMetrics to obtain the size of the largest region accessible to the app. I updated the fullscreen mode to use the new sizes. Task-number: QTBUG-41170 Task-number: QTBUG-66727 Pick-to: 6.4 6.3 6.2 5.15 Change-Id: Ic25555ed2e1b910b3fdbc0f3a31e3a19763a04eb Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Android: Light/dark modes detectionBartlomiej Moskal2022-09-055-0/+27
| | | | | | | | | | | After commit: 2248487c6ca9d5459c70a16868d5aeee07d96157 light/dark mode detection is supported by Windows and macOS. This commit add similar implementation on the Android side. Task-number: QTBUG-83185 Pick-to: 6.4 6.3 6.2 Change-Id: Id1ece98e91a31759b58d651ef62b3715ea25d85f Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Apply Q_CONSTINIT where beneficialSona Kurazyan2022-09-016-11/+11
| | | | | | | | | | Applied Q_CONSTINIT to variables with static storage duration, but skipped the POD types with core constant initializers. Task-number: QTBUG-100486 Change-Id: Iaabf824e9cb0f29a405a149912200d4e4b3573c1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Android A11Y: Fix TalkBack scrolling behaviorJens Trillmann2022-08-291-4/+24
| | | | | | | | | | | | | | | | | | | | | * Add CollectionInfo to scrollable nodes. Every scrollable node will get a CollectionInfo attached to signal the number of (possibly invisible) children. This is necessary as TalkBack on Android doesn't scroll to items not visible on screen if the number of further child nodes is not communicated to TalkBack. * Return success of scroll to TalkBack. TalkBack needs the result of the scroll to decide if it should leave the current element or stay after a scroll was successful. Success of a scroll action is measured as the successful movement of the children of the scrolled element. This is a workaround for the Qt Accessibility API not returning the success of failure of a performed action. Task-number: QTBUG-103499 Pick-to: 6.4 6.3 6.2 5.15 Change-Id: Ie2c51d0b77fb5030973a0f93c42e0db3082be45e Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android A11Y: Notify android about scroll eventsJens Trillmann2022-08-295-0/+15
| | | | | | | | | | | | | | | | | | | | QtQuick Flickable has an issue that after a scroll the previously hidden items are not added to the A11Y hierarchy. That happens because Android has no ways to detect that something has changed. This patch uses the ScrollingEnd event to notify Android A11Y backend that the Flickable was scrolled, so that it could update the A11Y hierarchy and add the previously hidden nodes. The ScrollingEnd event generation is added to QQuickFlickable in a separate commit. Task-number: QTBUG-103513 Pick-to: 6.4 6.3 6.2 5.15 Change-Id: Ie6cd688d56343bcfe7ce9580c0b9244dd6d6c068 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Samuel Mira <samuel.mira@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-231-1/+1
| | | | | | | Task-number: QTBUG-105718 Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Android: handle quoted args passed to an appAssam Boudjelthia2022-08-111-3/+4
| | | | | | | | | | | | | | | | | | | | | | Currently, arguments passed to the app through applicationArguments extra bundle treat every space as an argument separator. This then doesn't handle the case where an argument is a space separated quoted multi-word. This is more apparent when androidtestrunner is passing test arguments to the app where an argument can be a test case with a data tag that contains a space, which then is treated as two separate tag names. This change makes sure that androidtestrunner quotes each argument, and the app doesn't split the arguments list by spaces, but rather passed the argument string directly to c++ where QProcess::splitCommand() is used to get the correct set of arguments that will be passed to main(). Pick-to: 6.4 6.3 6.2 Task-number: QTBUG-104730 Change-Id: I45d8ca979d90f2a383c84623f0eb2eec29bba727 Reviewed-by: Dimitrios Apostolou <jimis@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Add license headers to cmake filesLucie Gérard2022-08-031-0/+3
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Android A11Y: Fix deadlock in QtAndroidAccessibility::runInObjectContext()Mike Achtelik2022-07-051-1/+7
| | | | | | | | | | | | | | | | | | | On android the event loop is normally blocked, when the application is suspended, e.g. when it enters the background or when the screen is locked (see android.app.background_running). This leads to a problem when we try to process events after this happens, e.g. when android sends us an ACTION_CLEAR_ACCESSIBILITY_FOCUS event after the event loop is suspended. While handling it we eventually call QtAndroidAccessibility::runInObjectContext() which tries to do a blocking call on the object context, however, with the event loop being suspended we run into a deadlock which leads to an ANR. So we need to make sure to never make a blocking call while the event loop is suspended. Task-number: QTBUG-102594 Pick-to: 6.4 6.3 6.2 5.15 Change-Id: I33f0440a3da84fb4bdae5ab0fc10d514c73f23ad Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* 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 Pick-to: 6.2 6.3 6.4 Change-Id: Ib95e1544fe91c273bc5317bd338a50a74fb1090a Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* 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 Pick-to: 6.4 6.3 6.2 5.15 Change-Id: I992f31b8f9e14dfec44cec78d0c1a2a3e18bdb7f Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* 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 Pick-to: 6.4 6.3 6.2 5.15 Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Replace QT_NO_ACCESSIBILITY with QT_CONFIG(accessibility)Allan Sandfeld Jensen2022-06-152-8/+8
| | | | | | | Pick-to: 6.4 Change-Id: Iee4bd8970810be1b23bdba65a74de912401dca65 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* 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>