Merge "Add storage fullness methods to volume provider." into oc-dev
This commit is contained in:
@@ -41,8 +41,8 @@ public class PrivateStorageInfo {
|
|||||||
long privateTotalBytes = 0;
|
long privateTotalBytes = 0;
|
||||||
for (VolumeInfo info : sm.getVolumes()) {
|
for (VolumeInfo info : sm.getVolumes()) {
|
||||||
if (info.getType() == VolumeInfo.TYPE_PRIVATE && info.isMountedReadable()) {
|
if (info.getType() == VolumeInfo.TYPE_PRIVATE && info.isMountedReadable()) {
|
||||||
privateTotalBytes += stats.getTotalBytes(info.getFsUuid());
|
privateTotalBytes += sm.getTotalBytes(stats, info);
|
||||||
privateFreeBytes += stats.getFreeBytes(info.getFsUuid());
|
privateFreeBytes += sm.getFreeBytes(stats, info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new PrivateStorageInfo(privateFreeBytes, privateTotalBytes);
|
return new PrivateStorageInfo(privateFreeBytes, privateTotalBytes);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.settingslib.deviceinfo;
|
package com.android.settingslib.deviceinfo;
|
||||||
|
|
||||||
|
import android.app.usage.StorageStatsManager;
|
||||||
import android.os.storage.StorageManager;
|
import android.os.storage.StorageManager;
|
||||||
import android.os.storage.VolumeInfo;
|
import android.os.storage.VolumeInfo;
|
||||||
|
|
||||||
@@ -46,4 +47,14 @@ public class StorageManagerVolumeProvider implements StorageVolumeProvider {
|
|||||||
public VolumeInfo findEmulatedForPrivate(VolumeInfo privateVolume) {
|
public VolumeInfo findEmulatedForPrivate(VolumeInfo privateVolume) {
|
||||||
return mStorageManager.findEmulatedForPrivate(privateVolume);
|
return mStorageManager.findEmulatedForPrivate(privateVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getTotalBytes(StorageStatsManager stats, VolumeInfo volume) {
|
||||||
|
return stats.getTotalBytes(volume.getFsUuid());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getFreeBytes(StorageStatsManager stats, VolumeInfo volume) {
|
||||||
|
return stats.getFreeBytes(volume.getFsUuid());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.settingslib.deviceinfo;
|
package com.android.settingslib.deviceinfo;
|
||||||
|
|
||||||
|
import android.app.usage.StorageStatsManager;
|
||||||
import android.os.storage.VolumeInfo;
|
import android.os.storage.VolumeInfo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -39,4 +40,18 @@ public interface StorageVolumeProvider {
|
|||||||
* Returns the emulated volume for a given private volume.
|
* Returns the emulated volume for a given private volume.
|
||||||
*/
|
*/
|
||||||
VolumeInfo findEmulatedForPrivate(VolumeInfo privateVolume);
|
VolumeInfo findEmulatedForPrivate(VolumeInfo privateVolume);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the total bytes for a given storage volume.
|
||||||
|
*
|
||||||
|
* @pre The volume is a private volume and is readable.
|
||||||
|
*/
|
||||||
|
long getTotalBytes(StorageStatsManager stats, VolumeInfo volume);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the free bytes for a given storage volume.
|
||||||
|
*
|
||||||
|
* @pre The volume is a private volume and is readable.
|
||||||
|
*/
|
||||||
|
long getFreeBytes(StorageStatsManager stats, VolumeInfo volume);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user