New quota APIs are much faster than trying to measure manually, and
removing this last user of calculateDirectorySize() means we can
remove it once and for all.
Bug:
36056324
Test: builds, boots
Change-Id: Ibdf1ee4e8885680e106df6a9269b6309ddc61af8
/** {@hide} */ public long videoBytes;
/** {@hide} */ public long imageBytes;
/** {@hide} */ public long appBytes;
+ /** {@hide} */ public long obbBytes;
/**
* Return the total bytes used by all files in the shared/external storage
}
/** {@hide} */
+ public @BytesLong long getObbBytes() {
+ return obbBytes;
+ }
+
+ /** {@hide} */
public ExternalStorageStats() {
}
this.videoBytes = in.readLong();
this.imageBytes = in.readLong();
this.appBytes = in.readLong();
+ this.obbBytes = in.readLong();
}
@Override
dest.writeLong(videoBytes);
dest.writeLong(imageBytes);
dest.writeLong(appBytes);
+ dest.writeLong(obbBytes);
}
public static final Creator<ExternalStorageStats> CREATOR = new Creator<ExternalStorageStats>() {
PackageInfoLite getMinimalPackageInfo(String packagePath, int flags, String abiOverride);
ObbInfo getObbInfo(String filename);
- long calculateDirectorySize(String directory);
- /** Return file system stats: [0] is total bytes, [1] is available bytes */
- long[] getFileSystemStats(String path);
void clearDirectory(String directory);
long calculateInstalledSize(String packagePath, boolean isForwardLocked, String abiOverride);
}
}
@Override
- public long calculateDirectorySize(String path) throws RemoteException {
- Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
-
- final File dir = Environment.maybeTranslateEmulatedPathToInternal(new File(path));
- if (dir.exists() && dir.isDirectory()) {
- final String targetPath = dir.getAbsolutePath();
- return MeasurementUtils.measureDirectory(targetPath);
- } else {
- return 0L;
- }
- }
-
- @Override
- public long[] getFileSystemStats(String path) {
- Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
-
- final File file = new File(path);
- return new long[] { file.getTotalSpace(), file.getUsableSpace() };
- }
-
- @Override
public void clearDirectory(String path) throws RemoteException {
Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
public long[] getExternalSize(String uuid, int userId, int flags, int[] appIds)
throws InstallerException {
- if (!checkBeforeRemote()) return new long[4];
+ if (!checkBeforeRemote()) return new long[6];
try {
return mInstalld.getExternalSize(uuid, userId, flags, appIds);
} catch (Exception e) {
res.videoBytes = stats[2];
res.imageBytes = stats[3];
res.appBytes = stats[4];
+ res.obbBytes = stats[5];
return res;
}