Fix hybrid app support detection for the Android editor

This commit is contained in:
Fredia Huya-Kouadio
2025-12-30 20:39:18 -08:00
parent 1559ab34c6
commit 185a4abcb5
4 changed files with 6 additions and 8 deletions
@@ -104,8 +104,8 @@ abstract class BaseGodotGame: GodotEditor() {
@CallSuper
override fun supportsFeature(featureTag: String): Boolean {
if (HYBRID_APP_FEATURE == featureTag) {
// Check if hybrid is enabled
return isHybridAppEnabled()
// Check if hybrid is enabled.
return godot?.isXrRuntime == true && isHybridAppEnabled()
}
return super.supportsFeature(featureTag)
@@ -135,6 +135,8 @@ class Godot private constructor(val context: Context) {
private val gyroscopeEnabled = AtomicBoolean(false)
private val mGyroscope: Sensor? by lazy { mSensorManager?.getDefaultSensor(Sensor.TYPE_GYROSCOPE) }
val isXrRuntime: Boolean by lazy { hasFeature("xr_runtime") }
val tts = GodotTTS(context)
val directoryAccessHandler = DirectoryAccessHandler(context)
val fileAccessHandler = FileAccessHandler(context)
@@ -80,13 +80,11 @@ class GodotGLRenderView extends GLSurfaceView implements GodotRenderView {
private final GodotInputHandler inputHandler;
private final GodotRenderer godotRenderer;
private final SparseArray<PointerIcon> customPointerIcons = new SparseArray<>();
private final boolean isXrDevice;
public GodotGLRenderView(Godot godot, GodotInputHandler inputHandler, XRMode xrMode, boolean useDebugOpengl, boolean shouldBeTranslucent) {
super(godot.getContext());
this.godot = godot;
isXrDevice = godot.hasFeature("xr_runtime");
this.inputHandler = inputHandler;
this.godotRenderer = new GodotRenderer();
setPointerIcon(PointerIcon.getSystemIcon(getContext(), PointerIcon.TYPE_DEFAULT));
@@ -177,7 +175,7 @@ class GodotGLRenderView extends GLSurfaceView implements GodotRenderView {
@Override
public boolean canCapturePointer() {
// Pointer capture is not supported on XR devices.
return !isXrDevice && inputHandler.canCapturePointer();
return !godot.isXrRuntime() && inputHandler.canCapturePointer();
}
@Override
@@ -55,13 +55,11 @@ class GodotVulkanRenderView extends VkSurfaceView implements GodotRenderView {
private final GodotInputHandler mInputHandler;
private final VkRenderer mRenderer;
private final SparseArray<PointerIcon> customPointerIcons = new SparseArray<>();
private final boolean isXrDevice;
public GodotVulkanRenderView(Godot godot, GodotInputHandler inputHandler, boolean shouldBeTranslucent) {
super(godot.getContext());
this.godot = godot;
isXrDevice = godot.hasFeature("xr_runtime");
mInputHandler = inputHandler;
mRenderer = new VkRenderer();
setPointerIcon(PointerIcon.getSystemIcon(getContext(), PointerIcon.TYPE_DEFAULT));
@@ -156,7 +154,7 @@ class GodotVulkanRenderView extends VkSurfaceView implements GodotRenderView {
@Override
public boolean canCapturePointer() {
// Pointer capture is not supported on XR devices.
return !isXrDevice && mInputHandler.canCapturePointer();
return !godot.isXrRuntime() && mInputHandler.canCapturePointer();
}
@Override
public void requestPointerCapture() {