Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 6, 2025

On Android 14+ with limited photo access (READ_MEDIA_VISUAL_USER_SELECTED), deselecting photos via presentLimited() doesn't notify the Flutter layer, even though MediaStore updates correctly.

Changes

  • Added onLimitedSelectionChanged() callback to PermissionsListener: Default implementation ensures backward compatibility
  • Modified PermissionDelegate34.handlePermissionResult(): Invokes callback when CODE_REQUEST_LIMITED completes
  • Implemented callback in PhotoManagerPlugin: Sends change notification via existing notifyChannel to trigger Flutter listeners

Effect

Apps using PhotoManager.addChangeCallback() now receive notifications when users modify their limited photo selection:

PhotoManager.addChangeCallback((call) {
  if (call.method == 'change') {
    // Now triggered when presentLimited() completes with selection changes
    refreshAssetList();
  }
});

await PhotoManager.presentLimited();  // User deselects photos -> callback fires

Testing

Requires Android 14+ device with limited photo permission to verify deselection triggers Flutter callbacks.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Bug report] 受限权限时选择部分图片视频,只能增加不能反减</issue_title>
<issue_description>### Version

3.7.2

Platforms

Android

Device Model

Meizu 21

flutter info

部分选择相册时,反选不生效,从android日志都能看出cursor的反选是生效的,但flutter层还是只增不减

How to reproduce?

比如:先选两个图,再打开系统选择,只选择一个,flutter层依然保持两个

Logs

Example code (optional)

Contact

No response</issue_description>

Comments on the Issue (you are @copilot in this section)

@fluttercandies-dev **AI Summary:** 用户报告Android端选择图片/视频时,反选功能失效,导致只能增加选择,无法减少已选内容。即使底层数据正确,Flutter层也未正确反映反选操作。

Custom agent used: PR Agent
An Agent that helps to implement features and fixes based on issues.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Add onLimitedSelectionChanged() callback to PermissionsListener interface
- Call this callback when CODE_REQUEST_LIMITED permission request completes
- Implement callback in PhotoManagerPlugin to send update notification to Flutter
- Update CHANGELOG.md with fix description

Co-authored-by: AlexV525 <[email protected]>
Copilot AI changed the title [WIP] Fix image and video selection issue in limited permissions Fix Android 14+ limited permission deselection not notifying Flutter Dec 6, 2025
Copilot AI requested a review from AlexV525 December 6, 2025 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug report] 受限权限时选择部分图片视频,只能增加不能反减

2 participants