Correct used size of Storage Settings.
Since StorageManager rounded the totalBytes of device storage but
they don't do that rounding for freeBytes.
So in some cases the freeBytes can be greater than totalBytes.
We propose to get totalBytes of device storage directly to calculate
correct privateUsedBytes.
Test: robotest
Bug: 281955532
Change-Id: I4f137c20e7c2f54f4e037d50e81b3176edc1a83a
(cherry picked from commit e52320e755
)
This commit is contained in:
@@ -387,7 +387,9 @@ public class StorageDashboardFragment extends DashboardFragment
|
||||
|
||||
setLoading(false /* loading */, false /* animate */);
|
||||
|
||||
final long privateUsedBytes = mStorageInfo.totalBytes - mStorageInfo.freeBytes;
|
||||
// TODO(b/288103116): replace with new API to get TotalBytes before rounding
|
||||
// once support by StorageManager.
|
||||
final long privateUsedBytes = Utils.getPrimaryStorageSize() - mStorageInfo.freeBytes;
|
||||
mPreferenceController.setVolume(mSelectedStorageEntry.getVolumeInfo());
|
||||
mPreferenceController.setUsedSize(privateUsedBytes);
|
||||
mPreferenceController.setTotalSize(mStorageInfo.totalBytes);
|
||||
|
Reference in New Issue
Block a user