Re-init storage size on resume.

In Storage settings, we used to cache the sizes of the volume that we
were observing. This meant that we cached the free and total sizes. If a
large amount of data is cleared in another app and we resume the
Settings app, however, it will result in a large change in free space.

Because we calculate the categorization breakdown again on resume, this
causes most of the categories to reflect the current size.
Unfortunately, the free size is stale. This means that the amount of
data deleted gets attributed to system, instead of to nothing at all.

By restarting the loader to fetch the free/total size of the volume, we
can avoid this issue.

Change-Id: I07b244f02230d28a58fcb70d8d9cd595f2a0f68f
Fixes: 64135242
Test: Manual
This commit is contained in:
Daniel Nishi
2017-08-15 15:29:45 -07:00
parent 858ea46a3a
commit 1533c85ade

View File

@@ -109,8 +109,9 @@ public class StorageDashboardFragment extends DashboardFragment
public void onResume() {
super.onResume();
getLoaderManager().restartLoader(STORAGE_JOB_ID, Bundle.EMPTY, this);
getLoaderManager()
.restartLoader(VOLUME_SIZE_JOB_ID, Bundle.EMPTY, new VolumeSizeCallbacks());
getLoaderManager().initLoader(ICON_JOB_ID, Bundle.EMPTY, new IconLoaderCallbacks());
getLoaderManager().initLoader(VOLUME_SIZE_JOB_ID, Bundle.EMPTY, new VolumeSizeCallbacks());
}
@Override