summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/tqtc/lts-5.15.13' into ↵v5.15.13-lts-lgplTarja Sundqvist2024-01-047-81/+853
|\ | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: Ie9df84af22570d601db002e391a1a0d97e7cd9e1
| * Android: pass EXTRA_INITIAL_URI to native FileDialogAssam Boudjelthia2023-01-232-6/+28
| | | | | | | | | | | | | | | | | | | | | | Allow setting the initial directory where the file dialog will be opened. Change-Id: I1395b367c74d28fb2890ac53a90456c3ac4c1b05 Reviewed-by: Andy Shaw <andy.shaw@qt.io> (cherry picked from commit 609e14724edfd8d8cef23c5f30ad7812a359ed8d) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
| * Android: handle move operation with content urisAssam Boudjelthia2023-01-171-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow moving content uris if the destination is provided a full content uri with a parent that's different from the source content uri (i.e. different folders). Note: since the underlaying Android APIs don't always know about the parent of a uri, we do some step to deduce that, but that's not always guaranteed to work. Task-number: QTBUG-98974 Change-Id: If21954e5963f4eb0b96c7ccd983943ea2cab5b24 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> (cherry picked from commit c203ec2720b694fd877512da531a227e0f3310cb)
| * Android: handle rename() operation with content urisAssam Boudjelthia2023-01-172-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | Allow renaming content uris if the destination is provided as a direct fileName (i.e. not full content scheme path), and if the destination has the same trailing path (or parent) which means a rename in the same folder structure. Task-number: QTBUG-98974 Change-Id: Ibc4973366807dd5284c19912ab04ff90f2a573cb Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> (cherry picked from commit c1fa5d602c541b06e3e2fc2d02f5d62060c84504)
| * Android: Add facilities to handle more content URIs operationsAssam Boudjelthia2023-01-172-72/+716
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use DocumentFile and DocumentsContract to support more operations on content URIs, such as: * listing files and subdirectories with usable content uris * mkdir, rmdir * creating non-existing files under a tree uri * remove And since dealing with content URIs require some level of user interation, manual tests were added to cover what's been implemented. Note: parts of the code were from from BogDan Vatra <bogdan@kdab.com>. Task-number: QTBUG-98974 Task-number: QTBUG-104776 Change-Id: I3d64958ef26d0155210905b65daae2efa3db31c1 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> (cherry picked from commit e5d591a0d09032d1870e47d1bf59c9069ea0a943)
| * Fix infinite loop when iterating content uri sub-files/dirsAssam Boudjelthia2023-01-173-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | make QAbstractFileEngineIterator::currentFilePath() virtual and implement it under AndroidContentFileEngine to return current fileName because content uris shouldn't be constructed manaully like normal file paths. Fixes: QTBUG-104776 Change-Id: I4643a73a3bd4019bedaa056c35468117bcec18dc Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> (cherry picked from commit f3c998510d3a6c8fc468e449d66b0280119d0a8f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * Android A11Y: Only access the main thread when it is not blockedJulian Greilich2023-01-051-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the qtMainLoopThread calls QSGThreadedRenderLoop::polishAndSync(), it waits for the QSGRenderThread. In the QSGRenderThread, QAndroidPlatformOpenGLWindow::eglSurface() calls QtAndroid::createSurface() and waits for the "android main thread" to return a valid surface. When the "android main thread" now calls "runInObjectContext" (e.g. by calling QtAndroidAccessibility::childIdListForAccessibleObject()) it waits for the qtMainLoopThread and the program is stuck in a deadlock. To prevent this, we protect all BlockedQueuedConnection from the "android main thread" to the qtMainLoopThread by acquiring the AndroidDeadlockProtector. When QAndroidPlatformOpenGLWindow::eglSurface() already acquired the AndroidDeadlockProtector we abort the current A11y call with an emtpy or default value. Note: b8a95275440b8a143ee648466fd8b5401ee1e839 already tried to fix this by checking "getSurfaceCount() != 0", but there are situations, where a new surface is being created while an old surface is still present. Task-number: QTBUG-105958 Change-Id: Ie40e8654c99aace9e69b0b8412952fa22c89f071 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit b832a5ac72c6015b6509d60b75b2ce5d5e570800) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * Android: Fix UI is scaled smaller than beforeSamuel Mira2023-01-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 413593183bbb1137fdc784d98c171d67a167bb32 patch changed the way how the display metrics are retrieved. By doing so, it was found that the previous way retrieved the scaledDensity always equal to density. It is intentional for scaledDensity to be dependent on the font scale chosen by the user. However, this change altered not only the font scale but also the layout. This patch will make the layout dependent on the density instead of the scaledDensity and normalize the way the display metrics are retrieved among Android versions. Currently, the fontScale is ignored, QTBUG-109566 will track future developments. Fixes: QTBUG-109026 Change-Id: I6adacd17583cbe9bee368af35c50b780872ab222 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> (cherry picked from commit 99893a914a821567e10935ffb8be24df7147ccd9) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
| * Android: fix Android assets handler not listing dirs with only sub dirsBartlomiej Moskal2023-01-021-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It looks like AAssetDir_getNextFileName is not enough. Directories that contain only other directories (no files) were not listed. On the other hand, AAssetManager_openDir() will always return a pointer to initialized object (even if the specified directory does not exists), so we can't just leave only it here. Using FolderIterator as a last resort. This approach should not be too time consuming. As part of this fix, add some unit tests to cover/ensure assets listing/iterating works as expected. Fixes: QTBUG-107627 Change-Id: Id375fe8f99f4ca3f8cad4756f783ffafe5c074df Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 4ceee3911a2ef567f614fc296475bc2b2a0e3add)
* | Merge remote-tracking branch 'origin/tqtc/lts-5.15.12' into ↵Tarja Sundqvist2023-10-112-16/+15
|\| | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: Ie633210bf47c0a8738f0278a2d2b6362334ca564
| * Android: properly retrieve mime type of uri to for openUrl()Assam Boudjelthia2022-10-211-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Retrieve the mime type of the url regardless of whether QFile::exists() returns true or false, because it is nonetheless required when calling openUrl(). Fixes: QTBUG-47979 Change-Id: Ia095b76d5d39addb0b115eb97ac6bbae0c18a21f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Samuel Mira <samuel.mira@qt.io> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> (cherry picked from commit 6f418df9cc931032ffc32a15b6ff268452fe9f01) Reviewed-by: BogDan Vatra <bogdan@kdab.com>
| * Android: Fix clipboard issue with urlsChristian Strømme2022-10-211-11/+9
| | | | | | | | | | | | | | | | | | | | Both hasUrls() and hasText() can return true when containing urls, as hasText() checks hasUrls() as well. Fixes: QTBUG-85773 Change-Id: I91a34f151e7de17ab5b9a2f24bc0b6e6c097d7f9 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 5f9591bde3f3a67c566f3aa3571b57c82bd59cc5)
* | Merge remote-tracking branch 'origin/tqtc/lts-5.15.11' into ↵v5.15.11-lts-lgplTarja Sundqvist2023-06-099-50/+154
|\| | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: Iac056a5e9f59fc8d1929171c18039aeb45be22b8
| * Android: Fix flickering on window resize and show keyboardSamuel Mira2022-09-231-16/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 Change-Id: Ic25555ed2e1b910b3fdbc0f3a31e3a19763a04eb Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ivan Solovev <ivan.solovev@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 Change-Id: Ie2c51d0b77fb5030973a0f93c42e0db3082be45e Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 56c4d183ec30c7f40ece09de1c483829eedc299b)
| * 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 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> (cherry picked from commit 3c709198838866d5122c69a30cacdc806605d0cf)
| * Fix select handles disappears issuesPekka Gehör2022-07-203-7/+37
| | | | | | | | | | | | | | | | | | | | | | Select handles {Left, Right}Point disappears when double click a first word or select all on QLineEdit without set leftMargin of QLineEdit. Cursor is not shown if it goes over the widget frame on main window or on dialog. To prevent this cursor position is not decreased if it is less than one. Fixes: QTBUG-91139 Change-Id: Ib54eb09e51076f7f41a2fca7eb7630f3c5591fed Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
| * Fix tst_AndroidAssets, broken by recent changes on assets load speedLouis du Verdier2022-07-121-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: Assam Boudjelthia <assam.boudjelthia@qt.io>
| * Android: Improve loading speed of individual assetsLouis du Verdier2022-07-121-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 CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@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 Change-Id: I33f0440a3da84fb4bdae5ab0fc10d514c73f23ad Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit ac984bd8768b3d7e6439e0ffd98fd8b53e16b922) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * 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: I9161d59cc13b2fab487ec27d9ba0e38f9240d9bc Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* | Merge remote-tracking branch 'origin/tqtc/lts-5.15.10' into ↵v5.15.10-lts-lgplTarja Sundqvist2023-04-246-14/+28
|\| | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: Ic1bb4240ca70a8a361fa0267476707446579221d
| * Android A11Y: handle LocationChanged event only for focused elementIvan Solovev2022-05-175-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Change-Id: I6b941733c9d215fed5ee5a7aeeb5be234add9ebe Reviewed-by: Mike Achtelik <mike.achtelik@gmail.com> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io> (cherry picked from commit 0613146d210e494bf98e0e4de97e03fc5021736e) Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
| * Android A11Y: Add supported role infos to A11yNodeInfoMike Achtelik2022-05-071-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. Change-Id: I96d8dd628d10b26b4c9ffee15dfa01a9abef61b1 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit ec4c6e0acb9b8a11e7e81a64c7e2bd6a01484f2d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * Android: fix A11Y object descriptionIvan Solovev2022-04-221-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 Change-Id: Ic1ba50859fb91c871c242189967dcce35723a0b2 Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> (cherry picked from commit 37746d2f710957923427b25c028910d12860e008) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * Android: wrap QAndroidInputContext's m_focusObject in a QPointerAssam Boudjelthia2022-04-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | To make sure we don't end up use a dangling pointer for m_focusObject. 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> (cherry picked from commit 0742e5770bb2fc133986c5151bfa18a2e8d4d231)
| * Fix crash in tst_qmltc_examples on AndroidAndreas Buhr2022-04-091-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 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> (cherry picked from commit f9297565784e7eae87588417c8080cc1c9eede5f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* | Merge remote-tracking branch 'origin/tqtc/lts-5.15.9' into ↵v5.15.9-lts-lgplTarja Sundqvist2023-03-2311-87/+474
|\| | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: Iaff6b55275e50d19973e1020853d8622587069f9
| * Android: Treat ACTION_CANCEL as TouchCancelEventMike Achtelik2022-03-181-7/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Change-Id: I68650a180130501568e5a1e9a7f20ea469461e97 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit d6da61f3b9e7e57e85d1e16f2756a8e39e571f77)
| * Android: make sure that orientationChange is reported after resizeIvan Solovev2022-03-113-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 Change-Id: I5c98e526d0370d380344b2297169d5e0c0ee8ea7 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 79fb80152ff29a30faa3f0cce79a602e36cadbeb)
| * Android: set all QScreen's geometry-related parameters togetherIvan Solovev2022-03-115-11/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Change-Id: I844f6d0db87df8d5e6e9bcce5d27126384a5a0de Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 285ea132861f8b8d1b5d1ea0f966c141da985953)
| * Android: terminate argv passed to main() with nullptrAssam Boudjelthia2022-03-041-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 Change-Id: I6e3a685f092a92a94f60d166357b75d2538af74c Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> (cherry picked from commit daf7f07c1bb00028d7bce6b030f5ade8c4d0da59) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * Android A11Y: Fix value roundingIvan Solovev2022-02-221-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 Change-Id: Ia5ca7345812e39629e9c191b6d8b896a8f51de80 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 60799fc14134472913af4b3ab87b6160bd46056d)
| * Android A11Y: Announce value together with element name when focusedIvan Solovev2022-02-221-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 Change-Id: Ia8667149ebd867945c5f57d951fd6ade0f382598 Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit a374d59abc415eee1866322176b7762158f48abd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * Android A11Y: handle valueChanged eventsIvan Solovev2022-02-225-3/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Change-Id: Ic44abd5f01b9b6f5468962131466edaf6a49d498 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> (cherry picked from commit b238f83380dcaa2830999a8f413f4b648db80beb)
| * Use Android's View.generateViewId() for generating ids for views/surfacesMichał Cieślak2022-02-121-3/+8
| | | | | | | | | | | | | | | | | | | | | | 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 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> (cherry picked from commit 02955a10faecc4873a4261a6e79a42275283302b)
| * Android A11Y: execute C++ code on main Qt threadIvan Solovev2022-02-114-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 Change-Id: Iff4f3f2645657f6aca426fa19ccc86a2cbe4d4d0 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi> (cherry picked from commit e0c61193ea8f6462192d2ef7f1d48d8fa3e38c99) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * Android: extract parentId for hidden object in advanceIvan Solovev2022-02-113-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 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> (cherry picked from commit 6d00aac1092d813446a44fbb234995733233f003)
| * [Android]: Handle the screen name, modes and refreshRate properlyIvan Solovev2022-01-315-3/+74
| | | | | | | | | | | | | | | | | | Fixes: QTBUG-87136 Fixes: QTBUG-93823 Fixes: QTBUG-94959 Change-Id: Id480e22611ec949b5e3ee780fc695fb502a5950c Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit c1a93b20ff1fec370b2483276b74f07eb54486ef)
| * Revert "Android: Fix screen flicker issues"Rami Potinkara2022-01-111-6/+3
| | | | | | | | | | | | | | | | | | | | This reverts commit 6bbba5576c9477c61721bc4fbb761752d98c23d2. Reason for revert regression case QTBUG-97503 Task-number: QTBUG-97503 Change-Id: I455c3fa15d008df55b32bc39144776e0347b21cd Reviewed-by: Pekka Gehör <pekka.gehor@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* | Merge remote-tracking branch 'origin/tqtc/lts-5.15.8' into ↵v5.15.8-lts-lgplTarja Sundqvist2022-11-117-75/+39
|\| | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: I569a2246c9e8d70430e8c5405b9f3df2218078ee
| * Android: Set sem_wait m_terminateSemaphore behind an atomic flagRami Potinkara2021-11-271-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | Prevents QML app using QtActivity never calling AndroidJniMain::startQt..'s to jam as ANR Task-number: QTBUG-97115 Change-Id: Ibfe8579dbb701068f4896b6d826ff487094bdf56 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 1a87f069161c23e8febf5173b5f533d84d0eb4a8) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
| * Revert "Android: Place cursor correctly on screen when editing"Rami Potinkara2021-11-094-61/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. 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> (cherry picked from commit b1820295e1e8f04634cf9c008a2473d9e2889288)
| * 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 Change-Id: Ib55191a7269bfad28af4928f4e74d87981bdd574 Reviewed-by: Andy Shaw <andy.shaw@qt.io> (cherry picked from commit cbc29dc16c4e08d6e399c7c26a38736bff80d6e6)
| * Android: Fix handling of cursor position when stop composingAndreas Buhr2021-10-161-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 Change-Id: Idd00e5afcbfe29c9cb77356f9add2e881c51b9bb Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> (cherry picked from commit a47f66cee280cef1e5854f3ed187e9f2be19697a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * Revert "[Android] Remove signal and slot mechanism to listen states in editor's"Andreas Buhr2021-10-162-29/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit a40a512dec0f34e84eb63812af556608f03713ff. It caused UI freezes and cursor position inconsistencies. See the linked bugs. 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> (cherry picked from commit 2630c15a3de65d118afd11bbeb349a415a4aa1d0) Reviewed-by: Pekka Gehör <pekka.gehor@qt.io>
* | Merge remote-tracking branch 'origin/tqtc/lts-5.15.7' into ↵Tarja Sundqvist2022-09-122-29/+8
|\ \ | | | | | | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: I976ce0c3664c9953dd0019b7d76d3f603583634f
| * | Revert "[Android] Remove signal and slot mechanism to listen states in editor's"Andreas Buhr2021-10-162-29/+8
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit a40a512dec0f34e84eb63812af556608f03713ff. It caused UI freezes and cursor position inconsistencies. See the linked bugs. 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> (cherry picked from commit 2630c15a3de65d118afd11bbeb349a415a4aa1d0)
* | Merge remote-tracking branch 'origin/tqtc/lts-5.15.6' into ↵Tarja Sundqvist2022-08-163-27/+10
|\| | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: Ia9164a17d80376f0a3ab9752c4a9f4dd2f0bd3d9
| * Fix Style java code format and warningsAssam Boudjelthia2021-08-182-19/+1
| | | | | | | | | | | | | | | | | | | | | | | | The code had many bad formating and syntax or API usage warnings, as well as some unused methods or classes which are fixed with this patch. Task-number: QTBUG-71590 Change-Id: Ib113a0dc05703afb5190ec880b27daf75274cb1e Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> (cherry picked from commit dc9075554135160bb07aa54708aba69d127160e2) Reviewed-by: BogDan Vatra <bogdan@kdab.com>