1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-29 11:15:51 +00:00

Debug cursor window size

This commit is contained in:
M66B 2021-09-29 12:11:14 +02:00
parent 9d9a23561e
commit e5a4826a90
3 changed files with 27 additions and 1 deletions

View file

@ -70,6 +70,7 @@ import androidx.preference.PreferenceManager;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.nio.charset.Charset;
import java.text.NumberFormat;
import java.util.ArrayList;
@ -146,6 +147,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private TextView tvStorageUsage;
private TextView tvSuffixes;
private TextView tvFingerprint;
private TextView tvCursorWindow;
private Button btnGC;
private Button btnCharsets;
private Button btnCiphers;
@ -266,6 +268,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
tvStorageUsage = view.findViewById(R.id.tvStorageUsage);
tvSuffixes = view.findViewById(R.id.tvSuffixes);
tvFingerprint = view.findViewById(R.id.tvFingerprint);
tvCursorWindow = view.findViewById(R.id.tvCursorWindow);
btnGC = view.findViewById(R.id.btnGC);
btnCharsets = view.findViewById(R.id.btnCharsets);
btnCiphers = view.findViewById(R.id.btnCiphers);
@ -1172,6 +1175,17 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
tvFingerprint.setText(Helper.getFingerprint(getContext()));
int cursorWindowSize = -1;
try {
Field fCursorWindowSize = io.requery.android.database.CursorWindow.class.getDeclaredField("sDefaultCursorWindowSize");
fCursorWindowSize.setAccessible(true);
cursorWindowSize = fCursorWindowSize.getInt(null);
} catch (Throwable ex) {
Log.w(ex);
}
tvCursorWindow.setText(getString(R.string.title_advanced_cursor_window,
Helper.humanReadableByteCount(cursorWindowSize, false)));
cardDebug.setVisibility(swDebug.isChecked() || BuildConfig.DEBUG ? View.VISIBLE : View.GONE);
}

View file

@ -855,6 +855,17 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvMemoryUsage" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvCursorWindow"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/title_advanced_cursor_window"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvStorageUsage" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvSuffixes"
android:layout_width="0dp"
@ -864,7 +875,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/tvCursorWindow" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvFingerprint"

View file

@ -662,6 +662,7 @@
<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</string>
<string name="title_advanced_cursor_window" translatable="false">Cursor window size: %1$s</string>
<string name="title_advanced_suffixes" translatable="false">Public suffix list: %1$d</string>
<string name="title_advanced_gc" translatable="false">GC</string>
<string name="title_advanced_charsets" translatable="false">Charsets</string>