Merge "Update the API usage to get total size of devices" into udc-d1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
d1373d4a1a
@@ -63,7 +63,6 @@ import android.os.BatteryManager;
|
||||
import android.os.Binder;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.IBinder;
|
||||
import android.os.INetworkManagementService;
|
||||
import android.os.RemoteException;
|
||||
@@ -1296,14 +1295,4 @@ public final class Utils extends com.android.settingslib.Utils {
|
||||
return dreamsSupported && (!dreamsOnlyEnabledForDockUser || canCurrentUserDream(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get private total size directly.
|
||||
* Referred from StorageManager
|
||||
*/
|
||||
public static long getPrimaryStorageSize() {
|
||||
// TODO(b/288103116): remove this method once support by StorageManager.
|
||||
return Environment.getDataDirectory().getTotalSpace()
|
||||
+ Environment.getRootDirectory().getTotalSpace();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -211,9 +211,7 @@ public class StorageCategoryFragment extends DashboardFragment
|
||||
|
||||
setLoading(false /* loading */, false /* animate */);
|
||||
|
||||
// TODO(b/288103116): replace with new API to get TotalBytes before rounding
|
||||
// once support by StorageManager.
|
||||
final long privateUsedBytes = Utils.getPrimaryStorageSize() - mStorageInfo.freeBytes;
|
||||
final long privateUsedBytes = mStorageInfo.totalBytes - mStorageInfo.freeBytes;
|
||||
mPreferenceController.setVolume(mSelectedStorageEntry.getVolumeInfo());
|
||||
mPreferenceController.setUsedSize(privateUsedBytes);
|
||||
mPreferenceController.setTotalSize(mStorageInfo.totalBytes);
|
||||
|
@@ -387,9 +387,7 @@ public class StorageDashboardFragment extends DashboardFragment
|
||||
|
||||
setLoading(false /* loading */, false /* animate */);
|
||||
|
||||
// TODO(b/288103116): replace with new API to get TotalBytes before rounding
|
||||
// once support by StorageManager.
|
||||
final long privateUsedBytes = Utils.getPrimaryStorageSize() - mStorageInfo.freeBytes;
|
||||
final long privateUsedBytes = mStorageInfo.totalBytes - mStorageInfo.freeBytes;
|
||||
mPreferenceController.setVolume(mSelectedStorageEntry.getVolumeInfo());
|
||||
mPreferenceController.setUsedSize(privateUsedBytes);
|
||||
mPreferenceController.setTotalSize(mStorageInfo.totalBytes);
|
||||
|
@@ -75,9 +75,7 @@ public class TopLevelStoragePreferenceController extends BasePreferenceControlle
|
||||
final PrivateStorageInfo info = PrivateStorageInfo.getPrivateStorageInfo(
|
||||
getStorageManagerVolumeProvider());
|
||||
|
||||
// TODO(b/288103116): replace with new API to get TotalBytes before rounding
|
||||
// once support by StorageManager.
|
||||
long usedBytes = Utils.getPrimaryStorageSize() - info.freeBytes;
|
||||
long usedBytes = info.totalBytes - info.freeBytes;
|
||||
storageCacheHelper.cacheUsedSize(usedBytes);
|
||||
ThreadUtils.postOnMainThread(() -> {
|
||||
preference.setSummary(
|
||||
|
@@ -26,7 +26,6 @@ import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settingslib.utils.ThreadUtils;
|
||||
import com.android.settingslib.widget.UsageProgressBarPreference;
|
||||
@@ -93,9 +92,7 @@ public class StorageUsageProgressBarPreferenceController extends BasePreferenceC
|
||||
if (mStorageEntry.isPrivate()) {
|
||||
// StorageStatsManager can only query private storages.
|
||||
mTotalBytes = mStorageStatsManager.getTotalBytes(mStorageEntry.getFsUuid());
|
||||
// TODO(b/288103116): replace with new API to get TotalBytes before rounding
|
||||
// once support by StorageManager.
|
||||
mUsedBytes = Utils.getPrimaryStorageSize()
|
||||
mUsedBytes = mTotalBytes
|
||||
- mStorageStatsManager.getFreeBytes(mStorageEntry.getFsUuid());
|
||||
} else {
|
||||
final File rootFile = mStorageEntry.getPath();
|
||||
|
Reference in New Issue
Block a user