From d319729622da1893e895f2e35f41d01ecdca3705 Mon Sep 17 00:00:00 2001 From: Steve Howard Date: Fri, 17 Sep 2010 16:45:58 -0700 Subject: 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 --- src/com/android/providers/downloads/DownloadProvider.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/com/android/providers/downloads/DownloadProvider.java') diff --git a/src/com/android/providers/downloads/DownloadProvider.java b/src/com/android/providers/downloads/DownloadProvider.java index 102c611d..26065015 100644 --- a/src/com/android/providers/downloads/DownloadProvider.java +++ b/src/com/android/providers/downloads/DownloadProvider.java @@ -57,7 +57,7 @@ public final class DownloadProvider extends ContentProvider { /** Database filename */ private static final String DB_NAME = "downloads.db"; /** Current database version */ - private static final int DB_VERSION = 103; + private static final int DB_VERSION = 104; /** Name of table in the database */ private static final String DB_TABLE = "downloads"; @@ -223,6 +223,11 @@ public final class DownloadProvider extends ContentProvider { makeCacheDownloadsInvisible(db); break; + case 104: + addColumn(db, DB_TABLE, Downloads.Impl.COLUMN_BYPASS_RECOMMENDED_SIZE_LIMIT, + "INTEGER NOT NULL DEFAULT 0"); + break; + default: throw new IllegalStateException("Don't know how to upgrade to " + version); } @@ -839,7 +844,9 @@ public final class DownloadProvider extends ContentProvider { Integer status = values.getAsInteger(Downloads.Impl.COLUMN_STATUS); boolean isRestart = status != null && status == Downloads.Impl.STATUS_PENDING; - if (isRestart) { + boolean isUserBypassingSizeLimit = + values.containsKey(Downloads.Impl.COLUMN_BYPASS_RECOMMENDED_SIZE_LIMIT); + if (isRestart || isUserBypassingSizeLimit) { startService = true; } } -- cgit v1.2.3