Changed|Fixed: Add java docs to PermissionUtils and fix permission checking

ContextCompat.checkSelfPermission() may return true for permissions not even requested so it now checked if permissions are even requested in app manifest before checking if they are granted and before asking for permission to be granted.

Also some general improvements in code quality, including using ActivityUtils to request non-standard permissions and added support for AppCompatActivity instances to request permissions in addition to Activity instances.
This commit is contained in:
agnostic-apollo
2021-10-21 23:10:00 +05:00
parent 50a97b1977
commit 32dd7eab03
2 changed files with 205 additions and 33 deletions

View File

@@ -36,9 +36,11 @@
<!-- PermissionUtils -->
<string name="message_sudo_please_grant_permissions">Please grant permissions on next screen</string>
<string name="message_sudo_please_grant_permissions">Please grant requested permission(s)</string>
<string name="error_failed_to_request_permissions">Failed to request permissions with request code %1$d: %2$s</string>
<string name="error_attempted_to_check_for_permissions_not_requested">Attempted to check for permissions that have not been requested in app manifest: %1$s</string>
<string name="error_attempted_to_ask_for_permissions_not_requested">Attempted to ask for permissions that have not been requested in app manifest: %1$s</string>