linhaiczy
2022-12-10 13:35:35 +08:00
ong totalBytes = storageStatsManager.getTotalBytes(uuid);
long freeBytes = storageStatsManager.getFreeBytes(uuid);
StorageStats storageStats = storageStatsManager.queryStatsForUser(uuid, user);
long appBytes = storageStats.getAppBytes();
long dataBytes = storageStats.getDataBytes();
ExternalStorageStats externalStorageStats = storageStatsManager.queryExternalStatsForUser(uuid,user);
long totalExternalUsedBytes = externalStorageStats.getTotalBytes();
long imageBytes = externalStorageStats.getImageBytes();
long audioBytes = externalStorageStats.getAudioBytes();
long videoBytes = externalStorageStats.getVideoBytes();
long appsSize = Utils.sub(Utils.add(appBytes, dataBytes).longValue(), totalExternalUsedBytes).longValue();
long otherSize = Utils.sub(totalExternalUsedBytes, imageBytes, audioBytes, videoBytes).longValue();
long dataSize = Utils.add(appBytes, dataBytes, freeBytes).longValue();
long system = Utils.sub(totalBytes, dataSize).longValue();
其中 appsSize 是计算的所有应用大小
目前是这么获取的,但总感觉有点问题
在用 adb 内存填充后,生成的文件会被统计到 storageStats.getDataBytes()中