Added memory info to debug info

This commit is contained in:
M66B 2019-07-21 08:57:59 +02:00
parent a26373f1d5
commit c652f3e90b
1 changed files with 10 additions and 0 deletions

View File

@ -45,6 +45,7 @@ import android.net.wifi.WifiManager;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Debug;
import android.os.PowerManager;
import android.preference.PreferenceManager;
import android.provider.Settings;
@ -76,6 +77,7 @@ import java.net.URL;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DateFormat;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
@ -842,6 +844,14 @@ public class Util {
abi = (Build.SUPPORTED_ABIS.length > 0 ? Build.SUPPORTED_ABIS[0] : "?");
sb.append(String.format("ABI: %s\r\n", abi));
Runtime rt = Runtime.getRuntime();
long hused = (rt.totalMemory() - rt.freeMemory()) / 1024L;
long hmax = rt.maxMemory() / 1024L;
long nheap = Debug.getNativeHeapAllocatedSize() / 1024L;
NumberFormat nf = NumberFormat.getIntegerInstance();
sb.append(String.format("Heap usage: %s/%s KiB native: %s KiB\r\n",
nf.format(hused), nf.format(hmax), nf.format(nheap)));
sb.append("\r\n");
sb.append(String.format("VPN dialogs: %B\r\n", isPackageInstalled("com.android.vpndialogs", context)));