diff options
| author | 2017-06-19 20:45:16 +0000 | |
|---|---|---|
| committer | 2017-06-19 20:45:16 +0000 | |
| commit | 1ba4f0e1da44bd18cc0698655bcc626e6ed34da8 (patch) | |
| tree | 2519f33e1d551ad373b3cb09b2eccdb411d166d9 | |
| parent | 7979566c723df20b1d47ff932142476cdd8a98f5 (diff) | |
| parent | 5e3fb57af80f91dc882eab910e865e3c22ae02be (diff) | |
Merge "Reduce no-op notification log messages." into oc-dev
am: 5e3fb57af8
Change-Id: I3f9d2d574ba20adf66d60c41e68b753e44c9c01a
| -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 b3c6ff657867..d7b36aaa8008 100644 --- a/services/core/java/com/android/server/notification/RankingHelper.java +++ b/services/core/java/com/android/server/notification/RankingHelper.java @@ -525,12 +525,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(); } @@ -558,13 +557,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; } @@ -622,7 +624,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(); } @@ -1141,6 +1146,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(); |