From 966f9efaea62c8dd8f3ca8af54755d8760c01654 Mon Sep 17 00:00:00 2001 From: Steve Elliott Date: Thu, 14 May 2020 11:56:58 -0400 Subject: [PATCH] Add additional debug logging to sections manager Bug: 151241067 Test: manual Change-Id: Ie7c3a0fb4321a9810e3a5f4b1d0e12ede346f875 --- .../stack/NotificationSectionsLogger.kt | 27 +++++++-- .../stack/NotificationSectionsManager.java | 55 +++++++++---------- 2 files changed, 48 insertions(+), 34 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsLogger.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsLogger.kt index 9cf1f74ea418f..92fdd6441539a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsLogger.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsLogger.kt @@ -36,14 +36,31 @@ class NotificationSectionsLogger @Inject constructor( { "Updating section boundaries: $reason" } ) - fun logStr(str: String) = logBuffer.log( + fun logIncomingHeader(position: Int) = logPosition(position, "INCOMING HEADER") + fun logMediaControls(position: Int) = logPosition(position, "MEDIA CONTROLS") + fun logConversationsHeader(position: Int) = logPosition(position, "CONVERSATIONS HEADER") + fun logAlertingHeader(position: Int) = logPosition(position, "ALERTING HEADER") + fun logSilentHeader(position: Int) = logPosition(position, "SILENT HEADER") + + fun logOther(position: Int, clazz: Class<*>) = logBuffer.log( TAG, LogLevel.DEBUG, - { str1 = str }, - { str1 ?: "" } + { + int1 = position + str1 = clazz.name + }, + { "$int1: other ($str1)" } ) - fun logPosition(position: Int, label: String) = logBuffer.log( + fun logHeadsUp(position: Int) = logPosition(position, "Heads Up") + fun logConversation(position: Int) = logPosition(position, "Conversation") + fun logAlerting(position: Int) = logPosition(position, "Alerting") + fun logSilent(position: Int) = logPosition(position, "Silent") + fun logForegroundService(position: Int) = logPosition(position, "Foreground Service") + + fun logStr(str: String) = logBuffer.log(TAG, LogLevel.DEBUG, { str1 = str }, { "$str1" }) + + private fun logPosition(position: Int, label: String) = logBuffer.log( TAG, LogLevel.DEBUG, { @@ -52,4 +69,4 @@ class NotificationSectionsLogger @Inject constructor( }, { "$int1: $str1" } ) -} \ No newline at end of file +} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.java index b5ba3a84fe0fd..f3ee2ceaf8ee0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.java @@ -255,44 +255,44 @@ public class NotificationSectionsManager implements StackScrollAlgorithm.Section for (int i = 0; i < childCount; i++) { View child = mParent.getChildAt(i); if (child == mIncomingHeader) { - mLogger.logPosition(i, "INCOMING HEADER"); + mLogger.logIncomingHeader(i); continue; } if (child == mMediaControlsView) { - mLogger.logPosition(i, "MEDIA CONTROLS"); + mLogger.logMediaControls(i); continue; } if (child == mPeopleHubView) { - mLogger.logPosition(i, "CONVERSATIONS HEADER"); + mLogger.logConversationsHeader(i); continue; } if (child == mAlertingHeader) { - mLogger.logPosition(i, "ALERTING HEADER"); + mLogger.logAlertingHeader(i); continue; } if (child == mGentleHeader) { - mLogger.logPosition(i, "SILENT HEADER"); + mLogger.logSilentHeader(i); continue; } if (!(child instanceof ExpandableNotificationRow)) { - mLogger.logPosition(i, "other:" + child.getClass().getName()); + mLogger.logOther(i, child.getClass()); continue; } ExpandableNotificationRow row = (ExpandableNotificationRow) child; // Once we enter a new section, calculate the target position for the header. switch (row.getEntry().getBucket()) { case BUCKET_HEADS_UP: - mLogger.logPosition(i, "Heads Up"); + mLogger.logHeadsUp(i); break; case BUCKET_PEOPLE: - mLogger.logPosition(i, "Conversation"); + mLogger.logConversation(i); break; case BUCKET_ALERTING: - mLogger.logPosition(i, "Alerting"); + mLogger.logAlerting(i); break; case BUCKET_SILENT: - mLogger.logPosition(i, "Silent"); + mLogger.logSilent(i); break; } } @@ -345,33 +345,33 @@ public class NotificationSectionsManager implements StackScrollAlgorithm.Section // Track the existing positions of the headers if (child == mIncomingHeader) { - mLogger.logPosition(i, "INCOMING HEADER"); + mLogger.logIncomingHeader(i); currentIncomingHeaderIdx = i; continue; } if (child == mMediaControlsView) { - mLogger.logPosition(i, "MEDIA CONTROLS"); + mLogger.logMediaControls(i); currentMediaControlsIdx = i; continue; } if (child == mPeopleHubView) { - mLogger.logPosition(i, "CONVERSATIONS HEADER"); + mLogger.logConversationsHeader(i); currentPeopleHeaderIdx = i; continue; } if (child == mAlertingHeader) { - mLogger.logPosition(i, "ALERTING HEADER"); + mLogger.logAlertingHeader(i); currentAlertingHeaderIdx = i; continue; } if (child == mGentleHeader) { - mLogger.logPosition(i, "SILENT HEADER"); + mLogger.logSilentHeader(i); currentGentleHeaderIdx = i; continue; } if (!(child instanceof ExpandableNotificationRow)) { - mLogger.logPosition(i, "other"); + mLogger.logOther(i, child.getClass()); continue; } lastNotifIndex = i; @@ -379,7 +379,7 @@ public class NotificationSectionsManager implements StackScrollAlgorithm.Section // Once we enter a new section, calculate the target position for the header. switch (row.getEntry().getBucket()) { case BUCKET_HEADS_UP: - mLogger.logPosition(i, "Heads Up"); + mLogger.logHeadsUp(i); if (showHeaders && incomingHeaderTarget == -1) { incomingHeaderTarget = i; // Offset the target if there are other headers before this that will be @@ -405,12 +405,13 @@ public class NotificationSectionsManager implements StackScrollAlgorithm.Section } break; case BUCKET_FOREGROUND_SERVICE: + mLogger.logForegroundService(i); if (mediaControlsTarget != -1) { mediaControlsTarget++; } break; case BUCKET_PEOPLE: - mLogger.logPosition(i, "Conversation"); + mLogger.logConversation(i); peopleNotifsPresent = true; if (showHeaders && peopleHeaderTarget == -1) { peopleHeaderTarget = i; @@ -428,7 +429,7 @@ public class NotificationSectionsManager implements StackScrollAlgorithm.Section } break; case BUCKET_ALERTING: - mLogger.logPosition(i, "Alerting"); + mLogger.logAlerting(i); if (showHeaders && usingPeopleFiltering && alertingHeaderTarget == -1) { alertingHeaderTarget = i; // Offset the target if there are other headers before this that will be @@ -442,7 +443,7 @@ public class NotificationSectionsManager implements StackScrollAlgorithm.Section } break; case BUCKET_SILENT: - mLogger.logPosition(i, "Silent"); + mLogger.logSilent(i); if (showHeaders && gentleHeaderTarget == -1) { gentleHeaderTarget = i; // Offset the target if there are other headers before this that will be @@ -474,12 +475,11 @@ public class NotificationSectionsManager implements StackScrollAlgorithm.Section } mLogger.logStr("New header target positions:"); - - mLogger.logPosition(incomingHeaderTarget, "INCOMING HEADER"); - mLogger.logPosition(mediaControlsTarget, "MEDIA CONTROLS"); - mLogger.logPosition(peopleHeaderTarget, "CONVERSATIONS HEADER"); - mLogger.logPosition(alertingHeaderTarget, "ALERTING HEADER"); - mLogger.logPosition(gentleHeaderTarget, "SILENT HEADER"); + mLogger.logIncomingHeader(incomingHeaderTarget); + mLogger.logMediaControls(mediaControlsTarget); + mLogger.logConversationsHeader(peopleHeaderTarget); + mLogger.logAlertingHeader(alertingHeaderTarget); + mLogger.logSilentHeader(gentleHeaderTarget); // Add headers in reverse order to preserve indices adjustHeaderVisibilityAndPosition( @@ -492,11 +492,8 @@ public class NotificationSectionsManager implements StackScrollAlgorithm.Section adjustHeaderVisibilityAndPosition(incomingHeaderTarget, mIncomingHeader, currentIncomingHeaderIdx); - mLogger.logStr("Final order:"); - logShadeContents(); - mLogger.logStr("Section boundary update complete"); // Update headers to reflect state of section contents