Merge "Some updates to DND logging"

This commit is contained in:
TreeHugger Robot
2020-10-28 20:33:12 +00:00
committed by Android (Google) Code Review
3 changed files with 18 additions and 7 deletions

View File

@@ -287,7 +287,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");
@@ -1831,12 +1831,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)
@@ -1844,6 +1845,7 @@ public class ZenModeConfig implements Parcelable {
.append(",enabler=").append(enabler)
.append(",zenPolicy=").append(zenPolicy)
.append(",modified=").append(modified)
.append(",condition=").append(condition)
.append(']').toString();
}
@@ -2011,6 +2013,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();
}
}
/**

View File

@@ -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) {
append(TYPE_CONFIG, reason
+ "," + (newConfig != null ? newConfig.toString() : null)
+ "," + ZenModeConfig.diff(oldConfig, newConfig));
ZenModeConfig.Diff diff = ZenModeConfig.diff(oldConfig, newConfig);
if (diff.isEmpty()) {
append(TYPE_CONFIG, reason + " no changes");
} else {
append(TYPE_CONFIG, reason
+ ",\n" + (newConfig != null ? newConfig.toString() : null)
+ ",\n" + ZenModeConfig.diff(oldConfig, newConfig));
}
}
public static void traceDisableEffects(NotificationRecord record, String reason) {

View File

@@ -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