Trim stale downloads from third-party apps.

Buggy third-party apps can enqueue lots of downloads and then
forget to remove them, causing DownloadManager to stop functioning.

This change removes any downloads that match _all_ of the following
conditions:

1. Download status is in a terminal (non-pending) state, usually a
concrete success or failure.
2. Download hasn't been touched in over a week.
3. Download is not visible in UI.

Bug: 17785419
Change-Id: Id82752fd6935371c1af682205d35f7ba35169473
1 file changed