Obsolete
Status Update
Comments
ad...@google.com <ad...@google.com>
ad...@google.com <ad...@google.com> #2
We have passed this to the development team and will update this issue with more information as it becomes available.
sa...@google.com <sa...@google.com> #4
We will be closing this bug as Obsolete. If you still think this issue is reproducible and relevant in the latest Android release (Android Q), please attach a new bug report along with reproduction details. If a reply is not received within the next 14 days, this issue will be closed. Thank you for your understanding.
Description
Build fingerprint: 'google/sailfish/sailfish:8.0.0/OPR3.170623.008/4294783:user/release-keys'
Please describe the problem in detail. Be sure to include:
- Steps to reproduce the problem (including sample code if appropriate).
Download some content from any app say Google Chrome --> Connect Device to PC (file transfer mode) --> Open Device files in File explorer --> rename the folder where the content was downloaded
Wait for the device go idle (say overnight) --> Locate the files in the folder (which you renamed).
- What happened.
Files are deleted.
- What you think the correct behavior should be.
Files should not be deleted.
Android O OS.
=============================
Technical Details:
We have analysed the problem and below are the technical details:
Issue is with DownloadProvider.
Step 1: Download content from Chrome
When Chrome downloads a content they create an entry in DownloadProvider DB via: DownloadManager.addCompletedDownload();
DownloadProvider creates this entry and run MediaScanner.
After MediaScanner is completed, it creates the following entry in its database:
DownloadProvider DB Schema:
_id: Download Id
_data: actual file path
mediaprovider_uri: URI pointing to entry in MediaProvider DB.
MediaProvider DB Schema:
Table Name: files
_id: Id
_data: Actual File path
Step 2:
User renames the folder:
When user renames the folder, for all the entries in the folder MediaProvider DB's entries are updated with the new file path. (i.e. _id is same but _data is updated)
Step 3:
Actual issue happens now.
DownloadProvider keeps on checking for its DB entry.
DownloadIdleService.cleanOrphans() checks if file corresponding to each DB entry (i.e. file pointed by _data) exists or not.
If file does not exists (as in this case, moved to another album), it requests DownloadProvider to delete via DownloadProvider.delete().
DownloadProvider.delete() calls MediaProvider.delete() to delete entry from MediaProvider which inturn removes file(because here new path is updated for same entry) as well as DB entry.
Note:
Issue is easily reproducible.