summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVasu Nori <vnori@google.com>2011-01-16 10:52:14 -0800
committerVasu Nori <vnori@google.com>2011-01-16 10:52:14 -0800
commit089951b2b78398975cf0e984356f9ed3b3ae4aa3 (patch)
tree9195143e93f822cb5c6a1e73395da4eb5a413c19
parentb05fd02f1c19423acfff6bd2462e4940c0caf9ca (diff)
downloadandroid_packages_providers_DownloadProvider-089951b2b78398975cf0e984356f9ed3b3ae4aa3.zip
android_packages_providers_DownloadProvider-089951b2b78398975cf0e984356f9ed3b3ae4aa3.tar.gz
android_packages_providers_DownloadProvider-089951b2b78398975cf0e984356f9ed3b3ae4aa3.tar.bz2
(GB MR) bug:3351783 don't store redirectcount in db
redirectcount shouldn't be stored in the db. say, you are downloading a large app and there are redirects involved inthe download. if network connectivity changes during download, then download is paused and resumed once connectivy is back on. when the download is resumed, it should start with redirectcount of 0 instead of redirectcount from the previous download session. Change-Id: I1acf2fb9491d24f5e109206a91dda3eea429e447
-rw-r--r--src/com/android/providers/downloads/DownloadInfo.java3
-rw-r--r--src/com/android/providers/downloads/DownloadThread.java11
2 files changed, 5 insertions, 9 deletions
diff --git a/src/com/android/providers/downloads/DownloadInfo.java b/src/com/android/providers/downloads/DownloadInfo.java
index 36816b5..7b29168 100644
--- a/src/com/android/providers/downloads/DownloadInfo.java
+++ b/src/com/android/providers/downloads/DownloadInfo.java
@@ -73,7 +73,6 @@ public class DownloadInfo {
info.mNumFailed = getInt(Constants.FAILED_CONNECTIONS);
int retryRedirect = getInt(Constants.RETRY_AFTER_X_REDIRECT_COUNT);
info.mRetryAfter = retryRedirect & 0xfffffff;
- info.mRedirectCount = retryRedirect >> 28;
info.mLastMod = getLong(Downloads.Impl.COLUMN_LAST_MODIFICATION);
info.mPackage = getString(info.mPackage, Downloads.Impl.COLUMN_NOTIFICATION_PACKAGE);
info.mClass = getString(info.mClass, Downloads.Impl.COLUMN_NOTIFICATION_CLASS);
@@ -223,7 +222,6 @@ public class DownloadInfo {
public int mStatus;
public int mNumFailed;
public int mRetryAfter;
- public int mRedirectCount;
public long mLastMod;
public String mPackage;
public String mClass;
@@ -506,7 +504,6 @@ public class DownloadInfo {
Log.v(Constants.TAG, "STATUS : " + mStatus);
Log.v(Constants.TAG, "FAILED_C: " + mNumFailed);
Log.v(Constants.TAG, "RETRY_AF: " + mRetryAfter);
- Log.v(Constants.TAG, "REDIRECT: " + mRedirectCount);
Log.v(Constants.TAG, "LAST_MOD: " + mLastMod);
Log.v(Constants.TAG, "PACKAGE : " + mPackage);
Log.v(Constants.TAG, "CLASS : " + mClass);
diff --git a/src/com/android/providers/downloads/DownloadThread.java b/src/com/android/providers/downloads/DownloadThread.java
index 7c10248..461d8ce 100644
--- a/src/com/android/providers/downloads/DownloadThread.java
+++ b/src/com/android/providers/downloads/DownloadThread.java
@@ -88,7 +88,6 @@ public class DownloadThread extends Thread {
public State(DownloadInfo info) {
mMimeType = sanitizeMimeType(info.mMimeType);
- mRedirectCount = info.mRedirectCount;
mRequestUri = info.mUri;
mFilename = info.mFileName;
}
@@ -200,7 +199,7 @@ public class DownloadThread extends Thread {
}
cleanupDestination(state, finalStatus);
notifyDownloadCompleted(finalStatus, state.mCountRetry, state.mRetryAfter,
- state.mRedirectCount, state.mGotData, state.mFilename,
+ state.mGotData, state.mFilename,
state.mNewUri, state.mMimeType);
mInfo.mHasActiveThread = false;
}
@@ -854,17 +853,17 @@ public class DownloadThread extends Thread {
* Stores information about the completed download, and notifies the initiating application.
*/
private void notifyDownloadCompleted(
- int status, boolean countRetry, int retryAfter, int redirectCount, boolean gotData,
+ int status, boolean countRetry, int retryAfter, boolean gotData,
String filename, String uri, String mimeType) {
notifyThroughDatabase(
- status, countRetry, retryAfter, redirectCount, gotData, filename, uri, mimeType);
+ status, countRetry, retryAfter, gotData, filename, uri, mimeType);
if (Downloads.Impl.isStatusCompleted(status)) {
mInfo.sendIntentIfRequested();
}
}
private void notifyThroughDatabase(
- int status, boolean countRetry, int retryAfter, int redirectCount, boolean gotData,
+ int status, boolean countRetry, int retryAfter, boolean gotData,
String filename, String uri, String mimeType) {
ContentValues values = new ContentValues();
values.put(Downloads.Impl.COLUMN_STATUS, status);
@@ -874,7 +873,7 @@ public class DownloadThread extends Thread {
}
values.put(Downloads.Impl.COLUMN_MIME_TYPE, mimeType);
values.put(Downloads.Impl.COLUMN_LAST_MODIFICATION, mSystemFacade.currentTimeMillis());
- values.put(Constants.RETRY_AFTER_X_REDIRECT_COUNT, retryAfter + (redirectCount << 28));
+ values.put(Constants.RETRY_AFTER_X_REDIRECT_COUNT, retryAfter);
if (!countRetry) {
values.put(Constants.FAILED_CONNECTIONS, 0);
} else if (gotData) {