Skip to content

Fix Android 14+ visual media permission short-circuit in PermissionDelegate34 - #1389

Merged
AlexV525 merged 2 commits into
mainfrom
copilot/fix-permissiondelegate34-short-circuit
May 14, 2026
Merged

Fix Android 14+ visual media permission short-circuit in PermissionDelegate34#1389
AlexV525 merged 2 commits into
mainfrom
copilot/fix-permissiondelegate34-short-circuit

Conversation

Copilot AI commented May 14, 2026

Copy link
Copy Markdown
Contributor

On Android 14+, requestPermissionExtend() could report authorized access for RequestType.common after only READ_MEDIA_IMAGES had been granted, which prevented READ_MEDIA_VIDEO from being requested and left videos missing from asset queries.

  • Permission evaluation

    • Tighten PermissionDelegate34.havePermissions(...) for visual media requests.
    • Combined image+video requests now require all requested full-access permissions, unless READ_MEDIA_VISUAL_USER_SELECTED is already granted.
    • This preserves limited-access behavior while avoiding false positives from partial grants.
  • Regression coverage

    • Add focused Android unit tests for the visual permission-combination logic:
      • image granted / video missing → not fully authorized
      • image + video granted → authorized
      • limited visual access → accepted
      • image-only request with image grant → accepted
  • Release notes

    • Add an Unreleased changelog entry for the Android 14+ permission fix.
// Before: image OR video OR limited access could satisfy a combined request.
PhotoManager.requestPermissionExtend() // could return authorized too early

// After: combined visual requests only short-circuit when:
// - both image and video permissions are granted, or
// - limited visual access is granted.

Copilot AI changed the title [WIP] Fix PermissionDelegate34 short-circuits requestPermission with READ_MEDIA_IMAGES Fix Android 14+ visual media permission short-circuit in PermissionDelegate34 May 14, 2026
Copilot AI requested a review from AlexV525 May 14, 2026 02:06
@AlexV525
AlexV525 requested a review from Copilot May 14, 2026 04:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Android 14+ visual media permission evaluation in the Android permission delegate so combined image+video requests don’t incorrectly short-circuit as “authorized” when only a subset of permissions is granted. This aligns permission checks with expected asset query behavior (avoids videos being missing after an “authorized” result).

Changes:

  • Tighten PermissionDelegate34.havePermissions(...) by requiring all requested full-access visual permissions (unless limited visual access is granted).
  • Add Android unit tests covering combined vs image-only visual permission combinations.
  • Add an Unreleased changelog entry documenting the Android 14+ permission short-circuit fix.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
CHANGELOG.md Adds Unreleased release note for the Android 14+ permission evaluation fix.
android/src/test/kotlin/com/fluttercandies/photo_manager/permission/impl/PermissionDelegate34Test.kt Adds unit tests validating the visual permission combination logic.
android/src/main/kotlin/com/fluttercandies/photo_manager/permission/impl/PermissionDelegate34.kt Fixes visual permission short-circuiting by centralizing the logic in hasRequestedVisualPermissions(...).

@github-actions

Copy link
Copy Markdown

Download apk from here for eed834f

@AlexV525
AlexV525 marked this pull request as ready for review May 14, 2026 04:28
@AlexV525
AlexV525 requested a review from CaiJingLong as a code owner May 14, 2026 04:28
@AlexV525
AlexV525 merged commit c458348 into main May 14, 2026
14 checks passed
@AlexV525
AlexV525 deleted the copilot/fix-permissiondelegate34-short-circuit branch May 14, 2026 04:35
@AlexV525 AlexV525 linked an issue May 14, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants