summaryrefslogtreecommitdiffstats
path: root/src/com/android/providers/downloads/DownloadReceiver.java
Commit message (Collapse)AuthorAgeFilesLines
* Move DownloadManager to use JobScheduler.Jeff Sharkey2016-04-251-58/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add "Cancel" action to downloads in notification.Oren Blasberg2015-06-251-0/+28
| | | | | | | | | | | | 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
* Add idle service to clean orphan downloads.Jeff Sharkey2014-02-061-19/+38
| | | | | | | | | | | | Periodically reconcile database against disk contents. This handles the case where a user/app deletes files directly from disk without updating the database, and the rare case where a database delete didn't make it to deleting the underlying file. Also cleans up any downloads belonging to a UID when removed. Bug: 12924143 Change-Id: I4899d09df7ef71f2625491ac01ceeafa8a2013ce
* Revert "change download provider to use system log"Doug Zongker2014-01-271-7/+7
| | | | | This reverts commit 4f9d2d04003fafb358d7c127054055b3a9732c9b, was only wanted for debugging.
* change download provider to use system logDoug Zongker2014-01-271-7/+7
| | | | | | | | Try to catch the download provider in the act of deleting pending system updates. Bug: 12680933 Change-Id: If58aba5c30fd624217e5d073730645af05e98ac7
* Unified handling of errors around opening.Jeff Sharkey2013-09-181-8/+2
| | | | | | | Handle both missing downloads and missing activities. Bug: 10799449, 10713636 Change-Id: I592b07fc5cf530526803379d7f7a99e8a6b207c4
* Update extras for in-progress download.Jeff Sharkey2012-11-271-1/+1
| | | | | | | | Follow move to EXTRA_NOTIFICATION_CLICK_DOWNLOAD_IDS extras, which was missing during refactoring. Bug: 7617373 Change-Id: I26203a2bc6fc0e211a1aa602c0de018332d76f60
* Rewrite of download notifications.Jeff Sharkey2012-11-091-80/+114
| | | | | | | | | | | | | | | | | | Switch to using new inbox-style notifications when collapsing multiple downloads. Correctly handles clustering, including cancellation of stale notifications. All notifications are now handled in a single class, making it easier to reason about correctness. Fixed bugs around handling of visibility flags. Move away from using "int" as internal keys, since they can overflow. Started work for time estimates, will finish in a future CL. Explicitly pass all relevant IDs to DownloadReceiver instead of doing a second racy query. Fix StrictMode warnings when querying in DownloadReceiver. Bug: 6777872, 5463678, 6663547, 6967346, 6634261, 5608365 Change-Id: I5eb47b73b90b6250acec2ce5bf8d7a274ed9d3a9
* Remove FLAG_ACTIVITY_NEW_TASK from the VIEW intent.Ruben Brunk2012-09-261-0/+1
| | | | | | | | | Bug: 7164238 Bug: 7237908 Got rid of FLAG_ACTIVITY_NEW_TASK for proper back behavior Change-Id: I50af9aeafb27d6079bda4f81f4a116b6bb600676
* Send ORIGINATING_URI and REFERRER to installer.Jeff Sharkey2012-08-271-17/+5
| | | | | | | | | When building PackageInstaller intents, include ORIGINATING_URI and REFERRER extras. Unify view intent building for both notifications and list UI. Bug: 6900672 Change-Id: I18435e0f8aa549880ec594f82b6a250232706135
* Move notification tests to LittleMock.Jeff Sharkey2012-07-241-1/+4
| | | | | | Directly mock NotificationManager instead of using SystemFacade. Change-Id: If932d26e23816e8674469c275a828701cce5fc2d
* Move away from deprecated NetworkInfo extra.Jeff Sharkey2012-01-301-2/+3
| | | | | | | | | Because the NetworkInfo included in CONNECTIVITY_ACTION broadcast extra does not reflect the state applicable to the calling UID, and the last sticky broadcast may have stale state, transition to calling ConnectivityManager.getActiveNetworkInfo() directly. Change-Id: Ie7a143e621e5a3a013ec6d8b8613709e7787dc0c
* Download provider change for DRM Forward Lock plugin:Gloria Wang2011-04-191-0/+1
| | | | | | | to convert .dm files to .fl files during downloading For bug 3188041 Change-Id: I882b851664432fba3e57dc25a6be827b48006e69
* bug:3435895 listen to media_mounted broadcast intentVasu Nori2011-02-081-0/+10
| | | | | | and retry downloads that failed due to the error "sdcard media not mounted" Change-Id: Id181b8167d331214f72679c85f18cc8b9b969e40
* in DM public API, sending notifications on clicks should include dataVasu Nori2010-11-011-1/+11
| | | | | | | | | | receiving application needs to know WHAT items the clicks occurred on - not just the fact that *something* was clicked on. this is duplicating the behavior as it exists today in the non-public API. depends on Change-Id: Ibe53ccd9934c73175459e42e3d417eee69ae6735 Change-Id: I924f85bd5faf443ac5648839b68390ec4de1f677
* remove usage of hidden public constants.Vasu Nori2010-10-201-0/+1
| | | | Change-Id: I2edf1bef5e741de8193cb293807e3ace42003b0c
* Manual merge: Moved DownloadManager to android.appSteve Howard2010-09-281-1/+1
| | | | Change-Id: Id1de44459ec1bf53e928cae826047467b355823d
* Fix notification bugs, cleanup DownloadService + DownloadReceiverSteve Howard2010-09-201-132/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change started out just fixing a few regressions related to notifications: * Browser downloads weren't picking up a title from the determined filename. This was due to my change to default the title field to "" instead of null. * Notification click/hide events weren't being handled properly. This was due to previous change to the URI structure of DownloadProvider. DownloadReceiver needed to be changed to perform queries through /all_downloads URIs, like all other parts of the download manager code. I did some general refactoring of the DownloadReceiver code while I was there. * The code in DownloadNotification wasn't picking up some updates to downloads properly. This was due to my change to make DownloadNotification use the DownloadInfo objects rather than querying the database directly, so that it could make use of info provided by the DownloadThread that didn't go into the DB. Fixing this didn't turn out to be all that complicated, but along the way to figuring this out I made some substantial refactoring in DownloadService which made it much cleaner anyway and eliminated a lot of duplication. That's something that had to happen eventually, so I'm leaving it all in. Change-Id: I847ccf80e3d928c84e36bc24791b33204104e1b2
* Stub out and test system notifications.Steve Howard2010-07-231-8/+3
| | | | | | | | | | | | | This change abstracts NotificationManager interactions behind SystemFacade and takes advantage of that to test notifications, to a limited degree. It also fixes a silly typo in AbstractDownloadManagerFunctionalTest, and it introduces an extra sleep between tests to avoid some flakiness. I'll look for a better solution to that problem after this change goes in. Change-Id: I3a0307f828955cd45b0e3581ad499da28cc0556e
* Public API support for broadcasts and connectivity control.Steve Howard2010-07-211-10/+24
| | | | | | | | | | | | | | | | * Three new DB fields, one indicating whether a download was initiated by the public API or not, two to hold connectivity control info. DB migration to add these fields and code in DownloadProvider.insert() to handle them. * Change broadcast intent code to match public API spec, for public API downloads only. (Legacy code can go away once existing clients are converted over to the new API.) * Introduce SystemFacade methods for sending broadcasts and checking package ownership; this facilitates new tests of broadcast code. * Change DownloadInfo.canUseNetwork() to obey new connectivity controls available in public API, but again, retain legacy behavior for downloads initiated directly through DownloadProvider * New test cases to cover the new behavior Also made a couple changes to reduce some test flakiness I was observing: * in tearDown(), wait for any running UpdateThread to complete * in PublicApiFunctionalTest.setUp(), if the test directory already exists, remove it rather than aborting DB changes for broadcast + roaming support Change-Id: I60f39fc133f678f3510880ea6eb9f639358914b4
* Introduce a seam to ConnectivityManager and TelephonyManagerSteve Howard2010-07-151-2/+8
| | | | | | | | | This change abstracts access to ConnectivityManager and TelephonyManager behind methods on SystemFacade, moving the code from Helpers into RealSystemFacade and adding fake implementations to FakeSystemFacade. This facilitates new connectivity tests. Change-Id: Id6c6b861e1d4ca45b3c1572bfb8ae0aa26af756b
* Use the private legacy APIJean-Baptiste Queru2010-01-141-18/+21
| | | | | | | | | | The public API is getting deeply reworked for forward compatibility, but since the Download Manager and the Browser need to continue using the old API, a separate copy is being kept on the side. Bug: 2245521 Change-Id: I85eff6ba9efc68600aa80e8dffa6720b0f2ed155
* Remove unnecessary loggingJean-Baptiste Queru2009-09-241-7/+0
| | | | | | | Also tweak some slightly inaccurate logging, and add a note about a potential bug. BUG=2055624
* Add a bit more logging to track down network state issues.Jean-Baptiste Queru2009-09-221-3/+15
| | | | BUG=2055624
* Add logging to track connectivity as seen from the Download Manager.Jean-Baptiste Queru2009-09-211-0/+10
| | | | | | | This is enabled by a separate build-time constant, so that it can be turned on for everyone without having to use a system property. BUG=2055624
* Use the new download manager APIs introduced in change 7400Jean-Baptiste Queru2009-01-211-10/+13
|
* Match the official code style guide.Jean-Baptiste Queru2009-01-201-4/+1
| | | | | | This fixes a number of style violations that weren't caught by automated tools and brings those files closer to compliance with the official style guide for this language.
* Code drop from //branches/cupcake/...@124589The Android Open Source Project2008-12-171-19/+11
|
* Initial ContributionThe Android Open Source Project2008-10-211-0/+167