Current Files app import photos by following steps:
1) Copy photos from DCIM folder in external device to local storage. (copy)
2) Upload photos in local storage to Google Drive. (sync)
If we skip 1) by uploading photos directly from DCIM folder to Google Drive,
we can expect some advantages:
- It's faster since we skip the copy step.
- It won't fill device storage by cached files.
- We'll manage less internal state.
The approach will be something like this:
1) Create a list of files which are not in Drive (same as the current behavior)
2) Send the file list to backend via new fileManagerPrivate API
3) The backend upload the files to Drive directly, and notify the progress via the callback passed in step 2.
When device is unplugged (resulting in read error) or offline, you can simply call error callback and forget everything.
The next try will start from 1) and the already-copied files will be skipped.
Comment 1 by weifangsun@chromium.org
, Nov 20 2017