refactor(android): Make WRITE_EXTERNAL_STORAGE optional #909
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 requireWRITE_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 necessaryconfig.xml
directives, if they plan on usingsaveToPhotoAlbum
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
(platform)
if this change only applies to one platform (e.g.(android)
)