Skip to content

Commit

Permalink
Has small memory class
Browse files Browse the repository at this point in the history
  • Loading branch information
M66B committed Jul 12, 2024
1 parent 3cb91d9 commit a2b163c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/src/main/java/eu/faircode/email/DebugHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,12 @@ private static StringBuilder getAppInfo(Context context) {
ActivityManager am = Helper.getSystemService(context, ActivityManager.class);
ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
am.getMemoryInfo(mi);
sb.append(String.format("Memory class: %d/%d MB Large: %s Total: %s Low: %b\r\n",
sb.append(String.format("Memory class: %d/%d MB Large: %s Total: %s Low: %b Small: %b\r\n",
am.getMemoryClass(), am.getLargeMemoryClass(),
largeHeap == null ? "?" : Boolean.toString(largeHeap),
Helper.humanReadableByteCount(mi.totalMem),
am.isLowRamDevice()));
am.isLowRamDevice(),
Helper.hasSmallMemoryClass(context)));

long storage_available = Helper.getAvailableStorageSpace();
long storage_total = Helper.getTotalStorageSpace();
Expand Down Expand Up @@ -1170,7 +1171,7 @@ private static void attachNetworkInfo(Context context, long id, int sequence) {

for (String key : prefs.getAll().keySet())
if (key.startsWith("dns_"))
size += write(os, key + "=" + prefs.getAll().get(key)+"\r\n");
size += write(os, key + "=" + prefs.getAll().get(key) + "\r\n");

size += write(os, "\r\n");
size += write(os, Log.getCiphers().toString());
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/java/eu/faircode/email/Helper.java
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,16 @@ static Boolean isOnForeground() {
}
}

static boolean hasSmallMemoryClass(Context context) {
try {
ActivityManager am = Helper.getSystemService(context, ActivityManager.class);
return (am.getMemoryClass() < 256);
} catch (Throwable ex) {
Log.e(ex);
return false;
}
}

// View

static int getMaxTextureSize() {
Expand Down

0 comments on commit a2b163c

Please sign in to comment.