History log of /packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
635e12dcdf24215246615c78c5de6b883cb00a0f 05-Sep-2017 Fyodor Kupolov <fkupolov@google.com> Close idle connections to release RAM

Close idle connections after 30s of inactivity to release RAM.
Savings: ~.2MB on marlin, ~0.1MB on low-ram devices

Bug: 63398887
Test: reboot and dumpsys meminfo android.process.media
Change-Id: If2505df7e654ab93cf64e6aeb7721c6f0a0134a5
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
d635ac295850ba23d528c02b1e5c6eb44b64b22b 15-Jul-2017 Jeff Sharkey <jsharkey@android.com> Allocate space using new StorageManager API.

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
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
50522c738bf68d2784ce4f52dd34188a491065b8 19-Apr-2017 Jeff Sharkey <jsharkey@android.com> Keep shared downloads when apps are uninstalled.

When an app downloads files to external storage, keep those downloads
around for the user to enjoy after the app is uninstalled.

We still end up deleting files stored in internal cache directories,
and under package-specific directories on external storage.

Test: builds, boots, downloads on external storage remain
Bug: 30868200
Change-Id: Ib70f42aa764a8252fe67c6fba9d60b3350f5d5a4
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
2ab9a2d15c63cd567805adb8fa4b9c524afc5ceb 28-Feb-2017 Suprabh Shukla <suprabh@google.com> Deleting downloads for removed uids on downloadprovider start

After uninstalling an app, if the system was shutdown before the
download provider received the broadcast for UID_REMOVED, another app
installed later in the same uid might be able to gain access to the
files downloaded by this app. Removing any such hanging downloads
at the start up of the download provider should fix this issue.

Test: Manually tested by uninstalling an app and killing and restarting
the process android.process.media, to check that the downloaded files of
the uninstalled app were deleted.

Bug:22011579

Change-Id: I7382c4846f99035b40412a01715aee5873efa9e6
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
16ee9158a395f3f67be12062d7f870f76e2677a5 14-Oct-2016 Jeff Sharkey <jsharkey@android.com> Only send DOWNLOAD_COMPLETE broadcast once.

Apps might end up confused if we tell them a download was completed
multiple times, so only send the broadcast exactly once when we
transition it into a "completed" state, either during an update() or
a delete() operation.

Test: verified single broadcast with test app
Bug: 31619480
Change-Id: I0b9139ea0e37f6d212b84314048692cd0c4f9cdf
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
145350ed9ddc3d7835c760a43b04c12325911209 17-Sep-2016 Jeff Sharkey <jsharkey@android.com> Merge commit '010fc1856c23d5a15a6e42e334b0fdc7986f7f30' into manual_merge_010fc18
am: e2c5d91b95

Change-Id: I5d3b829662449cc6068501c0cdf0f6b7bc67a8e5
e2c5d91b95a39a1e5028581bd72bd0e0ea907caf 17-Sep-2016 Jeff Sharkey <jsharkey@android.com> Merge commit '010fc1856c23d5a15a6e42e334b0fdc7986f7f30' into manual_merge_010fc18

Change-Id: I2fa7bbc82985a294564a072650f9e8472dae9694
1d0dcb200d466cd4b03f65fa03f16c7944a0b6c1 17-Sep-2016 Jeff Sharkey <jsharkey@android.com> Merge commit '40238b9a601d58d2b4f88da7b14823e8c0340bc6' into manual_merge_40238b9

Change-Id: I0d8441c4bae392726e7d41c77b1d9ac5eda1c09c
40238b9a601d58d2b4f88da7b14823e8c0340bc6 17-Sep-2016 Jeff Sharkey <jsharkey@android.com> Enforce calling identity before clearing. am: 7c1af8c62c am: 47dcd095ea am: 51033d49f6 am: 9bbd21ff0c am: 0bd9e49a06 am: 73721ade0d
am: 36b9c38a53

Change-Id: I53525f314f5ebc659e26c972c62517833ea03e19
0bd9e49a06ba3cb7a1ecc50ab6e0b7bd1a09601a 17-Sep-2016 Jeff Sharkey <jsharkey@android.com> Enforce calling identity before clearing. am: 7c1af8c62c am: 47dcd095ea am: 51033d49f6
am: 9bbd21ff0c

Change-Id: I5f09670f0629addb5fa847799184716020234f35
7c1af8c62c8bdf6e8de5a00c1927daf9fd9c03d1 16-Sep-2016 Jeff Sharkey <jsharkey@android.com> Enforce calling identity before clearing.

When opening a downloaded file, enforce that the caller can actually
see the requested download before clearing their identity to read
internal columns.

However, this means that we can no longer return the "my_downloads"
paths: if those Uris were shared beyond the app that requested the
download, access would be denied. Instead, we need to switch to
using "all_downloads" Uris so that permission grants can be issued
to third-party viewer apps.

Since an app requesting a download doesn't normally have permission
to "all_downloads" paths, we issue narrow grants toward the owner of
each download, both at device boot and when new downloads are
started.

Bug: 30537115, 30945409
Change-Id: If944aada020878a91c363963728d0da9f6fae3ea
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
22e1cd88bad6b7283c37d35ea620988141fa4d6d 01-Sep-2016 Jeff Sharkey <jsharkey@android.com> DO NOT MERGE. Send "completed" broadcast if download cancelled.
am: c0496a0b0b

Change-Id: I19d55af382ab6eb4ad080c402139eaf4df695ace
2be85cd23d2d56d1b0ea87f0f815ef80693b98c2 23-Aug-2016 Jeff Sharkey <jsharkey@android.com> DO NOT MERGE. Update notifications when deleting downloads.

Otherwise we end up leaving stale notifications around after the
underlying download was deleted.

Change-Id: Ie262a9dd369034de6c06be28b0eedc4231ea2e75
Test: none
Bug: 30697605
(cherry picked from commit 3b7e099588a2697305fd52c342f404a03ec9a9ab)
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
c0496a0b0b26bec9c37e94753823507a6067d700 23-Aug-2016 Jeff Sharkey <jsharkey@android.com> DO NOT MERGE. Send "completed" broadcast if download cancelled.

When a download is deleted, we may not have an active thread, so
always send the broadcast from the provider. If an active thread
encounters a deleted download, skip sending the broadcast twice.

Change-Id: If8d5b99a1b7232bb64c6d11f22fdb4f5d6dbbfec
Test: none
Bug: 30883889
(cherry picked from commit efb1ac6b49692e62fde6830c3d20953c8632d2ba)
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
1f9453daa07819c0f4dc2fdb6dbb85004eda93e4 27-Aug-2016 Adam Seaton <aseaton@google.com> Revert "Enforce calling identity before clearing." am: b440ceb00f am: 6777320335 am: a474af3a08 am: 8bec536bf2 am: 34ccbd80ea am: 956426bee5 am: 6a6944d1f4 am: 8e8770bdc8 am: 85a6e20a85 am: 29c0025ae0
am: 9e119a0c29

Change-Id: Ic8495c5744b3acd16ae2d63be103279a2621411c
85a6e20a85c4c1d2fb8167b4572230c6fdccfb38 27-Aug-2016 Adam Seaton <aseaton@google.com> Revert "Enforce calling identity before clearing." am: b440ceb00f am: 6777320335 am: a474af3a08 am: 8bec536bf2 am: 34ccbd80ea am: 956426bee5 am: 6a6944d1f4
am: 8e8770bdc8

Change-Id: I208036cd66780728f627cd11b2514eeb03c74800
8e8770bdc8811be61a747952e49b223a4c1af90a 27-Aug-2016 Adam Seaton <aseaton@google.com> Revert "Enforce calling identity before clearing." am: b440ceb00f am: 6777320335 am: a474af3a08 am: 8bec536bf2 am: 34ccbd80ea am: 956426bee5
am: 6a6944d1f4

Change-Id: Ib01cab89347d96c44478e51a27ef2cf17e1e7b2d
34ccbd80ea69444008e6edda72189d511e4806e2 26-Aug-2016 Adam Seaton <aseaton@google.com> Revert "Enforce calling identity before clearing." am: b440ceb00f am: 6777320335 am: a474af3a08
am: 8bec536bf2

