diff options
| author | 2017-06-14 14:03:18 -0400 | |
|---|---|---|
| committer | 2017-06-15 10:49:49 -0400 | |
| commit | 0171f574cf1d297a36c01d69b8e53e82862fe9c3 (patch) | |
| tree | d957e8e88bcab7277902b71db7f50a901a2da276 | |
| parent | 890cb590039774969a79ac7d0b8f27f0bb227e9f (diff) | |
Reduce no-op notification log messages.
Only log when channels or groups actually change.
Change-Id: I43e5a4f946962fc2d200f0d40d1744a938c83ca3
Fixes: 62487398
Test: runtest systemui-notification
| -rw-r--r-- | services/core/java/com/android/server/notification/RankingHelper.java | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/services/core/java/com/android/server/notification/RankingHelper.java b/services/core/java/com/android/server/notification/RankingHelper.java index 2c0cc9585e9f..4eadfd168640 100644 --- a/services/core/java/com/android/server/notification/RankingHelper.java +++ b/services/core/java/com/android/server/notification/RankingHelper.java @@ -524,12 +524,11 @@ public class RankingHelper implements RankingConfig { if (r == null) { throw new IllegalArgumentException("Invalid package"); } - LogMaker lm = new LogMaker(MetricsProto.MetricsEvent.ACTION_NOTIFICATION_CHANNEL_GROUP) - .setType(MetricsProto.MetricsEvent.TYPE_UPDATE) - .addTaggedData(MetricsProto.MetricsEvent.FIELD_NOTIFICATION_CHANNEL_GROUP_ID, - group.getId()) - .setPackageName(pkg); - MetricsLogger.action(lm); + final NotificationChannelGroup oldGroup = r.groups.get(group.getId()); + if (!group.equals(oldGroup)) { + // will log for new entries as well as name changes + MetricsLogger.action(getChannelGroupLog(group.getId(), pkg)); + } r.groups.put(group.getId(), group); updateConfig(); } @@ -557,13 +556,16 @@ public class RankingHelper implements RankingConfig { if (existing != null && fromTargetApp) { if (existing.isDeleted()) { 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.setDescription(channel.getDescription()); existing.setBlockableSystem(channel.isBlockableSystem()); - MetricsLogger.action(getChannelLog(channel, pkg)); updateConfig(); return; } @@ -621,7 +623,10 @@ public class RankingHelper implements RankingConfig { 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(); } @@ -1140,6 +1145,14 @@ public class RankingHelper implements RankingConfig { 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() { if (mBadgingEnabled == null) { mBadgingEnabled = new SparseBooleanArray(); |