Merge "Add additional debug logging to sections manager" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
1dabe0e620
@@ -36,14 +36,31 @@ class NotificationSectionsLogger @Inject constructor(
|
|||||||
{ "Updating section boundaries: $reason" }
|
{ "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,
|
TAG,
|
||||||
LogLevel.DEBUG,
|
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,
|
TAG,
|
||||||
LogLevel.DEBUG,
|
LogLevel.DEBUG,
|
||||||
{
|
{
|
||||||
@@ -52,4 +69,4 @@ class NotificationSectionsLogger @Inject constructor(
|
|||||||
},
|
},
|
||||||
{ "$int1: $str1" }
|
{ "$int1: $str1" }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -255,44 +255,44 @@ public class NotificationSectionsManager implements StackScrollAlgorithm.Section
|
|||||||
for (int i = 0; i < childCount; i++) {
|
for (int i = 0; i < childCount; i++) {
|
||||||
View child = mParent.getChildAt(i);
|
View child = mParent.getChildAt(i);
|
||||||
if (child == mIncomingHeader) {
|
if (child == mIncomingHeader) {
|
||||||
mLogger.logPosition(i, "INCOMING HEADER");
|
mLogger.logIncomingHeader(i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (child == mMediaControlsView) {
|
if (child == mMediaControlsView) {
|
||||||
mLogger.logPosition(i, "MEDIA CONTROLS");
|
mLogger.logMediaControls(i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (child == mPeopleHubView) {
|
if (child == mPeopleHubView) {
|
||||||
mLogger.logPosition(i, "CONVERSATIONS HEADER");
|
mLogger.logConversationsHeader(i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (child == mAlertingHeader) {
|
if (child == mAlertingHeader) {
|
||||||
mLogger.logPosition(i, "ALERTING HEADER");
|
mLogger.logAlertingHeader(i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (child == mGentleHeader) {
|
if (child == mGentleHeader) {
|
||||||
mLogger.logPosition(i, "SILENT HEADER");
|
mLogger.logSilentHeader(i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(child instanceof ExpandableNotificationRow)) {
|
if (!(child instanceof ExpandableNotificationRow)) {
|
||||||
mLogger.logPosition(i, "other:" + child.getClass().getName());
|
mLogger.logOther(i, child.getClass());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ExpandableNotificationRow row = (ExpandableNotificationRow) child;
|
ExpandableNotificationRow row = (ExpandableNotificationRow) child;
|
||||||
// Once we enter a new section, calculate the target position for the header.
|
// Once we enter a new section, calculate the target position for the header.
|
||||||
switch (row.getEntry().getBucket()) {
|
switch (row.getEntry().getBucket()) {
|
||||||
case BUCKET_HEADS_UP:
|
case BUCKET_HEADS_UP:
|
||||||
mLogger.logPosition(i, "Heads Up");
|
mLogger.logHeadsUp(i);
|
||||||
break;
|
break;
|
||||||
case BUCKET_PEOPLE:
|
case BUCKET_PEOPLE:
|
||||||
mLogger.logPosition(i, "Conversation");
|
mLogger.logConversation(i);
|
||||||
break;
|
break;
|
||||||
case BUCKET_ALERTING:
|
case BUCKET_ALERTING:
|
||||||
mLogger.logPosition(i, "Alerting");
|
mLogger.logAlerting(i);
|
||||||
break;
|
break;
|
||||||
case BUCKET_SILENT:
|
case BUCKET_SILENT:
|
||||||
mLogger.logPosition(i, "Silent");
|
mLogger.logSilent(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -345,33 +345,33 @@ public class NotificationSectionsManager implements StackScrollAlgorithm.Section
|
|||||||
|
|
||||||
// Track the existing positions of the headers
|
// Track the existing positions of the headers
|
||||||
if (child == mIncomingHeader) {
|
if (child == mIncomingHeader) {
|
||||||
mLogger.logPosition(i, "INCOMING HEADER");
|
mLogger.logIncomingHeader(i);
|
||||||
currentIncomingHeaderIdx = i;
|
currentIncomingHeaderIdx = i;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (child == mMediaControlsView) {
|
if (child == mMediaControlsView) {
|
||||||
mLogger.logPosition(i, "MEDIA CONTROLS");
|
mLogger.logMediaControls(i);
|
||||||
currentMediaControlsIdx = i;
|
currentMediaControlsIdx = i;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (child == mPeopleHubView) {
|
if (child == mPeopleHubView) {
|
||||||
mLogger.logPosition(i, "CONVERSATIONS HEADER");
|
mLogger.logConversationsHeader(i);
|
||||||
currentPeopleHeaderIdx = i;
|
currentPeopleHeaderIdx = i;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (child == mAlertingHeader) {
|
if (child == mAlertingHeader) {
|
||||||
mLogger.logPosition(i, "ALERTING HEADER");
|
mLogger.logAlertingHeader(i);
|
||||||
currentAlertingHeaderIdx = i;
|
currentAlertingHeaderIdx = i;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (child == mGentleHeader) {
|
if (child == mGentleHeader) {
|
||||||
mLogger.logPosition(i, "SILENT HEADER");
|
mLogger.logSilentHeader(i);
|
||||||
currentGentleHeaderIdx = i;
|
currentGentleHeaderIdx = i;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(child instanceof ExpandableNotificationRow)) {
|
if (!(child instanceof ExpandableNotificationRow)) {
|
||||||
mLogger.logPosition(i, "other");
|
mLogger.logOther(i, child.getClass());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
lastNotifIndex = i;
|
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.
|
// Once we enter a new section, calculate the target position for the header.
|
||||||
switch (row.getEntry().getBucket()) {
|
switch (row.getEntry().getBucket()) {
|
||||||
case BUCKET_HEADS_UP:
|
case BUCKET_HEADS_UP:
|
||||||
mLogger.logPosition(i, "Heads Up");
|
mLogger.logHeadsUp(i);
|
||||||
if (showHeaders && incomingHeaderTarget == -1) {
|
if (showHeaders && incomingHeaderTarget == -1) {
|
||||||
incomingHeaderTarget = i;
|
incomingHeaderTarget = i;
|
||||||
// Offset the target if there are other headers before this that will be
|
// Offset the target if there are other headers before this that will be
|
||||||
@@ -405,12 +405,13 @@ public class NotificationSectionsManager implements StackScrollAlgorithm.Section
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BUCKET_FOREGROUND_SERVICE:
|
case BUCKET_FOREGROUND_SERVICE:
|
||||||
|
mLogger.logForegroundService(i);
|
||||||
if (mediaControlsTarget != -1) {
|
if (mediaControlsTarget != -1) {
|
||||||
mediaControlsTarget++;
|
mediaControlsTarget++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BUCKET_PEOPLE:
|
case BUCKET_PEOPLE:
|
||||||
mLogger.logPosition(i, "Conversation");
|
mLogger.logConversation(i);
|
||||||
peopleNotifsPresent = true;
|
peopleNotifsPresent = true;
|
||||||
if (showHeaders && peopleHeaderTarget == -1) {
|
if (showHeaders && peopleHeaderTarget == -1) {
|
||||||
peopleHeaderTarget = i;
|
peopleHeaderTarget = i;
|
||||||
@@ -428,7 +429,7 @@ public class NotificationSectionsManager implements StackScrollAlgorithm.Section
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BUCKET_ALERTING:
|
case BUCKET_ALERTING:
|
||||||
mLogger.logPosition(i, "Alerting");
|
mLogger.logAlerting(i);
|
||||||
if (showHeaders && usingPeopleFiltering && alertingHeaderTarget == -1) {
|
if (showHeaders && usingPeopleFiltering && alertingHeaderTarget == -1) {
|
||||||
alertingHeaderTarget = i;
|
alertingHeaderTarget = i;
|
||||||
// Offset the target if there are other headers before this that will be
|
// Offset the target if there are other headers before this that will be
|
||||||
@@ -442,7 +443,7 @@ public class NotificationSectionsManager implements StackScrollAlgorithm.Section
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BUCKET_SILENT:
|
case BUCKET_SILENT:
|
||||||
mLogger.logPosition(i, "Silent");
|
mLogger.logSilent(i);
|
||||||
if (showHeaders && gentleHeaderTarget == -1) {
|
if (showHeaders && gentleHeaderTarget == -1) {
|
||||||
gentleHeaderTarget = i;
|
gentleHeaderTarget = i;
|
||||||
// Offset the target if there are other headers before this that will be
|
// 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.logStr("New header target positions:");
|
||||||
|
mLogger.logIncomingHeader(incomingHeaderTarget);
|
||||||
mLogger.logPosition(incomingHeaderTarget, "INCOMING HEADER");
|
mLogger.logMediaControls(mediaControlsTarget);
|
||||||
mLogger.logPosition(mediaControlsTarget, "MEDIA CONTROLS");
|
mLogger.logConversationsHeader(peopleHeaderTarget);
|
||||||
mLogger.logPosition(peopleHeaderTarget, "CONVERSATIONS HEADER");
|
mLogger.logAlertingHeader(alertingHeaderTarget);
|
||||||
mLogger.logPosition(alertingHeaderTarget, "ALERTING HEADER");
|
mLogger.logSilentHeader(gentleHeaderTarget);
|
||||||
mLogger.logPosition(gentleHeaderTarget, "SILENT HEADER");
|
|
||||||
|
|
||||||
// Add headers in reverse order to preserve indices
|
// Add headers in reverse order to preserve indices
|
||||||
adjustHeaderVisibilityAndPosition(
|
adjustHeaderVisibilityAndPosition(
|
||||||
@@ -492,11 +492,8 @@ public class NotificationSectionsManager implements StackScrollAlgorithm.Section
|
|||||||
adjustHeaderVisibilityAndPosition(incomingHeaderTarget, mIncomingHeader,
|
adjustHeaderVisibilityAndPosition(incomingHeaderTarget, mIncomingHeader,
|
||||||
currentIncomingHeaderIdx);
|
currentIncomingHeaderIdx);
|
||||||
|
|
||||||
|
|
||||||
mLogger.logStr("Final order:");
|
mLogger.logStr("Final order:");
|
||||||
|
|
||||||
logShadeContents();
|
logShadeContents();
|
||||||
|
|
||||||
mLogger.logStr("Section boundary update complete");
|
mLogger.logStr("Section boundary update complete");
|
||||||
|
|
||||||
// Update headers to reflect state of section contents
|
// Update headers to reflect state of section contents
|
||||||
|
|||||||
Reference in New Issue
Block a user