diff --git a/app/src/main/java/androidx/room/RoomTrackingLiveData.java b/app/src/main/java/androidx/room/RoomTrackingLiveData.java index 1e3daa74ea..bdb675fc4d 100644 --- a/app/src/main/java/androidx/room/RoomTrackingLiveData.java +++ b/app/src/main/java/androidx/room/RoomTrackingLiveData.java @@ -118,7 +118,7 @@ class RoomTrackingLiveData extends LiveData { if (isActive) synchronized (lock) { if (queued > 0) - eu.faircode.email.Log.persist(eu.faircode.email.EntityLog.Type.Debug, + eu.faircode.email.Log.persist(eu.faircode.email.EntityLog.Type.Debug1, mComputeFunction + " queued=" + queued); else { queued++; diff --git a/app/src/main/java/eu/faircode/email/EmailService.java b/app/src/main/java/eu/faircode/email/EmailService.java index 07ecc35381..aeb1f3025f 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.Debug, + EntityLog.log(context, EntityLog.Type.Debug1, 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 6ac4a3165a..da41a7f882 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, Debug} + public enum Type {General, Statistics, Scheduling, Network, Account, Protocol, Classification, Notification, Rules, Cloud, Debug1, Debug2, Debug3} 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.Debug && + if ((type == Type.Debug1 || type == Type.Debug2 || type == Type.Debug3) && !(BuildConfig.DEBUG || Log.isTestRelease())) return; @@ -233,8 +233,12 @@ public class EntityLog { return ContextCompat.getColor(context, R.color.solarizedCyan); case Cloud: return ContextCompat.getColor(context, R.color.solarizedRed); - case Debug: - return Helper.resolveColor(context, R.attr.colorWarning); + 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); 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 12c3d17f43..4496c3ce27 100644 --- a/app/src/main/java/eu/faircode/email/FragmentLogs.java +++ b/app/src/main/java/eu/faircode/email/FragmentLogs.java @@ -24,7 +24,6 @@ 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; @@ -40,6 +39,7 @@ 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--; + len -= 3; 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 4a292503cb..2ffad14062 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.Debug, "Owner state=" + state); + EntityLog.log(ServiceSynchronize.this, EntityLog.Type.Debug1, "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.Debug, + EntityLog.log(ServiceSynchronize.this, EntityLog.Type.Debug1, "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.Debug, + EntityLog.log(ServiceSynchronize.this, EntityLog.Type.Debug1, "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 34f86598fa..9471d03c23 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.Debug, "Owner gone task=" + name); + EntityLog.log(context, EntityLog.Type.Debug1, "Owner gone task=" + name); destroyed = true; onDestroyed(args); owner.getLifecycle().removeObserver(this);