Debug: cache quota

pull/207/head
M66B 3 years ago
parent 4f38136696
commit a4cd879026

@ -180,6 +180,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private TextView tvMemoryClass;
private TextView tvMemoryUsage;
private TextView tvStorageUsage;
private TextView tvCacheUsage;
private TextView tvContactInfo;
private TextView tvSuffixes;
private TextView tvAndroidId;
@ -350,6 +351,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
tvMemoryClass = view.findViewById(R.id.tvMemoryClass);
tvMemoryUsage = view.findViewById(R.id.tvMemoryUsage);
tvStorageUsage = view.findViewById(R.id.tvStorageUsage);
tvCacheUsage = view.findViewById(R.id.tvCacheUsage);
tvContactInfo = view.findViewById(R.id.tvContactInfo);
tvSuffixes = view.findViewById(R.id.tvSuffixes);
tvAndroidId = view.findViewById(R.id.tvAndroidId);
@ -1819,8 +1821,9 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
data.nheap = Debug.getNativeHeapAllocatedSize();
data.available = Helper.getAvailableStorageSpace();
data.total = Helper.getTotalStorageSpace();
data.used = Helper.getSize(context.getFilesDir());
data.cache = Helper.getCacheQuota(context);
data.used = Helper.getSizeUsed(context.getFilesDir());
data.cache_used = Helper.getSizeUsed(context.getCacheDir());
data.cache_quota = Helper.getCacheQuota(context);
return data;
}
@ -1834,8 +1837,10 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
tvStorageUsage.setText(getString(R.string.title_advanced_storage_usage,
Helper.humanReadableByteCount(data.total - data.available),
Helper.humanReadableByteCount(data.total),
Helper.humanReadableByteCount(data.used),
data.cache > 0 ? Helper.humanReadableByteCount(data.cache) : "-"));
Helper.humanReadableByteCount(data.used)));
tvCacheUsage.setText(getString(R.string.title_advanced_cache_usage,
Helper.humanReadableByteCount(data.cache_used),
Helper.humanReadableByteCount(data.cache_quota)));
getView().postDelayed(new Runnable() {
@Override
@ -1991,6 +1996,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private long available;
private long total;
private long used;
private long cache;
private long cache_used;
private long cache_quota;
}
}

@ -2029,16 +2029,16 @@ public class Helper {
} catch (IOException ex) {
Log.w(ex);
}
return -1;
return 0;
}
static long getSize(File dir) {
static long getSizeUsed(File dir) {
long size = 0;
File[] listed = dir.listFiles();
if (listed != null)
for (File file : listed)
if (file.isDirectory())
size += getSize(file);
size += getSizeUsed(file);
else
size += file.length();
return size;

@ -1885,13 +1885,17 @@ public class Log {
long storage_available = Helper.getAvailableStorageSpace();
long storage_total = Helper.getTotalStorageSpace();
long storage_used = Helper.getSize(context.getFilesDir());
long cache = Helper.getCacheQuota(context);
sb.append(String.format("Storage space: %s/%s App: %s cache: %s\r\n",
long storage_used = Helper.getSizeUsed(context.getFilesDir());
sb.append(String.format("Storage space: %s/%s App: %s\r\n",
Helper.humanReadableByteCount(storage_total - storage_available),
Helper.humanReadableByteCount(storage_total),
Helper.humanReadableByteCount(storage_used),
cache > 0 ? Helper.humanReadableByteCount(cache) : "-"));
Helper.humanReadableByteCount(storage_used)));
long cache_used = Helper.getSizeUsed(context.getCacheDir());
long cache_quota = Helper.getCacheQuota(context);
sb.append(String.format("Cache space: %s/%s\r\n",
Helper.humanReadableByteCount(cache_used),
Helper.humanReadableByteCount(cache_quota)));
Runtime rt = Runtime.getRuntime();
long hused = (rt.totalMemory() - rt.freeMemory()) / 1024L / 1024L;

@ -1497,6 +1497,17 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvMemoryUsage" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvCacheUsage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/title_advanced_storage_usage"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvStorageUsage" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvCursorWindow"
android:layout_width="0dp"
@ -1506,7 +1517,7 @@
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvStorageUsage" />
app:layout_constraintTop_toBottomOf="@id/tvCacheUsage" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvContactInfo"

@ -754,8 +754,8 @@
<string name="title_advanced_processors" translatable="false">Processors: %1$d</string>
<string name="title_advanced_memory_class" translatable="false">Memory class: %1$s/%2$s Total: %3$s</string>
<string name="title_advanced_memory_usage" translatable="false">Memory usage: %1$s/%2$s Native: %3$s</string>
<string name="title_advanced_storage_usage" translatable="false">Storage space: %1$s/%2$s App: %3$s Cache: %4$s</string>
<string name="title_advanced_cache_size" translatable="false">Cache size: %1$s</string>
<string name="title_advanced_storage_usage" translatable="false">Storage space: %1$s/%2$s App: %3$s</string>
<string name="title_advanced_cache_usage" translatable="false">Cache space: %1$s/%2$s</string>
<string name="title_advanced_cursor_window" translatable="false">Cursor window size: %1$s</string>
<string name="title_advanced_contact_info" translatable="false">Contact lookup: %1$d cached: %2$d</string>
<string name="title_advanced_suffixes" translatable="false">Public suffix list: %1$d</string>

Loading…
Cancel
Save