Merge "Update the API usage to get total size of devices" into udc-qpr-dev am: 1bc145ab6b
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/24434307 Change-Id: I221a7d43388bf3dea1dd91421a6c76c155b5f86f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -66,7 +66,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;
|
||||
@@ -1354,14 +1353,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