Commit 9171aefc authored by Shakti Sahu's avatar Shakti Sahu Committed by Commit Bot

Download infobar : Fixed byte size string

Since Formatter.formatFileSize switched to SI system starting from
android-O, we show 1.07GB for a 1GB file. Using our own formatter that
works with multiples of 1024 fixes this issue which is also used for
download home and notifications.

Bug: 891457
Change-Id: I238c0a2654908d550c91f4c77ec9a5a802bd6775
Reviewed-on: https://chromium-review.googlesource.com/c/1315700Reviewed-by: default avatarMin Qin <qinmin@chromium.org>
Commit-Queue: Shakti Sahu <shaktisahu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605156}
parent 9146723c
...@@ -11,7 +11,6 @@ import android.support.annotation.IntDef; ...@@ -11,7 +11,6 @@ import android.support.annotation.IntDef;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.annotation.PluralsRes; import android.support.annotation.PluralsRes;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.format.Formatter;
import org.chromium.base.ApplicationStatus; import org.chromium.base.ApplicationStatus;
import org.chromium.base.ContextUtils; import org.chromium.base.ContextUtils;
...@@ -583,8 +582,8 @@ public class DownloadInfoBarController implements OfflineContentProvider.Observe ...@@ -583,8 +582,8 @@ public class DownloadInfoBarController implements OfflineContentProvider.Observe
R.plurals.download_infobar_downloading_files, inProgressDownloadCount, R.plurals.download_infobar_downloading_files, inProgressDownloadCount,
inProgressDownloadCount); inProgressDownloadCount);
} else { } else {
String bytesString = String bytesString = DownloadUtils.getStringForBytes(
Formatter.formatFileSize(getContext(), totalDownloadingSizeBytes); getContext(), totalDownloadingSizeBytes);
info.message = inProgressDownloadCount == 1 info.message = inProgressDownloadCount == 1
? getContext().getString( ? getContext().getString(
R.string.downloading_file_with_bytes, bytesString) R.string.downloading_file_with_bytes, bytesString)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment