summaryrefslogtreecommitdiffstats
path: root/src/android
Commit message (Collapse)AuthorAgeFilesLines
* Android: remove getRootWindowInsetsRami Potinkara2023-04-201-1/+0
| | | | | | | | | QtLayout.Java had getRootWindowInsets function without any further usage. Function requires SDK API Level 23. Qt 5.15 supports SDK API 21. Fixes: QTBUG-110401 Change-Id: I826780b2ebef0440b92d0adab17cf392b5fa3e78 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Android: allow using string based versions in compileSdkVersionAssam Boudjelthia2023-04-111-1/+1
| | | | | | | | | | | | | | | | | Some platform sdk packages have names that contains non-integer characters such as android-33-ext5 or android-UpsideDownCake which fail building with androiddeployqt because build.gradle expects an integer only. This allows using string based versions and also fallbacks to setting an integer only value if it finds that the build.gradle of the project is still explicitly converting to integer (this to avoid breaking existing projects). Fixes: QTBUG-112465 Change-Id: If8cfc0fb84f0880a43644dc0a4188671736d3e21 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> (cherry picked from commit a43f349f9c2259966e6d6e94d31dd64a1156b17b) Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
* Specify Android architecture in gradle filesAndreas Buhr2023-02-241-0/+1
| | | | | | | | | | | | | | | | | | | | | When building for armeabi-v7a, building and APK using "ninja foo_make_apk" works. Building it by calling "gradlew assembleDebug" works. Opening the "android-build" folder in Android Studio and clicking the "Build" button works. But clicking the "Run" or "Debug" button in Android Studio does not work when the attached phone is arm64-v8a. Then Android Studio automatically selects the v8 architecture which does not find the Qt libraries. This patch adds explicit ABI selection to the gradle configuration files. With explicit ABI selection, Android Studio does not try to outsmart you. Fixes: QTBUG-96701 Task-number: QTBUG-87022 Change-Id: I4ad6356c38b7eca004c0e0dbbb357cab7de84c0f Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 07cfab07a2a489e021b56226824a2d9b1211fad7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Android: fix height calculationSamuel Mira2023-02-031-74/+11
| | | | | | | | | | | | | | | | | | | The application height calculation relied on the Display.getMetrics to obtain the size of the current app window. It works properly on stock android and Samsung devices, but not on some Huawei and it's unknown on other vendors. This patch changes the way the height and weight are calculated by using the provided values. Task-number: QTBUG-107604 Task-number: QTBUG-109268 Task-number: QTBUG-97503 Task-number: QTBUG-107923 Task-number: QTBUG-109351 Task-number: QTBUG-110501 Change-Id: I0b0d1a0e4688f10530054afd26e34f55a92ea2da Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 48ebd4e318d5fb2d7ffe4b8215cd16cf5638215e) Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
* Android: Add facilities to handle more content URIs operationsAssam Boudjelthia2023-01-171-189/+0
| | | | | | | | | | | | | | | | | | | | 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)
* Android: Fix UI is scaled smaller than beforeSamuel Mira2023-01-021-15/+6
| | | | | | | | | | | | | | | | | | | 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 deprecations for getDrawable() on QtMessageDialogHelperAssam Boudjelthia2022-12-271-4/+8
| | | | | | Change-Id: Icd359663af11f44b4bcf0cd4e4f1f7f5a51242e4 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> (cherry picked from commit 31a0d99fa565d39bf39f0c3ae5ed00859679a969)
* Android: Fix deprecations AlertDialog.setButton()Assam Boudjelthia2022-12-271-3/+10
| | | | | | | | | | https://developer.android.com/reference/android/app/ AlertDialog#setButton(java.lang.CharSequence, %20android.content.DialogInterface.OnClickListener) Change-Id: I470acba581b7226b2d4a56754cf6372baa167eb4 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> (cherry picked from commit 40b42ac517c45beff3caf5e991c84739ac014912)
* Android: Fix incorrect dimensions - part 2Samuel Mira2022-12-141-20/+15
| | | | | | | | | | | | The previous fix worked for lower API levels but failed to work properly on some devices (Devices with > 29 API levels). This patch fixes that issue. Task-number: QTBUG-107604 Task-number: QTBUG-107923 Change-Id: I8fd3601225026ea5c370a8a1a1aab317558432b5 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> (cherry picked from commit bb629a2e293b8b181cfb176087aab96f68cfbbd7)
* Android: Fix incorrect fullscreen dimensionsSamuel Mira2022-11-101-7/+16
| | | | | | | | | | | | | | The insets used to calculate the correct height were not the best choice. It used display cutout insets which would work correctly on most devices, but in the case of an emulator or a device without a camera, it could fail to calculate correctly. Task-number: QTBUG-107604 Task-number: QTBUG-107709 Task-number: QTBUG-107523 Change-Id: I8c4da83ae7359a0c133dbeb02dbd2cd260565f78 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> (cherry picked from commit d53ea82950e0662b8265642b840a12d9f9556888)
* Android: Add a way to disable accessibility via an environment varVille Voutilainen2022-10-201-0/+3
| | | | | | | Task-number: QTBUG-102168 Change-Id: I38956c1798b8874b3c5bc5b19c8cb09380e76cc3 (cherry picked from commit e7553adf16c14ec474b2659ad53757a37b336f95) Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: Fix Display.getRealMetrics deprecationSamuel Mira2022-10-143-22/+104
| | | | | | | | | | | | | In latest Android versions some functions related with Display metrics were deprecated. This patch changes some instances of that code to use the Resources.getDisplayMetrics or WindowManager.getMaximumWindowMetrics depending on the situation. Fixes: QTBUG-99543 Change-Id: Id9846efa877f704ef7f58c1b0820ad1527b53f09 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 413593183bbb1137fdc784d98c171d67a167bb32) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Android: Fix flickering on split screen modeSamuel Mira2022-09-271-1/+8
| | | | | | | | | Updated activity delegate to match the parent size on a split screen or multiwindow mode. It will repaint the window without flickering. Task-number: QTBUG-41170 Change-Id: Ifa8b51ccffba133df46c9343f678f579ec9113f0 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: Fix flickering on window resize and show keyboardSamuel Mira2022-09-231-10/+30
| | | | | | | | | | | | | 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: Check for active surface before calling into native codeJens Trillmann2022-09-211-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | This fixes a deadlock. The deadlock occurs on an application state change. During this state change the QML plugin requests Android to create a new surface for drawing and waits on the Android thread to complete the request (QAndroidPlatformOpenGLWindow::eglSurface()). In the meantime the android a11y delegate gets requests from the android a11y interface. The delegate tries to access the a11y information through the native interface, where it has to wait for the main loop thread to get the a11y information from the QtQuick objects. This leads to a deadlock in which the main loop thread waits on the quick rendering thread, the rendering thread waits on the android thread and the android thread waits on the main loop thread. This workaround avoids this issue by not calling into native code until a rendering surface has been created. Task-number: QTBUG-105958 Change-Id: Ib99145aa689d1d62e25d25e1f4f8598d53eee3a9 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit b8a95275440b8a143ee648466fd8b5401ee1e839) Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Android A11Y: Fix TalkBack scrolling behaviorJens Trillmann2022-08-291-0/+9
| | | | | | | | | | | | | | | | | | | | | * 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-293-0/+24
| | | | | | | | | | | | | | | | | | | | 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-0/+20
| | | | | | | | | | | 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>
* Android A11Y: Add content change type to content change eventAssam Boudjelthia2022-07-151-7/+19
| | | | | | | | | | | | | | | This fixes a problem where the accessibility tree is not correctly updated, when using e.g. a StackView. The problem was, that sometimes when pushing items of the previous view where still selectable via TalkBack. When popping this sometimes lead to some views not being selectable because the subtree wasn't updated. To solve this, lets tell android directly that the subtree changed when invalidating a view. Fixes: QTBUG-102825 Change-Id: Ifbf8da1b95f02935b9bcffabfe821547b1128103 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit d48ebb02fb171d0b6fe3749a28a312fc624f8b8e) Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Android: fix wrong position of cursor handle and editpopup menu in split screenPekka Gehör2022-06-302-6/+16
| | | | | | | | | | | | Use activity location in the Window to handling a cursor handle and editpopup menu in Multi-Window mode. No effect when using full screen. Fixes: QTBUG-58503 Change-Id: I17f3119be4c3dda2fca50156bf62c1260c2ea1f6 Reviewed-by: Samuel Mira <samuel.mira@qt.io> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit c27cca5c3421b08253535cfcfb9dd414986c7653)
* Android 13: Fix warnings on starting an applicationSamuel Mira2022-06-281-2/+2
| | | | | | | | | | | | | On Android 13, currently in beta, android triggers a warning because it is using a deprecated getDrawable function. The patch changes it to use the non-deprecated alternative as suggested in the warning. Fixes: QTBUG-103568 Change-Id: I3e629e7b75044bfb51874256895be0ec7e1088f8 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> (cherry picked from commit e07fea6fb405c6e9affe6e377ad99a98a740c5be) Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: Fix missing importSamuel Mira2022-06-151-0/+1
| | | | | | | | | A faulty merge of 04ec9c5593f0ac067dd39ccfca65c768419dc1fd missed an import. This patch fixes the missing import. Fixes: QTBUG-104262 Change-Id: Ifb91d750c8a9bf77bbc5274b394e343f90bec144 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Android: Fix ANR when QtService and QtActivity load in same processSamuel Mira2022-06-071-1/+12
| | | | | | | | | | | | | This patch is a fix to prevent the ANR. In this patch, the QtService queries QtNative if there is a QtActivity or QtService started and, in case there is, it does not begin the loading process. When that happens, the QtService will be a regular android Service. Fixes: QTBUG-99691 Change-Id: Ibd8aa8554107a9744b53cca4e0dd7e6f9b25baea Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io> (cherry picked from commit 08a4fd357064cfefd8de7af13025a9f1cb04cafb)
* Fix restart QtActivitySamuel Mira2022-06-073-81/+139
| | | | | | | | | | | | | | | | | | Previously, a restart of QtActivity on Android would make the application fail with a blank screen. That happened because the QtActivity tried to reload the whole application and failed. With this patch, the QtActivity detects if the application is restarting by checking if QtNative and QtActivityDelegate are live and updates the connections on those objects accordingly. It allows the application to continue as before. In case that is not possible, the QtActivity will restart the application. Fixes: QTBUG-38971 Fixes: QTBUG-102298 Change-Id: Id500d20b185d57b39d45d34eeaa99745a3c2b95b Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 5fd6704091febcc4abbc8d7ce06a393572524fa5)
* Android A11Y: handle LocationChanged event only for focused elementIvan Solovev2022-05-174-8/+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: set useLegacyPackaging to true in build.gradleAssam Boudjelthia2022-05-102-1/+4
| | | | | | | | | | | | | Since we set android:extractNativeLibs to "true" in AndroidManifest.xml, a warning is thrown by the gradle build, which needs the property packagingOptions.jniLibs.useLegacyPackaging to be set to true. Change-Id: I725d2663d68ab88abfda630f8a61666510043967 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ramon Sadornil <ramon.sadornil@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit 3a9aba287ce92f5250c1b68d0e2a39a5f25c031d) Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: add missing properties in AndroidManifest.xmlAssam Boudjelthia2022-04-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Some missing values has to be defined in AndroidManifest.xml, otherwise, warnings might be thrown. * android:exported="true": because the manifest sets an intent-filter, and it then has to explicitly to avoid the warning [1]. * android:allowBackup="true": this has to be explicitly set, we set it to the default value here [2]. * android:fullBackupOnly="false": SDK 23+ use this to deteremine to user auto backup or not, we set it to the default value here [3]. [1] https://developer.android.com/guide/topics/manifest/activity- element#exported [2] https://developer.android.com/guide/topics/manifest/application- element#allowbackup [3] https://developer.android.com/guide/topics/manifest/application- element#fullBackupOnly Fixes: QTBUG-101320 Change-Id: I0872dc00e48a867154ec9ded26620383fb747918 Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io> (cherry picked from commit 56dee3de5e4ac1c4d37a2c5e27361e7ddbdea1a7) Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Android: replace ndk.dir with android.ndkVersion in build.gradleAssam Boudjelthia2022-04-251-2/+2
| | | | | | | | | | | | | | | | | | The use of ndk.dir in local.properties is deprecated in favor of android.ndkVersion in build.gradle, and will be totatlly removed in the future, so we need to adapt to that. This 5.15 cherry-pick retrieve the ndk version without the use of QSettings because we use androiddeployqt uses bootstrap when building as a host_build while doing a cross-compilation. Fixes: QTBUG-91391 Change-Id: I54c57113a759d43c3685c9cdf2b9dcc5c948c0fd Reviewed-by: BogDan Vatra <bogdan@kdab.com> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> (cherry picked from commit 7235eeab19e7e50ba102938993acc04d14b58164) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Fix access to content: URLs with transient read/write permissionsAssam Boudjelthia2022-03-211-17/+21
| | | | | | | | | | | | | | | | | The current code assumed that the lack of persistent permissions means we cannot access the file at all. That however isn't the case for content: URLs we get e.g. via Intents, those are accessible perfectly fine via QFile, we just don't have (and can't obtain) persistent permissions for them. This is done by continuing in the case of not having persistent permissions and checking for SecurityExceptions that are thrown when accessing content: URLs we really have no permission for. Change-Id: I39115a7730d717eb9517e4f1c1a57e40988001a5 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit ec497d5e6587ac247a326fb9a0a11c37bb197786) Reviewed-by: Tarja Sundqvist <tarja.sundqvist@qt.io>
* Android: Treat ACTION_CANCEL as TouchCancelEventMike Achtelik2022-03-181-2/+9
| | | | | | | | | | | | | | | | | | | | 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-112-3/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 A11Y: handle valueChanged eventsIvan Solovev2022-02-225-0/+53
| | | | | | | | | | | | | | | | | | | | | 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)
* Android A11Y: populate child elements when constructing node infoIvan Solovev2022-02-141-0/+4
| | | | | | | | | | | | This commit partly reverts 020a6f0daec2e36866888b23c8b3a65bfb366146. It restores the code that is responsible for filling the children for individual elements. Without this code, we have only top-level element and its children in our accessibility hierarchy. Fixes: QTBUG-100545 Change-Id: I0604bbf5f1bdb0b3998a25fec7ed0a1fe554da8d Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit b99fdae5f520dbd10b94a2124ea950723c162efb)
* Android: Re-focus focused accessibility node after orientation changeIvan Solovev2022-02-111-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this patch the accessibility focus on a selected element could be drawn incorrectly after the screen orientation has changed. The reason for that is that wrong X and Y offsets were used for it. The offsets are used to take the sizes of different panels (like buttons and notifications bar) into account. Normally they are updated only when getNodeForView() is called and the whole accessibility info is reconstructed. However, when the screen orientation changes, we get some getNodeForVirtualViewId(selectedId) calls before the whole accessibility tree is recreated. This is when redrawing happens, and as I understand, this is an internal Android event, so we can't do much about it. The most straightforward fix for the problem would be to query the offsets also in each getNodeForVirtualViewId() call. However, offset calculation seems to be quite heavy operation, and getNodeForVirtualViewId can be called very often (esp. if we have a lot of UI elements). As a result, this fix can't be implemented. In this patch I came up with the second approach - once getNodeForView() is called, and it detects that the offsets have changed, we force re-focus of the currently selected element. This allows us to retain the offsets-caching mechanism. Fixes: QTBUG-93402 Change-Id: Ic420afe1fe5e80fbdf91b2b2651f2daa71c6e44d Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 7c00ad4e9a950e4c3493a417895169f1c936ea51)
* Android: extract parentId for hidden object in advanceIvan Solovev2022-02-114-8/+7
| | | | | | | | | | | | | | | | | | 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: replace stacktrace with debug message in search for setServiceLars Schmertmann2022-02-101-2/+6
| | | | | | | | | | | | | | | Don't print stacktrace when setService is not found but only print a debug message, QtServiceDelegate will continue to look for setContext which might actually be a problem if not implemented. 950e628fd842f22ac741b18440fcc99213820587 did this change for QtActivityDelegate. Fixes: QTBUG-86733 Change-Id: I8f2c6494da9133a3e9dedaabbe5fc931732d0d72 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 15572f9efeb1b7dd609b55f8981eb5b5dc3d3db9) Reviewed-by: Tarja Sundqvist <tarja.sundqvist@qt.io>
* [Android]: Handle the screen name, modes and refreshRate properlyIvan Solovev2022-01-314-15/+33
| | | | | | | | | 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)
* Android A11Y: fix content update notification when object is hiddenIvan Solovev2022-01-281-1/+4
| | | | | | | | | | | When the object is hidden, we should not use its viewId to notify content changed. Instead, we need to use its parent id. Task-number: QTBUG-95764 Change-Id: I608658e21c401d76459a09e4b274c60b849ace86 Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 850a7f1238e84b6960a84e12687e40cf939a44d9)
* Android: explicitly remove accessibility focus when element is hiddenIvan Solovev2022-01-281-0/+11
| | | | | | | | | | | | | | | | | | Before this patch when an element that had an Accessibility focus was hidden (for example, a button because of Accessibility.onPressAction), the focus was still remaining on that hidden element. So the next doubletaps on the screen caused the Accessibility.onPressAction() of the hidden element to be executed again and again. To fix this, we have to explicitly send a FOCUS_CLEARED event to the Android OS, when the object is hidden. Another needed fix is to set the m_focusedVirtualViewId in notifyObjectFocus() properly. Fixes: QTBUG-93393 Change-Id: I6ff8a19868b96842719924037545c4ecc91e0dad Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit f6ddb3e921e39cf165fcc184e30bd16d5311c575)
* Revert "Android: Fix screen flicker issues"Rami Potinkara2022-01-113-37/+9
| | | | | | | | | | 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>
* Revert "Android: Place cursor correctly on screen when editing"Rami Potinkara2021-11-093-35/+8
| | | | | | | | | | | | | | | 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)
* Update Gradle to 7.2.0 and Android Gradle Plugin to 7.0.2Assam Boudjelthia2021-11-081-1/+1
| | | | | | | | | | | | | | | The latest build-tools 31.0.0 requires AGP version 7.0+, and that requires Gradle version 7.0+, so use the latest stable release for both. [1] https://developer.android.com/studio/releases/gradle-plugin? buildsystem=ndk-build#updating-gradle Fixes: QTBUG-97002 Change-Id: I8ff26819bdf1a00f484ecc194c4d4e7bca2b598a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 5ea712987be3bed4c15e486d96851b46f466e944) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Android: set allowNativeHeapPointerTagging to false in the manifestAssam Boudjelthia2021-10-251-1/+1
| | | | | | | | | | | | | | | Android 11 enables pointer tagging by default on arm64 systems [1], which can cause QML to get invalid data, which caused the color issue (and most likely other issues). [1] https://source.android.com/devices/tech/debug/tagged-pointers Fixes: QTBUG-97009 Task-number: QTBUG-91150 Change-Id: Ic4f145bba3345b3bee5445685f03269e3785f514 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> (cherry picked from commit 9fa805f7f8dfe96d561e9ed3170770ad768baf93)
* Android: Hide the keyboard when the height is less than 0Andy Shaw2021-10-201-0/+4
| | | | | | | | | | | | | | When swiping on a device to do the back gesture then there is no back key pressed sent so we still need to catch when the keyboard is hidden. So we can listen for the geometry change and if the height is less than 0 then it is safe to say it is hidden so we update the internal setting on this. Fixes: QTBUG-96560 Change-Id: Iec0560935ef914d2cebcb7641a72ab4f71877d23 Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit d0d29a944a5836bedbac9e57ffc937c5c3842899)
* Android: Fix unnecessary clipboard data accessAssam Boudjelthia2021-08-241-12/+7
| | | | | | | | | | | | | | Android 12 introduced a notification which is shown to the user each time the app accesses the clipboard via getPrimaryClip. Currently this notification is triggered, even if we just want to check, if some clipboard data exists. So lets not get the actual data and instead use getPrimaryClipDescription to check for the existence of the correct mime type in the clipboard. Change-Id: I4800f5545ab46b7f6cade0ce9d78c04b50ae96cf Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 5a7f4c1f4964a4bf6595002478fbcd474cedd8a6) Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Android: guard getStateCount() with correct VERSION.SDK_INTAssam Boudjelthia2021-08-241-1/+7
| | | | | | | | | | The call getStateCount() was introduced in 29, so cases for lower API should be handled. Change-Id: I6085209d89e2b40cfa210ef9201df7f340dddb7e Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> (cherry picked from commit bbfbb18df18658e8ceec4bc04bd2cdf59f6a35ed) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix Style java code format and warningsAssam Boudjelthia2021-08-181-506/+344
| | | | | | | | | | | | 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>
* Android: Fix fullscreen bottom bar hide issuesPekka Gehör2021-08-161-3/+5
| | | | | | | | | Hide bottom bar when the fullscreen is setted Fixes: QTBUG-94990 Change-Id: I530ed2f3a0774ba80ccf7ac92b9fb612f241de75 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
* Fix hidden API access for Android styleAssam Boudjelthia2021-08-132-841/+789
| | | | | | | | | | | | | | | | | | | | Use public API and attributes to retrieve part of the Android style values instead of using reflection to access hidden or private fields. This latter method, was throwing lots of warnings or exceptions at the start of apps making it big annoyance to deal with. This patch doesn't handle drawables though, so the "full" and "default" Android style will be somehow broken still for now. For that reason, the default style extraction method is set to minimal to avoid getting warnings about it, and Fusion style could be used for Widgets apps, and for QML apps, it's recommended to use the Material style from Quick Controls 2. Task-number: QTBUG-71590 Change-Id: If87895dc66751e23c9f4ea840e9f3e611aaa8833 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> (cherry picked from commit b5b9c264ddff6c6eebb08038d9d3f2282df5c0ec)
* Android: Fix Application becomes unresponsive issuePekka Gehör2021-06-212-4/+14
| | | | | | | | | | | Block key events until the plugin is running. Fixes: QTBUG-67944 Change-Id: Iea47f2e94d850141834a7e8fc26218be2cacf660 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 2262a9cd2d135d5ea2ade42460496c88d8b2c292) (cherry picked from commit 8fc1a885d19a2dfb1a3a684aea1cfa41967e041f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>