feat(messaging,android): improve how messaging is determining permission on Android - #18101
feat(messaging,android): improve how messaging is determining permission on Android#18101Lyokone wants to merge 7 commits into
Conversation
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. |
2fe1422 to
ae2cfa3
Compare
Use PackageManager permission flags instead of SharedPreferences so soft deny, permanent deny, and never-asked are distinguished correctly even when another plugin requested POST_NOTIFICATIONS. Add AuthorizationStatus.deniedPermanently and reset Android 13+ e2e permission state between tests.
Getters are not valid inside the group() callback body, which broke dart analyze in the tests package.
…form APIs PackageManager.getPermissionFlags() and the FLAG_PERMISSION_USER_SET / FLAG_PERMISSION_USER_FIXED constants are @hide/@Systemapi and are not part of the public SDK at any API level, so the plugin failed to compile. Resolve the status with public API instead: shouldShowRequestPermissionRationale() plus a SharedPreferences record of whether the prompt was ever shown. The flag is written when the permission is requested rather than only on denial, so a grant followed by a revoke from system settings still reports deniedPermanently. Also clear that record from the e2e permission reset helper so "never asked" is reproducible across tests, and fix a google-java-format violation.
Description
On Android 13+,
getNotificationSettings()now correctly returnsnotDeterminedwhen the user has never been prompted. Previously it always returneddenied, making it impossible to distinguish from a permanent denial.Uses
shouldShowRequestPermissionRationale()+ SharedPreferences (same approach aspermission_handler) to break the ambiguity. iOS/macOS/web unchanged — they already handled this correctly.Related Issues
Checklist
///).melos run analyze) does not report any problems on my PR.Breaking Change