Skip to content

Commit ddc2203

Browse files
authored
Fix: Return correct permission status for Android's limited media access (#1362)
1 parent 39fba43 commit ddc2203

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

permission_handler_android/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 12.0.12
2+
3+
* Fixes permission status returned from `Permission.photos.request()` or `Permission.videos.request()` when limited access selected
4+
15
## 12.0.11
26

37
* Adds `TargetApi` annotation to `getManifestNames` method in `PermissionUtils.java`.

permission_handler_android/android/src/main/java/com/baseflow/permissionhandler/PermissionManager.java

+6
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,12 @@ public boolean onRequestPermissionsResult(
260260
}
261261

262262
requestResults.put(permission, permissionStatus);
263+
// [grantResults] can only contain PermissionConstants.PERMISSION_STATUS_GRANTED or PermissionConstants.PERMISSION_STATUS_DENIED status.
264+
// But these permissions can have status PermissionConstants.PERMISSION_STATUS_LIMITED, so we need to recheck status
265+
} else if (permission == PermissionConstants.PERMISSION_GROUP_PHOTOS || permission == PermissionConstants.PERMISSION_GROUP_VIDEOS) {
266+
requestResults.put(
267+
permission,
268+
determinePermissionStatus(permission));
263269
} else if (!requestResults.containsKey(permission)) {
264270
requestResults.put(
265271
permission,

permission_handler_android/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: permission_handler_android
22
description: Permission plugin for Flutter. This plugin provides the Android API to request and check permissions.
33
homepage: https://github.com/baseflow/flutter-permission-handler
4-
version: 12.0.11
4+
version: 12.0.12
55

66
environment:
77
sdk: ">=2.15.0 <4.0.0"

0 commit comments

Comments
 (0)