Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add request permissions on start project setting #203

Merged

Conversation

m4gr3d
Copy link
Collaborator

@m4gr3d m4gr3d commented Sep 9, 2024

This PR is a follow-up from a discussion with @dsnopek; it introduces the xr/openxr/extensions/automatically_request_runtime_permissions project setting which allows users the ability to enable / disable the automatic request of runtime permissions that's done at start. This is done so that the app / game logic can itself request the permissions in a context-specific manner.

The project setting is enabled (set to true) by default to keep consistency with the current behavior.

Note that this PR builds on top of #202 to avoid duplicating the same logic across all the vendors modules.

@m4gr3d m4gr3d added the enhancement New feature or request label Sep 9, 2024
@m4gr3d m4gr3d added this to the 3.1.0 milestone Sep 9, 2024
@m4gr3d m4gr3d force-pushed the add_request_permissions_on_start_project_setting branch from e46b47e to e195b13 Compare September 9, 2024 03:18
@dsnopek
Copy link
Collaborator

dsnopek commented Sep 9, 2024

Thanks! I did some testing with this, and it seems to be working great

I was using the 'meta-scene-sample', and if I uninstall it, then re-export with the "Automatically Request Runtime Permissions" unchecked, then the permission panel doesn't come up. However, if check it, and re-export, then the permission panel appears correctly.

I also experimented with manually requesting permissions. Both OS.request_permissions() and OS.request_permission("com.oculus.permission.USE_SCENE") will bring up the permission panel. However, I don't understand how I'm supposed to wait for the user to finish using the panel before moving on? Those functions return immediately with false, regardless of what the user chooses. Although, that's more of a Godot thing, rather than something this PR needs to solve :-)

@m4gr3d
Copy link
Collaborator Author

m4gr3d commented Sep 9, 2024

However, I don't understand how I'm supposed to wait for the user to finish using the panel before moving on? Those functions return immediately with false, regardless of what the user chooses.

That's the expected flow since the runtime permission dialog is async and we don't want to block waiting for it.
When the user accept (or deny) the permission request, a signal should be fired with the result.

See https://github.com/godotengine/godot/blob/27552a2f26adcdba579cd804197de3942e8cb0ec/platform/android/java_godot_lib_jni.cpp#L549 for reference.

@dsnopek
Copy link
Collaborator

dsnopek commented Sep 9, 2024

See https://github.com/godotengine/godot/blob/27552a2f26adcdba579cd804197de3942e8cb0ec/platform/android/java_godot_lib_jni.cpp#L549 for reference.

Ah, the signal is on MainLoop! Because OS.request_permission() is on OS, I was looking for a signal there. I should have looked at the code :-)

This should probably be mentioned in the docs for OS.request_permission() too

@m4gr3d m4gr3d force-pushed the add_request_permissions_on_start_project_setting branch from e195b13 to 7fceb09 Compare September 11, 2024 21:28
@m4gr3d m4gr3d force-pushed the add_request_permissions_on_start_project_setting branch from 7fceb09 to 7be336f Compare September 13, 2024 15:14
@m4gr3d m4gr3d merged commit cdedfcb into GodotVR:master Sep 13, 2024
10 checks passed
@m4gr3d m4gr3d deleted the add_request_permissions_on_start_project_setting branch September 13, 2024 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants