Merge "Reduce no-op notification log messages." into oc-dev

This commit is contained in:
TreeHugger Robot
2017-06-19 20:32:13 +00:00
committed by Android (Google) Code Review

View File

@@ -525,12 +525,11 @@ public class RankingHelper implements RankingConfig {
if (r == null) { if (r == null) {
throw new IllegalArgumentException("Invalid package"); throw new IllegalArgumentException("Invalid package");
} }
LogMaker lm = new LogMaker(MetricsProto.MetricsEvent.ACTION_NOTIFICATION_CHANNEL_GROUP) final NotificationChannelGroup oldGroup = r.groups.get(group.getId());
.setType(MetricsProto.MetricsEvent.TYPE_UPDATE) if (!group.equals(oldGroup)) {
.addTaggedData(MetricsProto.MetricsEvent.FIELD_NOTIFICATION_CHANNEL_GROUP_ID, // will log for new entries as well as name changes
group.getId()) MetricsLogger.action(getChannelGroupLog(group.getId(), pkg));
.setPackageName(pkg); }
MetricsLogger.action(lm);
r.groups.put(group.getId(), group); r.groups.put(group.getId(), group);
updateConfig(); updateConfig();
} }
@@ -558,13 +557,16 @@ public class RankingHelper implements RankingConfig {
if (existing != null && fromTargetApp) { if (existing != null && fromTargetApp) {
if (existing.isDeleted()) { if (existing.isDeleted()) {
existing.setDeleted(false); existing.setDeleted(false);
// log a resurrected channel as if it's new again
MetricsLogger.action(getChannelLog(channel, pkg).setType(
MetricsProto.MetricsEvent.TYPE_OPEN));
} }
existing.setName(channel.getName().toString()); existing.setName(channel.getName().toString());
existing.setDescription(channel.getDescription()); existing.setDescription(channel.getDescription());
existing.setBlockableSystem(channel.isBlockableSystem()); existing.setBlockableSystem(channel.isBlockableSystem());
MetricsLogger.action(getChannelLog(channel, pkg));
updateConfig(); updateConfig();
return; return;
} }
@@ -622,7 +624,10 @@ public class RankingHelper implements RankingConfig {
r.showBadge = updatedChannel.canShowBadge(); r.showBadge = updatedChannel.canShowBadge();
} }
MetricsLogger.action(getChannelLog(updatedChannel, pkg)); if (!channel.equals(updatedChannel)) {
// only log if there are real changes
MetricsLogger.action(getChannelLog(updatedChannel, pkg));
}
updateConfig(); updateConfig();
} }
@@ -1141,6 +1146,14 @@ public class RankingHelper implements RankingConfig {
channel.getImportance()); channel.getImportance());
} }
private LogMaker getChannelGroupLog(String groupId, String pkg) {
return new LogMaker(MetricsProto.MetricsEvent.ACTION_NOTIFICATION_CHANNEL_GROUP)
.setType(MetricsProto.MetricsEvent.TYPE_UPDATE)
.addTaggedData(MetricsProto.MetricsEvent.FIELD_NOTIFICATION_CHANNEL_GROUP_ID,
groupId)
.setPackageName(pkg);
}
public void updateBadgingEnabled() { public void updateBadgingEnabled() {
if (mBadgingEnabled == null) { if (mBadgingEnabled == null) {
mBadgingEnabled = new SparseBooleanArray(); mBadgingEnabled = new SparseBooleanArray();