Change-Id: I81ea34a6f1cdaa438af6397651d7374628d44eff
b440ceb00fd46c9233723066c680a538067fbf82 26-Aug-2016 Adam Seaton <aseaton@google.com> Revert "Enforce calling identity before clearing."

This reverts commit 8be3a92eb0b4105a9ed748be5a937ce79145f565.

Change-Id: I10401d57239b868f8e3514f81a0e20486838e29c
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
6377e23c09d30fa7c2c0d92011a4db9e1d711463 24-Aug-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Send "completed" broadcast if download cancelled."
efb1ac6b49692e62fde6830c3d20953c8632d2ba 23-Aug-2016 Jeff Sharkey <jsharkey@android.com> Send "completed" broadcast if download cancelled.

When a download is deleted, we may not have an active thread, so
always send the broadcast from the provider. If an active thread
encounters a deleted download, skip sending the broadcast twice.

Change-Id: If8d5b99a1b7232bb64c6d11f22fdb4f5d6dbbfec
Test: none
Bug: 30883889
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
3b7e099588a2697305fd52c342f404a03ec9a9ab 23-Aug-2016 Jeff Sharkey <jsharkey@android.com> Update notifications when deleting downloads.

Otherwise we end up leaving stale notifications around after the
underlying download was deleted.

Change-Id: Ie262a9dd369034de6c06be28b0eedc4231ea2e75
Test: none
Bug: 30697605
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
3f4a29b5ebc72fa6236f135253fbace6d6d2222d 09-Aug-2016 Jeff Sharkey <jsharkey@android.com> Enforce calling identity before clearing. am: 8be3a92eb0 am: ec19fe6485 am: b3ce7976f2 am: 860239d87e am: 616f47abce am: a9ea617232 am: 567e549614 am: 14ae5650e4 am: 80ab64c562 am: 77b7d90939
am: 7bd19160b1

Change-Id: I5f041155cf85feb81db55f2b23868754f270ac4d
80ab64c562842fef49509dbf876cd29ef55c0727 09-Aug-2016 Jeff Sharkey <jsharkey@android.com> Enforce calling identity before clearing. am: 8be3a92eb0 am: ec19fe6485 am: b3ce7976f2 am: 860239d87e am: 616f47abce am: a9ea617232 am: 567e549614
am: 14ae5650e4

Change-Id: I3688aa1ad8e48901b321823f03636bbd55d76780
14ae5650e450984f7882e022f3332852fbd2b300 09-Aug-2016 Jeff Sharkey <jsharkey@android.com> Enforce calling identity before clearing. am: 8be3a92eb0 am: ec19fe6485 am: b3ce7976f2 am: 860239d87e am: 616f47abce am: a9ea617232
am: 567e549614

Change-Id: I47ae3c7cfa1e3f6239d95697cf641c8d498a4e60
616f47abce356af095e92d8571a02285917e9d92 09-Aug-2016 Jeff Sharkey <jsharkey@android.com> Enforce calling identity before clearing. am: 8be3a92eb0 am: ec19fe6485 am: b3ce7976f2
am: 860239d87e

Change-Id: Ic62206ad61c81da00eb57679211c140ce7053032
8be3a92eb0b4105a9ed748be5a937ce79145f565 01-Aug-2016 Jeff Sharkey <jsharkey@android.com> Enforce calling identity before clearing.

When opening a downloaded file, enforce that the caller can actually
see the requested download before clearing their identity to read
internal columns.

Bug: 30537115
Change-Id: I01bbad7997e5e908bfb19f5d576860a24f59f295
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
8ffd8e8401724fc43f8536816d3ca5cb195be8b7 28-Jun-2016 Jeff Sharkey <jsharkey@android.com> Clear identity when deleting scanned entry. am: 01dee86505 am: d8fc87e08e
am: 7dda783c24

Change-Id: I26c1c681d83ad21b2dc79586ab7768abf18dc577
01dee865054aedb9aa7e90a8ef2c556e19af95e1 28-Jun-2016 Jeff Sharkey <jsharkey@android.com> Clear identity when deleting scanned entry.

When deleting a file from DownloadManager, we also reach over and
clean up any scanned MediaStore entries. However, DownloadManager
clients may not hold the WRITE_EXTERNAL_STORAGE permission, such as
when they downloaded a file into their package-specific directories.

The safest fix for now is to clear the calling identity and always
clean up the MediaStore entries ourselves, since DownloadProvider
always holds the required storage permission.

Bug: 29777504
Change-Id: Iea8f5696410010807b118bb56e5b897c53f0e1fe
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
b759707b80987d0cb4ad2a3a78c11702a45a36c2 30-Apr-2016 Ben Lin <linben@google.com> Enable search for Downloads.

Bug: 26524617
Change-Id: Ide23c822b97ccab29a341184f14698dc942e8e14
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
053674aa4d0ecd7e37dadb8ee37a9cafbdf2f16c 09-May-2016 Jeff Sharkey <jsharkey@android.com> Scan completed downloads when requested.

The recent JobScheduler rewrite means we no longer spin up a service
when insterting an already-completed download. However, the calling
app may have requested the download to be scanned, so kick off a
scan request for them.

Bug: 28659693
Change-Id: I497e10995ba04f1522fe8d7e547ebea6e305f6e9
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
3a5f5eafb34eaa4963c801882148e8f61514a61b 21-Apr-2016 Jeff Sharkey <jsharkey@android.com> Move DownloadManager to use JobScheduler.

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
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
102cab3e7deee3392a4d4bf818fabc527db0a222 18-Feb-2016 Jeff Sharkey <jsharkey@google.com> Merge "DO NOT MERGE. Use resolved path when inserting and deleting." into mnc-dr1.5-dev
c0b05b37d7af47455c54fdd0dac4c39f2cf8e5dd 17-Feb-2016 Jeff Sharkey <jsharkey@android.com> DO NOT MERGE. Use resolved path when inserting and deleting.

This avoids a race condition where someone can change a symlink
target after the security checks have passed.

Bug: 26211054
Change-Id: I03b06b746fde5d08d6b61a7011bdace0b4e9fa77
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
ebb842e081f2d9eddbeddb9447631fd81e8961b9 16-Feb-2016 Jeff Sharkey <jsharkey@android.com> DO NOT MERGE. Use resolved path when inserting and deleting.

This avoids a race condition where someone can change a symlink
target after the security checks have passed.

Bug: 26211054
Change-Id: I40ed6d2298e4b66b4f7a055e68d9820515adf351
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
8c088f73a53813869e68a5c4671c09e8732da6d3 07-Feb-2016 Jeff Sharkey <jsharkey@android.com> Use resolved path for both checking and opening.

This avoids a race condition where someone can change a symlink
target after the security checks have passed.

Bug: 26211054
Change-Id: I5e1a2343d631109c21a4c5b2d8d00b2946756680
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
a4af46faac3ed68540d634e25f311cb7e071e6a5 22-Jan-2016 Jeff Sharkey <jsharkey@google.com> Revert "Use resolved path for both checking and opening."

This reverts commit 366af2ee1f841615d44ab770b537112d769eed05.

Change-Id: Id1155425ebcae23be8ce3916f19dda82eee992c4
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
5c08fb8cbeb045b9ce447443208e87f42604d168 07-Jan-2016 Jeff Sharkey <jsharkey@android.com> Use resolved path for both checking and opening.

This avoids a race condition where someone can change a symlink
target after the security checks have passed.

Bug: 26211054
Change-Id: I5842aaecc7b7d417a3b1902957b59b8a1f3c1ccb
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
8fbf1207a69b123493a8c6ca7e0295c385d195dc 07-Jan-2016 Jeff Sharkey <jsharkey@android.com> Use resolved path for both checking and opening.

This avoids a race condition where someone can change a symlink
target after the security checks have passed.

Bug: 26211054
Change-Id: I5842aaecc7b7d417a3b1902957b59b8a1f3c1ccb
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
366af2ee1f841615d44ab770b537112d769eed05 07-Jan-2016 Jeff Sharkey <jsharkey@android.com> Use resolved path for both checking and opening.

