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

[FEATURE REQUEST] Scoped Storage #2877

Closed
16 of 20 tasks
jesmrec opened this issue May 8, 2020 · 7 comments · Fixed by #3269
Closed
16 of 20 tasks

[FEATURE REQUEST] Scoped Storage #2877

jesmrec opened this issue May 8, 2020 · 7 comments · Fixed by #3269

Comments

@jesmrec
Copy link
Collaborator

jesmrec commented May 8, 2020

Place to discussion about the necessary feature in the close future

Documentation:

https://developer.android.com/preview/privacy/storage?hl=en
https://developer.android.com/training/data-storage

Scoped storage will provide a way to enclose user data related to an app.

Research: #2894

TASKS

  • Research (if needed) -> SPIKE [SPIKE] Scoped storage #2894
  • Create branch feature/scoped_storage
  • Development tasks
    • Recheck of the spike
    • Update target to 30 (Android 11 #2920)
    • Remove flag to opt-out the scoped storage
    • Select a new location inside the sandbox
    • Files downloaded stored in the scoped storage.
    • Taking a photo within ownCloud is uploaded properly
    • 'Open with' have enough permissions to open a file with other apps.
    • 'Share with' have enough permissions to share a file with other apps.
    • Camera uploads have enough permissions to access the camera folder and get pictures from there.
    • Sharing files with ownCloud works as expected.
    • Chunk uploads works as expected
    • 'Upload files from local storage' works as expected
    • Recheck permissions to access folders in setup, like camera folder in auto uploads... (check if native picker helps)
  • Code review and apply changes requested
  • Design test plan
  • QA
  • Merge branch feature/scoped_storage into master

PR

This is part of Android 10 target: #2576

@jesmrec
Copy link
Collaborator Author

jesmrec commented May 8, 2020

Needed: upload targeting to API 29. Should we do in advance and test separately? or... is it not a problem to do in the same PR/PRs as scoped storage? @abelgardep @davigonz

@abelgardep
Copy link
Contributor

Needed: upload targeting to API 29. Should we do in advance and test separately? or... is it not a problem to do in the same PR/PRs as scoped storage? @abelgardep @davigonz

We could do it separately if we add the next attribute: requestLegacyExternalStorage.

@jesmrec jesmrec mentioned this issue Jun 8, 2020
9 tasks
@jesmrec jesmrec modified the milestones: 2.16-current, backlog Jun 19, 2020
@abelgardep abelgardep mentioned this issue Jun 22, 2020
5 tasks
@jesmrec jesmrec mentioned this issue Jul 10, 2020
@michaelstingl michaelstingl modified the milestones: backlog, 2.17-next Sep 30, 2020
@jesmrec jesmrec modified the milestones: 2.17-next, 2.18 Jan 14, 2021
@jesmrec
Copy link
Collaborator Author

jesmrec commented Apr 9, 2021

Some regards with this, after discussing (from #2872 (comment) by @abelgardep ).

The initial question is: how must be stored a file in the device after downloading??. There will be three kinds of download (by @abelgardep)

  • Previews: They could be downloaded to the app-specific storage and maybe to the cached one. This way we could free some space when needed

  • Av. Offline: They could be downloaded to the app-specific storage and it may have sense to store them in the persisted one

  • Select and download: This behavior could be changed and make it download to the downloads folder if the user considers it important to persist it.

What i think about it:

  • Previews: i like the idea they can be removed from cache, manually, or automatically (feasible as future improvement? iOS app implements this). That means, file is downloaded only to be previewed

  • Av. Offline: They must be persisted in scoped storage.

  • Select and download: Would it make sense to get rid of this option? i mean, with Previews you can open and check a file by clicking on it. If this file is important for you, you will make it av. offline and will be always stored and synced in your device. Downloading a file and keep it in the device in a non-synced way does not offer advantages (doesn't it?). Indeed, we have to take care of the space limit. What do you think??

As @theScrabi , the "Download" option should have a different meaning (saving the file somewhere in the device storage, out of the scoped storage) and should have renamed to "Export" or something similar when it is implemented.

This discussion has some product and security concerns, that must be agreed before implementing.

CC @michaelstingl

@michaelstingl
Copy link
Contributor

  • Select and download: Would it make sense to get rid of this option? i mean, with Previews you can open and check a file by clicking on it. If this file is important for you, you will make it av. offline and will be always stored and synced in your device. Downloading a file and keep it in the device in a non-synced way does not offer advantages (doesn't it?). Indeed, we have to take care of the space limit. What do you think??

I think export and safe somewhere on the storage is already possible with native Android feature. Then "Select and download" is no longer needed. If users really need it, they can set ab. offline.

@jesmrec jesmrec modified the milestones: 2.18-current, 2.19-next May 6, 2021
@abelgardep
Copy link
Contributor

We could check this repo when we decide to work on Scoped Storage. It could have interesting information.

@abelgardep abelgardep mentioned this issue May 28, 2021
2 tasks
@abelgardep abelgardep linked a pull request May 28, 2021 that will close this issue
2 tasks
@jesmrec jesmrec mentioned this issue Jun 17, 2021
24 tasks
@jesmrec jesmrec removed the Sprint label Jun 18, 2021
@jesmrec jesmrec added Sprint and removed Sprint labels Jul 9, 2021
@abelgardep
Copy link
Contributor

abelgardep commented Jul 21, 2021

Migration from current storage to scoped storage.

For a common scenario: App installed and files are stored in external storage in the device.

Case 1: Device API<29 (before Android 10)
A device whose current API is lower than 29, could access the external storage after migrating to scoped storage. They keep read/write external storage permission. New files will be downloaded to scoped storage. Smooth transition.

Screenshot 2021-07-21 at 09 52 56

Case 2: Device API>=29 (Android 10 and later)
A device whose current API is 29 or higher, will lose access to current downloaded files after moving to scoped storage.
Screenshot 2021-07-21 at 10 09 55
It means that we will need to reset the field where the downloaded path is stored in the database. This way, files won't appear as downloaded and, sadly, they will need to be downloaded again. Additionally, we will need to ask the user for the removal of old files in the external storage.

EDIT: We could request preserveLegacyExternalStorage so we can migrate files by ourselves: https://developer.android.com/training/data-storage/use-cases?hl=en#migrate-legacy-storage

Fresh install

Files are stored in scoped storage location as expected. Nothing to do here.

@abelgardep
Copy link
Contributor

abelgardep commented Jul 22, 2021

I think that we should resume the work in #125 before moving to ScopedStorage.

Scoped storage is limited and we should free space after each account deletion.

As #125 (comment) states, there are 2 different cases:

  • Removing the account from the app -> Probably the most common case. Should not be so complex to include. Would be enough for a first iteration. Will be done in Files remain if deleting account #125
  • Removing the account from Device settings -> Not so common and harder to manage. (Future feature. Garbage collector worker?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants