-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Android][Permissions]Requesting permissions using RequestAsync while the app is in the background - fix #30697
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
Conversation
|
Hey there @@kubaflo! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a critical bug in Android permissions handling where interrupted user interactions could lead to incorrect permission grant assumptions. The change adds a necessary check to handle empty grant results arrays that can occur when permission requests are interrupted (e.g., when the app goes to background).
- Adds validation for empty
grantResultsarray in permission request handling - Ensures interrupted permission requests are properly treated as denied rather than incorrectly assumed as granted
Comments suppressed due to low confidence (1)
src/Essentials/src/Permissions/Permissions.android.cs:89
- This critical security fix that handles interrupted permission requests should have corresponding test cases to verify the behavior when grantResults is empty. Please ensure test cases exist in TestCases.HostApp and TestCases.Shared.Tests to validate this edge case.
if (permissionResult.GrantResults.Length == 0 || permissionResult.GrantResults.Any(g => g == Permission.Denied))
Description of Change
This check is necessary because in Android, OnRequestPermissionsResult can be called with an empty grantResults array if the user interaction was interrupted. Ignoring this could lead to incorrect assumptions that permissions were granted.
Issues Fixed
Fixes #30678