This avoids a race condition where someone can change a symlink
target after the security checks have passed.

Bug: 26211054
Change-Id: I5842aaecc7b7d417a3b1902957b59b8a1f3c1ccb
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
b8bc2a76ddaa0c59d681913dba10fd7ec0a2a22b 25-Jul-2015 Jeff Sharkey <jsharkey@android.com> Switch to proxy variants of app-ops calls.

Bug: 22718722
Change-Id: I9c054956c3b3655332475607d6919dc34515e550
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
ed30deae5fe5b9de142b44933001c9b098c47712 13-Jul-2015 Jeff Sharkey <jsharkey@android.com> Relax permissions on package-specific paths.

Normally apps must hold the WRITE_EXTERNAL_STORAGE permission in
order to use DownloadManager. However, now that the platform has
relaxed permissions on package-specific directories, we relax the
DownloadManager check in a similar way. This also opens up using
DownloadManager to save files on secondary external storage devices.

Fix bug so that we now check the relevant volume state when thinking
about resuming a download.

Bug: 22135060
Change-Id: If439340ea48789ea167f49709b5b69a4f0883150
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
f775c9840f8f9520ab3dc859597cb34624213363 19-Jun-2015 Todd Kennedy <toddke@google.com> Create a handler thread

The onCreate() method [where we initialize the handler] runs on the
main thread. This means the ParcelFileDescriptor also runs tasks
involving disk access on the main thread. We need to create a
separate thread to run the Content Provider's handler.

Bug: 19718299
Change-Id: Ia3661fafd3442ad6260f04253ba24ddf83b176b2
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
e3960ea97d5ddee80e5237796d577892e42a28cb 17-Jun-2015 Jeff Sharkey <jsharkey@android.com> Actually delete files when rows are deleted.

Otherwise they're orphaned until the next idle maintenance pass.

Bug: 21786983
Change-Id: I6eb2240d657366b65482bd3a0d5683e5d34a541a
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
2e16979a9133ef83f6e513eaa4b84de40350a2dd 06-Aug-2014 Jeff Sharkey <jsharkey@android.com> Whoops, clear identity to get internal columns.

Bug: 16822344
Change-Id: Ib90e171cbb7babc7a3eea59de5cb899c79fadf94
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
495edec1d9f7659923c71b009db66c1bd4782034 05-Aug-2014 Jeff Sharkey <jsharkey@android.com> Scan after writing download files.

Kicks off media scanner after files are written, usually through a
DocumentsProvider.

Bug: 13557203
Change-Id: I4e29b778b4e19a217f60c1e415c4d814724752d3
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
d308640acf7179eb4b16f7067edc64da55a12521 10-May-2014 Jeff Sharkey <jsharkey@android.com> am f04a7690: am 90e7485d: am 02562d30: Merge "Avoid leaking cursors"

* commit 'f04a7690b53288c98c07e0aa05214cceebea1331':
Avoid leaking cursors
a2aad3aa41402afe88a2bf7b820f3459f795d079 27-Mar-2014 Mattias Nilsson <mattias.nilsson@sonymobile.com> Avoid leaking cursors

Adding try/finally blocks to make sure that cursor
resources are let go

Change-Id: I596074aa9ab5752f91a26b5a03e1f39c23c64a5f
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
b9e36b4f5390c9100d567cbe6e61a3304e37e680 15-Mar-2014 Nick Kralevich <nnk@google.com> resolved conflicts for merge of 2ca55fd3 to master

Change-Id: I59df74b902c95299ae9adda2ddddb6bad4260159
470a6a6806ebacee69f8e820cdb2ee307d58f11a 12-Mar-2014 Stephen Smalley <sds@tycho.nsa.gov> Drop restorecon call from DownloadProvider.

It is not necessary/useful to place this directory into a separate
type from other app data files, so remove this restorecon.

Change-Id: Iabd643a515c134ab2a62e82866a3f72530f795ba
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
1f2c2c560400ba60c5b9dfd6fd4f5e73b232803a 07-Feb-2014 Jeff Sharkey <jsharkey@android.com> Add idle service to clean orphan downloads.

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
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
dffbb9c4567e9d29d19964a83129e38dceab7055 31-Jan-2014 Jeff Sharkey <jsharkey@android.com> Many improvements to download storage management.

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
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
9b731a5521f569c91aeb419d43fa098a34cf78cb 27-Jan-2014 Doug Zongker <dougz@android.com> Revert "change download provider to use system log"

This reverts commit 4f9d2d04003fafb358d7c127054055b3a9732c9b, was only
wanted for debugging.
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
4f9d2d04003fafb358d7c127054055b3a9732c9b 27-Jan-2014 Doug Zongker <dougz@android.com> change download provider to use system log

Try to catch the download provider in the act of deleting pending
system updates.

Bug: 12680933
Change-Id: If58aba5c30fd624217e5d073730645af05e98ac7
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
1225c34df262ece7a9f95ee5fe61c1985bf16df1 05-Oct-2013 Jeff Sharkey <jsharkey@android.com> Always update notifications, media scanner.

insert() was trying to be too clever, and it would end up delaying
the media scanner until the next download happened. This resulted
in duplicate photos in DocumentsUI.

Bug: 11081685
Change-Id: Ic9549ede38118372849119dd3a21415a4723e9f5
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
04c1c2afb7481e7fb9b66f96023c79d19cad8c90 01-Oct-2013 Jeff Sharkey <jsharkey@android.com> Allow all downloads to be writable.

Bug: 10943812
Change-Id: Ib0cb3e608c1f40a2e2fcd6e493c8f920d8b4221b
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
afaf53bd2b1322167b6f31eda941e38335c4a952 26-Sep-2013 Jeff Sharkey <jsharkey@android.com> Revoke grants when downloads are deleted.

When deleting downloads, revoke any Uri permission grants, which
removes from getPersistedUriPermissions().

Bug: 10928851
Change-Id: I3e90c4071385832dcb3e0cf9ca3fdccafbe30037
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
c067c8be21dc4a6dc5f49b2b1aed7f91aab47063 23-Sep-2013 Jeff Sharkey <jsharkey@android.com> Allow saving to Downloads.

Add column to mark downloads as being writable, and allow documents
to be created under Downloads backend. Update database when writing
is finished, and generate unique filenames when they already exist.

Check canonical path on incoming _DATA paths.

Bug: 10667164, 10892621, 10893268
Change-Id: I8c203b96ff042a895b58686903fcd07fc755a00f
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
445b908259dac16f32664521c77d94959db7ded3 04-Apr-2013 Geremy Condra <gcondra@google.com> Restore the appropriate SELinux context to the downloads dir.

Change-Id: I4839fd07abdd1c6b866f1d94dc36567df047e30c
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
1d0a0aa2cc5bfed8107aa70f7e890fde9a7ea2b4 30-Jan-2013 Jeff Sharkey <jsharkey@android.com> Dump recent downloads from provider.

The lifetime of DownloadService can be limited, and it's often
missing from bugreports. The provider has a much longer lifetime,
so have it dump raw data about recent downloads.

Bug: 7350685
Change-Id: I55c9d602d77014ea27820936f1cf5c8ad24f286a
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
12f5dc46aaa8e28cabfbe25d55f0af68f24ab306 18-Jan-2013 Jeff Sharkey <jsharkey@android.com> Better handling of retryable errors.

Now the final errors are always thrown, and the outer code decides
how to handle them as retries. Also clean up method signatures.

Bug: 8022478
Change-Id: I4e7e43be793294ab837370df521e7c381e0bb6c3
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
701d66efeff513a7509eeaafab6e47f4f6edb857 05-Jan-2013 Jeff Sharkey <jsharkey@android.com> Remove singleton StorageManager.

Now DownloadService creates and owns the lifecycle of its own
StorageManager instance.

Change-Id: I8f6bedc02f1dbe610a8e6a25d55383a12716d344
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
a40a349c0107660bfb4004467550725a3ca3ec97 03-Aug-2012 Jeff Sharkey <jsharkey@android.com> Rewrite of download notifications.

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
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
c3f3d992e415185a8e2d89ab8f8dfbcb538ec21e 19-Apr-2012 Jeff Sharkey <jsharkey@android.com> Report MIME type for individual downloads.

