-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
Move request for microphone permission to onCreate #25
Conversation
Citra already handles falling back to no mic if the permission is not granted. CitraVR/src/audio_core/input_details.cpp Line 42 in 3dd3e25
|
This change does delay the initial microphone permission request to when a game is launched. |
This code was added in the Added VR megacommit so it isn't clear if this workaround some other issue. I double checked that we have the microphone permission when it is determining which input device to use, so I am not sure the purpose of this. |
Ah! I forgot about this. That's because the runtime permissions dialog can launch in either the 2D window or as its own immersive window on top of XR depending on the current scene, and checking on game launch (2D -> immersive) can cause it to appear in the wrong container. The check should probably be in onCreate of MainActivity instead of onResume(), unless there was a specific reason I avoided that. Regarding your comment about the loop: in theory, the permissions dialog should cause MainActivity to lose focus, but not pause. Is that not the case? |
Do you mean that originally the permission request would sometimes be shown on the 2d app and sometimes on the 3d app? I didn't heavily stress test this scenario myself, but that seems plausible.
It is not the case.
|
More specifically: when requested while the immersive activity is launching, it will try (and fail) to show the correct permissions dialog over the activity. |
@gyroninja note: in the original project, audio was being requested here. Now I remember: the reason I moved the permission request originally is because the native code requests the mic permission on the launch of the application -- which triggers the issue I mentioned. Moving it to the launch of MainActivity makes this a non-issue. You should be able to request the permission in |
2680305
to
bb8a8eb
Compare
This request can cause issues if the user denies the microphone permission. Calling requestPermissions causes GrantPermissionsActivity to be launched. Citra's MainActivity will pause. GrantPermissionsActivity will immediately finish as the user has already denied the permission. Citra's MainActivity then gets resumed and then tries to request the permission again forming a loop.
bb8a8eb
to
ce640bb
Compare
Moving it to onCreate worked fine. |
This request can cause issues if the user denies the microphone permission.
Calling requestPermissions causes GrantPermissionsActivity to be launched.
Citra's MainActivity will pause. GrantPermissionsActivity will immediately
finish as the user has already denied the permission. Citra's MainActivity then
gets resumed and then tries to request the permission again forming a loop.