Merge "Fix storage settings crash." into oc-dev

am: 496fb93060

Change-Id: I76354ceb7c6e87bc3b0ee845a2c95e46c3569f21
This commit is contained in:
Daniel Nishi
2017-04-14 22:41:30 +00:00
committed by android-build-merger
3 changed files with 24 additions and 3 deletions

View File

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

View File

@@ -79,8 +79,15 @@ public class StorageAsyncLoader
UserHandle myUser = UserHandle.of(userId);
for (int i = 0, size = applicationInfos.size(); i < size; i++) {
ApplicationInfo app = applicationInfos.get(i);
StorageStatsSource.AppStorageStats stats =
mStatsManager.getStatsForPackage(mUuid, app.packageName, myUser);
StorageStatsSource.AppStorageStats stats;
try {
stats = mStatsManager.getStatsForPackage(mUuid, app.packageName, myUser);
} catch (IllegalStateException e) {
// This may happen if the package was removed during our calculation.
Log.w("App unexpectedly not found", e);
continue;
}
long attributedAppSizeInBytes = stats.getDataBytes();
// This matches how the package manager calculates sizes -- by zeroing out code sizes of