Bug: 6358473
Change-Id: Ied4a6c8194d0cbb735e43cf7d7759f4674efe535
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
a7ae77fdae69bcc6d6609d4639fed5d96e55eeaa 17-Apr-2012 Jeff Sharkey <jsharkey@android.com> Add and enforce ALLOW_METERED column.

Include flag with each download to indicate if its allowed to proceed
over metered networks. Downloads are left in WAITING_FOR_NETWORK
state, similar to how ALLOWED_NETWORK_TYPES is handled.

Also keep blocked downloads in WAITING_FOR_NETWORK state instead
of marking them as failed.

Bug: 3001465, 5734560
Change-Id: I80bb9aa9bd25ddf6f7a2472db344b6ba6878bd74
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
9b606340a0b5b88436505651dbe3cdaf60117604 16-Apr-2012 Jeff Sharkey <jsharkey@android.com> View file downloads through DownloadsProvider.

When viewing file://-style downloads, open through DownloadsProvider
so that FLAG_GRANT_READ_URI_PERMISSION works. Add support for
OpenableColumns to support external apps probing for metadata.

Bug: 6343461
Change-Id: I630405406321ea1871c62cbcded55a4ee024ef6e
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
bff4fe9b858d95e984298d4863a5199f1ee2c54e 11-Nov-2011 Jeff Sharkey <jsharkey@android.com> Use UID instead of PID.

Bug: 5606426
Change-Id: I9b9cee142c360da2a30a4bb8be8dcf40b8c7e43e
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
d195a5c677e575ba7e96e9366d0823c3c822231d 12-Oct-2011 Jeff Sharkey <jsharkey@android.com> Check canonical path when download requested.

Bug: 5449870
Change-Id: I3219273be9b796b123545c811e5f39fa83b5768e
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
12c7bd488afe3a611d665e364e361f04f4a8c8d8 09-Jul-2011 Jeff Brown <jeffbrown@google.com> Eliminate single-process mode.
Bug: 5010576

Change-Id: I2f9bcad41cf50ed0b17dd487d0389f7b38500fd7
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
51cc2143feeed748c62544c7f1a57415bd90c7af 13-Apr-2011 Jeff Sharkey <jsharkey@android.com> Allow VISIBLE_NOTIFY_COMPLETED on Request.

Updates list of allowed visibility values to enable Request builders
to use Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED.

Bug: 4283223
Change-Id: I8ebe4a13f95a58f25f6025946a6d4725261717f2
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
9b2576f9181fc177dbbc9033c435b1d4049fc2e0 07-Mar-2011 Vasu Nori <vnori@google.com> bug:3513950 fix the comments

Change-Id: I6192a829c7cac86c55a0f67364ebd722504d5dc7
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
2c02577af19bf11714220d14cfc96d2c017ac1ab 11-Feb-2011 Vasu Nori <vnori@google.com> bug:3425749 if adding completed download to db, send completion notif

Change-Id: I9f9f6f2e0b2bd18f3767574fc51301b75bb1b76d
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
7806290088fbd6f802288021ec551ddd9469892a 04-Feb-2011 Vasu Nori <vnori@google.com> am 6e9abd8e: am d119d3cb: Revert "bug:3414192 if otaupdate column is set, don\'t check mobile download limits"

* commit '6e9abd8e04c4aaafb8493a25efc34f4dd4fa6013':
Revert "bug:3414192 if otaupdate column is set, don't check mobile download limits"
580871b3950761a39a69e3cb4db9fbdfb96f3917 04-Feb-2011 Vasu Nori <vnori@google.com> am 49663f1f: am f20af912: Revert "Merge "bug:3341145 if ignore_size_limits flag set, validate caller\'s perms" into honeycomb"

* commit '49663f1ffe58a546fb0d2ab84898843ef5e89eb5':
Revert "Merge "bug:3341145 if ignore_size_limits flag set, validate caller's perms" into honeycomb"
27478475ac5fd6f1b141b18b8b49f41beb8fce87 04-Feb-2011 Vasu Nori <vnori@google.com> am afefa43d: am cac5bbb5: Revert "bug:3420722"

* commit 'afefa43d9919f9284885f7080111c54a50c4fc90':
Revert "bug:3420722"
a29b942fe0f868b9d94299877f39a4ddcc3e85cc 04-Feb-2011 Vasu Nori <vnori@google.com> resolved conflicts for merge of 73642748 to master

Change-Id: I477599f16db5ea64e4fbc4d2be68dcedf2c80269
d119d3cbae976e791c9093cc5bea91ab9145a993 03-Feb-2011 Vasu Nori <vnori@google.com> Revert "bug:3414192 if otaupdate column is set, don't check mobile download limits"

This reverts commit ea245800c69d6bc10dc2680e6a242f59e9cb49b6.
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
f20af91262fecce05928167123c8d335b4cfd33d 03-Feb-2011 Vasu Nori <vnori@google.com> Revert "Merge "bug:3341145 if ignore_size_limits flag set, validate caller's perms" into honeycomb"

This reverts commit 3e7bb1c5d7e7d1a013df959c1a6947b33df0a0fd, reversing
changes made to b2085f61b37ad4a70c799012f25ff62a38173f68.
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
cac5bbb5f0c0d16fb8f3dd0a811c162ef7ba743b 03-Feb-2011 Vasu Nori <vnori@google.com> Revert "bug:3420722"

This reverts commit 1cccc19b596f168ed34126db38b046ab164e063b.
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
1cccc19b596f168ed34126db38b046ab164e063b 03-Feb-2011 Vasu Nori <vnori@google.com> bug:3420722

Change-Id: Id40d2dbbefe5fa2546f8c5231be5f7fe9a7b43d6
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
ed4870094f53bcd19c0542400389a1f56636ce5a 03-Feb-2011 Vasu Nori <vnori@google.com> resolved conflicts for merge of 43d649e9 to master

Change-Id: I27a615509269f256cf66de2dd217d8c4667caab4
86c04344cd871e0a443ab3dee86f8f7994f6d429 03-Feb-2011 Vasu Nori <vnori@google.com> bug:3341145 if ignore_size_limits flag set, validate caller's perms

and then of course ignore the mobile network size limits

Change-Id: I6765be9255187f93bd51acecc19a15db4f324204
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
d0b57887912ff7bc0fc3c2976fecc062136465d5 02-Feb-2011 Leon Scroggins <scroggo@google.com> Check for null before accessing pckg.

Prevents null pointer exception when using
DownloadManager.completedDownload

Change-Id: I53859705c5e925f2320491451e41a631e4fed715
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
93842036405d99a1c26471d5d06fe3f1b5048b2d 02-Feb-2011 Vasu Nori <vnori@google.com> am 8db8fba2: am ea245800: bug:3414192 if otaupdate column is set, don\'t check mobile download limits

* commit '8db8fba215a981edd24ad1f7118d3397be0114d2':
bug:3414192 if otaupdate column is set, don't check mobile download limits
ea245800c69d6bc10dc2680e6a242f59e9cb49b6 02-Feb-2011 Vasu Nori <vnori@google.com> bug:3414192 if otaupdate column is set, don't check mobile download limits

this allows OTA update to work without being subject to download limits
on mobile networks.

Change-Id: I92c60ba3ecbde615bd93778b391a5fe067dbd2fe
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
b18ed519040c1ecd98f8cb139adcc315a3f4eedc 21-Jan-2011 Vasu Nori <vnori@google.com> bug:3048327 (master) ability to add completed download to dnload mgr

Change-Id: Ib9d4df107787191a5349365908cbe096b67770dc
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
5218d33d57990c3e3549c58bd3f0ac244dfc3d59 17-Dec-2010 Vasu Nori <vnori@google.com> bug:3286430 set quota on downloads data dir

make sure the doanloads data dir size is limited by some quote -
100MB default and 200MB for SR.
bug:3286430

tests are in Change-Id: I688f7e058511089bec7fa21e972e23780604d98a

