Added storage space debug info

pull/164/head
M66B 5 years ago
parent 3cf2c89708
commit c815f1fcd0

@ -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;

@ -239,6 +239,16 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvProcessors" />
<TextView
android:id="@+id/tvStorageSpace"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/title_advanced_storage_space"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvMemoryClass" />
<TextView
android:id="@+id/tvLastCleanup"
android:layout_width="0dp"
@ -247,7 +257,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvMemoryClass" />
app:layout_constraintTop_toBottomOf="@id/tvStorageSpace" />
<TextView
android:id="@+id/tvUuid"
@ -265,6 +275,6 @@
android:id="@+id/grpDebug"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="tvProcessors,tvMemoryClass,tvLastCleanup,tvUuid" />
app:constraint_referenced_ids="tvProcessors,tvMemoryClass,tvStorageSpace,tvLastCleanup,tvUuid" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

@ -334,6 +334,7 @@
<string name="title_advanced_cleanup">Cleanup</string>
<string name="title_advanced_processors" translatable="false">Processors: %1$d</string>
<string name="title_advanced_memory_class" translatable="false">Memory class: %1$s</string>
<string name="title_advanced_storage_space" translatable="false">Storage space: %1$s</string>
<string name="title_advanced_last_cleanup" translatable="false">Last cleanup: %1$s</string>
<string name="title_advanced_enabled_hint">Globally disable or enable receiving of messages</string>

Loading…
Cancel
Save