Commit 12be1cb2 authored by Xing Liu's avatar Xing Liu Committed by Commit Bot

Download home v2: Fix issue in storage summary.

Currently removing an ongoing download may hit assertion in
StorageSummaryProvider, this is due to a bug in onItemUpdated that we
increase the total storage based on old item instead of the new item.

Bug: 892328
Change-Id: I64cda81662290df049f74aa3f1893c7a0984c043
Reviewed-on: https://chromium-review.googlesource.com/c/1284705Reviewed-by: default avatarShakti Sahu <shaktisahu@chromium.org>
Commit-Queue: Xing Liu <xingliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600167}
parent da688ad0
...@@ -96,7 +96,7 @@ public class StorageSummaryProvider implements OfflineItemFilterObserver { ...@@ -96,7 +96,7 @@ public class StorageSummaryProvider implements OfflineItemFilterObserver {
public void onItemUpdated(OfflineItem oldItem, OfflineItem item) { public void onItemUpdated(OfflineItem oldItem, OfflineItem item) {
// Computes the delta of storage used by downloads. // Computes the delta of storage used by downloads.
mTotalDownloadSize -= oldItem.receivedBytes; mTotalDownloadSize -= oldItem.receivedBytes;
mTotalDownloadSize += oldItem.receivedBytes; mTotalDownloadSize += item.receivedBytes;
if (item.state != OfflineItemState.IN_PROGRESS) update(); if (item.state != OfflineItemState.IN_PROGRESS) update();
} }
......
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