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
if (darkMode != newDarkMode) {
darkMode = newDarkMode
GodotLib.onNightModeChanged()
runOnRenderThread {
GodotLib.onNightModeChanged()
}
}
if (currentConfig.orientation != newConfig.orientation) {
@@ -780,7 +782,9 @@ class Godot private constructor(val context: Context) {
plugin.onMainActivityResult(requestCode, resultCode, data)
}
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) {
plugin.onMainRequestPermissionsResult(requestCode, permissions, grantResults)
}
for (i in permissions.indices) {
GodotLib.requestPermissionResult(
permissions[i],
grantResults[i] == PackageManager.PERMISSION_GRANTED
)
runOnRenderThread {
for (i in permissions.indices) {
GodotLib.requestPermissionResult(
permissions[i],
grantResults[i] == PackageManager.PERMISSION_GRANTED
)
}
}
}
@@ -1108,7 +1114,7 @@ class Godot private constructor(val context: Context) {
for (plugin in pluginRegistry.allPlugins) {
plugin.onMainBackPressed()
}
renderView?.queueOnRenderThread { GodotLib.back() }
runOnRenderThread { GodotLib.back() }
}
/**