IJPL-248178 Fix the race between two writers of the ATK Wrapper VM option

Setting GeneralSettings.isSupportScreenReaders notifies ScreenReaderStateManager, which synchronizes the same VM option from its own coroutine. Both writers raced, and when the listener won, updateAtkWrapperVmOption found the option already up to date and reported that nothing had changed. If the temporary in-session activation of the wrapper had failed as well, applyRequestedChanges then skipped the restart, so the requested configuration only took effect after the next manual restart and the user was not told about it.

(cherry picked from commit 9238f77faac6659ba73e97f7bd669c1104f70a38)

GitOrigin-RevId: 6acbaccdb10fa4be3ea5771479a3bf1befa4d612
This commit is contained in:
Tatiana Elfimova
2026-08-10 17:55:49 +00:00
committed by intellij-monorepo-bot
parent 24dd20f124
commit 8eb7d9779a
@@ -119,14 +119,14 @@ object LinuxAccessibilitySupport {
* or to leave the temporary runtime ATK Wrapper activation state.
*/
suspend fun applyRequestedChanges(): Boolean {
if (screenReaderSupportRequested && !isSupportScreenReadersOverridden()) {
serviceAsync<GeneralSettings>().isSupportScreenReaders = true
}
val vmOptionsUpdated = linuxAccessibilitySupportRequested &&
!atkWrapperEnabledInConfig &&
updateAtkWrapperVmOption(shouldEnableAtkWrapper = true)
if (screenReaderSupportRequested && !isSupportScreenReadersOverridden()) {
serviceAsync<GeneralSettings>().isSupportScreenReaders = true
}
val restartRequired = atkWrapperActivatedInCurrentSession || vmOptionsUpdated
if (restartRequired) {
AccessibilityUsageTrackerCollector.flushRaisedEvents()