summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Trigger mediascan after a download is completed.Sudheer Shanka2019-07-311-0/+6
| | | | | | | | | | | | | | When a media item is inserted, media_type will be automatically updated but some of the other media attributes will only be updated after a media scan. Bug: 138419471 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: If8192b31fb7da37425480e7afa53dd1304533b76
* Whitelist DownloadManager.ACTION_NOTIFICATION_CLICKED broadcastMichal Karpinski2019-06-182-0/+17
| | | | | | | | | | | | | 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
* Update behavior of setDestinationInExternalPublicDir().Sudheer Shanka2019-05-091-0/+15
| | | | | | | | | | | | | | 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
* Fix DownloadProviderTests.Sudheer Shanka2019-05-012-3/+11
| | | | | | Bug: 131693243 Test: atest DownloadProviderTests Change-Id: Iefdd7690e45351c2dbdac1cff49f0d11aeba0fb0
* Update API impl of allowScanningByMediaScanner/setVisibleInDownloadsUi.Sudheer Shanka2019-04-301-0/+17
| | | | | | | | | | | | | 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
* Make downloads deletion on owner uninstall consistent.Sudheer Shanka2019-04-281-2/+3
| | | | | | | | | | | | 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
* Fix the atest can't start with single testFelka Chang2019-03-261-1/+1
| | | | | | | | | | | | | | | When the developer want to start single test by using "atest package:class_name#method_name" but doesn't work. To replace InstrumentationTest with AndroidJunitTest in Android.bp. Bug: 129309239 Test: TID="DownloadProviderTests"; \ PACKAGE_NAME="com.android.providers.downloads"; \ TEST_CLASS="DownloadProviderFunctionalTest"; \ TEST_METHOD="testDownloadToCache"; \ atest "${TID}:${PACKAGE_NAME}.${TEST_CLASS}#${TEST_METHOD}" Change-Id: If592035777f7cc69a4a2e20aebf77867251774c8
* Canonicalize filepaths before saving to db.Sudheer Shanka2019-03-021-1/+1
| | | | | | | | | Bug: 126888145 Bug: 122475235 Test: atest DownloadProviderTests Test: atest cts/tests/app/src/android/app/cts/DownloadManagerTest.java Change-Id: I96fa73d3a18e94986043c45dc4e12a47d62eeea6
* Add DownloadProvider entries to MediaStore Downloads collection.Sudheer Shanka2019-01-061-0/+37
| | | | | | | | | | | | | | 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
* Convert android.mk to android.bpfelkachang2018-11-148-54/+164
| | | | | | | | | | | | | In order to o speedup the development cycle, transform android.mk to android.bp * add license * add AndroidTest.xml Change-Id: I970a37e967d41abd38951cc8a5598eb1e0b27c3d Fixes: 117861161 Test: atest DownloadProviderTests DownloadPublicApiAccessTests \ DownloadProviderPermissionTests
* Merge "Stop using Arrays.checkOffsetAndCount." am: 20dfa43eb7Pete Gillin2018-05-161-2/+3
|\ | | | | | | | | | | am: 991e53c2df Change-Id: Ic0366d2492e941cebd44c83e167c7876a0892bdc
| * Stop using Arrays.checkOffsetAndCount.Pete Gillin2018-05-101-2/+3
| | | | | | | | | | | | | | | | | | Start using ArrayUtils.throwsIfOutOfBounds instead. The Arrays method is going to be removed. Bug: 78447530 Test: tradefed.sh run commandAndExit template/local_min --template:map test=DownloadProviderTests Change-Id: I973f0b145d1dfd98b43ba429393b2324122ba374
* | Use the network security config's cleartext settingsChad Brubaker2018-04-131-1/+1
| | | | | | | | | | | | | | | | | | | | Previously DownloadManager only respected the manifest attribute, this change makes DownloadManager handle both the manifest and the network security config Change-Id: I5666a1eea6278acc3864620a0e5a4c3ae37635b8 Fixes: 78028215 Test: atest CtsNetSecConfigDownloadManagerTestCases
* | Exempt tests from hidden API checks.Nicolas Geoffray2018-04-061-0/+1
| | | | | | | | | | | | | | Bug: 64382372 Bug: 74963051 Test: m Change-Id: I8a6e22a3ef027b562355f63edf9354732e2d3938
* | Merge "packages/providers/DownloadProvider: Set LOCAL_SDK_VERSION where ↵Anton Hansson2018-03-013-0/+3
|\| | | | | | | | | | | | | | | possible." am: 8515a33c49 am: 2be155f869 am: da391ab7df Change-Id: Idba4a7c600d2c5afa8f5417325751289047c001d
| * packages/providers/DownloadProvider: Set LOCAL_SDK_VERSION where possible.Anton Hansson2018-02-223-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change sets LOCAL_SDK_VERSION for all packages where this is possible without breaking the build, and LOCAL_PRIVATE_PLATFORM_APIS := true otherwise. Setting one of these two will be made required soon, and this is a change in preparation for that. Not setting LOCAL_SDK_VERSION makes the app implicitly depend on the bootclasspath, which is often not required. This change effectively makes depending on private apis opt-in rather than opt-out. Test: make relevant packages Bug: 73535841 Change-Id: Ic2019b11a0dfb30b2dedb840011b365228e7786a
* | Stop statically including legacy-android-testPaul Duffin2017-12-083-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Statically including legacy-android-test leads to duplicate classes which causes build time problems (with Proguard) and runtime problems on older SDK versions. This change: * Stops statically including legacy-android-test. * Adds compile time dependencies on andoid.test.base, android.test.mock and android.test.runner where necessary. * Adds <uses-library android:name="android.test.runner"/> to any affected package to ensure that the classes that were included by legacy-android-test are still available at runtime. That also adds a dependency on android.test.base and android.test.mock. The following change descriptions were generated automatically and so may be a little repetitive. They are provided to give the reviewer enough information to check the comments match what has actually been changed and check the reasoning behind the changes. * tests/Android.mk Added 'android.test.base' and 'android.test.mock' to LOCAL_JAVA_LIBRARIES because DownloadProviderTests's source depends on their classes and because of these changes they are no longer present on the compilation path. Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES because statically including the classes in DownloadProviderTests results in duplicate classes which leads to build time and compile time issues. * tests/permission/Android.mk Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because DownloadProviderPermissionTests's source depends on its classes and because of these changes they are no longer present on the compilation path. Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES because statically including the classes in DownloadProviderPermissionTests results in duplicate classes which leads to build time and compile time issues. * tests/public_api_access/Android.mk Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because DownloadPublicApiAccessTests's source depends on its classes and because of these changes they are no longer present on the compilation path. Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES because statically including the classes in DownloadPublicApiAccessTests results in duplicate classes which leads to build time and compile time issues. Bug: 30188076 Test: make checkbuild Change-Id: I5120c8944fee3cf34e375ffbe988c12771d6cff2
* | Move to NOT_ROAMING capability.Jeff Sharkey2017-11-091-3/+13
| | | | | | | | | | | | | | | | | | Checking new capability is perferred way to verify a network isn't roaming; isRoaming() is now deprecated. Test: bit DownloadProviderTests:* Bug: 68397798 Change-Id: I11d19fd5a389b52e199c604a6906423d405072e2
* | Use explicit Network from JobParameters.Jeff Sharkey2017-10-251-1/+2
|/ | | | | | | | | | | | On devices with multiple active networks, or rapidly switching between networks, we need an API to tell jobs explicitly which network to use. (For example, the default route could meet all job criteria, but we could have changed the default network by the time we spun up the JobService.) Test: verified via DownloadManager Bug: 64133169 Change-Id: I9c131818d7199f79e147893d85c281473d00bee9
* Allocate space using new StorageManager API.Jeff Sharkey2017-07-153-273/+13
| | | | | | | | | | | | | | Instead of reaching directly into PackageManager, use the new StorageManager API to allocate disk space for downloads. This wraps both clearing cached files and fallocate() into a single method. Remove support for storing downloads on the /cache partition, which doesn't exist on many devices. Bug: 63057877 Test: bit DownloadProviderTests:* Exempt-From-Owner-Approval: Bug 63673347 Change-Id: I5749f7a2f7ded9157fea763dc652bf4da88d86ff
* Follow removal of NetworkInfo metered flag.Jeff Sharkey2017-07-141-2/+7
| | | | | | | | | | The OS now completely relies on NET_CAPABILITY_NOT_METERED to avoid confusion and staleness. Bug: 63391323 Test: builds, boots, Wi-Fi policy is upgraded Exempt-From-Owner-Approval: Bug 63673347 Change-Id: Iea83e0afd8cbd2be10d85b8a35c903047716b5b9
* Add test config to DownloadProviderTestsDan Shi2017-03-221-0/+27
| | | | | | | | | Details about test configs changes are tracked in doc https://docs.google.com/document/d/1EWUjJ7fjy8ge_Nk0YQbFdRp8DSHo3z6GU0R8jLgrAcw/edit# Bug: 35882476 Test: local test Change-Id: I468b280c2285f8ff0b7f79161cb4e21d4ebd19c2
* packages/providers/DownloadProvider: Add APCT tests to the device-tests suite.Simran Basi2017-03-151-0/+1
| | | | | | | | | | | | | | This CL adds the APCT tests within this project to a similar suite as CTS known as device-tests. The current method of running APCT tests in the infrastructure is unaffected. Bug: 35882476 Test: `make dist device-tests -j` and local builds of continuous_instrumentation_tests & continuous_native_tests Change-Id: Ia52f36245fb9ec0bedcc71933fb2af46310fb1a9
* Merge "Remove unnecessary direct dependency on dexmaker" am: b33ebabb85 am: ↵Paul Duffin2017-03-091-1/+0
|\ | | | | | | | | | | | | | | 5f8a055a1c am: 9264e2d7c2 Change-Id: Ic76eb48cbe5ab523eabb26cedc4f2cc4925d1073
| * Remove unnecessary direct dependency on dexmakerPaul Duffin2017-03-071-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The mockito-target library already statically includes dexmaker so the direct dependency is unnecessary and could make the upgrade of mockito more difficult. This is part of the cleanup work prior to upgrading mockito. I ran the tests before and after the change and in both cases got 2 failures and between 4-6 errors; at least some of the errors are flaky as the exact number changed from one run to the next. Bug: 32912773 Test: clean make of DownloadProviderTests, verify still includes dexmaker classes Change-Id: I8133d0869a2b0ff7a9ffc19daff61ed1bbc6a7f6
* | Merge "Prepare for removal of legacy-test from default targets" am: ↵Paul Duffin2017-01-183-1/+7
|\| | | | | | | | | | | | | | | ec6226a6e6 am: 1655131ad9 am: 8be70727ed am: 199c9d1ba8 Change-Id: I4cdfa049d3a5fb4b050aa02efdf7b1d8f619c3c5
| * Prepare for removal of legacy-test from default targetsPaul Duffin2017-01-173-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | In preparation for removing junit classes from the Android API the legacy-test target will be removed from the TARGET_DEFAULT_JAVA_LIBRARIES. This change adds explicit dependencies on junit and/or legacy-android-test to ensure that modules will compile properly once it is removed. Bug: 30188076 Test: make checkbuild Change-Id: I8b29b7d78c97c648d3c98067ac7b050b0a106369
* | Use calling app\\\'s Network Security Config for HTTPS downloads am: ↵Chad Brubaker2016-06-211-0/+18
|\| | | | | | | | | | | | | | | 473ee1358d am: 3799056e04 am: f2283c55d4 Change-Id: I4368376fe6f963c44e179df93ea6124a82d3954f
| * Use calling app's Network Security Config for HTTPS downloadsChad Brubaker2016-06-201-0/+18
| | | | | | | | | | Bug:29505888 Change-Id: Ifc33fd75e44d1dbc5a4ce5caa8e1ff938b94623e
* | Enable search for Downloads.Ben Lin2016-05-101-0/+18
|/ | | | | Bug: 26524617 Change-Id: Ide23c822b97ccab29a341184f14698dc942e8e14
* Visible downloads should run while blocked/dozing.Jeff Sharkey2016-04-291-2/+2
| | | | | | | | | | | Downloads with visible notifications should behave as if the requesting app was running a foreground service. The easiest way to implement this for now is to ignore any BLOCKED network status and use the new setWillBeForeground() API so job scheduling ignores any active blocked/dozing status. Bug: 26571724 Change-Id: I8ea2b2a7cdb5f469adc11b4d897ff55bd8a9db9a
* Move DownloadManager to use JobScheduler.Jeff Sharkey2016-04-256-82/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | JobScheduler is in a much better position to coordinate tasks across the platform to optimize battery and RAM usage. This change removes a bunch of manual scheduling logic by representing each download as a separate job with relevant scheduling constraints. Requested network types, retry backoff timing, and newly added charging and idle constraints are plumbed through as job parameters. When a job times out, we halt the download and schedule it to resume later. The majority of downloads should have ETag values to enable resuming like this. Remove local wakelocks, since the platform now acquires and blames our jobs on the requesting app. When an active download is pushing updates to the database, check for both paused and cancelled state to quickly halt an ongoing download. Shift DownloadNotifier to update directly based on a Cursor, since we no longer have the overhead of fully-parsed DownloadInfo objects. Unify a handful of worker threads into a single shared thread. Remove legacy "large download" activity that was thrown in the face of the user; the UX best-practice is to go through notification, and update that dialog to let the user override and continue if under the hard limit. Bug: 28098882, 26571724 Change-Id: I33ebe59b3c2ea9c89ec526f70b1950c734abc4a7
* Tidy up uses of Integer.valueOf.Narayan Kamath2016-04-191-1/+1
| | | | | | | | Use parseInt when the result is assigned to an int. Allocates fewer objects. bug: 28078871 Change-Id: I2c58112795fecce6395c558f2bb1e1fefe83a5bf
* Merge "Implement multi-network downloads" into nyc-devRobin Lee2016-04-071-0/+7
|\
| * Implement multi-network downloadsRobin Lee2016-04-071-0/+7
| | | | | | | | | | | | | | | | | | Downloads should use the default network for the caller. This prevents applications from, for example, bypassing VPN by routing all requests through the DownloadProvider. Bug: 27074270 Change-Id: I7830226dd2910757d3a5c78f373330f84637ccfa
* | Add tag to downloadprovider storage tests to run in apctMd Haque2016-03-241-0/+2
|/ | | | Change-Id: I9b2711c2a9b3edd4bbef97ff6cdcae9fdc9ef433
* Follow framework refactoring.Jeff Sharkey2016-01-062-2/+14
| | | | | Bug: 22958127 Change-Id: I314a9bdd21988bf7e6cc79a2ae842bed29c96f17
* Add "Cancel" action to downloads in notification.Oren Blasberg2015-06-252-1/+32
| | | | | | | | | | | | Add a "Cancel" action to in-progress downloads shown in notification pane. We add a new action type for a new "cancel" intent sent by DownloadNotifier to DownloadReceiver, which in turn cancels the download by way of DownloadManager. BUG=19972464 Change-Id: I83cd2f40e1442c327f756027b99f9eac913a0e70
* Make DownloadProvider honor the cleartext traffic policy.Alex Klyubin2015-04-012-0/+23
| | | | | | | | | | | | | | | | | | | This makes the Provider-side of the DownloadManager framework honor the per-UID cleartext network traffic policy. The policy is enforced in the Provider rather than in its client (DownloadManager) because download URLs could get redirected between HTTPS and HTTP and only the Provider currently has visibility into and control over this. Whether cleartext network traffic is permitted is a per-package policy. However, the DownloadProvider can only access the UID of the requesting application. Multiple packages can run under the same UID. In that scenario, cleartext traffic is permited for the UID if cleartext traffic is permitted for any of the packages running under the UID. This could be improved by making the DownloadManager provide the package name in addition to the UID. Bug: 19215516 Change-Id: Ib37585a7a2fc2869954d52a1b08052926f49bc9b
* Fix compilation after update to MockWebServerNeil Fuller2014-10-271-1/+2
| | | | | | | Bug: 18083851 (cherry pick from commit f1cd37d8bade42be0632f54dcd61f81711269606) Change-Id: I93f14e171abc7a52fe2117c8503374734147513b
* Move internal DownloadProvider code off libcore.os.Elliott Hughes2014-04-281-7/+6
| | | | | | (As much as possible. There are no plans to make the mocking API public.) Change-Id: I348877b850d6d34572d5a19e67952254bc4f12ef
* fix test buildsColin Cross2014-04-241-2/+2
| | | | | | | StructStatVfs and ErrnoException were moved from libcore.io to android.system Change-Id: I42c789a941f964ae7dde224b16af39a95212fbc7
* Many improvements to download storage management.Jeff Sharkey2014-02-068-46/+352
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change all data transfer to occur through FileDescriptors instead of relying on local files. This paves the way for downloading directly to content:// Uris in the future. Rewrite storage management logic to preflight download when size is known. If enough space is found, immediately reserve the space with fallocate(), advising the kernel block allocator to try giving us a contiguous block regions to reduce fragmentation. When preflighting on internal storage or emulated external storage, ask PackageManager to clear private app caches to free up space. Since we fallocate() the entire file, use the database as the source of truth for resume locations, which requires that we fsync() before each database update. Store in-progress downloads in separate directories to keep the OS from deleting out from under us. Clean up filename generation logic to break ties in this new dual-directory case. Clearer enforcement of successful download preconditions around content lengths and ETags. Move all database field mutations to clearer DownloadInfoDelta object, and write back through single code path. Catch and log uncaught exceptions from DownloadThread. Tests to verify new storage behaviors. Fixed existing test to reflect correct RFC behavior. Bug: 5287571, 3213677, 12663412 Change-Id: I6bb905eca7c7d1a6bc88df3db28b65d70f660221
* Follow MockWebServer API changes.Jeff Sharkey2013-04-032-7/+1
| | | | Change-Id: Icaba016bc6e098745e56a3b6367a8a6af0151158
* Start using MockStreamResponse.Jeff Sharkey2013-03-252-1/+7
| | | | Change-Id: Ida4a0a85883ccd6763b07e958ddc6ecf7eedf790
* Fix race conditions around filename claiming.Jeff Sharkey2013-03-011-0/+46
| | | | | | | | | | | | | When multiple downloads are running in parallel, they can end up claiming the same filename and clobber over each other. This change introduces locking around filename generation, and touches the claimed filename so other threads fail the File.exists() check and keep looking. Tests to verify. Bug: 8255596 Change-Id: Ie75ed047c199cf679832c75159056ca036eac18d
* Test to verify extremely large downloads.Jeff Sharkey2013-02-253-3/+105
| | | | | | | | Streams a 3GB file to verify that it downloads correctly, using new MockWebServer streaming API. Bug: 8209169 Change-Id: Ic36271bfef3176e1ccea2b40edc7abb1044222f1
* Redesign of DownloadManager update loop.Jeff Sharkey2013-02-123-1/+58
| | | | | | | | | | | | | | | | | | Previously, the service lifecycle was managed through a large for() loop which was extremely tricky to reason about. This resulted in several race conditions that could leave the service running indefinitely, or terminate it early before tasks had finished. This change redesigns the update loop to be event driven based on database updates, and to collapse mutiple pending update passes. It is much easier to reason about service termination conditions, and it correctly uses startId to handle races during command delivery. Also moves scanner into isolated class, and switches to using public API instead of binding to private interface. Bug: 7638470, 7455406, 7162341 Change-Id: I380e77f5432223b2acb4e819e37f29f98ee4782b
* Migrate to using Mockito directly.Jeff Sharkey2013-01-313-9/+9
| | | | Change-Id: Ice24d5c62bbcbcfd3d7374eac3a20580f7f31f36
* Tests for max retries/redirects, ETag switches.Jeff Sharkey2013-01-295-14/+108
| | | | | | | | | | Verify that servers responding with many retries or redirects result in failed download, instead of spinning out of control. Test to verify that changed ETag results in download failing. Also fix handling of HTTP 301 to update Uri in database. Change-Id: Iff2948d79961a245b7900117d107edaa356618c9