Skip to content

Commit 16975f5

Browse files
committed
Merge pull request godotengine#114465 from m4gr3d/fix_editor_hybrid_app_support_detection
[Android editor] Restrict Android editor support for hybrid app projects to XR devices
2 parents 4b96991 + 185a4ab commit 16975f5

4 files changed

Lines changed: 6 additions & 8 deletions

File tree

platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotGame.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ abstract class BaseGodotGame: GodotEditor() {
104104
@CallSuper
105105
override fun supportsFeature(featureTag: String): Boolean {
106106
if (HYBRID_APP_FEATURE == featureTag) {
107-
// Check if hybrid is enabled
108-
return isHybridAppEnabled()
107+
// Check if hybrid is enabled.
108+
return godot?.isXrRuntime == true && isHybridAppEnabled()
109109
}
110110

111111
return super.supportsFeature(featureTag)

platform/android/java/lib/src/main/java/org/godotengine/godot/Godot.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ class Godot private constructor(val context: Context) {
135135
private val gyroscopeEnabled = AtomicBoolean(false)
136136
private val mGyroscope: Sensor? by lazy { mSensorManager?.getDefaultSensor(Sensor.TYPE_GYROSCOPE) }
137137

138+
val isXrRuntime: Boolean by lazy { hasFeature("xr_runtime") }
139+
138140
val tts = GodotTTS(context)
139141
val directoryAccessHandler = DirectoryAccessHandler(context)
140142
val fileAccessHandler = FileAccessHandler(context)

platform/android/java/lib/src/main/java/org/godotengine/godot/GodotGLRenderView.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,11 @@ class GodotGLRenderView extends GLSurfaceView implements GodotRenderView {
8080
private final GodotInputHandler inputHandler;
8181
private final GodotRenderer godotRenderer;
8282
private final SparseArray<PointerIcon> customPointerIcons = new SparseArray<>();
83-
private final boolean isXrDevice;
8483

8584
public GodotGLRenderView(Godot godot, GodotInputHandler inputHandler, XRMode xrMode, boolean useDebugOpengl, boolean shouldBeTranslucent) {
8685
super(godot.getContext());
8786

8887
this.godot = godot;
89-
isXrDevice = godot.hasFeature("xr_runtime");
9088
this.inputHandler = inputHandler;
9189
this.godotRenderer = new GodotRenderer();
9290
setPointerIcon(PointerIcon.getSystemIcon(getContext(), PointerIcon.TYPE_DEFAULT));
@@ -177,7 +175,7 @@ public void onPointerCaptureChange(boolean hasCapture) {
177175
@Override
178176
public boolean canCapturePointer() {
179177
// Pointer capture is not supported on XR devices.
180-
return !isXrDevice && inputHandler.canCapturePointer();
178+
return !godot.isXrRuntime() && inputHandler.canCapturePointer();
181179
}
182180

183181
@Override

platform/android/java/lib/src/main/java/org/godotengine/godot/GodotVulkanRenderView.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,11 @@ class GodotVulkanRenderView extends VkSurfaceView implements GodotRenderView {
5555
private final GodotInputHandler mInputHandler;
5656
private final VkRenderer mRenderer;
5757
private final SparseArray<PointerIcon> customPointerIcons = new SparseArray<>();
58-
private final boolean isXrDevice;
5958

6059
public GodotVulkanRenderView(Godot godot, GodotInputHandler inputHandler, boolean shouldBeTranslucent) {
6160
super(godot.getContext());
6261

6362
this.godot = godot;
64-
isXrDevice = godot.hasFeature("xr_runtime");
6563
mInputHandler = inputHandler;
6664
mRenderer = new VkRenderer();
6765
setPointerIcon(PointerIcon.getSystemIcon(getContext(), PointerIcon.TYPE_DEFAULT));
@@ -156,7 +154,7 @@ public boolean onCapturedPointerEvent(MotionEvent event) {
156154
@Override
157155
public boolean canCapturePointer() {
158156
// Pointer capture is not supported on XR devices.
159-
return !isXrDevice && mInputHandler.canCapturePointer();
157+
return !godot.isXrRuntime() && mInputHandler.canCapturePointer();
160158
}
161159
@Override
162160
public void requestPointerCapture() {

0 commit comments

Comments
 (0)