mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 06:01:14 +00:00
Merge pull request #96742 from m4gr3d/check_openxr_automatic_permissions_request
[Android editor] Limit when OpenXR runtime permissions are requested
This commit is contained in:
commit
f33a81977b
3 changed files with 19 additions and 11 deletions
|
|
@ -45,15 +45,13 @@ open class GodotEditor : BaseGodotEditor() {
|
|||
|
||||
internal val XR_RUN_GAME_INFO = EditorWindowInfo(GodotXRGame::class.java, 1667, ":GodotXRGame")
|
||||
|
||||
internal const val USE_ANCHOR_API_PERMISSION = "com.oculus.permission.USE_ANCHOR_API"
|
||||
internal const val USE_SCENE_PERMISSION = "com.oculus.permission.USE_SCENE"
|
||||
}
|
||||
|
||||
override fun getExcludedPermissions(): MutableSet<String> {
|
||||
val excludedPermissions = super.getExcludedPermissions()
|
||||
// The USE_ANCHOR_API and USE_SCENE permissions are requested when the "xr/openxr/enabled"
|
||||
// project setting is enabled.
|
||||
excludedPermissions.add(USE_ANCHOR_API_PERMISSION)
|
||||
// The USE_SCENE permission is requested when the "xr/openxr/enabled" project setting
|
||||
// is enabled.
|
||||
excludedPermissions.add(USE_SCENE_PERMISSION)
|
||||
return excludedPermissions
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
package org.godotengine.editor
|
||||
|
||||
import org.godotengine.godot.GodotLib
|
||||
import org.godotengine.godot.utils.PermissionsUtil
|
||||
import org.godotengine.godot.xr.XRMode
|
||||
|
||||
/**
|
||||
|
|
@ -62,8 +61,16 @@ open class GodotXRGame: GodotGame() {
|
|||
|
||||
val openxrEnabled = GodotLib.getGlobal("xr/openxr/enabled").toBoolean()
|
||||
if (openxrEnabled) {
|
||||
permissionsToEnable.add(USE_ANCHOR_API_PERMISSION)
|
||||
permissionsToEnable.add(USE_SCENE_PERMISSION)
|
||||
// We only request permissions when the `automatically_request_runtime_permissions`
|
||||
// project setting is enabled.
|
||||
// If the project setting is not defined, we fall-back to the default behavior which is
|
||||
// to automatically request permissions.
|
||||
val automaticallyRequestPermissionsSetting = GodotLib.getGlobal("xr/openxr/extensions/automatically_request_runtime_permissions")
|
||||
val automaticPermissionsRequestEnabled = automaticallyRequestPermissionsSetting.isNullOrEmpty() ||
|
||||
automaticallyRequestPermissionsSetting.toBoolean()
|
||||
if (automaticPermissionsRequestEnabled) {
|
||||
permissionsToEnable.add(USE_SCENE_PERMISSION)
|
||||
}
|
||||
}
|
||||
|
||||
return permissionsToEnable
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue