GodotVR / godot_openxr_vendors

Godot 4 wrapper for OpenXR vendors loaders and extensions
MIT License
99 stars 22 forks source link

Only first permission in `GodotOpenXRMeta.onMainCreate()` is actually requested #101

Closed dsnopek closed 7 months ago

dsnopek commented 7 months ago

I'm experiencing an issue where the com.oculus.permission.USE_SCENE is never actually requested, because only the first permission request actually goes through.

So, right now we have this in GodotOpenXRMeta.onMainCreate():

        // Request the eye tracking permission if it's included in the manifest
        if (PermissionsUtil.hasManifestPermission(activity, EYE_TRACKING_PERMISSION)) {
            Log.d(TAG, "Requesting permission '${EYE_TRACKING_PERMISSION}'")
            PermissionsUtil.requestPermission(EYE_TRACKING_PERMISSION, activity)
        }
        // Request the face tracking permission if it's included in the manifest
        if (PermissionsUtil.hasManifestPermission(activity, FACE_TRACKING_PERMISSION)) {
            Log.d(TAG, "Requesting permission '${FACE_TRACKING_PERMISSION}'")
            PermissionsUtil.requestPermission(FACE_TRACKING_PERMISSION, activity)
        }
        // Request the scene API permission if it's included in the manifest
        if (PermissionsUtil.hasManifestPermission(activity, SCENE_PERMISSION)) {
            Log.d(TAG, "Requesting permission '${SCENE_PERMISSION}'")
            PermissionsUtil.requestPermission(SCENE_PERMISSION, activity)
        }

But what I see in adb logcat is this message:

03-07 11:17:50.127 18997 18997 D GodotOpenXRMeta: Requesting permission 'com.oculus.permission.USE_SCENE'
03-07 11:17:50.128 18997 18997 W Activity: Can request only one set of permissions at a time

However, if I remove all the permission requests above, except for the SCENE_PERMISSION that I care about, then the permission actually gets requested, and in the headset the window pops up giving me the option to grant permission.

@m4gr3d How best to solve this? Is there something we can do here? Or, is this best resolved in Godot, where we can update PermissionsUtil?

It would be kind of nice if PermissionsUtil had a function that accepted a list of permissions, and then tried each one in order, checking if they are in the manifest first, and then waiting until after we get a result for each one before moving on to the next.

m4gr3d commented 7 months ago

@m4gr3d How best to solve this? Is there something we can do here? Or, is this best resolved in Godot, where we can update PermissionsUtil?

It would be kind of nice if PermissionsUtil had a function that accepted a list of permissions, and then tried each one in order, checking if they are in the manifest first, and then waiting until after we get a result for each one before moving on to the next.

@dsnopek We can do both. The api used to request permissions are regular Android apis so we can use them directly in GodotOpenXRMeta. I'll also update the PermissionsUtil api to include a method to request a list of permissions. When we release dev5, we can then switch back to using PermissionsUtil.