Refactoring

This commit is contained in:
M66B 2022-04-30 22:35:22 +02:00
parent 350e91d953
commit 531eddf84b
3 changed files with 4 additions and 4 deletions

View File

@ -40,7 +40,6 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Debug;
import android.os.Environment;
import android.os.storage.StorageManager;
import android.provider.Settings;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
@ -1821,7 +1820,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
data.available = Helper.getAvailableStorageSpace();
data.total = Helper.getTotalStorageSpace();
data.used = Helper.getSize(context.getFilesDir());
data.cache = Helper.getCacheSize(context);
data.cache = Helper.getCacheQuota(context);
return data;
}

View File

@ -2019,7 +2019,8 @@ public class Helper {
return stats.getTotalBytes();
}
static long getCacheSize(Context context) {
static long getCacheQuota(Context context) {
// https://developer.android.com/reference/android/content/Context#getCacheDir()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
try {
StorageManager sm = Helper.getSystemService(context, StorageManager.class);

View File

@ -1886,7 +1886,7 @@ public class Log {
long storage_available = Helper.getAvailableStorageSpace();
long storage_total = Helper.getTotalStorageSpace();
long storage_used = Helper.getSize(context.getFilesDir());
long cache = Helper.getCacheSize(context);
long cache = Helper.getCacheQuota(context);
sb.append(String.format("Storage space: %s/%s App: %s cache: %s\r\n",
Helper.humanReadableByteCount(storage_total - storage_available),
Helper.humanReadableByteCount(storage_total),