mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-13 04:25:47 +02:00
Added storage space debug info
This commit is contained in:
@@ -62,6 +62,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||
|
||||
private TextView tvProcessors;
|
||||
private TextView tvMemoryClass;
|
||||
private TextView tvStorageSpace;
|
||||
private TextView tvLastCleanup;
|
||||
private TextView tvUuid;
|
||||
|
||||
@@ -102,6 +103,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||
|
||||
tvProcessors = view.findViewById(R.id.tvProcessors);
|
||||
tvMemoryClass = view.findViewById(R.id.tvMemoryClass);
|
||||
tvStorageSpace = view.findViewById(R.id.tvStorageSpace);
|
||||
tvLastCleanup = view.findViewById(R.id.tvLastCleanup);
|
||||
tvUuid = view.findViewById(R.id.tvUuid);
|
||||
|
||||
@@ -340,6 +342,10 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||
ActivityManager am = (ActivityManager) getContext().getSystemService(Context.ACTIVITY_SERVICE);
|
||||
int class_mb = am.getMemoryClass();
|
||||
tvMemoryClass.setText(getString(R.string.title_advanced_memory_class, class_mb + " MB"));
|
||||
|
||||
tvStorageSpace.setText(getString(R.string.title_advanced_storage_space,
|
||||
Helper.humanReadableByteCount(Helper.getStorageSpace(), true)));
|
||||
|
||||
tvUuid.setText(prefs.getString("uuid", null));
|
||||
|
||||
grpDebug.setVisibility(swDebug.isChecked() || BuildConfig.DEBUG ? View.VISIBLE : View.GONE);
|
||||
|
||||
@@ -40,9 +40,11 @@ import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.Parcel;
|
||||
import android.os.PowerManager;
|
||||
import android.os.StatFs;
|
||||
import android.text.Spannable;
|
||||
import android.text.Spanned;
|
||||
import android.text.format.DateUtils;
|
||||
@@ -676,6 +678,11 @@ public class Helper {
|
||||
}
|
||||
}
|
||||
|
||||
static long getStorageSpace() {
|
||||
StatFs stats = new StatFs(Environment.getDataDirectory().getAbsolutePath());
|
||||
return stats.getAvailableBlocksLong() * stats.getBlockSizeLong();
|
||||
}
|
||||
|
||||
static Bitmap decodeImage(File file, int scaleToPixels) {
|
||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||
options.inJustDecodeBounds = true;
|
||||
|
||||
@@ -541,6 +541,9 @@ public class Log {
|
||||
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
sb.append(String.format("Memory class: %d\r\n", am.getMemoryClass()));
|
||||
|
||||
sb.append(String.format("Storage space: %s\r\n",
|
||||
Helper.humanReadableByteCount(Helper.getStorageSpace(), true)));
|
||||
|
||||
Runtime rt = Runtime.getRuntime();
|
||||
long hused = (rt.totalMemory() - rt.freeMemory()) / 1024L;
|
||||
long hmax = rt.maxMemory() / 1024L;
|
||||
|
||||
Reference in New Issue
Block a user