mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-05 08:33:37 +02:00
Improved debug info
This commit is contained in:
@@ -468,6 +468,33 @@ public class ConnectionHelper {
|
||||
return (status == ConnectivityManager.RESTRICT_BACKGROUND_STATUS_ENABLED);
|
||||
}
|
||||
|
||||
static String getDataSaving(Context context) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N)
|
||||
return null;
|
||||
|
||||
try {
|
||||
ConnectivityManager cm =
|
||||
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
if (cm == null)
|
||||
return null;
|
||||
|
||||
int status = cm.getRestrictBackgroundStatus();
|
||||
switch (status) {
|
||||
case ConnectivityManager.RESTRICT_BACKGROUND_STATUS_DISABLED:
|
||||
return "disabled";
|
||||
case ConnectivityManager.RESTRICT_BACKGROUND_STATUS_ENABLED:
|
||||
return "enabled";
|
||||
case ConnectivityManager.RESTRICT_BACKGROUND_STATUS_WHITELISTED:
|
||||
return "whitelisted";
|
||||
default:
|
||||
return Integer.toString(status);
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static boolean vpnActive(Context context) {
|
||||
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
if (cm == null)
|
||||
|
||||
@@ -2059,6 +2059,7 @@ public class Log {
|
||||
boolean auto_optimize = prefs.getBoolean("auto_optimize", false);
|
||||
boolean schedule = prefs.getBoolean("schedule", false);
|
||||
|
||||
String ds = ConnectionHelper.getDataSaving(context);
|
||||
boolean vpn = ConnectionHelper.vpnActive(context);
|
||||
boolean ng = Helper.isInstalled(context, "eu.faircode.netguard");
|
||||
boolean tc = Helper.isInstalled(context, "net.kollnig.missioncontrol");
|
||||
@@ -2066,6 +2067,7 @@ public class Log {
|
||||
size += write(os, "enabled=" + enabled + (enabled ? "" : " !!!") +
|
||||
" interval=" + pollInterval + "\r\n" +
|
||||
"metered=" + metered + (metered ? "" : " !!!") +
|
||||
" restricted=" + ds + ("enabled".equals(ds) ? " !!!" : "") +
|
||||
" vpn=" + vpn + (vpn ? " !!!" : "") +
|
||||
" ng=" + ng + " tc=" + tc + "\r\n" +
|
||||
"optimizing=" + (ignoring == null ? null : !ignoring) + (Boolean.FALSE.equals(ignoring) ? " !!!" : "") +
|
||||
|
||||
Reference in New Issue
Block a user