From 1533c85ade2d71176dd8b8024d2059f593b4cb39 Mon Sep 17 00:00:00 2001 From: Daniel Nishi Date: Tue, 15 Aug 2017 15:29:45 -0700 Subject: [PATCH] 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 --- .../android/settings/deviceinfo/StorageDashboardFragment.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/deviceinfo/StorageDashboardFragment.java b/src/com/android/settings/deviceinfo/StorageDashboardFragment.java index be72539a0a6..33d7d36b85c 100644 --- a/src/com/android/settings/deviceinfo/StorageDashboardFragment.java +++ b/src/com/android/settings/deviceinfo/StorageDashboardFragment.java @@ -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