mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-01 06:38:29 +02:00
Debug: cache size
This commit is contained in:
@@ -54,6 +54,7 @@ import android.os.LocaleList;
|
||||
import android.os.Parcel;
|
||||
import android.os.PowerManager;
|
||||
import android.os.StatFs;
|
||||
import android.os.storage.StorageManager;
|
||||
import android.provider.Settings;
|
||||
import android.security.KeyChain;
|
||||
import android.security.KeyChainAliasCallback;
|
||||
@@ -2018,6 +2019,18 @@ public class Helper {
|
||||
return stats.getTotalBytes();
|
||||
}
|
||||
|
||||
static long getCacheSize(Context context) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
||||
try {
|
||||
StorageManager sm = Helper.getSystemService(context, StorageManager.class);
|
||||
File cache = context.getCacheDir();
|
||||
return sm.getCacheQuotaBytes(sm.getUuidForPath(cache));
|
||||
} catch (IOException ex) {
|
||||
Log.w(ex);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static long getSize(File dir) {
|
||||
long size = 0;
|
||||
File[] listed = dir.listFiles();
|
||||
|
||||
Reference in New Issue
Block a user