Merge "Add additional debug logging to sections manager" into rvc-dev am: 1dabe0e620

Change-Id: If228d53c4624c38e2f22110bd9c49de237bdf49d
This commit is contained in:
TreeHugger Robot
2020-05-15 20:49:16 +00:00
committed by Automerger Merge Worker
2 changed files with 48 additions and 34 deletions

View File

@@ -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" }
)
}
}

View File

@@ -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