Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5297)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java

Issue 2647343005: [Download Home] Fix for 0 seconds remaining (Closed)
Patch Set: qinmin@ comments Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java
index 737dd84c23e7f77ce2df6154e81bfc04c1573d11..fc9ed5b7de5434d22626ee72c5c2d8f964baabf9 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java
@@ -270,7 +270,7 @@ public class DownloadNotificationService extends Service {
* @param percentage Percentage completed. Value should be between 0 to 100 if
* the percentage can be determined, or -1 if it is unknown.
* @param bytesReceived Total number of bytes received.
- * @param timeRemainingInMillis Remaining download time in milliseconds.
+ * @param timeRemainingInMillis Remaining download time in milliseconds or -1 if it is unknown.
* @param startTime Time when download started.
* @param isOffTheRecord Whether the download is off the record.
* @param canDownloadWhileMetered Whether the download can happen in metered network.
@@ -292,7 +292,9 @@ public class DownloadNotificationService extends Service {
contentText = DownloadUtils.getStringForBytes(
mContext, DownloadUtils.BYTES_DOWNLOADED_STRINGS, bytesReceived);
} else {
- contentText = formatRemainingTime(mContext, timeRemainingInMillis);
+ contentText = timeRemainingInMillis < 0
+ ? mContext.getResources().getString(R.string.download_started)
+ : formatRemainingTime(mContext, timeRemainingInMillis);
}
int resId = isDownloadPending ? R.drawable.ic_download_pending
: android.R.drawable.stat_sys_download;

Powered by Google App Engine
This is Rietveld 408576698