summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Set FGS priority for download jobs with visible notifications.Sudheer Shanka2019-07-032-1/+2
| | | | | | | | | | | | | | | | | | | | This is what DownloadProvider used to do pre-Q using PRIORITY_FOREGROUND_APP but in Q, we added a new priority to denote FGS but DownloadProvider was still using PRIORITY_FOREGROUND_APP which is now considered a lower priority than FGS and some jobs are getting preempted unnecessarily. So, update DownloadProvider to mark download jobs with FGS priority instead of BFGS priority. This still has some issues but at least this will be kind of reverting DownloadProvider to its pre-Q behavior. Bug: 135982638 Test: manual - Go through DO provisioning a few times and check admin app can be successfully downloaded. Test: atest DownloadProviderTests Test: atest cts/tests/app/src/android/app/cts/DownloadManagerTest.java Test: atest cts/tests/app/DownloadManagerLegacyTest/src/android/app/cts/DownloadManagerLegacyTest.java Test: atest cts/tests/app/DownloadManagerApi28Test/src/android/app/cts/DownloadManagerApi28Test.java Change-Id: I020e366845d768da271b860a7ace91318e67d8ae
* Whitelist DownloadManager.ACTION_NOTIFICATION_CLICKED broadcastMichal Karpinski2019-06-183-1/+16
| | | | | | | | | | | | | for background activity starts When the DownloadManager download notification is clicked, that broadcast is sent to an app, and the app should be able to open activities from bg for its duration. Bug: 135515407 Test: com.android.providers.downloads.PublicApiFunctionalTest#testNotificationClickedBroadcast Test: manual Change-Id: Ic1691f5bda890ceb2938ac76f4ca2a4c7e7a1160
* Delegate deletion of mediaprovider downloads to FileSystemProvider.Sudheer Shanka2019-06-131-10/+2
| | | | | | | | | | | Using ContentResolver.delete() directly on MediaProvider doesn't work for uris corresponding to directories. For now, delegate this deletion to FileSystemProvider which will try deleting all entries regex-matching the file path. Bug: 135031305 Test: manual Change-Id: Iac18d0fd0be05758aaf2c03971d716592d96699b
* Delete entries of uninstalled pkgs which haven't started downloading.Sudheer Shanka2019-05-291-1/+4
| | | | | | | | | | Fixes: 133741222 Test: manual Test: atest DownloadProviderTests Test: atest cts/tests/app/src/android/app/cts/DownloadManagerTest.java Test: atest cts/tests/app/DownloadManagerLegacyTest/src/android/app/cts/DownloadManagerLegacyTest.java Test: atest cts/tests/app/DownloadManagerApi28Test/src/android/app/cts/DownloadManagerApi28Test.java Change-Id: I00796e5ff8e9b30d153490f997fb7c776b600e57
* Merge "Don't use linked mediastore uris in DownloadProvider operations." ↵Sudheer Shanka2019-05-222-188/+78
|\ | | | | | | into qt-dev
| * Don't use linked mediastore uris in DownloadProvider operations.Sudheer Shanka2019-05-212-188/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When MediaProvider db gets recreated, all the media content ids get renumbered. It's possible that when DownloadProvider is trying to delete an entry, it is holding onto a invalid mediastore uri. So, don't use linked mediastore uris in DownloadProvider operations. Also, revoke any prior uri grants of media content from DownloadStorageProvider. Bug: 132087334 Test: manual Test: atest DownloadProviderTests Test: atest cts/tests/app/src/android/app/cts/DownloadManagerTest.java Test: atest cts/tests/app/DownloadManagerLegacyTest/src/android/app/cts/DownloadManagerLegacyTest.java Test: atest cts/tests/app/DownloadManagerApi28Test/src/android/app/cts/DownloadManagerApi28Test.java Test: atest cts/hostsidetests/appsecurity/src/android/appsecurity/cts/AppSecurityTests.java Change-Id: If6fb479da7e937ecdfa23136811f3456f7bcd75c
* | Update DownloadStorageProvider for trailing '/' in RELATIVE_PATHshafik2019-05-211-2/+2
|/ | | | | | | | Add trailing '/' to RELATIVE_PATH selection args in db queries. Test: atest --test-mapping packages/providers/MediaProvider Bug:132631113 Change-Id: Ib8887dbb0e49dc76df6e4292d36e8f5948f256c5
* Allow files to be created under download dirs from MediaStore.Sudheer Shanka2019-05-131-3/+8
| | | | | | | | | | Also, allow files to be renamed if they are not in pending state and trigger a media scan when a new file is created. Bug: 127844893 Bug: 127802924 Test: manual Change-Id: Iec14c5d349930c5fae54ac3346ee5cf11fcda387
* Update behavior of setDestinationInExternalPublicDir().Sudheer Shanka2019-05-093-106/+142
| | | | | | | | | | | | | | Allow apps to use DownloadManager for downloading files into known public dirs other than "Download" but don't include them as part of Downloads collection. Bug: 132136431 Test: manual Test: atest DownloadProviderTests Test: atest cts/tests/app/src/android/app/cts/DownloadManagerTest.java Test: atest cts/tests/app/DownloadManagerLegacyTest/src/android/app/cts/DownloadManagerLegacyTest.java Test: atest cts/tests/app/DownloadManagerApi28Test/src/android/app/cts/DownloadManagerApi28Test.java Change-Id: I62d4f810c71c9231e2b6d8e276a0a1e326382e14
* Don't log when checking if a filepath belongs to certain dirs.Sudheer Shanka2019-05-062-4/+6
| | | | | | Bug: 131693243 Test: n/a Change-Id: Iae700a00f1bca78f823a3f8b732d86d380942828
* Merge "Update API impl of ↵TreeHugger Robot2019-05-012-8/+49
|\ | | | | | | allowScanningByMediaScanner/setVisibleInDownloadsUi." into qt-dev
| * Update API impl of allowScanningByMediaScanner/setVisibleInDownloadsUi.Sudheer Shanka2019-04-302-8/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | These APIs javadocs have been updated earlier to indicate how they behave on Q, now updating impl of those APIs to match with javadocs. Bug: 131693243 Test: manual Test: atest DownloadProviderTests Test: atest cts/tests/app/src/android/app/cts/DownloadManagerTest.java Test: atest cts/tests/app/DownloadManagerLegacyTest/src/android/app/cts/DownloadManagerLegacyTest.java Test: atest cts/tests/app/DownloadManagerApi28Test/src/android/app/cts/DownloadManagerApi28Test.java Change-Id: I8fb43806b27fefaffc510fde5424b48e3ff56d20
* | Merge "Skip restrictions if DownloadProvider itself is trying to add a ↵Sudheer Shanka2019-04-301-1/+3
|\ \ | |/ |/| | | download." into qt-dev
| * Skip restrictions if DownloadProvider itself is trying to add a download.Sudheer Shanka2019-04-301-1/+3
| | | | | | | | | | | | | | Fixes: 131624566 Fixes: 131610977 Test: manual Change-Id: I771ff8a39ac977c510f1785c3cb61e859bbb0c0f
* | Make downloads deletion on owner uninstall consistent.Sudheer Shanka2019-04-282-22/+95
|/ | | | | | | | | | | | When an app is uninstalled, it's downloads in top-level download directory will be orphaned and the rest will be deleted. Bug: 126064843 Test: manual Test: atest DownloadProviderTests Test: atest cts/tests/app/src/android/app/cts/DownloadManagerTest.java Change-Id: Iad430f7ec14f306ed859a3b30db9eea29a23c19d
* Update behavior of some DownloadManager APIs.Sudheer Shanka2019-04-232-130/+194
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -- Update behavior of DownloadManager.setDestinationUri(), DownloadManager.setDestinationInExternalPublicDir() and DownloadManager.addCompletedDownload() based on the latest storage re-design. Essentially, going forward these APIs will only allow downloading files into package owned dirs or the top-level Download dir. -- Allow some system components to specify MediaColumns.OWNER_PACKAGE_NAME when inserting items into MediaProvider. -- Don't copy DownloadManager.COLUMN_TITLE to MediaProvider. DownloadProvider and MediaProvider have different constraints around "title" and there isn't really a need to keep these in sync. -- Sanity check file download paths hinted by apps. -- Remove sandbox related logic in DownloadProvider. Bug: 120879208 Bug: 128630262 Bug: 130797842 Test: manual Test: atest DownloadProviderTests Test: atest cts/tests/app/src/android/app/cts/DownloadManagerTest.java Test: atest cts/tests/app/DownloadManagerLegacyTest/src/android/app/cts/DownloadManagerLegacyTest.java Test: atest cts/tests/app/DownloadManagerApi28Test/src/android/app/cts/DownloadManagerApi28Test.java Test: atest cts/tests/tests/provider/src/android/provider/cts/MediaStore* Change-Id: I8f4569f91f2c0567ff892a2107183cd11b7065a7
* Remove logic of including downloads dirs in pkg sandboxes.Sudheer Shanka2019-04-181-49/+29
| | | | | | Bug: 130427780 Test: manual Change-Id: I3a3c98dfa769ea6e2dac1fb3d92148489c04f3a1
* Merge "Update DownloadStorageProvider to use MediaStore.DownloadColumns." ↵Sudheer Shanka2019-04-182-55/+112
|\ | | | | | | into qt-dev
| * Update DownloadStorageProvider to use MediaStore.DownloadColumns.Sudheer Shanka2019-04-172-55/+112
| | | | | | | | | | | | | | Bug: 130232195 Test: manual Test: atest --test-mapping packages/providers/MediaProvider Change-Id: I77cd8b38c729aaaa2df138c3bc30049dba68b693
* | Merge "Fix issue of downloaded apks not getting installed." into qt-devSudheer Shanka2019-04-181-0/+1
|\ \
| * | Fix issue of downloaded apks not getting installed.Sudheer Shanka2019-04-171-0/+1
| |/ | | | | | | | | | | Fixes: 130759236 Test: manual Change-Id: I8791cd3261f6a0f85cb5bc0e6d13a656fa7b1e8b
* / Exclude media files in queryRecentDocumentsIvan Chiang2019-04-161-3/+9
|/ | | | | | | | Exclude the media files when query recent files from mediastore Change-Id: If9cb87967b4cc21a7b14f1bc10e1a2349d06eb2b Fix: 130233533 Test: manual
* Remove an obsolete todo.Sudheer Shanka2019-04-121-3/+1
| | | | | | Bug: 130226648 Test: manual Change-Id: Ie38de7099d01d7d676bcaacd3951bb2aea41e90d
* Don't canonicalize app paths in system.Jeff Sharkey2019-03-131-8/+4
| | | | | | | | | The provider isn't in the requesting app's sandbox, so it's unlikely that we can canonicalize the path. Bug: 128383017 Test: none Change-Id: I689ebb44e4c5d7f579ec998ff7333ee9b8d46542
* Merge "Canonicalize filepaths before saving to db."Sudheer Shanka2019-03-041-9/+31
|\
| * Canonicalize filepaths before saving to db.Sudheer Shanka2019-03-021-9/+31
| | | | | | | | | | | | | | | | | | Bug: 126888145 Bug: 122475235 Test: atest DownloadProviderTests Test: atest cts/tests/app/src/android/app/cts/DownloadManagerTest.java Change-Id: I96fa73d3a18e94986043c45dc4e12a47d62eeea6
* | Fix DownloadStorageProvider watching files in known download dirs.Sudheer Shanka2019-02-281-14/+4
|/ | | | | | | | | | | | | | | This change will ensure when the download root is queried for the first time, DownloadStorageProvider will start observing the existing download dirs. There is still a corner case which is not fixed by this change that is if a new sandbox top-level Download directory gets created while the user is using the files app, changes in that newly created directory won't be picked up automatically unless the user refreshes the app. Bug: 124524422 Test: manual Change-Id: I8d57eeb3f630039d217c4f0c8802c1b1b80da745
* Treat download entries with null mimeType as directories.Sudheer Shanka2019-02-211-2/+7
| | | | | | Bug: 124337318 Test: manual Change-Id: Ic0c3d2de51e07923e9d04375329ca7c84cccd88f
* Ensure DownloadStorageProvider is only reading from Files table.Sudheer Shanka2019-02-151-25/+26
| | | | | | | | | DownloadStorageProvider queries Files table, so it should only read columns available in Files table. Bug: 124504769 Test: manual Change-Id: If56e087b30229d3079b51699388f37bef887d5b2
* Fix NPE in DownloadStorageProvider.Sudheer Shanka2019-02-081-8/+5
| | | | | | Fixes: 123017716 Test: manual Change-Id: Ia2f9f57051dd8b91261e35d0bdf6d1023f4c8523
* Merge "Fix NPE in DownloadStorageProvider."Sudheer Shanka2019-01-301-2/+2
|\
| * Fix NPE in DownloadStorageProvider.Sudheer Shanka2019-01-301-2/+2
| | | | | | | | | | | | | | | | | | Android/sandbox dir is not available on devices with isolated_storage flag disabled. Bug: 123613559 Test: manual Change-Id: Iaed734f9068c8089a34816936dc07ff0ff91ee03
* | Merge "Don't ignore COLUMN_MEDIA_SCANNED values from caller."Sudheer Shanka2019-01-304-27/+48
|\ \ | |/ |/|
| * Don't ignore COLUMN_MEDIA_SCANNED values from caller.Sudheer Shanka2019-01-294-27/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Right now, DownloadProvider only uses the COLUMN_MEDIA_SCANNED value if it is coming from addCompletedDownload and for the rest of the requests, it ignores the incoming COLUMN_MEDIA_SCANNED value and always invokes mediascanner. This is not what the documentation says. For e.g., if the caller uses DownloadManager.setDestinationUri() API, then unless otherwise specified, the download doesn't need to be mediascanned. Also, since we are inserting user visible downloads to MediaProvider, use that info to populate the COLUMN_MEDIAPROVIDER_URI column as well and update DownloadProvider to not invoke MediaScanner. Bug: 123440050 Test: atest DownloadProviderTests Test: atest cts/tests/app/src/android/app/cts/DownloadManagerTest.java Test: atest cts/tests/tests/provider/src/android/provider/cts/MediaStore* Change-Id: Ia667319a811d502d42a0602581bdc34ed46d88f7
* | Allow renaming of downloads from MediaProvider.Sudheer Shanka2019-01-291-6/+42
|/ | | | | Test: manual Change-Id: I4f18c33cbb7521c023fabf96e78394c34301b61b
* Update DownloadStorageProvider to include MediaStore.Downloads.Sudheer Shanka2019-01-284-84/+535
| | | | | | | | | | Bug: 120879205 Test: manual Test: atest DownloadProviderTests Test: atest cts/tests/app/src/android/app/cts/DownloadManagerTest.java Test: atest MediaProviderTests Test: atest cts/tests/tests/provider/src/android/provider/cts/MediaStore* Change-Id: Ief04f55614d34ba3c8a094fbd1ede34d4fef930b
* Merge "Add new column in Root's cursor to get the supported query args"Ivan Chiang2019-01-231-1/+2
|\
| * Add new column in Root's cursor to get the supported query argsIvan Chiang2019-01-211-1/+2
| | | | | | | | | | | | | | | | | | Add new column Root.COLUMN_QUERY_ARGS in Root's cursor to get the supported query args. Bug: 121234248 Test: manual Change-Id: Id1cb040927d0205dfdf5f60138a97932abb5aa19
* | Merge "Query MediaProvider for possibly stale columns in DownloadProvider."Sudheer Shanka2019-01-221-13/+132
|\ \ | |/ |/|
| * Query MediaProvider for possibly stale columns in DownloadProvider.Sudheer Shanka2019-01-071-13/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Some of the downloads columns data in DownloadProvider could possibly stale. When these columns gets queried from DownloadProvider, DownloadProvider will query internally query MediaProvider and serve those values. Bug: 120876251 Test: atest DownloadProviderTests Test: atest cts/tests/app/src/android/app/cts/DownloadManagerTest.java Test: atest MediaProviderTests Test: atest cts/tests/tests/provider/src/android/provider/cts/MediaStore* Change-Id: Iaae77646a5f8303aa2a73437fbf28595e7019e6f
* | Use "sys.isolated_storage_snapshot" prop to check for the feature.Sudheer Shanka2019-01-171-1/+1
|/ | | | | | | | | | StorageManager.hasIsolatedStorage() has already been updated to use this, so most callers are already using this sys prop. Now, updating remaining callers to use it as well. Bug: 122559151 Test: manual Change-Id: I0967a215daa9e0f2f3cbe7edfa9fa4fe7e53978b
* Fix NPE in DownloadProvider.Sudheer Shanka2019-01-071-2/+2
| | | | | | | Bug: 122434250 Test: manual Exempt-From-Owner-Approval: minor fix to resolve a chase list bug Change-Id: I7a4a64ae0fa42eb0571d78a34166ac96457ce43a
* Add DownloadProvider entries to MediaStore Downloads collection.Sudheer Shanka2019-01-062-27/+222
| | | | | | | | | | | | | | Files downloaded using DownloadManager or those added to DownloadProvider using DownloadManager.addCompletedDownload() API are added to MediaStore Downloads collection so that apps can query all their downloads using MediaStore collection APIs. Bug: 120876251 Test: atest DownloadProviderTests Test: atest cts/tests/app/src/android/app/cts/DownloadManagerTest.java Test: atest MediaProviderTests Test: atest cts/tests/tests/provider/src/android/provider/cts/MediaStore* Change-Id: Icaff9b013bb9486651ce0b5631cc48e80cdbb4b9
* Don't duplicate media files in querySearchDocumentsIvan Chiang2018-12-101-8/+36
| | | | | | | | | | | When the value of DocumentsContract.QUERY_ARG_EXCLUDE_MEDIA from query bundle is true, ignore the duplicated media files. If the behavior of MediaScanner is changed, we need to add them back. Change-Id: I2322561aa7b85dc2d0418a2581446425d763b03d Fix: 119390918 Test: manual test in DocumentsUI
* Fix can't see download files in recent root in DocumentsUIIvan Chiang2018-11-281-6/+29
| | | | | | | | | | 1. Fix issue of can't see download files in recent. 2. Implement the new queryRecentDocuments method to get query limit from bundle. Change-Id: Icb9db95065d27172cd86b482dd60e2fe5390ff0c Fix: 118418471 Test: manual test in DocumentsUI
* Update DownloadProvider to handle paths inside app sandboxes.Sudheer Shanka2018-11-161-20/+99
| | | | | | | | | Bug: 119265456 Bug: 119215560 Test: atest DownloadProviderTests Test: atest cts/tests/app/src/android/app/cts/DownloadManagerTest.java Test: manual Change-Id: I300430b7a97e77820238b1efd1cbd27e0e8a35a9
* Merge "Extend DocumentsContract search to accept mime types"Ivan Chiang2018-11-151-8/+22
|\
| * Extend DocumentsContract search to accept mime typesIvan Chiang2018-11-141-8/+22
| | | | | | | | | | | | | | | | Implement new querySearchDocuments method Bug: 111786939 Test: Manual Test Change-Id: I154e7e3e9c059f9b18cfef64b7f6c907284d27ea
* | Remove references to DefaultContainerService.Sudheer Shanka2018-11-131-17/+1
|/ | | | | | | | | DefaultContainerService is not being used for anything now and is going to be removed. Bug: 111838160 Test: builds and boots Change-Id: Idcd0ef4b479809ea2953d7a583b61aa1769755e0
* Move back to SQLiteQueryBuilder for backports.Jeff Sharkey2018-07-251-20/+31
| | | | | | | | Bug: 111085900 Test: atest packages/providers/DownloadProvider/tests/ Test: atest cts/tests/app/src/android/app/cts/DownloadManagerTest.java Test: atest cts/tests/tests/database/src/android/database/sqlite/cts/SQLiteQueryBuilderTest.java Change-Id: I1ede1af6d8c462f2200361d36cdeeb9b52ccbaf8