Change-Id: Iba7fab9fa91ea018f35e1c3ef5ec0e6b03cba650
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
9aadb4b3f2b3c914166ebfae8851fbecaf536f4f 14-Dec-2010 Vasu Nori <vnori@google.com> Download dir: /data/data/com.android.providers.downloads/cache NOT /cache

bug:3264401
still to do:
make sure only N bytes are taken up by downloads dir
N = a value specific to each device.
default = 100MB.

Change-Id: I2a49f4b3831d3a8d7be13b5fd46d85d56e831e38
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
d2ce7f387eace18b625018b21ee3ae50e9cf8c2f 01-Dec-2010 Kenny Root <kroot@google.com> am 5c29cce0: am e1823c84: Don\'t filter by UID for apps with ACCESS_ALL_DOWNLOADS

* commit '5c29cce0bac00a7a32cd92210825a789e140cf94':
Don't filter by UID for apps with ACCESS_ALL_DOWNLOADS
e1823c84698006aa26a8c5dcfa5c4034858dfbe3 01-Dec-2010 Kenny Root <kroot@google.com> Don't filter by UID for apps with ACCESS_ALL_DOWNLOADS

Old platform behavior of DownloadProvider would allow anyone with
special access to access all the downloads. New behavior is to return
/my_downloads/ on an .insert() call. For things that aren't using the
new API where DownloadInfo.getAllDownloadsUri() is accessible, make any
application with ACCESS_ALL_DOWNLOADS permission bypass the calling UID
check for /my_downloads/

Bug: 3242328
Change-Id: I536fde4525dd74066879f7c7da7fa609ff344645
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
01d0182d86db003b2da5b831cb26820093888d9a 09-Nov-2010 Vasu Nori <vnori@google.com> provider changes due to CL: Ief1693785f0484c1b434fb41a68693f9aff96492

Change-Id: I8940778292d0a9166cfcfb92d37ea568b8f6ceef
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
9d27069a5453574824860ad3db179599d044e7bd 12-Nov-2010 Vasu Nori <vnori@google.com> when a download fails, store the error msg in db

useful for debugging for bugs like bug:3187299
without this error message, one doesn't know WHY downloads
fail.
to prevent PII info in database,
there is a STOPSHIP comment around storage of this error
message in database.

Change-Id: I612e383aef8483b68b772f70dff722a5daea2ef5
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
3002e1870d4ad76c260b4729a8d86212c8db3e78 05-Nov-2010 Vasu Nori <vnori@google.com> allow the column "scanned" from DownloadManager. bug:3169437

Change-Id: I96f0b51295611b67735c1b726bcd46bbeaa90613
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
3ca67748bc92eac89f731796c5597ff1fbe9217b 04-Nov-2010 Vasu Nori <vnori@google.com> changes to support CL: I1f5dd734e394db0056579a3a0c26862fee27981e

1. if an application designates a downloaded file to be mediascanner
scannable or not, store that fact in database.
2. use the above to determine whether a file shoudl be mediascanned or not
in DownloadService
3. implement code to return mimetype for the new Uri "/public_downloads"
introduced in CL: I1f5dd734e394db0056579a3a0c26862fee27981e

Change-Id: I5c062ad6d1b58306044cee49ff3827e908d27fd9
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
04f09085f85d094207d22ae8969102bd48178180 20-Oct-2010 Vasu Nori <vnori@google.com> remove usage of hidden public constants.

Change-Id: I2edf1bef5e741de8193cb293807e3ace42003b0c
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
1e82f310a9ee461690a2e05265348c8e8e26c05d 15-Oct-2010 Vasu Nori <vnori@google.com> am 3e759e21: am a53c21ed: fix broken build bug:3095237

Merge commit '3e759e21291d6ca1a49ded3f24f3be0a26af4e2b'

* commit '3e759e21291d6ca1a49ded3f24f3be0a26af4e2b':
fix broken build bug:3095237
f9360e2fdc28e98d2f5c0fb25c18d2f1e6b32645 15-Oct-2010 Vasu Nori <vnori@google.com> am 57c4e918: am e00c3120: bug:3069735 in Download UI app, handle deletes correctly

Merge commit '57c4e9180e3a339dba984f1c8dff76ef18443a7a'

* commit '57c4e9180e3a339dba984f1c8dff76ef18443a7a':
bug:3069735 in Download UI app, handle deletes correctly
a53c21edb5dc57d97dcddd03fbfa2022abf43787 14-Oct-2010 Vasu Nori <vnori@google.com> fix broken build bug:3095237

Change-Id: I7e1fe99cc482fc270894a820049275fc0c64233e
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
e00c31208405bd2e4c88e069df7a2b15237f70bf 13-Oct-2010 Vasu Nori <vnori@google.com> bug:3069735 in Download UI app, handle deletes correctly

gingerbread.
High-level details
1. When a file is downloaded by DownloadManager, metadata about the file
is stored in 2 databases: DownloadProvider and MediaProvider.

2. So, when it is to be deleted, its metadata needs to be cleaned up from
both the databases.

3. But the 2 databases use differnt content-uri's as "primary keys" and
DownloadProvider loses the "primary-key" of the row in MediaProvider
database.

4. Easiest thing would have been to have DownloadProvider give filepath
to MediaProvider and let MediaProvider linearly scan its database
to locate the row and delete it.

5. The other - faster but more coding for now - option is to have
DownloadProvider store the "primary-key" of the MediaProvider's
row. implemented in this CL.

Low-level details
1. add 2 new columns to downloads table in downloads.db:
mediaprovider_uri = downloaded file's content_uri in mediaprovider db
this column is null for downloads that finished before this column is
added to the database.
deleted = flag is set to true if a file is to be deleted
2. download UI app shows only those files whose 'deleted' flag is not set.
3. when the user deletes downloads from download UI app,
3.1. if mediaprovider_uri is NOT null, then the row is deleted from
downloads table AND from the mediaprovider database.
3.2 if mediaprovider_uri is NULL, then its row in downloads database
is marked 'tp be deleted' by setting 'deleted' column to '1'.
4. When DownloadService (in DownloadProvider) processes all rows from
downloads table, if it sees any rows wth 'deleted' = 1, then
it uses MediaScanner Service to re-scan the file,
get the mediaprovider_uri from MediaProvider
and update the row in downloads table with this mediaprovider_uri value
and then delete the row by doing the following
1. delete it from MediaProvider database using mediaprovider_uri
2. delete it from DownloadProvider database

Problem with this solution:
There is a small window where it is deleted by the user on the Download app
(and the row disappears from the display) but it is still present in
Gallery app.
Thats due to the following asynchronous operations
1. DownladService which processes rows-to-be-deleted is not always up
2. DownloadService uses asynchronous call to have the file re-scanned
by MediaScanner to get mediaprovider_uri

Change-Id: Ib90eb9e647f543312c865d3bbf9a06fb867a648b
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
137f02d0e961b5fb761868db85e7f43966f35d52 11-Oct-2010 Steve Howard <showard@google.com> am 1f262cf3: am cd990514: Merge "Make DownloadProvider use parameterized queries." into gingerbread

Merge commit '1f262cf3af0512e0d621b7818aab9bb79527f01f'

* commit '1f262cf3af0512e0d621b7818aab9bb79527f01f':
Make DownloadProvider use parameterized queries.
e610c0502c00689411624c00c3f81497df93b202 08-Oct-2010 Steve Howard <showard@google.com> Make DownloadProvider use parameterized queries.

This avoids filling up the query cache unnecessary, but required some
structural changes to ease the passing around of a selection along
with its arguments.

Change-Id: I724185763b94146d17573cab68f675c24e49634e
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
b00b6560382d2b51ab2741f710738a281128dbea 01-Oct-2010 Steve Howard <showard@google.com> am 42469fa4: am 5d81e244: Avoid NPE when checking file URI in DownloadProvider

Merge commit '42469fa405c7aa891e7c431cd65edd424803979c'

* commit '42469fa405c7aa891e7c431cd65edd424803979c':
Avoid NPE when checking file URI in DownloadProvider
5d81e2447ed77860afecd71583e137178c2c6807 01-Oct-2010 Steve Howard <showard@google.com> Avoid NPE when checking file URI in DownloadProvider

