summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android
Commit message (Collapse)AuthorAgeFilesLines
* a11y Android: Use RANGE_TYPE_PERCENT for RangeInfo of ProgressBarJulian Greilich6 days1-2/+11
| | | | | | | | | This way the current value is announced as "xy percent". Task-number: QTBUG-139712 Pick-to: 6.10 6.8 Change-Id: I796e942a799c78f4fc144e77bf9d18b9c1cb0ea3 Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: improve setting of platform window states and flagsAssam Boudjelthia11 days3-31/+15
| | | | | | | | | | | | | | | | | | | | | | | The current implementation had two issues: 1. Setting a flag before the window is shown has no effect, becuase the android platform window had its own flags data, but before the window is shown, the platform window isn't yet created, so that initial flag setting is lost. 2. The system UI was never updated when a flag has changed, as in the case of Qt::ExpandedClientAreaHint which affects the system the system UI visibility. This patch gets rid of rid of the platform window's separate internal tracking of states and flags to make things simpler. Also, it changes the way updateSystemUiVisibility() works by passing states/flags to it to be more flexible to handle all changes and cases. Fixes: QTBUG-140830 Pick-to: 6.10 6.8 6.5 Change-Id: Iff9f1b02a0a71320a3514e462de0cd6c1b8589fd Reviewed-by: Tor Arne Vestbø <[email protected]>
* a11y: Add Switch roleLars Schmertmann14 days1-1/+2
| | | | | | | | | | | | | | | Distinguishing a Switch from a CheckBox is necessary on at least Android. Windows uses the already available IToggleProvider interface, which gets correctly recognized as a switch when used with UIA_ButtonControlTypeId. [ChangeLog][QtGui][QAccessible] Added new Switch role that can be used instead of CheckBox for more accurately communicating the elements role to assistive technology. Fixes: QTBUG-139676 Change-Id: I77d33ea5ad32e58ba01c63c418c11ccc25d19c54 Reviewed-by: Michael Weghorn <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]>
* Android: don't check keyboard visibility in hasValidFocusObject()Assam Boudjelthia14 days1-3/+0
| | | | | | | | | | | | | | | | | | Don't check for keyboard visibility when checking for a valid focus object under QAndroidInputContext before running actions on the Android thread. because the keyboard is not immediately visible after being reqeusted, some actions might end up being dropped at the beginning, and the other checks we have already should cover cases to avoid calling those actions on non-valid input object. Partially reverts c8a1e7bb37863ccf1d5859f36841a350060aaddf. Fixes: QTBUG-140856 Pick-to: 6.10 6.8 6.5 Change-Id: Ic3bc43f50aa0ef9ac46b4bb2e490c8be5d560619 Reviewed-by: Konsta Alajärvi <[email protected]> Reviewed-by: Ville Voutilainen <[email protected]>
* Android: move system ui code to its own QtWindowInsetsController classAssam Boudjelthia14 days2-7/+15
| | | | | | | | | | 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: init QPA plugin separately from application startAssam Boudjelthia14 days1-35/+38
| | | | | | | | | | | | | 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]>
* Update contrastPreference correctly on AndroidOliver Eftevaag2025-10-072-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: guard platform plugin egl code behind QT_CONFIG(egl)Assam Boudjelthia2025-10-014-6/+37
| | | | | | | Pick-to: 6.10 6.8 Fixes: QTBUG-140536 Change-Id: Ic2f3fe3fde80af7b84d8df5cf38e03de6b627112 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Android: set system bars colors when Qt color scheme is requestedAssam Boudjelthia2025-09-292-0/+25
| | | | | | | | | | | 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]>
* Remove Qt::WindowType::Desktop in QAndroidJniMenuAxel Spoerl2025-09-271-1/+1
| | | | | | | | | Qt::WindowType::Desktop is no longer a valid window type in Qt6. Remove its occurence in QAndroidJniMenu. Task-number: QTBUG-140514 Change-Id: I64cd1b81001e3b8b34a45bfd87917038449849dc Reviewed-by: Volker Hilsheimer <[email protected]>
* Android: Avoid announcing simple text as clickableLars Schmertmann2025-09-161-2/+3
| | | | | | | | | | | | | | | The definition of Accessible.onPressAction is enough to let Android announce an element as clickable. But this is a problem when components are designied in a way like this: Accessible.role: clickable ? Accessible.Button : Accessible.StaticText Accessible.onPressAction: clickable ? doit() : nothing() So we avoid to set clickable for StaticText and Heading. Windows, macOS and iOS already have the right behavior and do not care about pressAction or toggleAction on simple text. Pick-to: 6.10 6.9 6.8 Change-Id: I7bf9ffae112b92dd4a90f51f014a348dfe1b63f3 Reviewed-by: Tor Arne Vestbø <[email protected]>
* a11y Android: Set a RangeInfo by using the ValueInterfaceJulian Greilich2025-09-161-0/+39
| | | | | | | | | | | | | This enables components to provide more detailed information about the value to the a11y-interface. For the ProgressBar this controls the pitch of the sound which TalkBack uses to represent the current value of the ProgressBar. Task-number: QTBUG-139712 Pick-to: 6.8 6.9 6.10 Change-Id: I0b2694e8e47b264d75e3fcecbbe900c310aa4e19 Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: don't keep system visibility cache on both C++ and JavaAssam Boudjelthia2025-09-122-9/+2
| | | | | | | | | | | Since Android Java side is managing the system ui visibility calls, keep any cached states there to avoid any inconsistency between the two sides, so Qt always sends the call and Java decides whether it goes through with it or not. Pick-to: 6.10 6.10.0 Change-Id: I68dfb64fe38ecd7d71a6aae5bfa2e32b8f481b04 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Android: warn instead of assert on invalid winId on windowFocusChangedAssam Boudjelthia2025-09-101-1/+6
| | | | | | Pick-to: 6.9 6.10 Change-Id: I2cb0431dccc1fd87a4d363b4bcc9a18443abbaaf Reviewed-by: Tor Arne Vestbø <[email protected]>
* Android: fix rendering glitch after window size changesAssam Boudjelthia2025-09-092-0/+3
| | | | | | | | | | | | | | | | | | | | | | | 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]>
* Android: report margins only when window is under unsafe areaAssam Boudjelthia2025-09-061-15/+20
| | | | | | | | | | | | | | | | | | | | | 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-5/+0
| | | | | | | | | | | | | | | | | | 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]>
* Deprecate and remove traces of RasterGLSurfaceTor Arne Vestbø2025-09-031-1/+0
| | | | | | | | | | We no longer use this hybrid surface type approach for Qt Widget's composition mode. Nowadays we use RHI to compose the widget texture and the native textures, and the window surface type depends on the RHI API in use, e.g. QSurface::MetalSurface, or QSurface::OpenGLSurface. Change-Id: I85001100f681a1cf524b8b7dc50f680a9579b447 Reviewed-by: Laszlo Agocs <[email protected]>
* Revert "Re-land: Android: destroy the window surface only after exit transition"Assam Boudjelthia2025-09-021-7/+0
| | | | | | | | | | | | | 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: rename m_surfaceCreated to m_androidSurfaceCreatedAssam Boudjelthia2025-09-014-9/+9
| | | | | | | | | This would make it clear that the boolean is tracking the Android surface (QtSurface) and not the egl surface. Pick-to: 6.10 Change-Id: Idd46940b9f18d7c489b0ed3ca8b64780f248bb76 Reviewed-by: Laszlo Agocs <[email protected]>
* Android: ensure ANativeWindow_fromSurface() is called on valid objectAssam Boudjelthia2025-09-013-18/+13
| | | | | | | | | | | | Amends b25c1e8452ecffa70b4b75fdb579f08187b36a63. The above change simplified the logic there but introduced a potential crash if m_surfaceCreated is true while the surface m_androidSurfaceObject has not yet been initialized. Pick-to: 6.10 Change-Id: Ia185aef175022b973614950857aae4e02cb8c0d3 Reviewed-by: Laszlo Agocs <[email protected]>
* Android: use QJniEnvironment::getJniEnv() without creating an instanceAssam Boudjelthia2025-08-291-2/+2
| | | | | | Pick-to: 6.8 6.9 6.10 Change-Id: I7e5ecc0d3c738dc49c25b37184938f8eca99eabb Reviewed-by: Volker Hilsheimer <[email protected]>
* Android: terminate Qt after main() also for embedded use caseAssam Boudjelthia2025-08-281-8/+11
| | | | | | | | | | | | | | | | | | | | | Prior to 6aba83405cea658a5c58eb70dd31f41a9135ae49, Qt was calling quitQt() if the app is embedding Qt into an Android app, but that change didn't keep that and instead of only handling the normal Qt for Android use case. At the same time, move setStarted() inside the runOnAndroidMainThread() otherwise native views created from the UI thread might complain being changed from a different thread like the one startQtNativeApplication() is called from. As a pass by, fix the call to "selfStop" JNI method name that mistakenly had parenthesis in the string. Amends 6aba83405cea658a5c58eb70dd31f41a9135ae49. Fixes: QTBUG-139591 Change-Id: I8f7aa47e75ed6fc28ad23fa2178bcd3be7018a59 Reviewed-by: Ville Voutilainen <[email protected]>
* Android: set surface type from Raster to OpenGL in QAndroidPlatformWindowAssam Boudjelthia2025-08-282-5/+3
| | | | | | | | ... instead of the QAndroidPlatformOpenGLWindow. Pick-to: 6.10 6.9 6.8 Change-Id: I3e0b72517d03ca95b55eb40320733c55ebd8e03e Reviewed-by: Tor Arne Vestbø <[email protected]>
* Android: split and rename checkNativeSurface()Assam Boudjelthia2025-08-273-15/+16
| | | | | | | | | | | | This function is doing more than what's obvious from the name, it checks if the surface has been created and creates the egl surface and then calls sendExpose(). This splits and renamed to one call for checking if the surface, then sendExpose() is moved to the existing createEgl(). Pick-to: 6.10 Change-Id: Ie15123324fca68df4a66c386916f13d691ac66c6 Reviewed-by: Ville Voutilainen <[email protected]>
* Android: add debug print when egl/vkSurface() called while suspendedAssam Boudjelthia2025-08-272-1/+5
| | | | | | Pick-to: 6.10 Change-Id: I5a75a75c6f56c8b8f9f18aff400aea6160496cee Reviewed-by: Ville Voutilainen <[email protected]>
* Android: remove unnecessary comma in debug messageAssam Boudjelthia2025-08-261-1/+1
| | | | | | Pick-to: 6.10 Change-Id: I3071c27d83123512a8980773c2029115c573a37f Reviewed-by: Ville Voutilainen <[email protected]>
* Android: add logging for AndroidDeadlockProtectorAssam Boudjelthia2025-08-265-6/+16
| | | | | | | | | | | Have AndroidDeadlockProtector instance provide a string as an identifier of where it's going to be acquired so that when another code try to acquire we can have better logs of what can potentially go wrong. Pick-to: 6.10 Change-Id: I14abc0058831c5f23f2d96c6ce0231a6e0cc8f68 Reviewed-by: Ville Voutilainen <[email protected]>
* Android: move AndroidDeadlockProtector to QtAndroidPrivate namespaceAssam Boudjelthia2025-08-269-44/+5
| | | | | | | | | | This way it can be used by all Qt code and not only under the platform plugin and avoid cases where it's forgotten to manually release it when only using acquireAndroidDeadlockProtector(). Pick-to: 6.10 Change-Id: Ie7658b4057d499c470cf7d8706928870edabcf0e Reviewed-by: Ville Voutilainen <[email protected]>
* Android: fix deadlock protector locking in QAndroidEventDispatcherAssam Boudjelthia2025-08-261-1/+1
| | | | | | | | | | | | | | | | | The order of conditions in QAndroidEventDispatcher::processEvents() causes excessive and unnecessary locking for AndroidDeadlockProtector with every call to processEvents() and in the majority of the cases it's not needed at all. QAndroidEventDispatcher is mainly used when setting the app's state or when creating the window surface, for that reason we end up with calls first locking the deadlock protector and then check m_stopRequest that most of the time is false. To avoid any issues with trying to acquire same lock over and over and to be more effecient the check for m_stopRequest needs to comes first. Pick-to: 6.5 6.8 6.9 6.10 Fixes: QTBUG-132695 Change-Id: Iaa9a019ad666e2da073454d6473bba65c6c18418 Reviewed-by: Ville Voutilainen <[email protected]>
* Android: check if focus object has input method hintsAssam Boudjelthia2025-08-261-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | Check the focus object has inputMethodHints property that's set for various Qt elements that support IME input, this can avoid more calls to runOnQtThread() that might interfere with egl operations. This is not a proper fix for the underlying issue but more of an improvement on top of the existing check. Amends c8a1e7bb37863ccf1d5859f36841a350060aaddf. Task-number: QTBUG-139211 Task-number: QTBUG-100991 Task-number: QTBUG-131695 Task-number: QTBUG-125083 Task-number: QTBUG-138837 Task-number: QTBUG-132695 Task-number: QTBUG-139400 Task-number: QTBUG-107028 Task-number: QTBUG-100259 Task-number: QTBUG-100258 Task-number: QTBUG-139415 Pick-to: 6.5 6.8 6.9 6.10 Change-Id: Ieeeb2dedfd773b13f9635714c436c6f104531748 Reviewed-by: Mitch Curtis <[email protected]>
* Android: qFatal() if eglSurface() can't acquire deadlock protectorAssam Boudjelthia2025-08-231-1/+4
| | | | | | | | | This will fail later but with a more unspecific fatal message, so calling qFatal() here with a proper reason is better. Pick-to: 6.10 Change-Id: Idd38379cb8808ad987549f7fe2d770ae245adfe5 Reviewed-by: Volker Hilsheimer <[email protected]>
* Android: ensure valid focus object before native input context actionsAssam Boudjelthia2025-08-222-22/+37
| | | | | | | | | | | | | | | | | | | | Before attempting any input context operations coming from Qt native Java calls ensure we have a valid focus object. Attempting to do this locks the AndroidDeadlockProtector, at the time potentially QAndroidPlatformOpenGLWindow::eglSurface() can be called while the surface is not yet ready, and it attempts to create one and that also locks the AndroidDeadlockProtector. Pick-to: 6.5 6.8 6.9 6.10 Fixes: QTBUG-139211 Fixes: QTBUG-100991 Fixes: QTBUG-131695 Fixes: QTBUG-125083 Fixes: QTBUG-138837 Task-number: QTBUG-132695 Task-number: QTBUG-139400 Change-Id: I4689a0625d62f3ae3fbcd3674c046c431a3e84ca Reviewed-by: Volker Hilsheimer <[email protected]>
* Android: Set name-matched class names for Slider and ScrollBar for TalkBackTimon Sassor2025-08-221-2/+3
| | | | | | | | | | | | | | | | Seekbar is not the ideal class name for ScrollBar and Slider. It changes the behavior of these Element, so that the scroll actions are not properly delivered to them by TalkBack. We use the Android class name that best match the QAccessible role name. We accept, that TalkBack has no implementation for them and will use the default behavior of Android.view. [ChangeLog][Accessibility][Android] Use different Android class names for Slider and Scroller. Pick-to: 6.10 6.9 6.8 Change-Id: I03d9ce2bd051ff2c330852636d92e47c6d971884 Reviewed-by: Assam Boudjelthia <[email protected]>
* a11y Android: Announce changes to name/description to TalkBackJan Moeller2025-08-225-0/+23
| | | | | | | | | | | | 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-221-0/+28
| | | | | | | | | | | | | | 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: check if returned bitmap is valid before useAssam Boudjelthia2025-08-181-0/+4
| | | | | | Pick-to: 6.10 Change-Id: Ief11389fa4e1b44a854b3d98c47f74d6d0d04bf7 Reviewed-by: Volker Hilsheimer <[email protected]>
* Android: rework and fix issues with content file engineAssam Boudjelthia2025-08-142-112/+256
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rework parts of the content file engine handling especially when parsing the paths to get valid uri that can be used seemlessly with DocumentsContract. This fixes few issues with the content uri handling and allow more operations to be done without awkward workarounds: * The main issue was parsing the URI and creating a valid DocumentFile and parent if applicable, this was not handled quite properly before. So now, each case of a URI type is delt with separately (e.g. document, tree, mixed, children URIs) all while making sure to keep proper encoding while parsing the URI. * open() was getting involved into details like the path structure and not relying on DocumentFile implementation. * Handle file names, especially in cases where the file is not yet created and doing query() would fail, so in such cases initialize the DocumentFile with an initial name as fallback. * Moving operations were always failing due to the various name and path string manipulations, and not properly relying on the DocumentFile child/parent implementation. Pick-to: 6.10 6.9 6.8 Fixes: QTBUG-124011 Fixes: QTBUG-115143 Fixes: QTBUG-114979 Change-Id: I949f84fc658bf0588ebe239b07e6111d5b3b0cce Reviewed-by: Ville Voutilainen <[email protected]>
* Android: qApp->quit() for QtService from terminateQtNativeApplication()Assam Boudjelthia2025-08-081-9/+4
| | | | | | | | | 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-081-10/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-13/+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-63/+66
| | | | | | | | | | | | | | | | | | | | | | 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-081-0/+10
| | | | | | | | | | | | | | 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]>
* Android: reword Android QPA start info messageAssam Boudjelthia2025-07-311-1/+1
| | | | | | | | | | Be more specific with the info message of what has been started qt started -> Qt platform plugin started Pick-to: 6.10 Change-Id: I4bdb7012a1aed83ee67efce6ec1f1eff01dff02d Reviewed-by: Petri Virkkunen <[email protected]>
* a11y Android: Forward new QAccessibleAnnouncementEvent on AndroidJan Moeller2025-07-295-0/+17
| | | | | | | | | | | | 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]>
* Android: rephrase A11Y setActive(true) log as debug instead of warningAssam Boudjelthia2025-07-261-3/+5
| | | | | | | | | | | When the platform integration is not ready, we defer the activation till when the former is ready, that log message is not a warning and it's better to be just a debug message since there's nothing bad to necessarily warn about. Pick-to: 6.10 6.9 6.8 Change-Id: Ibadd879b9d16b2ff2e668099abad15439f363277 Reviewed-by: Petri Virkkunen <[email protected]>
* Android: simplify accessibility layer initializationAssam Boudjelthia2025-07-265-17/+2
| | | | | | | | | | 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: silence spurious warnings from AndroidContentFileEngineAssam Boudjelthia2025-07-261-11/+14
| | | | | | | | | | | | | | | | | | | | | | 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-241-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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]>
* CRA: rectify androidcontentfileengine.cpp and extract.cpp filesAssam Boudjelthia2025-07-142-2/+1
| | | | | | | | | | | | | | | | | | | | Under androidcontentfileengine.cpp, mainly parsing and encoding/decoding of file paths are done, so a more accurate reason is data-parser instead of file-handling. Under extract.cpp, the criticality is not very accurate either, as the only way we're using this code is to extract Android system style, and it's not expected to have security concerns or be affected by a 3rd party. Amends a6caa394ba49cb58cc07613f9a5fc6bfb5975e3b. Pick-to: 6.10 6.9 6.8 Task-number: QTBUG-136818 Task-number: QTBUG-135178 Task-number: QTBUG-136816 Change-Id: Id582d92befb000afbe4d9b01f79ef220e274711e Reviewed-by: Dimitrios Apostolou <[email protected]>