Only show storage category stats preferences for private volumes

Hide it because there is no framework API to get storage
category stats of public volumes.

Bug: 174964885
Test: manual
      Observe storage settings UI of a USB flash drive.
Change-Id: I7272cd18c186793f86548a87b5cb88bb957ff8d5
This commit is contained in:
Arc Wang
2021-03-19 15:35:06 +08:00
parent b2eb0317a4
commit 40396d532f
4 changed files with 30 additions and 48 deletions

View File

@@ -248,13 +248,15 @@ public class StorageDashboardFragment extends DashboardFragment
mPreferenceController.setVolume(mSelectedStorageEntry.getVolumeInfo());
if (mSelectedStorageEntry.isMounted()) {
if (mSelectedStorageEntry.isPrivate() && mSelectedStorageEntry.isMounted()) {
// Stats data is only available on private volumes.
getLoaderManager().restartLoader(STORAGE_JOB_ID, Bundle.EMPTY, this);
getLoaderManager()
.restartLoader(VOLUME_SIZE_JOB_ID, Bundle.EMPTY, new VolumeSizeCallbacks());
getLoaderManager().restartLoader(ICON_JOB_ID, Bundle.EMPTY, new IconLoaderCallbacks());
} else {
mPreferenceController.clearStorageSizeDisplay();
// Set null volume to hide category stats.
mPreferenceController.setVolume(null);
}
}