1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-31 18:41:20 +00:00

Ensure that the permission requests results are dispatched on the render thread

This commit is contained in:
Fredia Huya-Kouadio
2025-12-12 14:38:54 -08:00
parent 08e6cd181f
commit c9fb6a3040

View File

@@ -761,7 +761,9 @@ class Godot private constructor(val context: Context) {
val newDarkMode = newConfig.uiMode.and(Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES val newDarkMode = newConfig.uiMode.and(Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES
if (darkMode != newDarkMode) { if (darkMode != newDarkMode) {
darkMode = newDarkMode darkMode = newDarkMode
GodotLib.onNightModeChanged() runOnRenderThread {
GodotLib.onNightModeChanged()
}
} }
if (currentConfig.orientation != newConfig.orientation) { if (currentConfig.orientation != newConfig.orientation) {
@@ -780,7 +782,9 @@ class Godot private constructor(val context: Context) {
plugin.onMainActivityResult(requestCode, resultCode, data) plugin.onMainActivityResult(requestCode, resultCode, data)
} }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
FilePicker.handleActivityResult(context, requestCode, resultCode, data) runOnRenderThread {
FilePicker.handleActivityResult(context, requestCode, resultCode, data)
}
} }
} }
@@ -795,11 +799,13 @@ class Godot private constructor(val context: Context) {
for (plugin in pluginRegistry.allPlugins) { for (plugin in pluginRegistry.allPlugins) {
plugin.onMainRequestPermissionsResult(requestCode, permissions, grantResults) plugin.onMainRequestPermissionsResult(requestCode, permissions, grantResults)
} }
for (i in permissions.indices) { runOnRenderThread {
GodotLib.requestPermissionResult( for (i in permissions.indices) {
permissions[i], GodotLib.requestPermissionResult(
grantResults[i] == PackageManager.PERMISSION_GRANTED permissions[i],
) grantResults[i] == PackageManager.PERMISSION_GRANTED
)
}
} }
} }
@@ -1108,7 +1114,7 @@ class Godot private constructor(val context: Context) {
for (plugin in pluginRegistry.allPlugins) { for (plugin in pluginRegistry.allPlugins) {
plugin.onMainBackPressed() plugin.onMainBackPressed()
} }
renderView?.queueOnRenderThread { GodotLib.back() } runOnRenderThread { GodotLib.back() }
} }
/** /**