Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(android): Make WRITE_EXTERNAL_STORAGE optional #909

Merged
merged 4 commits into from
Oct 28, 2024

Conversation

breautek
Copy link
Contributor

@breautek breautek commented Oct 25, 2024

Platforms affected

Android

Motivation and Context

Depends on #907

closes #861
closes #876

Across all API levels that we support, no permissions are necessary for reading from
gallery. This is because we use the Media Store and gain temporary access to the content.

Across all API levels that we support, no permissions are necessary for capturing an image from the camera. This is because we use an internal app cache directory and we grant the camera app to use this path.

Where permissions might be necessary is with the saveToPhotoAlbum option. If enabled, non scoped access devices (API 24-28) do require WRITE_EXTERNAL_STORAGE to write to the device's gallery. API 29+ with scoped access framework, no permissions are required.

This PR allows to be more modern on modern devices, and allows the user to opt into WRITE_EXTERNAL_STORAGE by providing the necessary config.xml directives, if they plan on using saveToPhotoAlbum option.

Users that don't want to save to the photo album does not need to declare any extra permissions.

Description

Reworked permission management so that WRITE_EXTERNAL_STORAGE is optional. READ_EXTERNAL_STORAGE is completely obsolete and has been removed.

The CAMERA permission workaround is still relevant across all API levels. If declared, the permission must be granted to use the camera intent and that workaround still remains.

Testing

Manual testing on API 28 & 34.
Paramedic test passes

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

@breautek breautek added this to the 8.0.0 milestone Oct 25, 2024
@breautek breautek changed the title Refactor/optional perms refactor(android): Make WRITE_EXTERNAL_STORAGE optional Oct 25, 2024
@breautek breautek force-pushed the refactor/optional-perms branch from 8efce9e to 3509bd1 Compare October 28, 2024 16:35
@breautek breautek requested a review from erisu October 28, 2024 16:35
@breautek breautek marked this pull request as ready for review October 28, 2024 16:35
@breautek breautek force-pushed the refactor/optional-perms branch from 3509bd1 to b497214 Compare October 28, 2024 17:03
@breautek breautek force-pushed the refactor/optional-perms branch from b497214 to 41941f1 Compare October 28, 2024 17:06
Copy link
Member

@erisu erisu left a comment

Choose a reason for hiding this comment

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

  • Code changes LGTM
  • Tested sample project
  • Tested mobile spec

@breautek breautek merged commit 48c4cdd into apache:master Oct 28, 2024
14 of 15 checks passed
@breautek breautek deleted the refactor/optional-perms branch October 28, 2024 18:21
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.

Its working but in Imagepicker not [Android] Still request gallery access permission after granted
2 participants