Change-Id: Ic937b05308cecce244725e25767a3a1310a8463d
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
7704d598c451c1a2615a8910d65c593de1757d19 23-Sep-2010 Steve Howard <showard@google.com> am 04d70252: am 36f06f4c: Merge "DB migration to eliminate some null fields in old downloads" into gingerbread

Merge commit '04d7025262d7f6c5c372ec699d78b18d05b0400b'

* commit '04d7025262d7f6c5c372ec699d78b18d05b0400b':
DB migration to eliminate some null fields in old downloads
73f5f223477795e10079d25c1eb5f796af1f00a9 23-Sep-2010 Steve Howard <showard@google.com> DB migration to eliminate some null fields in old downloads

The DownloadProvider now ensures that current bytes, total bytes,
title and description are never null in the DB. Some new code relies
on this assumption for simplicity. That means we need to ensure this
invariant is true for pre-existing downloads as well.

Change-Id: Iea2289516d2636edf3394678ab08aa9cea31dc69
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
b157649a5620aba3ad65750d1044100b62c65d9c 21-Sep-2010 Steve Howard <showard@google.com> am 7b96b251: am d3197296: Implement dialogs for wifi required + recommended limits.

Merge commit '7b96b251c0404ed3f05652bd7d5209910fb999cc'

* commit '7b96b251c0404ed3f05652bd7d5209910fb999cc':
Implement dialogs for wifi required + recommended limits.
d319729622da1893e895f2e35f41d01ecdca3705 18-Sep-2010 Steve Howard <showard@google.com> Implement dialogs for wifi required + recommended limits.

This change extends the original work to add a size limit over which
wifi is required to download a file.

First, this change adds a second size limit, over which wifi is
recommended but not required. The user has the option to bypass this
limit.

Second, this change implements dialogs shown to the user when either
limit is exceeded. These dialogs are shown by the background download
manager service when a download is started and found to be over the
limit (and wifi is not connected).

I'm including one small fix to the unit tests needed from the previous
change.

Change-Id: Ia0f0acaa7b0d00e98355925c3446c0472048df10
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
99c0a5d260376d26281497e8fc2fd043d431f8c3 21-Sep-2010 Steve Howard <showard@google.com> am 2031fa7b: am dc738781: Merge "Improve file error reporting + new detailed error messages in UI" into gingerbread

Merge commit '2031fa7bad5ef3e31cf0ea73d0b9bf4670842cf0'

* commit '2031fa7bad5ef3e31cf0ea73d0b9bf4670842cf0':
Improve file error reporting + new detailed error messages in UI
b9a0ad7182209d4aca708e13e876e9b1b43ffafc 16-Sep-2010 Steve Howard <showard@google.com> Improve file error reporting + new detailed error messages in UI

* support new error code for "destination file already exists"
* improve error handling for various file error cases to return a more
specific error code when appropriate
* make UI support more detailed error messages for some cases
* use Uri.getPath() instead of Uri.getSchemeSpecificPart() for file
URIs

Change-Id: Icb01d4d3b47c7776be3ddcd8347212e950cd023e
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
31eb4c1b778686307c3d217577dd304ea475064a 20-Sep-2010 Steve Howard <showard@google.com> am b9115af1: am 3398db8f: Fix notification bugs, cleanup DownloadService + DownloadReceiver

Merge commit 'b9115af1e7b39a25c00aed7c9d3bb413ecef9eda'

* commit 'b9115af1e7b39a25c00aed7c9d3bb413ecef9eda':
Fix notification bugs, cleanup DownloadService + DownloadReceiver
3398db8f3b195959faa2a7cf09918f364432ac28 15-Sep-2010 Steve Howard <showard@google.com> Fix notification bugs, cleanup DownloadService + DownloadReceiver

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
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
a5e23ea33b415bca6ca7572e3286d4ea04b62c8a 18-Sep-2010 Steve Howard <showard@google.com> am e8027017: am 4bebe75b: Temporary fix to support old URIs for Market

Merge commit 'e80270177d1b504525d1f4ea4139b0c213fea891'

* commit 'e80270177d1b504525d1f4ea4139b0c213fea891':
Temporary fix to support old URIs for Market
4bebe75b3e2361d7fb0aa966598c41c45ad9317f 18-Sep-2010 Steve Howard <showard@google.com> Temporary fix to support old URIs for Market

Market has its own copies of the download manager URIs. This change
bring back support for those so Market will keep working until they
can properly update their code.

Change-Id: I283ea65931085c0f083a182842d362c113427537
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
21b7855b2a6411bacbe27a91527fa2d68d14b8fa 16-Sep-2010 Steve Howard <showard@google.com> am 176a7442: resolved conflicts for merge of 3d55d829 to gingerbread-plus-aosp

Merge commit '176a74426f750dc56e7d200a4cdc3b6ed75fe6cd'

* commit '176a74426f750dc56e7d200a4cdc3b6ed75fe6cd':
New URI structure with "my_downloads" and "all_downloads"
3d55d829c03fe78ad8cdab119293efb6c6e49c64 13-Sep-2010 Steve Howard <showard@google.com> New URI structure with "my_downloads" and "all_downloads"

This change introduces a second view into the download manager
database via a set of URIs starting with /all_downloads, renaming the
original /download URIs to /my_downloads. In addition to making
things more clear, this change allows the downloads UI to grant
permissions on individual downloads to viewer apps.

The old semantics were:

* for ordinary callers, /download included only downloads initiated by
the calling UID
* for intraprocess calls or calls by root, /download included all
downloads

The new semantics are

* /my_downloads always includes only downloads initiated by the
calling UID, and requires only INTERNET permission. It could just
as well require no permission, but that's not possible in the
framework, since path-permissions can only broaden access, not
tighten it. It doesn't matter, because these URIs are useless
without INTERNET permission -- if a user can't initiate downloads,
there's no reason to read this.
* /all_downloads always includes all downloads on the system, and
requires the new permission ACCESS_ALL_DOWNLOADS. This permission
is currently protectionLevel=signature -- this could be relaxed
later to support third-party download managers.

All download manager code has been changed to use /all_downloads URIs,
except when passing a URI to another app. In making this change
across the download manager code, I've taken some liberties in
cleaning things up. Other apps are unchanged and will use
/my_downloads.

Finally, this incorporates changes to DownloadManager to return a
content URI for /cache downloads -- the download UI no longer assumes
it's a file URI, and it grants permissions to the receiver of the VIEW
intent. The public API test has also been updated.

I've also fixed some null cursor checking in DownloadManager.

Change-Id: I05a501eb4388249fe80c43724405657c950d7238
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
81bbddb5086163ebc9d388a6cca852ed4a16d203 13-Sep-2010 Steve Howard <showard@google.com> am 7fa71b17: am 71e7fda9: Further work on the new downloads UI.

Merge commit '7fa71b17d1bcaceb4688cb4b0e6982d1db4a0538'

* commit '7fa71b17d1bcaceb4688cb4b0e6982d1db4a0538':
Further work on the new downloads UI.
71e7fda9135a0915af1fd419d07ebf85ad09beb4 09-Sep-2010 Steve Howard <showard@google.com> Further work on the new downloads UI.

* add support for downloads not visible in the UI
* add support for restarting failed downloads and downloads for which
the file is missing
* add "clear selection" button to selection menu
* fix DateSortedExpandableListAdapter to ensure the view refreshes
properly anytime the underlying data changes
* make DownloadList handle when a selected download gets deleted by
another app
* make DownloadList close a dialog for a pending download when the
download starts
* show a dialog when the user tries to open a download but the
file is missing
* display "<Unknown>" when no title is provided for a download
* add a test case for DownloadManager.orderBy() (should've gone in the
previous commit)

Change-Id: Ibf3062e8228e7f2c1270be24d8d5527dfb064658
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
99a9c8fbffc70670553ded9bfb4b08c89c67fc7e 19-Aug-2010 Steve Howard <showard@google.com> resolved conflicts for merge of 2f3c8c7e to master

