From 48425613e05ac1630025fe08a5655e231e4fc915 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 19 Jun 2022 08:14:22 +0200 Subject: [PATCH] Improved debug info --- app/src/main/java/eu/faircode/email/Log.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/Log.java b/app/src/main/java/eu/faircode/email/Log.java index 45b9573911..71cbd7e6bc 100644 --- a/app/src/main/java/eu/faircode/email/Log.java +++ b/app/src/main/java/eu/faircode/email/Log.java @@ -2156,6 +2156,14 @@ public class Log { boolean ng = Helper.isInstalled(context, "eu.faircode.netguard"); boolean tc = Helper.isInstalled(context, "net.kollnig.missioncontrol"); + Integer bucket = null; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) + try { + UsageStatsManager usm = Helper.getSystemService(context, UsageStatsManager.class); + bucket = usm.getAppStandbyBucket(); + } catch (Throwable ignored) { + } + size += write(os, "enabled=" + enabled + (enabled ? "" : " !!!") + " interval=" + pollInterval + "\r\n" + "metered=" + metered + (metered ? "" : " !!!") + @@ -2163,6 +2171,9 @@ public class Log { " vpn=" + vpn + (vpn ? " !!!" : "") + " ng=" + ng + " tc=" + tc + "\r\n" + "optimizing=" + (ignoring == null ? null : !ignoring) + (Boolean.FALSE.equals(ignoring) ? " !!!" : "") + + " bucket=" + + (bucket == null ? null : Helper.getStandbyBucketName(bucket)) + + (bucket != null && bucket > UsageStatsManager.STANDBY_BUCKET_ACTIVE ? " !!!" : "") + " canSchedule=" + canSchedule + (canSchedule ? "" : " !!!") + " auto_optimize=" + auto_optimize + (auto_optimize ? " !!!" : "") + "\r\n" + "accounts=" + accounts.size() +