summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ioana Alexandru <aioana@google.com> 2022-11-11 22:46:34 +0000
committer Ioana Alexandru <aioana@google.com> 2022-11-18 15:54:45 +0000
commita26a332581fcdd16bc34cf0ecef5ec32b1298712 (patch)
tree22038cb8d57ed52e5c76cbad8134eac839e6afdd
parent296c636fce2c20f6891bbe67670731098da58584 (diff)
Don't spam consecutive parent suppressions in NotifLog.
Previously, we were logging parent suppressions on every build that they happened. This is not ideal, since if the state causing the suppression doesn't change for a long time, the suppression logs will be repeated many times, hogging the buffer. See related bug: b/244592922 Instead, I opted to log this suppression once when it starts happening, and a second time when it stops. This prevents the situation described above, and in the linked bug, with many duplicate lines of "Change of parent to .. suppressed". One downside of this, however, is if the suppression only happens for a single iteration, we are now creating two log entries instead of one. This could technically be avoided if we did something a bit more complicated, e.g. tracking "in-progress" suppressions and only calling logParentSuppressedStopped for suppressions lasting longer than 1 iteration. However, this would imo add unnecessary complexity for an insignificant improvement. Fix: 250876257 Test: Forced a suppression using Notify2-SC by posting two delayed notifications (while there was no group for this app already in the list) and opening the shade, then keeping it open for a bit. Dumped the relevant logs by calling: ``` adb shell dumpsys activity service com.android.systemui/.dump.SystemUIAuxiliaryDumpService ``` and compared the results in the NotifLog section. Example logs before this change (notice the multiple consecutive suppression logs): go/paste/5500881658183680 Example logs after this change (only logging beginning and end of suppression): go/paste/5866408205352960 Change-Id: Ieccb7284ac5f5cc230f55d4ab5b717d19cc2000e
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ShadeListBuilder.java15
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/listbuilder/ShadeListBuilderLogger.kt17
2 files changed, 28 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ShadeListBuilder.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ShadeListBuilder.java
index 3ae2545e4e10..65a21a4e2190 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ShadeListBuilder.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ShadeListBuilder.java
@@ -1160,12 +1160,21 @@ public class ShadeListBuilder implements Dumpable, PipelineDumpable {
mLogger.logParentChanged(mIterationCount, prev.getParent(), curr.getParent());
}
- if (curr.getSuppressedChanges().getParent() != null) {
- mLogger.logParentChangeSuppressed(
+ GroupEntry currSuppressedParent = curr.getSuppressedChanges().getParent();
+ GroupEntry prevSuppressedParent = prev.getSuppressedChanges().getParent();
+ if (currSuppressedParent != null && (prevSuppressedParent == null
+ || !prevSuppressedParent.getKey().equals(currSuppressedParent.getKey()))) {
+ mLogger.logParentChangeSuppressedStarted(
mIterationCount,
- curr.getSuppressedChanges().getParent(),
+ currSuppressedParent,
curr.getParent());
}
+ if (prevSuppressedParent != null && currSuppressedParent == null) {
+ mLogger.logParentChangeSuppressedStopped(
+ mIterationCount,
+ prevSuppressedParent,
+ prev.getParent());
+ }
if (curr.getSuppressedChanges().getSection() != null) {
mLogger.logSectionChangeSuppressed(
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/listbuilder/ShadeListBuilderLogger.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/listbuilder/ShadeListBuilderLogger.kt
index 8e052c7dcc5d..4adc90aec0fb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/listbuilder/ShadeListBuilderLogger.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/listbuilder/ShadeListBuilderLogger.kt
@@ -193,7 +193,7 @@ class ShadeListBuilderLogger @Inject constructor(
})
}
- fun logParentChangeSuppressed(
+ fun logParentChangeSuppressedStarted(
buildId: Int,
suppressedParent: GroupEntry?,
keepingParent: GroupEntry?
@@ -207,6 +207,21 @@ class ShadeListBuilderLogger @Inject constructor(
})
}
+ fun logParentChangeSuppressedStopped(
+ buildId: Int,
+ previouslySuppressedParent: GroupEntry?,
+ previouslyKeptParent: GroupEntry?
+ ) {
+ buffer.log(TAG, INFO, {
+ long1 = buildId.toLong()
+ str1 = previouslySuppressedParent?.logKey
+ str2 = previouslyKeptParent?.logKey
+ }, {
+ "(Build $long1) Change of parent to '$str1' no longer suppressed; " +
+ "replaced parent '$str2'"
+ })
+ }
+
fun logGroupPruningSuppressed(
buildId: Int,
keepingParent: GroupEntry?