Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 79f7901b authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Some updates to DND logging

Store more messages & clean up some formatting so the log is easier
to read

Test: manual
Bug: 170565565
Change-Id: I195109e136cb10f0ff7dd35c883134cebdbfddad
parent 90d0b580
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -286,7 +286,7 @@ public class ZenModeConfig implements Parcelable {
        }

        StringBuilder buffer = new StringBuilder(automaticRules.size() * 28);
        buffer.append('{');
        buffer.append("{\n");
        for (int i = 0; i < automaticRules.size(); i++) {
            if (i > 0) {
                buffer.append(",\n");
@@ -1830,12 +1830,13 @@ public class ZenModeConfig implements Parcelable {
        public String toString() {
            return new StringBuilder(ZenRule.class.getSimpleName()).append('[')
                    .append("id=").append(id)
                    .append(",state=").append(condition == null ? "STATE_FALSE"
                            : Condition.stateToString(condition.state))
                    .append(",enabled=").append(String.valueOf(enabled).toUpperCase())
                    .append(",snoozing=").append(snoozing)
                    .append(",name=").append(name)
                    .append(",zenMode=").append(Global.zenModeToString(zenMode))
                    .append(",conditionId=").append(conditionId)
                    .append(",condition=").append(condition)
                    .append(",pkg=").append(pkg)
                    .append(",component=").append(component)
                    .append(",configActivity=").append(configurationActivity)
@@ -1843,6 +1844,7 @@ public class ZenModeConfig implements Parcelable {
                    .append(",enabler=").append(enabler)
                    .append(",zenPolicy=").append(zenPolicy)
                    .append(",modified=").append(modified)
                    .append(",condition=").append(condition)
                    .append(']').toString();
        }

@@ -2010,6 +2012,10 @@ public class ZenModeConfig implements Parcelable {
        public Diff addLine(String item, Object from, Object to) {
            return addLine(item, from + "->" + to);
        }

        public boolean isEmpty() {
            return lines.isEmpty();
        }
    }

    /**
+9 −4
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ public class ZenLog {
    // the ZenLog is *very* verbose, so be careful about setting this to true
    private static final boolean DEBUG = false;

    private static final int SIZE = Build.IS_DEBUGGABLE ? 100 : 20;
    private static final int SIZE = Build.IS_DEBUGGABLE ? 200 : 100;

    private static final long[] TIMES = new long[SIZE];
    private static final int[] TYPES = new int[SIZE];
@@ -136,9 +136,14 @@ public class ZenLog {

    public static void traceConfig(String reason, ZenModeConfig oldConfig,
            ZenModeConfig newConfig) {
        ZenModeConfig.Diff diff = ZenModeConfig.diff(oldConfig, newConfig);
        if (diff.isEmpty()) {
            append(TYPE_CONFIG, reason + " no changes");
        } else {
            append(TYPE_CONFIG, reason
                + "," + (newConfig != null ? newConfig.toString() : null)
                + "," + ZenModeConfig.diff(oldConfig, newConfig));
                    + ",\n" + (newConfig != null ? newConfig.toString() : null)
                    + ",\n" + ZenModeConfig.diff(oldConfig, newConfig));
        }
    }

    public static void traceDisableEffects(NotificationRecord record, String reason) {
+1 −1
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ public class ZenModeConditions implements ConditionProviders.Callback {
    @Override
    public void onServiceAdded(ComponentName component) {
        if (DEBUG) Log.d(TAG, "onServiceAdded " + component);
        mHelper.setConfig(mHelper.getConfig(), component, "zmc.onServiceAdded");
        mHelper.setConfig(mHelper.getConfig(), component, "zmc.onServiceAdded:" + component);
    }

    @Override