path: root/tests
diff options
authorSteve Howard <>2010-09-29 16:48:01 -0700
committerSteve Howard <>2010-09-29 17:34:52 -0700
commitb108a273b150e81bf26553b8851d6241bc711f98 (patch)
tree51f469e8e8d3d600f4bf279ec6c08f714fef2ae6 /tests
parent69784dc727df4f79ceff2ca88d4c79a98583c5b0 (diff)
Improve how the download manager reports paused statuses.
This change makes the download manager report more detail when a download is paused. Rather than always reporting status RUNNING_PAUSED, there are now four different statuses: * paused by the app * waiting to retry after a network error * waiting for network connectivity * queued for wifi due to size limits This allows a few improvements: * code deciding when to run a download can be improved and cleaned up (I've taken some extra steps in cleaning up this particular code) * notification code no longer has to rely on the in-memory-only "mPausedReason" member of DownloadInfo; instead, it knows from the status that the download is queued for wifi, and can display the appropriate string. This moves the string fetching out into the UI-specific logic and is a sign that this is really the right way to do things. And finally, the real motivation for this change: I've changed the meaning of "Queued" in the downloads UI so it now means "Queued for WiFi'. This is what was originally intended, I'd misunderstood. What was formerly known as "Queued", a download that hadn't started, is now displayed as "In progress" (it's always a transient state so it's basically meaningless anyway). Otherwise it remains the same (in particular, downloads paused for other reasons are still reported as "In progress"). I've also increased some of the logging in DownloadThread a bit, as this change initally introduced some bugs that were impossible to track down without that logging. There have been other bug reports that were impossible to diagnose and these few extra log statements should really help, without cluttering logs too much. I've taken care to avoid potentially introducing any PII into the logs. Change-Id: Id0b8d65fc8e4406ad7ffa1439ffc22a0281b051f
Diffstat (limited to 'tests')
2 files changed, 4 insertions, 4 deletions
diff --git a/tests/src/com/android/providers/downloads/ b/tests/src/com/android/providers/downloads/
index 350c63d4..0cb63e0f 100644
--- a/tests/src/com/android/providers/downloads/
+++ b/tests/src/com/android/providers/downloads/
@@ -82,7 +82,7 @@ public class DownloadManagerFunctionalTest extends AbstractDownloadManagerFuncti
downloadUri = requestDownload("/path");
updateDownload(downloadUri, Downloads.COLUMN_DESTINATION,
- runUntilStatus(downloadUri, Downloads.STATUS_RUNNING_PAUSED);
+ runUntilStatus(downloadUri, Downloads.Impl.STATUS_WAITING_FOR_NETWORK);
// ...and pick up when we're off roaming
enqueueResponse(HTTP_OK, FILE_CONTENT);
diff --git a/tests/src/com/android/providers/downloads/ b/tests/src/com/android/providers/downloads/
index ab7d0e4e..cad01df6 100644
--- a/tests/src/com/android/providers/downloads/
+++ b/tests/src/com/android/providers/downloads/
@@ -531,7 +531,7 @@ public class PublicApiFunctionalTest extends AbstractPublicApiTest {
Download download = enqueueRequest(getRequest().setDestinationUri(destination));
- download.getLongField(DownloadManager.COLUMN_ERROR_CODE));
+ download.getLongField(DownloadManager.COLUMN_REASON));
public void testEmptyFields() throws Exception {
@@ -542,7 +542,7 @@ public class PublicApiFunctionalTest extends AbstractPublicApiTest {
assertEquals(0, download.getLongField(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR));
assertEquals(-1, download.getLongField(DownloadManager.COLUMN_TOTAL_SIZE_BYTES));
// just ensure no exception is thrown
- download.getLongField(DownloadManager.COLUMN_ERROR_CODE);
+ download.getLongField(DownloadManager.COLUMN_REASON);
public void testRestart() throws Exception {
@@ -567,7 +567,7 @@ public class PublicApiFunctionalTest extends AbstractPublicApiTest {
Download download = enqueueRequest(getRequest());
- download.getLongField(DownloadManager.COLUMN_ERROR_CODE));
+ download.getLongField(DownloadManager.COLUMN_REASON));