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

Commit d1ef2a76 authored by Dan Sandler's avatar Dan Sandler Committed by android-build-merger
Browse files

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

am: 5e3fb57a

Change-Id: I6e45c94b21d0162b9050fcc076cab03e00650efc
parents aeef0e6e 5e3fb57a
Loading
Loading
Loading
Loading
+21 −8
Original line number Diff line number Diff line
@@ -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();
        }

        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();