Improve logging in NotifCollection for when ending the LifetimeExtender fails or might fail.
Bug: 227254780 Test: atest NotifCollectionTest Change-Id: Id9f50e84831a6f8cb2fa3ce6b8d1d200aebc9a06
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user