Change-Id: Idcaa37fc828bfae41a150f2cce7b55fa152987be
a89321ea04ced76d06f60f5909be203cb654a830 03-Aug-2010 Steve Howard <showard@google.com> Fix and test handling of null/empty download fields.

Minor change to make title/description default to blank stings, and
add test case covering all null/empty download fields.

Change-Id: Id44344bc2e464f46589faed49c8f383a45a8d329
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
a69384858be6b58739b4ce759ec8db3883283d3e 17-Aug-2010 Steve Howard <showard@google.com> am e80c3555: am e61798da: Extend PublicApiAccessTest to exercise DownloadManager.

Merge commit 'e80c35557bd72489323303af9d93c2c33c88cce9'

* commit 'e80c35557bd72489323303af9d93c2c33c88cce9':
Extend PublicApiAccessTest to exercise DownloadManager.
e61798da80558450f580ed948d0d469bd6423d8e 02-Aug-2010 Steve Howard <showard@google.com> Extend PublicApiAccessTest to exercise DownloadManager.

This change adds a new test case to PublicApiAccessTest to enqueue a
request through DownloadManager, ensuring that the values constructed
by DownloadManager fit within the allowed bounds. It also fixes a bug
with allowing http header values exposed by the new test.

Change-Id: I94fec57d7a41298ac42ddaab338516e6a60c4e75
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
e5c19fcdb4ed7da8f594b49efeb11dc33f0ca9a3 07-Aug-2010 Steve Howard <showard@google.com> am 1d332ceb: am da5a4183: Merge "Make all public API downloads visible." into gingerbread

Merge commit '1d332ceb5756ef2e09ae97f1735aa9b529063874'

* commit '1d332ceb5756ef2e09ae97f1735aa9b529063874':
Make all public API downloads visible.
9da9df3d6e84a3c4b04dd22d277e0e6d8f7f1ccb 29-Jul-2010 Steve Howard <showard@google.com> Make all public API downloads visible.

This change makes all downloads through the public API visible by
default. It removes the API that had allowed applications to control
notifications while the download runs. This has been replaced with a
hidden API, since such behavior is needed by SystemUpdater and Market
(for self-updates). Additionally, the behavior is now protected by a
new permission.

