Merge changes Id9f50e84,I4d7f0497 into tm-qpr-dev

* changes:
  Improve logging in NotifCollection for when ending the LifetimeExtender fails or might fail.
  Improve dumps/logs to diagnose mis-ordered group children
This commit is contained in:
Jeff DeCew
2022-05-23 18:31:19 +00:00
committed by Android (Google) Code Review
4 changed files with 36 additions and 10 deletions

View File

@@ -121,6 +121,12 @@ public class ListDumper {
sb.append(" (parent=")
.append(entry.getParent() != null ? entry.getParent().getKey() : null)
.append(")");
NotificationEntry notifEntry = entry.getRepresentativeEntry();
if (notifEntry != null) {
sb.append(" rank=")
.append(notifEntry.getRanking().getRank());
}
}
if (entry.getSection() != null) {

View File

@@ -609,12 +609,21 @@ public class NotifCollection implements Dumpable {
}
checkForReentrantCall();
NotificationEntry collectionEntry = getEntry(entry.getKey());
String logKey = logKey(entry);
String collectionEntryIs = collectionEntry == null ? "null"
: entry == collectionEntry ? "same" : "different";
if (entry != collectionEntry) {
// TODO: We should probably make this throw, but that's too risky right now
mLogger.logEntryBeingExtendedNotInCollection(entry, extender, collectionEntryIs);
}
if (!entry.mLifetimeExtenders.remove(extender)) {
throw mEulogizer.record(new IllegalStateException(
String.format(
"Cannot end lifetime extension for extender \"%s\" (%s)",
extender.getName(),
extender)));
String.format("Cannot end lifetime extension for extender \"%s\""
+ " of entry %s (collection entry is %s)",
extender.getName(), logKey, collectionEntryIs)));
}
mLogger.logLifetimeExtensionEnded(

View File

@@ -25,12 +25,9 @@ data class NotifSection(
val sectioner: NotifSectioner,
val index: Int
) {
val label: String
get() = "Section($index, $bucket, \"${sectioner.name}\")"
@PriorityBucket
val bucket: Int = sectioner.bucket
val label: String = "$index:$bucket:${sectioner.name}"
val headerController: NodeController? = sectioner.headerNodeController
val comparator: NotifComparator? = sectioner.comparator
@PriorityBucket val bucket: Int = sectioner.bucket
}

View File

@@ -248,6 +248,20 @@ class NotifCollectionLogger @Inject constructor(
})
}
fun logEntryBeingExtendedNotInCollection(
entry: NotificationEntry,
extender: NotifLifetimeExtender,
collectionEntryIs: String
) {
buffer.log(TAG, WARNING, {
str1 = entry.logKey
str2 = extender.name
str3 = collectionEntryIs
}, {
"While ending lifetime extension by $str2 of $str1, entry in collection is $str3"
})
}
fun logFutureDismissalReused(dismissal: FutureDismissal) {
buffer.log(TAG, INFO, {
str1 = dismissal.label