You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Android: Stabilize camera lifecycle handling
- Pause camera feeds during lifecycle transitions to avoid crashes - Refresh camera metadata after rotation to keep orientation accurate
This commit is contained in:
@@ -170,6 +170,7 @@ class Godot private constructor(val context: Context) {
|
||||
*/
|
||||
private var renderViewInitialized = false
|
||||
private var primaryHost: GodotHost? = null
|
||||
private var currentConfig = context.resources.configuration
|
||||
|
||||
/**
|
||||
* Tracks whether we're in the RESUMED lifecycle state.
|
||||
@@ -757,6 +758,13 @@ class Godot private constructor(val context: Context) {
|
||||
darkMode = newDarkMode
|
||||
GodotLib.onNightModeChanged()
|
||||
}
|
||||
|
||||
if (currentConfig.orientation != newConfig.orientation) {
|
||||
runOnRenderThread {
|
||||
GodotLib.onScreenRotationChange()
|
||||
}
|
||||
}
|
||||
currentConfig = newConfig
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -295,6 +295,11 @@ public class GodotLib {
|
||||
*/
|
||||
public static native void onRendererPaused();
|
||||
|
||||
/**
|
||||
* Invoked when the screen orientation changes.
|
||||
*/
|
||||
static native void onScreenRotationChange();
|
||||
|
||||
/**
|
||||
* @return true if input must be dispatched from the render thread. If false, input is
|
||||
* dispatched from the UI thread.
|
||||
|
||||
Reference in New Issue
Block a user