I'm making this permission signatureOrSystem, and changing the
non-purgeable permission to the same (it should've been that, I just
didn't know). I'm also adding string descriptions to appease the
translation folks.

Change-Id: I192e8b19ff9b0e425257cef0db081c3d75996ea5
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
59554027a29a0ad2bcc6ce641cccb0b214be000b 26-Jul-2010 Steve Howard <showard@google.com> am 0a450da1: am 71aab521: Support for non-purgeable downloads through the public API.

Merge commit '0a450da1d9e95f27f479aa45b442960baac49bb1'

* commit '0a450da1d9e95f27f479aa45b442960baac49bb1':
Support for non-purgeable downloads through the public API.
1e5f9f05bcc378a30445483b7ef02654ca75fe20 26-Jul-2010 Steve Howard <showard@google.com> am 8667ebd1: am b06b739b: Make DownloadProvider accessible for public API usage.

Merge commit '8667ebd109ea212a7645ad6c214d4d765bb70b75'

* commit '8667ebd109ea212a7645ad6c214d4d765bb70b75':
Make DownloadProvider accessible for public API usage.
71aab521efba9b28779541440c797220ec98ac97 21-Jul-2010 Steve Howard <showard@google.com> Support for non-purgeable downloads through the public API.

This change adds a permission,
android.permission.DOWNLOAD_CACHE_NON_PURGEABLE. When an app has this
permission, any downloads it requests through the public API to the
download cache will automatically become non-purgeable, i.e. they'll
never be automatically deleted by the download manager to free up
space. This is intended for use only by the system updater.

Change-Id: I35cdd44f7e5d46bc70443d1a9743f61a51395ddb
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
b06b739b078ce4b00600487cfec31659647bf31f 22-Jul-2010 Steve Howard <showard@google.com> Make DownloadProvider accessible for public API usage.

This change removes the requirement that apps have the
ACCESS_DOWNLOAD_MANAGER permission in order to access
DownloadProvider. This enables the public API to work. Instead,
DownloadProvider enforces the new permissions model for the public
API:
* insert() requires INTERNET permission
* insert() checks that input fits within the restricted input allowed
for the public API
* insert() also strictly checks the file URI provided with
DESTINATION_FILE_URI (and still requires WRITE_EXTERNAL_STORAGE
permission if that is supplied)

Note that if an app has the ACCESS_DOWNLOAD_MANAGER permission, legacy
behavior is retained.

I've added a test to cover this new access, and updated the existing
permissions tests.

I also fixed a bug in WHERE clause construction in update() and
delete(), and refactored the code to eliminate duplication.

Change-Id: I53a08df137b35c2788c36350276c9dff24858af1
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
d91f26cc74666ed70b92a3026f09e91b93f10da5 22-Jul-2010 Steve Howard <showard@google.com> am c2448d48: am 0d8d8910: Make COLUMN_URI readable and tighten UID restrictions.

Merge commit 'c2448d488ff4e476762d0a07bb0757ca99c05445'

* commit 'c2448d488ff4e476762d0a07bb0757ca99c05445':
Make COLUMN_URI readable and tighten UID restrictions.
95d3f8f9ba709ab8acaa05a6263118c88ebe5d31 22-Jul-2010 Steve Howard <showard@google.com> am 0bd0e0c9: am 0a77c62a: Public API support for broadcasts and connectivity control.

Merge commit '0bd0e0c9e4eec9d63b4e0f213e80fc9eee85fdf6'

* commit '0bd0e0c9e4eec9d63b4e0f213e80fc9eee85fdf6':
Public API support for broadcasts and connectivity control.
0d8d89105c00edbad95a268aaae65f2ff94ed5a1 22-Jul-2010 Steve Howard <showard@google.com> Make COLUMN_URI readable and tighten UID restrictions.

I need to make COLUMN_URI readable by apps, since the public API
exposes that field. In order to avoid any possible security issues, I
got rid of the feature that potentially allowed apps to view downloads
from other UIDs. No one was using that feature and the public API
exposes no such feature (yet).

While at it, I cleaned up some related code in update() and delete().

Change-Id: I5384115d2a865255d009fbe37449488fd2269389
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
0a77c62a82503b38c484e0079648f0231dd85d53 21-Jul-2010 Steve Howard <showard@google.com> Public API support for broadcasts and connectivity control.

* 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
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
5f33f029b35bd10533cb77a0a8589325100f408a 21-Jul-2010 Steve Howard <showard@google.com> am 918f819a: resolved conflicts for merge of b5629da7 to gingerbread-plus-aosp

Merge commit '918f819abfb1da3661c1c604440666655e0c8909'

* commit '918f819abfb1da3661c1c604440666655e0c8909':
Major refactoring of DownloadThread.run().
b5629da794cb3c1ca1970d206343743b165b9644 16-Jul-2010 Steve Howard <showard@google.com> Major refactoring of DownloadThread.run().

Motivation: I need to fix the handling of 302s, so that after a
disconnect, subsequent retries will use the original URI, not the
redirected one. Rather than store extra information in the DB, I'd
like to just keep the redirected URI in memory and make the redirected
request within the same DownloadThread. This involves working with
the large-scale structure of DownloadThread.run(). Since run() was a
~700 line method, I didn't feel comfortable making such changes.

So this change refactors run() into a ~80 line method which calls into
a collection of ~20 other short methods. The state previously kept in
local variables has been pulled into a couple of state-only inner
classes. The error-handling control flow, formerly handled by "break
http_request_loop" statements, is now handled by throwing a
"StopRequest" exception. The remaining structure of run() has been
simplified -- the outermost for loop, for example, could never
actually repeat and has been removed for now. Some other bits of code
have been cleaned up a bit, but the functionality has not been
modified.

There are many good next steps to this refactoring. Besides various
other cleanup bits, a major improvement would be to consolidate the
State/InnerState classes, move some functionality to this new class
(there are many functions of the form "void foo(State)" which would be
good candidates), and promote it to a top-level class. But I want to
take things one step at a time, and I think what I've got here is a
major improvement and should be enough to allow me to safely implement
the changes to redirection handling.

In the process of doing this refactoring I added many test cases to
PublicApiFunctionalTest to exercise some of the pieces of code I was
moving around. I also moved some test cases from
DownloadManagerFunctionalTest. Over time I'd like to move everything
over to use the PublicApiFunctionalTest approach, and then I may break
that into some smaller suites.

Other minor changes:
* use longs instead of ints to track file sizes, as these may be
getting quite large in the future
* provide a default DB value of -1 for COLUMN_TOTAL_BYTES, as this
simplifies some logic in DownloadThread
* small extensions to MockResponse to faciliate new test cases

Change-Id: If7862349296ad79ff6cdc97e554ad14c01ce1f49
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
74e3e793cf01755d4b220b3e8b966d40eaacca7e 19-Jul-2010 Steve Howard <showard@google.com> am c45c8eb1: am 1aa26989: Merge "Introduce a seam to ConnectivityManager and TelephonyManager" into gingerbread

Merge commit 'c45c8eb1f9e8d93a02a7af2621a8fbcea1b2f6a7'

* commit 'c45c8eb1f9e8d93a02a7af2621a8fbcea1b2f6a7':
Introduce a seam to ConnectivityManager and TelephonyManager
af28400b74de05862b470412a5c92f68e99f59f8 16-Jul-2010 Steve Howard <showard@google.com> Introduce a seam to ConnectivityManager and TelephonyManager

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
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
53356ad554f53a093434161cb494b8e818c294fb 15-Jul-2010 Steve Howard <showard@google.com> Fix build - remove reference to ReadOnlyCursorWrapper

Change-Id: I099c98e310039886990502d63566f3e217738b45
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
99327c5d21c3886188f8ad263ca3abc833fdb7c5 15-Jul-2010 Steve Howard <showard@google.com> am d1bec343: am 88ea0b39: Merge "Support for custom HTTP headers on download requests" into gingerbread

Merge commit 'd1bec343dcbbc555837790119449ff7eea7c5312'

* commit 'd1bec343dcbbc555837790119449ff7eea7c5312':
Support for custom HTTP headers on download requests
5224c6fbf20b4803a580ef449ab87ebfbbfedb78 14-Jul-2010 Steve Howard <showard@google.com> Support for custom HTTP headers on download requests

Provider changes:
* new many-to-one DB table holding headers for each download. since
there was no real migration logic in DownloadProvider, I implemented
some.
* DownloadProvider.insert() reads request headers out of the
ContentValues and puts them into the new table
* DownloadProvider.query() supports a new URI form,
download/#/headers, to fetch the headers associated with a download
* DownloadProvider.delete() removes request headers from this table

Service changes:
* made DownloadInfo store request headers upon initialization. While
I was at it, I refactored the initialization logic into DownloadInfo
to get rid of the massive 24-parameter constructor. The right next
step would be to move the update logic into DownloadInfo and merge
it with the initialization logic; however, I realized that headers
don't need to be updatable, and in the future, we won't need the
update logic at all, so i didn't bother touching the update code.
* made DownloadThread read headers from the DownloadInfo and include
them in the request; merged the custom Cookie and Referer logic into
this logic

Also added a couple new test cases for this stuff.

Change-Id: I421ce1f0a694e815f2e099795182393650fcb3ff
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
736f45c45b7c2b08814f70a5d23e2c8e7e09d1fa 14-Jul-2010 Steve Howard <showard@google.com> am 2c80c375: am 6d9b9828: Support for file URI destinations + last modified timestamp

Merge commit '2c80c37546b89dfd31875f6f6e977e9610cdb22b'

* commit '2c80c37546b89dfd31875f6f6e977e9610cdb22b':
Support for file URI destinations + last modified timestamp
6d9b98282c817b86a00f9c19a705da4cb19bc3a6 13-Jul-2010 Steve Howard <showard@google.com> Support for file URI destinations + last modified timestamp

File URI destinations:
* permission checking in DownloadProvider
* implementation in Helpers.generateSaveFile(). it's a fairly small
amount of logic added here, but I did some significant method
extraction to simplify this change and clean up the code in general.
* added test case

Last modified timestamp:
* made DownloadProvider use a SystemFacade for getting system time, so I could properly test timestamps
* updated test cases to cover last modified time + handle new ordering
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
9c8e16f85d14ef4d5d55242a24a454ff549bc1f0 13-May-2010 Jeff Hamilton <jham@android.com> Stop using private APIs that are going away.

Change-Id: Ic675d13e70e8e18af44d71b590f4782559966396
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
a2028ed4141075da8199ba04a499be77734a85ae 28-Jan-2010 Leon Scroggins <scroggo@google.com> Create a new permission that allows apps to see downloads from other
applications to the SD card.

Necessary for http://b/issue?id=2384554

Also create names for files by default, so they do not display as
<Untitled>. Remove calls to createTitleFromFilename, which are
no longer necessary.

Requires a change to frameworks/base.
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
91e4522fa90d969a596058756c24e173df1a6196 26-Jan-2010 Suchi Amalapurapu <asuchitra@google.com> Grant access to downloaded packages to default container.
The package name is hardcoded for now but will eventually move to a separate gid
guarded by a permission.
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
7dd92fa94df0a13b4592ee636b7aa2b605f6b473 08-Jan-2010 Jean-Baptiste Queru <jbq@google.com> Use the private legacy API

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
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
4ed4c65f46f5d077bb40f82e7a4821bd47217fdd 06-Jul-2009 Jean-Baptiste Queru <jbq@google.com> Merge commit 'f0fa1cdc' into manualmerge

Fix crash in discardPurgeableFiles with proper selection syntax.

The basic crash is that this codepath was doing a query to the download
provider without properly quoting its selection arguments (which is
mandated by the download provider).

A secondary crash is that the DESTINATION column wasn't readable.

This fixes bug 1941125.

Tested by force-calling discardPurgeableFiles for each download
to /cache, locally adding a few debugging statements to be sure
that the codepath was getting executed, and doing a market download.

Conflicts:
src/com/android/providers/downloads/DownloadProvider.java
src/com/android/providers/downloads/Helpers.java
f0fa1cdc1a36cbe0abd57ef9cf9a636fd1d3e2c8 02-Jul-2009 Jean-Baptiste Queru <jbq@google.com> Fix crash in discardPurgeableFiles with proper selection syntax.

The basic crash is that this codepath was doing a query to the download
provider without properly quoting its selection arguments (which is
mandated by the download provider).

A secondary crash is that the DESTINATION column wasn't readable.

This fixes bug 1941125.

Tested by force-calling discardPurgeableFiles for each download
to /cache, locally adding a few debugging statements to be sure
that the codepath was getting executed, and doing a market download.
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
2dd83ce992eaaf3d44c32bc7468b47e3db014027 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
1edb39f280d23b3a87db45b63c2f26850d68eafe 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
f8e520e6b7ba9533117d4805a29fb7321534d6ce 28-Feb-2009 Jean-Baptiste Queru <jbq@google.com> Make the DownloadProvider work in the simulator
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
eaeda874c62a0ebc439894858e110160b7e2a212 11-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@130745
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
ce8813afb256269e9e223f72ebced92560201bbb 06-Feb-2009 Jean-Baptiste Queru <jbq@google.com> Refine interaction between destination and default visibility.

The previous code was hard to read, and relied on the fact that one of
the constants was 0 (which is also the default value when reading
back uninitialized columns).
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
59910f4a9ce953ea74c8db759448f227c96796b3 20-Jan-2009 Jean-Baptiste Queru <jbq@google.com> Use the new download manager APIs introduced in change 7400
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
c6f5aad265cfc36a64cd2bdb5adf3cc9736bbd80 20-Jan-2009 Jean-Baptiste Queru <jbq@google.com> Match the official code style guide.

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.
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
1fbad9cfa532f13f6cf03f542febf2e4689edec5 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java
57f55b3cb4f7e4136cde8d1ea12c1e70ec903362 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
/packages/providers/DownloadProvider/src/com/android/providers/downloads/DownloadProvider.java