summaryrefslogtreecommitdiffstats
path: root/src/android
Commit message (Collapse)AuthorAgeFilesLines
* Android: don't enable focus for QtEditText when added to the viewAssam Boudjelthia6 days1-0/+11
| | | | | | | | | | | | | | | | | | | | This way we avoid having the QtInputConnection invoke any operations that might end up locking the the UI thread before the potential window surfaces are being created on the UI thread and end up not being able to acquire it. Pick-to: 6.11 6.10 6.8 6.5 Fixes: QTBUG-141579 Fixes: QTBUG-141782 Fixes: QTBUG-141357 Fixes: JTP-23 Fixes: JTP-4 Fixes: JTP-3 Task-number: QTBUG-139400 Task-number: QTBUG-142460 Change-Id: I152f0dc3976b28e7ba589958d3470f9c0d3dcccb Reviewed-by: Ville Voutilainen <[email protected]> Reviewed-by: Jani Korteniemi <[email protected]>
* Remove unused Android importsJan Moeller2025-11-201-2/+0
| | | | | | | | | | This amends 93ce4ad5f91522d110b549dd2d42e2864372d49d where the dialog usage was removed, the imports were originially introduced in 2b48614f68cbf98d6597819749b732556c32cb44. Pick-to: 6.10 6.8 Change-Id: I8adefea66efb07e1a7354a4605a381579ea76bf6 Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: Use setWindowInsetsAnimationCallback to detect keyboard animation endJani Korteniemi2025-11-131-17/+24
| | | | | | | | | | | | | | | Use setWindowInsetsAnimationCallback istead of controlWindowInsetsAnimation to update cursorposiion and check for the keyboard height at the end of the keyboard show animation. Remove controlWindowInsetsAnimation() as in the Android 16 IME visiblility was requested twice and it gets cancelled. Pick-to: 6.10 6.8 Fixes: QTBUG-140897 Change-Id: Ic62f5e0afa7ab8df4985e5a186035ff33af0ab66 Reviewed-by: Assam Boudjelthia <[email protected]> (cherry picked from commit 44c02ece447f57779a4e53db10dc107de2d14479) Reviewed-by: Qt Cherry-pick Bot <[email protected]>
* a11y Android: Use correct EventType TYPE_WINDOW_CONTENT_CHANGEDJulian Greilich2025-11-111-4/+7
| | | | | | | | | | | | | | | | | * The correct way to announce changes of accessible name, description and value is to use the EventType TYPE_WINDOW_CONTENT_CHANGED with the correct CONTENT_CHANGE_TYPE set. * We don't need to pass the (new) value anymore to the notifyValueChanged and notifyNameOrDescriptionChanged method anymore. * Now TalkBack plays a sound to represent changes of the value of e.g. the progressbar instead of announcing the value as text. Task-number: QTBUG-139712 Pick-to: 6.8 6.10 Change-Id: Ic9cd4f4cf212ba3cd3d392dacce1955d7cb2bf54 Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: Fix double emission of certain a11y eventsTimon Sassor2025-10-281-16/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | 3c709198838866d5122c69a30cacdc806605d0cf and e7a211d702d6aa21a30eff56ceeffc153385443e introduced a11y actions for focusing and scrolling. However they also accidentally introduced a double emission of their according events. This causes problems, since every new event stops the processing and announcement of the previous in TalkBack. We remove the sendEventForVirtualViewId() calls from performAction() and performActionForVirtualViewId(), because they are the culprit. If an action like focus or scroll changes the app state, an a11y update is triggered, which ends up calling notifyObjectFocus() or notifyScrolledEvent() where the according event is then emitted and the a11y delegate state is updated. For the focus there is an exception, since an element cannot gain the active focus if is is disabled. However TalkBack should still be able to place its focus frame on that element and read out its content. Pick-to: 6.10 6.8 Change-Id: I9061eec713fd5382feb7aacafdffe393968ef8f1 Reviewed-by: Lars Schmertmann <[email protected]> Reviewed-by: Morten Johan Sørvig <[email protected]> Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: fix QtQuickView fields access levelAssam Boudjelthia2025-10-141-10/+39
| | | | | | | | | | | | Some fields under QtView and thus under QtQuickView are marked as protected which ends up shown in javadoc. These fiedls are internal and shouldn't be treated as public, so instead, make them private and provide package-private getters/setters for QtQuickView to access those fields internally. Pick-to: 6.10 6.8 Change-Id: I438b1828a6691199d94c94810591f604f2b4299c Reviewed-by: Soheil Armin <[email protected]>
* Android: move system ui code to its own QtWindowInsetsController classAssam Boudjelthia2025-10-137-382/+371
| | | | | | | | | | Most of the code dealing with system ui visibility, system bars and insets is under QtDisplayManager which is not exactly the correct place. Instead of that move, move the code its own class named QtWindowInsetsController which has all those utilities. Change-Id: I174f9cc5a1a324c65630cd7edd01c05ee6114c1c Reviewed-by: Ville Voutilainen <[email protected]>
* Android: fix some java deprecated APIs warningsAssam Boudjelthia2025-10-132-3/+4
| | | | | Change-Id: Ie635a69187a58811a6d7275093306a7bad1b8265 Reviewed-by: Ville Voutilainen <[email protected]>
* Android: silence warning about deprecated themeAssam Boudjelthia2025-10-131-3/+5
| | | | | | | | The theme selection is already guarded by API version and we don't need to have the deprecation warnings thrown. Change-Id: Iada47f4fc0c8712be860d8841bed1d03a80ee05a Reviewed-by: Ville Voutilainen <[email protected]>
* Android: fix indentation of root layout paramsAssam Boudjelthia2025-10-131-3/+3
| | | | | Change-Id: I44592702707be237d3b57bdc324c07370c438d12 Reviewed-by: Ville Voutilainen <[email protected]>
* Android: make system ui visisibility flat with no cached valuesAssam Boudjelthia2025-10-133-32/+44
| | | | | | | | | | | | | If system ui visibility is requested simply send the event and let the system decide what to do about it, that way we don't need to keep any cached values. Also, when checking for states like fullscreen and expanded modes figure that out from current system ui state instead of fetching the cached values which is more accurate because the system ui is usually not updated immediately. Change-Id: Id186d69a0e338e9533d58a23f1bd2b74612d9a88 Reviewed-by: Ville Voutilainen <[email protected]>
* Android: rework system ui visibility codeAssam Boudjelthia2025-10-131-77/+146
| | | | | | | | | Make the code more modular and split into smaller atomic methods. This might mean a bit more duplicate conditions but it's simpler to read and maintain. Change-Id: I17ec7a982c68082d5fb3fb7bd432e9267ede93bc Reviewed-by: Ville Voutilainen <[email protected]>
* Android: init QPA plugin separately from application startAssam Boudjelthia2025-10-131-0/+5
| | | | | | | | | | | | | First, init the QPA plugin and its backends first before posting the Qt application start to the QtThread as it was, otherwise, we can end up with apps like Qt Quick for Android apps hanging and never able to finish instantiating a QGuiApplication. Partially reverts d00e5433f6b4d91d481e1a4f7a193d0f5b4ff10c. Task-number: QTBUG-139591 Change-Id: I91705d933034e2fc94d37dafd8bfb154b650ae65 Reviewed-by: Ville Voutilainen <[email protected]>
* Android: Add support for GET_EXTRACTED_TEXT_MONITORKonsta Alajärvi2025-10-081-12/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for GET_EXTRACTED_TEXT_MONITOR flag of InputConnection. By Android docs this indicates that we would like to receive updates when the extracted text changes. This with the addition of updateExtractedText() method will keep the extracted text field updated without the need for restarting the input connection everytime input is given. Add m_isComposing variable to check if we are currently composing text and if so, ignore selection changes. This fixes the issue where moving the cursor position in extracted text field during composition corrupts the current composition text. This reverts parts from changes: a4850d0e0f42229afe2af10cee5794d0de70416c 1f6d7cbb341bd79826d3f6d69e1f1a427ebb8f1b ab98013efc16766bb7a538f86b0b9de8db6634ff Task-number: QTBUG-138858 Task-number: QTBUG-37980 Fixes: QTBUG-140694 Pick-to: 6.10 6.9 6.8 Change-Id: Ic450e167367eaca78034a27cfa2eb265f63da1ab Reviewed-by: Assam Boudjelthia <[email protected]>
* Update contrastPreference correctly on AndroidOliver Eftevaag2025-10-071-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Android has an option called "Color contrast" in the Settings app, found under "Display and Touch". Qt has a new property in 6.10 called contrastPreference, which can either be `NoPreference` or `HighContrast`. The intention is to use native API's to determine if the user has enabled a setting on the platform level, to increase the overall contrast on the system. If that is the case, the contrastPreference property should return `HighContrast`. This property is then used by our built-in styles, to add more outlines to controls and potentially change some of the palette colors that are in use. It can also be used by custom styles. We're already detecting if the system is running in high contrast mode on Windows, macOS, Gnome, and WebAssembly. Android took a bit longer to implement due to the ambiguity of their API. On Android the user has the option to set the "Color contrast" to either `Default`, `Medium` or `High`. For now, the contrastPreference property will only return `HighContrast` if the "Color contrast" is set to `High` only. When changing this setting on Android, the Activity is recreated. It is desireable to handle this configuration change ourselves, however, we've not been able to find a good approach here. Most configuration changes can be added to a list in AndroidManifest.xml to override the default behavior of resetting the Activity, but 'colorMode' or any other handler doesn't seem to work when changing the contrast setting. Fixes: QTBUG-139294 Pick-to: 6.10 Change-Id: Iaebb89c79feb749655132d2db83c1bb1a67b301d Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: set system bars colors when Qt color scheme is requestedAssam Boudjelthia2025-09-292-3/+10
| | | | | | | | | | | When Qt requests a color scheme request the same color scheme for the device's status and/or navigation bars. Fixes: QTBUG-137248 Task-number: QTBUG-51196 Pick-to: 6.10 6.8 Change-Id: I36c8d0b1f7a18210e900634512b842856b18c822 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Android: read and apply theme's values on handUiModeChangeAssam Boudjelthia2025-09-292-12/+139
| | | | | | | | | | | | When the uiMode changes like from light to dark mode, to keep the bars contrast correct we need to re-apply the theme's colors again, otherwise the system won't do it for us because we explicitly opted in to handle any uiMode change ourselves. Task-number: QTBUG-137248 Pick-to: 6.10 6.8 Change-Id: I5f918fe047077c5a12be08b0baefb58cf08b5106 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Android: call handleUiModeChange only when the uiMode has changedAssam Boudjelthia2025-09-293-3/+7
| | | | | | | | | | | handleUiModeChange is currently called whenever onConfigurationChanged is called, that can be for irrelevant cases like orientation change. So check the configuration diff and only call it if uiMode changes. Task-number: QTBUG-137248 Pick-to: 6.10 6.8 Change-Id: I8df118404585b5e4273a441db9806549093eae02 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Android: change only the opacity of system bars when setting system uiAssam Boudjelthia2025-09-291-3/+36
| | | | | | | | | | | | | | When switching between expanded mode (similar to edge-to-edge) and back to normal mode, we shouldn't be touching the colors of the system bars, as that can mess up with the theme values or user defined values. Instead, simply change the opacity (alpha bits) of the color so we get transparent bars in expanded mode and opaque bars in normal mode. Task-number: QTBUG-139690 Pick-to: 6.10 6.8 Change-Id: Iadc5a9d8625c50009a0dc1a5ac29b5354089d345 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Android: call view's onApplyWindowInsets() in QtInputDelegateAssam Boudjelthia2025-09-191-6/+4
| | | | | | | | | | | | | | | | | This callback was done on the decor view and wasn't calling the base onApplyWindowInsets() practically ignoring base insets like system decorations, this then messes with the default behavior of system bars making calls to customize color schemes have unexpected behavior at least or at worse not working at all. Fixing this brings back the expected behavior of the insets when in the case of the linked ticket, we would get back correct handling of navigation bar semi-transparent bars where the bar icons have low contrast compared to the content below it. Pick-to: 6.10 6.9 6.8 Fixes: QTBUG-139690 Change-Id: I5b46f6f6e0c7850fba117a0ba76d3a693c1cb37b Reviewed-by: Tor Arne Vestbø <[email protected]>
* Android: call requestApplyInsets() after system ui visibility changeAssam Boudjelthia2025-09-121-0/+2
| | | | | | | | | | | | | | Always call decorView.requestApplyInsets() after a system ui visibility change. This ensures the insets are updated and we don't end up with wrong window sizes or half-way transitions to different visibility states. With this change, the various transitions are no longer flaky, many tests for safe margins and fullscreen dimensions under tst_android are now reliably executed over multiple iterations. Pick-to: 6.10 6.10.0 6.9 6.8 Change-Id: I69260f76aa0a0e67f65918b6a8b10413cae13fd4 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Android: use rootView to retrieve the insets in of the current viewAssam Boudjelthia2025-09-121-1/+1
| | | | | | | | | | The insets are calculated for the top level windows so using the current view to retrieve them is not accurate although it can work. Pick-to: 6.10 6.10.0 6.9 Change-Id: Ibc0526822760ebccbb30b7c8ad557e7005118f85 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Android: clamp safe margins values to max of the reported insetsAssam Boudjelthia2025-09-121-4/+4
| | | | | | | | | | | | In some cases during resize events after an orientation change, it can happen that the subtraction logic to figure out the remaining value to leave the non-safe area, might compare a transcient/old geometry, and end with big values in the reported safe margin. To avoid that clamp the value to insets reported by the system. Pick-to: 6.9 6.10 6.10.0 Change-Id: Ia7b39e1ef3969dca0cdc998368290646ab6d2b6d Reviewed-by: Tor Arne Vestbø <[email protected]>
* Android: don't use OnPreDrawListener in setOnApplyWindowInsetsListenerAssam Boudjelthia2025-09-121-14/+7
| | | | | | | | | | | | | | | | | | | | | | | Firstly, this was adding a new OnPreDrawListener listener with each onApplyWindowInsets call and it wasn't cleaned afterwards. In this case it's not even necessary to have those nested listeners. Furthermore, don't set m_firstSafeMarginsDelivered from within the onApplyWindowInsetsListener so that we're certain that some safe margin values are retrieved from sources other than the onApplyWindowInsetsListener just a guarantee. If the window moves or resizes under the root while the root doesn't change, signals like setOnApplyWindowInsetsListener won't be sent thus we'll end up with out-dated safe margins, so add addOnLayoutChangeListener to fix that. Along the way move the expanded show after the normal show because that's how I found this case handling was missing. Pick-to: 6.9 6.10 6.10.0 Task-number: QTBUG-135808 Change-Id: I57c74cbd8ec7a0c190dc97ba9a92a0292a535240 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Android: add docs to QtActivity.appendApplicationParameters()Assam Boudjelthia2025-09-101-2/+6
| | | | | | Pick-to: 6.10 6.9 6.8 Change-Id: Icefdaa0a51aa8fcfb792f6b6265493b4fd890123 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Android: fix rendering glitch after window size changesAssam Boudjelthia2025-09-091-1/+5
| | | | | | | | | | | | | | | | | | | | | | | Currently, apps might end up with half of the window size not rendered or not reflecting size changes. When the root layout size changes, the available size is reported but the screen size is not always sent from Android callbacks, this is the case after an orientation change. So make sure here to update the the screen geometry also when receiving the available geometry. This part amends 7dcf58eedbeb0cbfbf01f3aabfb72f8546f96cdf. However, the issue was still present in 6.9 and 6.8 before that above commit, to fix that, it's needed to call sendExpose() to send expose event for the window in the new region, and this after propagating the surface change from QtSurface to the platform window. Pick-to: 6.8 6.9 6.10 6.10.0 Fixes: QTBUG-132718 Fixes: QTBUG-134082 Task-number: QTBUG-124140 Change-Id: I390aaba45f324693dc47d7d0110fdb22dc9aca61 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Docs: Fix bugsNicholas Bennett2025-09-083-8/+10
| | | | | | | | | | Fixed tag errors and malformed links Fixes: QTBUG-139720 Task-number: QTBUG-139688 Pick-to: 6.10.0 6.10 6.9 6.8 Change-Id: I65ab0e14cdd035762505a36b72bf84d140596ce3 Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: subtract action bar height from top safe marginsAssam Boudjelthia2025-09-061-1/+28
| | | | | | | | | | | | | | | | | Qt for Android apps by default disable the native action bar, however, especially on older Android versions, it can happen that the safe margins are being calculated around the time that the action bar is being hidden. In such case we will end up with incorrect values. To avoid that, when retrieving the top safe margin, check if that value minus the action bar height is positive value, in which case we can assume that the initial top value consists from a status bar height + an action bar height. This has been noticed mainly in Android 9 and 10. Fixes: QTBUG-135808 Pick-to: 6.9 6.10 Change-Id: Iabaaf9a864bd3b13a5b672080ee1efdd5adf98fe Reviewed-by: Tor Arne Vestbø <[email protected]>
* Android: report margins only when window is under unsafe areaAssam Boudjelthia2025-09-061-17/+45
| | | | | | | | | | | | | | | | | | | | | To avoid reporting margins/insets when it's not needed, like for some older Android versions, or to avoid wrong or improperly handled resize events, we only report the margins values for a window to reach the safe, otherwise, we could end up with extra padding from Qt safe margins and the system padding. Also, to ensure the root view location is up-to-date and avoid going into a race condition, we post() the safe margins reporting to the root view that way we ensure it's done after the root view has gone through the resize event. On safeAreaMarginsChanged() JNI implementation, don't do JNI calls to get the margin values unless the relevant platform window is found. Fixes: QTBUG-135808 Pick-to: 6.9 6.10 Change-Id: Idda072b8ebbd019c54ae6ae45f672bc7abb195b7 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Android: hook into pre draw and attach listener to deliver safe areaAssam Boudjelthia2025-09-061-27/+53
| | | | | | | | | | | | | | | | | | Instead of relying only on setOnApplyWindowInsetsListener() and trying to guess when to try and deliver root decor insets in case the setOnApplyWindowInsetsListener() doesn't deliver the view's insets early on, a cleaner way is to hook into addOnAttachStateChangeListener() and OnPreDrawListener() listeners. With this approach we guarantee that at least in one of those cases, especially OnPreDrawListener(), we would be guaranteed to get the insets when the view is attached. With this approach we only need to get once such event and from there forward we rely still on setOnApplyWindowInsetsListener(). Fixes: QTBUG-135808 Pick-to: 6.9 6.10 Change-Id: I05bf3009eb9a33f104d01d29e7f02d780900fc66 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Revert "Re-land: Android: destroy the window surface only after exit transition"Assam Boudjelthia2025-09-022-80/+21
| | | | | | | | | | | | | This reverts commit 5ef73686cfb488dfc6a4077a2ecb12f883de1461. Reason for revert: causes multiple regressions. Pick-to: 6.9 6.10 Task-number: QTBUG-127705 Task-number: QTBUG-139606 Task-number: QTBUG-139659 Change-Id: I446d2aad7babf71ed59aa56e29e01b85eb940867 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Android: accessiblity deprecation warningsAssam Boudjelthia2025-08-221-16/+59
| | | | | | Pick-to: 6.10 Change-Id: Idebf0f6ecb8c9ae342932d4f8fd042f79d304693 Reviewed-by: Ville Voutilainen <[email protected]>
* Android: fix fromHtml() deprecation warningAssam Boudjelthia2025-08-221-6/+5
| | | | | | Pick-to: 6.10 Change-Id: I743796d947825d53e3a6ce38ca8c7757fc540f4f Reviewed-by: Ville Voutilainen <[email protected]>
* a11y Android: Announce changes to name/description to TalkBackJan Moeller2025-08-223-0/+12
| | | | | | | | | | | | Changes are only announced for the currently focused element using the same mechanism as a value change as Android does not offer a more specific event type if only the contentDescription of an AccessibilityEvent changes. Task-number: QTBUG-139275 Pick-to: 6.8 6.9 6.10 Change-Id: Ia8c0eeeb01b46a116f0e4d3e5ab1692d9492793e Reviewed-by: Volker Hilsheimer <[email protected]>
* Android: Use the TalkBack focus signal to trigger focusActionTimon Sassor2025-08-222-0/+4
| | | | | | | | | | | | | | TalkBack provides A11y specific focus signals that are emitted when the focus frame is moved. It would be useful to pass this focus change to the focused property of an item. [ChangeLog][Accessibility][Android] Use TalkBack ACTION_ACCESSIBILITY_FOCUS to trigger focusAction. Fixes: QTBUG-137769 Pick-to: 6.10 6.9 6.8 Change-Id: I63219cfb9b8776ddaa6c85ccf1844adb1984d2b7 Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: show a toast instead of a dialog in case of app start failureAssam Boudjelthia2025-08-141-15/+23
| | | | | | | | | | | | | | | | | | | Instead of showing a dialog that waits for user input to accept it to then finish() the activity, we show a toast and right away finish(). This is a better approach for handling failed Qt libraries loading since while the app waits for the user input, other Android callbacks might be called (e.g. onNewIntent(), onPrepareOptionsMenu(), etc.) and those themselves call native methods which will get an UnsatisfiedLinkError that might hide the real failure which is that the native libraries failed to load. Task-number: QTBUG-132211 Task-number: QTBUG-120467 Task-number: QTBUG-70114 Task-number: QTBUG-86314 Pick-to: 6.10 6.9 6.8 Change-Id: Ib0a8a93bef7f07bbf0d24cd9860eb87e4a4fed3e Reviewed-by: Ville Voutilainen <[email protected]>
* Android: ensure the preferred ABI is parsed early on under QtLoader ctorAssam Boudjelthia2025-08-141-22/+36
| | | | | | | | | | | | | | | | | | | | Ensure the preferred ABI is obtained separately early on before doing anything else. At the moment it is assigned a value when it's first accessed by some call that needs it and some calls might not work if it's null, so that way it can easily cause unexpected behavior. Now, that we should be guaranteed the perferred ABI to be resolved first, and the libs list is not going to change later during the lifetime of the app, we can populate only one ArrayList of libs instead of a Map of libs for each ABI. Task-number: QTBUG-132211 Task-number: QTBUG-120467 Task-number: QTBUG-70114 Task-number: QTBUG-86314 Pick-to: 6.10 6.9 6.8 Change-Id: I89a6d3aef5c2df0134579e3d12c04e4c5d7e021a Reviewed-by: Ville Voutilainen <[email protected]>
* Android: Fix crash when parent window is detached but view reference remainsAhmed El Khazari2025-08-121-0/+1
| | | | | | | | | | | | | | | | | | | This commit addresses a crash that occurs when the parent window is destroyed while the view reference is still held. The crash happens when the callback onAttachedToWindow is triggered and the QuickView.createQuickView() function is called in native code. In this scenario, the view reference is still pointing to the previous QuickView whose parent has already been cleared, causing the crash. To fix this, we reset the reference to 0 when the parent is deleted or destroyed. This ensures that when onAttachedToWindow is called again, the view is properly recreated after its underlying window has been destroyed. Pick-to: 6.10 6.9.2 6.9 Fixes: QTBUG-138922 Change-Id: Ia39eb83b58af19cd9b881915215b2be2adcfee49 Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: qApp->quit() for QtService from terminateQtNativeApplication()Assam Boudjelthia2025-08-082-2/+0
| | | | | | | | | We don't need a dedicated native call to do QCoreApplication::quit() for QtService. This can be incorporated directly under terminateQtNativeApplication(). Change-Id: I3106236430001ab3634afab7fe9ca6ac2dfe1ba2 Reviewed-by: Petri Virkkunen <[email protected]>
* Android: simplify the Qt app's exit logicAssam Boudjelthia2025-08-087-38/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, we have terminateQt(), quitApp(), quitQt() and also quitQtCoreApplication(). All these calls are called at some point or another while tearing down the Qt application. Right after main() returns, we call quitApp() which finish() the QtActivity and sets isStarted to false, then shortly after onDestroy() would be called, which calls terminateQt() which does the cleanup in native C++ side and then exit()/join() the Qt thread. The other call quitQt(), does mainly the same with the exception that it won't finish() the Activity because it's a normal Activity and it's owned by Qt, this is the way in Quick for Android use case. These many calls makes the exit sequence slightly convoluted, and to simplify it, we could do it slightly differently. Firstly, right after main() returns, we set isStarted to false, then for normal Qt apps we call finish() -> onDestroy() then calls terminateQt(), and for Quick for Android apps, their delegates would call terminateQt() directly. At the end terminateQt() would exit()/join() the Qt thread. To follow the naming of startQtNativeApplication(), this renames terminateQt() to terminateQtNativeApplication(). Change-Id: Iefe7fcc23039b3c58f81a8a3d7f38097f97ee07c Reviewed-by: Petri Virkkunen <[email protected]>
* Android: remove redundant quitQtAndroidPlugin() native methodAssam Boudjelthia2025-08-081-2/+0
| | | | | | | | | | | | | This method is redundant because the same logic is already called under terminateQt(). Below is the sequence of execution which leads the same outcome: quitApp() -> QtActivity.finish() -> onDestroy() -> terminateQt(). And this native method is called inside quitApp() just one line before QtActivity.finish(). Change-Id: I02aab9f0ccded549dbddb1d4a9a9cbcd6e39d20c Reviewed-by: Petri Virkkunen <[email protected]>
* Android: simply Qt application startup logicAssam Boudjelthia2025-08-081-13/+3
| | | | | | | | | | | | | | | | | | | | | | Currently, we have two calls responsible for application startup, startQtAndroidPlugin() and startQtApplication(). The first one is responsible for initializing things mostly, such as getting the main() handle, setting file engine handlers. That method is called as a blocking task on the Qt thread. The second one is responsible for starting the app, i.e. calling main() and after that closing and exiting the app. This one is posted to the Qt thread right after setting the application's state to started. Having this separation doesn't necessarily serve much and only adds to the complexity of the calls dance we need to do from Java <-> C++. This patch simplifies things by having one call that does the initialization, gets the main() handle, start the app and exit the Qt C++ application afterwards. This will still be run under the Qt thread as before. Change-Id: I1e93ec1a77792880426939a6302f8487a74e8915 Reviewed-by: Petri Virkkunen <[email protected]>
* Android: fix crash with -no-accessibility and a11y enabled on-deviceAssam Boudjelthia2025-08-082-1/+3
| | | | | | | | | | | | | | When Qt is built with -no-accessibility and the device has accessibility enabled (e.g. Talkback), it will lead to a crash from calling an unregistered native method. Now, this adds a small native method that's registered on library load that returns whether Qt is configured with accessibility or not which decides whether to init the accessibility layer from Java or not. Pick-to: 6.10 Fixes: QTBUG-138894 Change-Id: I6d5f86b8777c12d3b82672a221827dffcfccbbf2 Reviewed-by: Petri Virkkunen <[email protected]>
* Doc: Add target for section in Qt for Android Manifest documentationKai Köhne2025-07-291-0/+1
| | | | | | | | | Allows pages in qtdoc to link to the section with a stable anchor. Pick-to: 6.5 6.8 6.9 6.10 Task-number: QTBUG-138527 Change-Id: I086f76be542b3667e72c6bc231e581f123b08368 Reviewed-by: Assam Boudjelthia <[email protected]>
* a11y Android: Forward new QAccessibleAnnouncementEvent on AndroidJan Moeller2025-07-293-0/+32
| | | | | | | | | | | | Android support was missing and the QAccessibleAnnouncementEvent had no effect, this implements its support on Android. Task-number: QTBUG-75003 Task-number: QTBUG-135413 Pick-to: 6.8 6.9 6.10 Change-Id: Ic51920f7181c84ee54c729cb50b9b1418e208afd Reviewed-by: Assam Boudjelthia <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]>
* Docs:Update Android Manifest configuration docsSheree Morphett2025-07-281-5/+4
| | | | | | | | | | I updated the Android Manifest configuration docs to show "full" style extraction obsolete and minimal as the default Fixes: QTBUG-138654 Change-Id: I58c262288adc102510d07acf6feb30fa365dafe8 Pick-to: 6.10 6.8 Reviewed-by: Nicholas Bennett <[email protected]>
* Android: simplify accessibility layer initializationAssam Boudjelthia2025-07-262-10/+1
| | | | | | | | | | Initialize the accessibility layer directly from Java under QtActivityDelegate and get rid of the many chained calls from many places in the Qt C++ side. Pick-to: 6.10 Change-Id: Ib2c3ca3f856a5898c4e0392e98b9867b63d15938 Reviewed-by: Petri Virkkunen <[email protected]>
* Android: fix layout check under initLayoutAccessibility()Assam Boudjelthia2025-07-261-1/+3
| | | | | | | | | | It was checking for m_layout being null before it's ever initialized which will always give false and thus a misleading warning. Check instead for the layout parameter provided to the method. Pick-to: 6.10 6.9 6.8 Change-Id: I6e589763ac70343ad896a6d582d9256b71751143 Reviewed-by: Petri Virkkunen <[email protected]>
* Android: silence spurious warnings from AndroidContentFileEngineAssam Boudjelthia2025-07-262-0/+76
| | | | | | | | | | | | | | | | | | | | | | Move Java calls that might throw exceptions and handle them with a try/catch by printing the appropriate error messages where relevant and ignore the ones we don't necessarily need. For certain operations like query we should check if we have read permission for the URI first, and only then do the query, because otherwise it's guaranteed to fail if there's no read permission. Pick-to: 6.10 6.9 6.8 Fixes: QTBUG-138013 Fixes: QTBUG-126531 Fixes: QTBUG-123319 Fixes: QTBUG-134912 Fixes: QTBUG-110240 Fixes: QTBUG-132403 Fixes: QTBUG-129324 Change-Id: I8457b6bfd9381bf1a62077520cf9a222311ded7a Reviewed-by: Petri Virkkunen <[email protected]>
* Re-land: Android: destroy the window surface only after exit transitionJani Korteniemi2025-07-242-21/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Splash screen (or blank launch screen) is shown when exiting the Android application caused by hiding shown windows and destroying it's surface before application exit. On application exit all windows are first set to invisible then surfaces destroyed and finally removed from layout. Also window opacity change can show underlying splash screen as it is set as theme for the application. When pressing Android device's back button application either should hide current window or exit the application. When exiting current window should be visible during application exit. Add AtomicBoolean m_canBeDestroyed to QtWindow for blocking normal surface removal. Set false by default from QtActivityDelegate.addTopLevelWindow and changed from QAndroidPlatformWindow::setVisible() dependent on if there are more visible windows present. Destroy last window with delay so it can be shown during app exit. Set full screen flags for current window on pre Android 11 so it's decor view can scale to full screen on multi-window mode view is when updated. In QtActivityDelegate.setUpSplashScreen() set layout to use android device's DayNight theme colors to not show splash screen theme if window opacity is changed. Previous reverted change caused crashed tst_qmltc_examples test. Previous SHA e40d9d43614b71c803a92fc640fc66f9a96cb095 Fixes: QTBUG-127705 Task-number: QTBUG-124140 Pick-to: 6.8 6.9 6.10 Change-Id: Ifda904c08c3b4363005e953e5ba9ff15a46e5195 Reviewed-by: Jarkko Koivikko <[email protected]> Reviewed-by: Assam Boudjelthia <[email protected]>