From 8cd2f1d3802353ba9bfed246a0081ab2a971a036 Mon Sep 17 00:00:00 2001 From: Ned Burns Date: Mon, 3 Feb 2020 16:24:06 -0500 Subject: [PATCH] Log a warning whenever we get an incomplete ranking map Follow-up to ag/10235076 Test: atest Change-Id: Icdcc61688b00f112be1bb9c5cc42f6052b74a87f --- .../collection/NotifCollection.java | 2 ++ .../notifcollection/NotifCollectionLogger.kt | 21 ++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotifCollection.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotifCollection.java index 64d460bfb8fe0..1b6170326bacc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotifCollection.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotifCollection.java @@ -326,6 +326,8 @@ public class NotifCollection implements Dumpable { entry.getSbn().setOverrideGroupKey(newOverrideGroupKey); } } + } else { + mLogger.logRankingMissing(entry.getKey(), rankingMap); } } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionLogger.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionLogger.kt index bd1bd860f80c9..0d0a46adb41fa 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionLogger.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionLogger.kt @@ -16,8 +16,11 @@ package com.android.systemui.statusbar.notification.collection.notifcollection +import android.service.notification.NotificationListenerService.RankingMap import com.android.systemui.log.LogBuffer -import com.android.systemui.log.LogLevel +import com.android.systemui.log.LogLevel.DEBUG +import com.android.systemui.log.LogLevel.INFO +import com.android.systemui.log.LogLevel.WARNING import com.android.systemui.log.dagger.NotificationLog import javax.inject.Inject @@ -25,7 +28,7 @@ class NotifCollectionLogger @Inject constructor( @NotificationLog private val buffer: LogBuffer ) { fun logNotifPosted(key: String) { - buffer.log(TAG, LogLevel.INFO, { + buffer.log(TAG, INFO, { str1 = key }, { "POSTED $str1" @@ -33,7 +36,7 @@ class NotifCollectionLogger @Inject constructor( } fun logNotifGroupPosted(groupKey: String, batchSize: Int) { - buffer.log(TAG, LogLevel.INFO, { + buffer.log(TAG, INFO, { str1 = groupKey int1 = batchSize }, { @@ -42,7 +45,7 @@ class NotifCollectionLogger @Inject constructor( } fun logNotifUpdated(key: String) { - buffer.log(TAG, LogLevel.INFO, { + buffer.log(TAG, INFO, { str1 = key }, { "UPDATED $str1" @@ -50,13 +53,21 @@ class NotifCollectionLogger @Inject constructor( } fun logNotifRemoved(key: String, reason: Int) { - buffer.log(TAG, LogLevel.INFO, { + buffer.log(TAG, INFO, { str1 = key int1 = reason }, { "REMOVED $str1 reason=$int1" }) } + + fun logRankingMissing(key: String, rankingMap: RankingMap) { + buffer.log(TAG, WARNING, { str1 = key }, { "Ranking update is missing ranking for $str1" }) + buffer.log(TAG, DEBUG, {}, { "Ranking map contents:" }) + for (entry in rankingMap.orderedKeys) { + buffer.log(TAG, DEBUG, { str1 = entry }, { " $str1" }) + } + } } private const val TAG = "NotifCollection" \ No newline at end of file