diff --git a/app/src/main/java/androidx/room/RoomTrackingLiveData.kt b/app/src/main/java/androidx/room/RoomTrackingLiveData.kt index 916133262c..4323c841fe 100644 --- a/app/src/main/java/androidx/room/RoomTrackingLiveData.kt +++ b/app/src/main/java/androidx/room/RoomTrackingLiveData.kt @@ -100,7 +100,7 @@ internal class RoomTrackingLiveData ( if (isActive) { synchronized(lock) { if (queued.value > 0) { - eu.faircode.email.Log.persist(eu.faircode.email.EntityLog.Type.Debug1, "$computeFunction queued=" + queued.value) + eu.faircode.email.Log.persist(eu.faircode.email.EntityLog.Type.Debug, "$computeFunction queued=" + queued.value) } else { queued.value++ queryExecutor.execute(refreshRunnable) diff --git a/app/src/main/java/eu/faircode/email/EmailService.java b/app/src/main/java/eu/faircode/email/EmailService.java index aeb1f3025f..07ecc35381 100644 --- a/app/src/main/java/eu/faircode/email/EmailService.java +++ b/app/src/main/java/eu/faircode/email/EmailService.java @@ -520,7 +520,7 @@ public class EmailService implements AutoCloseable { if (auth == AUTH_TYPE_GMAIL || auth == AUTH_TYPE_OAUTH) { try { - EntityLog.log(context, EntityLog.Type.Debug1, + EntityLog.log(context, EntityLog.Type.Debug, ex + "\n" + android.util.Log.getStackTraceString(ex)); authenticator.refreshToken(true); connect(dnssec, host, port, auth, user, factory); diff --git a/app/src/main/java/eu/faircode/email/EntityLog.java b/app/src/main/java/eu/faircode/email/EntityLog.java index da41a7f882..6ac4a3165a 100644 --- a/app/src/main/java/eu/faircode/email/EntityLog.java +++ b/app/src/main/java/eu/faircode/email/EntityLog.java @@ -65,7 +65,7 @@ public class EntityLog { @NonNull public String data; - public enum Type {General, Statistics, Scheduling, Network, Account, Protocol, Classification, Notification, Rules, Cloud, Debug1, Debug2, Debug3} + public enum Type {General, Statistics, Scheduling, Network, Account, Protocol, Classification, Notification, Rules, Cloud, Debug} public static void log(final Context context, String data) { log(context, Type.General, data); @@ -109,7 +109,7 @@ public class EntityLog { if (context == null) return; - if ((type == Type.Debug1 || type == Type.Debug2 || type == Type.Debug3) && + if (type == Type.Debug && !(BuildConfig.DEBUG || Log.isTestRelease())) return; @@ -233,12 +233,8 @@ public class EntityLog { return ContextCompat.getColor(context, R.color.solarizedCyan); case Cloud: return ContextCompat.getColor(context, R.color.solarizedRed); - case Debug1: - return ContextCompat.getColor(context, R.color.solarizedRed); - case Debug2: - return ContextCompat.getColor(context, R.color.solarizedGreen); - case Debug3: - return ContextCompat.getColor(context, R.color.solarizedBlue); + case Debug: + return Helper.resolveColor(context, R.attr.colorWarning); default: return null; } diff --git a/app/src/main/java/eu/faircode/email/FragmentLogs.java b/app/src/main/java/eu/faircode/email/FragmentLogs.java index 4496c3ce27..12c3d17f43 100644 --- a/app/src/main/java/eu/faircode/email/FragmentLogs.java +++ b/app/src/main/java/eu/faircode/email/FragmentLogs.java @@ -24,6 +24,7 @@ import android.content.DialogInterface; import android.content.SharedPreferences; import android.graphics.Typeface; import android.os.Bundle; +import android.preference.PreferenceManager; import android.text.SpannableStringBuilder; import android.text.style.ForegroundColorSpan; import android.text.style.StyleSpan; @@ -39,7 +40,6 @@ import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; import androidx.constraintlayout.widget.Group; import androidx.lifecycle.Observer; -import androidx.preference.PreferenceManager; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -203,7 +203,7 @@ public class FragmentLogs extends FragmentBase { int len = EntityLog.Type.values().length; if (!BuildConfig.DEBUG) - len -= 3; + len--; SpannableStringBuilder[] titles = new SpannableStringBuilder[len]; boolean[] states = new boolean[len]; diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 2ffad14062..4a292503cb 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -850,7 +850,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences @OnLifecycleEvent(Lifecycle.Event.ON_ANY) public void onStateChanged() { Lifecycle.State state = mowner.getLifecycle().getCurrentState(); - EntityLog.log(ServiceSynchronize.this, EntityLog.Type.Debug1, "Owner state=" + state); + EntityLog.log(ServiceSynchronize.this, EntityLog.Type.Debug, "Owner state=" + state); if (state.equals(Lifecycle.State.DESTROYED)) mowner.getLifecycle().removeObserver(this); } @@ -872,7 +872,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences @Override public void onChanged(boolean inCall) { boolean suppress = prefs.getBoolean("notify_suppress_in_call", false); - EntityLog.log(ServiceSynchronize.this, EntityLog.Type.Debug1, + EntityLog.log(ServiceSynchronize.this, EntityLog.Type.Debug, "In call=" + inCall + " suppress=" + suppress); isInCall = (inCall && suppress); boolean fg = Boolean.TRUE.equals(foreground.getValue()); @@ -889,7 +889,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences boolean projection = (connectionState != null && connectionState == CarConnection.CONNECTION_TYPE_PROJECTION); boolean suppress = prefs.getBoolean("notify_suppress_in_car", false); - EntityLog.log(ServiceSynchronize.this, EntityLog.Type.Debug1, + EntityLog.log(ServiceSynchronize.this, EntityLog.Type.Debug, "Projection=" + projection + " state=" + connectionState + " suppress=" + suppress); isInCar = (projection && suppress); boolean fg = Boolean.TRUE.equals(foreground.getValue()); diff --git a/app/src/main/java/eu/faircode/email/SimpleTask.java b/app/src/main/java/eu/faircode/email/SimpleTask.java index 9471d03c23..34f86598fa 100644 --- a/app/src/main/java/eu/faircode/email/SimpleTask.java +++ b/app/src/main/java/eu/faircode/email/SimpleTask.java @@ -203,7 +203,7 @@ public abstract class SimpleTask implements LifecycleObserver { LifecycleObserver watcher = new LifecycleObserver() { @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY) public void onDestroy() { - EntityLog.log(context, EntityLog.Type.Debug1, "Owner gone task=" + name); + EntityLog.log(context, EntityLog.Type.Debug, "Owner gone task=" + name); destroyed = true; onDestroyed(args); owner.getLifecycle().removeObserver(this);