feat: update system favorites on Android 11+ when favoriting media#872
feat: update system favorites on Android 11+ when favoriting media#872terofeev wants to merge 9 commits intoFossifyOrg:mainfrom
Conversation
…ing-system-api # Conflicts: # CHANGELOG.md
naveensingh
left a comment
There was a problem hiding this comment.
I found two issues:
- The app shows
Unknown error occurredwhen removing items from favorites without "All files access". - The app shows
Unknown error occurredwhen removing/adding items to/from favorites without "All files access" and "Media management" permissions.
We should fallback to MediaStore.createFavoriteRequest() and friends when only limited permissions are available.
|
@naveensingh applied suggested changes, thank you! Also fixed case without "All files access". Could you help me with the case without "Media management" permissions? I see a dialog stating that Gallery needs full access to display all your photos and videos and that the app can't be used without it. |
Sorry, my bad. I thought the error happened when I skipped granting both "Media only" and "All files access" by clicking outside the permission dialog, but no, it's happening with SVG files regardless of permission status. I can provide a stacktrace later. PS: Detekt check is failing :) |
…ing-system-api # Conflicts: # CHANGELOG.md
| "image/gif", | ||
| "image/bmp", | ||
| "image/x-ms-bmp" | ||
| ) |
There was a problem hiding this comment.
What about other formats such as avif, JXL, etc? Are those failing too?
| // Update media in favorites collection for Android 11+ (API level 30) | ||
| if (isRPlus()) { | ||
| val uri = getFilePublicUri(File(path), BuildConfig.APPLICATION_ID) | ||
| if (isMedia(contentResolver, uri)) { |
There was a problem hiding this comment.
Why not reuse helpers from the commons lib here?
| if (isMedia(contentResolver, uri)) { | |
| if (path.isImageFast() && !path.isSvg()) { |
There was a problem hiding this comment.
Thanks for the suggestion. Using path.isImageFast() would throw exceptions for AVIF, JXL, etc. (fails on my Android 15 test device).
Given Android's scoped storage restrictions, when users grant "media only" access they only see specific MIME types - which is exactly what we should check for in the isMedia function.
There was a problem hiding this comment.
There was a problem hiding this comment.
Tested many formats but only image/jpeg consistently works with the media picker. Propose reducing supportedImageTypes to just image/jpeg. What do you think?
Type of change(s)
What changed and why
Tests performed
Before & after preview
Closes the following issue(s)
Checklist
CHANGELOG.md(if applicable).