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

Commit f4896df8 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Some updates to DND logging"

parents 9d22de95 79f7901b
Loading
Loading
Loading
Loading
+8 −2
Original line number Original line Diff line number Diff line
@@ -287,7 +287,7 @@ public class ZenModeConfig implements Parcelable {
        }
        }


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


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

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


    /**
    /**
+9 −4
Original line number Original line 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
    // the ZenLog is *very* verbose, so be careful about setting this to true
    private static final boolean DEBUG = false;
    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 long[] TIMES = new long[SIZE];
    private static final int[] TYPES = new int[SIZE];
    private static final int[] TYPES = new int[SIZE];
@@ -136,9 +136,14 @@ public class ZenLog {


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


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


    @Override
    @Override