NotificationEntry logging improvements

* Pass the NotificationEntry to Loggers, rather than the SBN or key
* Use the logKey methods to ensure that notification keys with newlines are cleaned up
* This allows engineers to set NotificationUtils.INCLUDE_HASH_CODE_IN_LIST_ENTRY_LOG_KEY=true and detect instance changes from logs.

Bug: 224598080
Bug: 231337045
Bug: 236140753
Test: atest ShadeListBuilderTest NotifCollectionTest HeadsUpViewBinderTest HeadsUpManagerTest
Test: dumpsysui NotifLog NotifHeadsUpLog
Change-Id: I9324c50ffb3384e15c52d85bfe25afd637edd100
This commit is contained in:
Jeff DeCew
2022-05-02 19:16:46 +00:00
parent ecb49e9d87
commit 9f7587d1cb
24 changed files with 287 additions and 262 deletions

View File

@@ -66,7 +66,7 @@ public abstract class AlertingNotificationManager implements NotificationLifetim
* @param entry entry to show
*/
public void showNotification(@NonNull NotificationEntry entry) {
mLogger.logShowNotification(entry.getKey());
mLogger.logShowNotification(entry);
addAlertEntry(entry);
updateNotification(entry.getKey(), true /* alert */);
entry.setInterruption();
@@ -320,7 +320,7 @@ public abstract class AlertingNotificationManager implements NotificationLifetim
* @param updatePostTime whether or not to refresh the post time
*/
public void updateEntry(boolean updatePostTime) {
mLogger.logUpdateEntry(mEntry.getKey(), updatePostTime);
mLogger.logUpdateEntry(mEntry, updatePostTime);
long currentTime = mClock.currentTimeMillis();
mEarliestRemovaltime = currentTime + mMinimumDisplayTime;

View File

@@ -16,6 +16,7 @@
package com.android.systemui.statusbar.notification.collection;
import static com.android.systemui.statusbar.notification.NotificationUtils.logKey;
import static com.android.systemui.statusbar.notification.collection.NotifCollection.REASON_NOT_CANCELED;
import static com.android.systemui.statusbar.notification.collection.NotificationEntry.DismissState.NOT_DISMISSED;
@@ -52,7 +53,7 @@ public class ListDumper {
sb,
true,
includeRecordKeeping,
interactionTracker.hasUserInteractedWith(entry.getKey()));
interactionTracker.hasUserInteractedWith(logKey(entry)));
if (entry instanceof GroupEntry) {
GroupEntry ge = (GroupEntry) entry;
NotificationEntry summary = ge.getSummary();
@@ -63,7 +64,7 @@ public class ListDumper {
sb,
true,
includeRecordKeeping,
interactionTracker.hasUserInteractedWith(summary.getKey()));
interactionTracker.hasUserInteractedWith(logKey(summary)));
}
List<NotificationEntry> children = ge.getChildren();
for (int childIndex = 0; childIndex < children.size(); childIndex++) {
@@ -74,7 +75,7 @@ public class ListDumper {
sb,
true,
includeRecordKeeping,
interactionTracker.hasUserInteractedWith(child.getKey()));
interactionTracker.hasUserInteractedWith(logKey(child)));
}
}
}
@@ -116,11 +117,11 @@ public class ListDumper {
sb.append(indent)
.append("[").append(index).append("] ")
.append(index.length() == 1 ? " " : "")
.append(entry.getKey());
.append(logKey(entry));
if (includeParent) {
sb.append(" (parent=")
.append(entry.getParent() != null ? entry.getParent().getKey() : null)
.append(logKey(entry.getParent()))
.append(")");
NotificationEntry notifEntry = entry.getRepresentativeEntry();
@@ -185,8 +186,8 @@ public class ListDumper {
if (notifEntry.getAttachState().getSuppressedChanges().getParent() != null) {
rksb.append("suppressedParent=")
.append(notifEntry.getAttachState().getSuppressedChanges()
.getParent().getKey())
.append(logKey(notifEntry.getAttachState().getSuppressedChanges()
.getParent()))
.append(" ");
}

View File

@@ -267,13 +267,14 @@ public class NotifCollection implements Dumpable {
requireNonNull(stats);
NotificationEntry storedEntry = mNotificationSet.get(entry.getKey());
if (storedEntry == null) {
mLogger.logNonExistentNotifDismissed(entry.getKey());
mLogger.logNonExistentNotifDismissed(entry);
continue;
}
if (entry != storedEntry) {
throw mEulogizer.record(
new IllegalStateException("Invalid entry: "
+ "different stored and dismissed entries for " + entry.getKey()));
+ "different stored and dismissed entries for " + logKey(entry)
+ " stored=@" + Integer.toHexString(storedEntry.hashCode())));
}
if (entry.getDismissState() == DISMISSED) {
@@ -282,7 +283,7 @@ public class NotifCollection implements Dumpable {
updateDismissInterceptors(entry);
if (isDismissIntercepted(entry)) {
mLogger.logNotifDismissedIntercepted(entry.getKey());
mLogger.logNotifDismissedIntercepted(entry);
continue;
}
@@ -299,7 +300,7 @@ public class NotifCollection implements Dumpable {
stats.notificationVisibility);
} catch (RemoteException e) {
// system process is dead if we're here.
mLogger.logRemoteExceptionOnNotificationClear(entry.getKey(), e);
mLogger.logRemoteExceptionOnNotificationClear(entry, e);
}
}
}
@@ -342,7 +343,7 @@ public class NotifCollection implements Dumpable {
// interceptors the chance to filter the notification
updateDismissInterceptors(entry);
if (isDismissIntercepted(entry)) {
mLogger.logNotifClearAllDismissalIntercepted(entry.getKey());
mLogger.logNotifClearAllDismissalIntercepted(entry);
}
entries.remove(i);
}
@@ -363,7 +364,7 @@ public class NotifCollection implements Dumpable {
NotificationEntry entry = entries.get(i);
entry.setDismissState(DISMISSED);
mLogger.logNotifDismissed(entry.getKey());
mLogger.logNotifDismissed(entry);
if (isCanceled(entry)) {
canceledEntries.add(entry);
@@ -416,12 +417,12 @@ public class NotifCollection implements Dumpable {
int reason) {
Assert.isMainThread();
mLogger.logNotifRemoved(sbn.getKey(), reason);
mLogger.logNotifRemoved(sbn, reason);
final NotificationEntry entry = mNotificationSet.get(sbn.getKey());
if (entry == null) {
// TODO (b/160008901): Throw an exception here
mLogger.logNoNotificationToRemoveWithKey(sbn.getKey(), reason);
mLogger.logNoNotificationToRemoveWithKey(sbn, reason);
return;
}
@@ -464,7 +465,7 @@ public class NotifCollection implements Dumpable {
mEventQueue.add(new BindEntryEvent(entry, sbn));
mNotificationSet.put(sbn.getKey(), entry);
mLogger.logNotifPosted(sbn.getKey());
mLogger.logNotifPosted(entry);
mEventQueue.add(new EntryAddedEvent(entry));
} else {
@@ -483,7 +484,7 @@ public class NotifCollection implements Dumpable {
entry.setSbn(sbn);
mEventQueue.add(new BindEntryEvent(entry, sbn));
mLogger.logNotifUpdated(sbn.getKey());
mLogger.logNotifUpdated(entry);
mEventQueue.add(new EntryUpdatedEvent(entry, true /* fromSystem */));
}
}
@@ -498,12 +499,12 @@ public class NotifCollection implements Dumpable {
if (mNotificationSet.get(entry.getKey()) != entry) {
throw mEulogizer.record(
new IllegalStateException("No notification to remove with key "
+ entry.getKey()));
+ logKey(entry)));
}
if (!isCanceled(entry)) {
throw mEulogizer.record(
new IllegalStateException("Cannot remove notification " + entry.getKey()
new IllegalStateException("Cannot remove notification " + logKey(entry)
+ ": has not been marked for removal"));
}
@@ -514,7 +515,7 @@ public class NotifCollection implements Dumpable {
}
if (!isLifetimeExtended(entry)) {
mLogger.logNotifReleased(entry.getKey());
mLogger.logNotifReleased(entry);
mNotificationSet.remove(entry.getKey());
cancelDismissInterception(entry);
mEventQueue.add(new EntryRemovedEvent(entry, entry.mCancellationReason));
@@ -580,7 +581,7 @@ public class NotifCollection implements Dumpable {
}
}
} else {
mLogger.logRankingMissing(entry.getKey(), rankingMap);
mLogger.logRankingMissing(entry, rankingMap);
}
}
}
@@ -627,10 +628,7 @@ public class NotifCollection implements Dumpable {
extender.getName(), logKey, collectionEntryIs)));
}
mLogger.logLifetimeExtensionEnded(
entry.getKey(),
extender,
entry.mLifetimeExtenders.size());
mLogger.logLifetimeExtensionEnded(entry, extender, entry.mLifetimeExtenders.size());
if (!isLifetimeExtended(entry)) {
if (tryRemoveNotification(entry)) {
@@ -657,7 +655,7 @@ public class NotifCollection implements Dumpable {
mAmDispatchingToOtherCode = true;
for (NotifLifetimeExtender extender : mLifetimeExtenders) {
if (extender.maybeExtendLifetime(entry, entry.mCancellationReason)) {
mLogger.logLifetimeExtended(entry.getKey(), extender);
mLogger.logLifetimeExtended(entry, extender);
entry.mLifetimeExtenders.add(extender);
}
}
@@ -916,17 +914,17 @@ public class NotifCollection implements Dumpable {
// Make sure we have the notification to update
NotificationEntry entry = mNotificationSet.get(sbn.getKey());
if (entry == null) {
mLogger.logNotifInternalUpdateFailed(sbn.getKey(), name, reason);
mLogger.logNotifInternalUpdateFailed(sbn, name, reason);
return;
}
mLogger.logNotifInternalUpdate(sbn.getKey(), name, reason);
mLogger.logNotifInternalUpdate(entry, name, reason);
// First do the pieces of postNotification which are not about assuming the notification
// was sent by the app
entry.setSbn(sbn);
mEventQueue.add(new BindEntryEvent(entry, sbn));
mLogger.logNotifUpdated(sbn.getKey());
mLogger.logNotifUpdated(entry);
mEventQueue.add(new EntryUpdatedEvent(entry, false /* fromSystem */));
// Skip the applyRanking step and go straight to dispatching the events

View File

@@ -579,11 +579,7 @@ public class ShadeListBuilder implements Dumpable {
if (existingSummary == null) {
group.setSummary(entry);
} else {
mLogger.logDuplicateSummary(
mIterationCount,
group.getKey(),
existingSummary.getKey(),
entry.getKey());
mLogger.logDuplicateSummary(mIterationCount, group, existingSummary, entry);
// Use whichever one was posted most recently
if (entry.getSbn().getPostTime()
@@ -1070,7 +1066,7 @@ public class ShadeListBuilder implements Dumpable {
if (!Objects.equals(curr, prev)) {
mLogger.logEntryAttachStateChanged(
mIterationCount,
entry.getKey(),
entry,
prev.getParent(),
curr.getParent());

View File

@@ -360,13 +360,13 @@ public class PreparationCoordinator implements Coordinator {
}
private void abortInflation(NotificationEntry entry, String reason) {
mLogger.logInflationAborted(entry.getKey(), reason);
mLogger.logInflationAborted(entry, reason);
mNotifInflater.abortInflation(entry);
mInflatingNotifs.remove(entry);
}
private void onInflationFinished(NotificationEntry entry, NotifViewController controller) {
mLogger.logNotifInflated(entry.getKey());
mLogger.logNotifInflated(entry);
mInflatingNotifs.remove(entry);
mViewBarn.registerViewForEntry(entry, controller);
mInflationStates.put(entry, STATE_INFLATED);
@@ -398,20 +398,20 @@ public class PreparationCoordinator implements Coordinator {
return false;
}
if (isBeyondGroupInitializationWindow(group, now)) {
mLogger.logGroupInflationTookTooLong(group.getKey());
mLogger.logGroupInflationTookTooLong(group);
return false;
}
if (mInflatingNotifs.contains(group.getSummary())) {
mLogger.logDelayingGroupRelease(group.getKey(), group.getSummary().getKey());
mLogger.logDelayingGroupRelease(group, group.getSummary());
return true;
}
for (NotificationEntry child : group.getChildren()) {
if (mInflatingNotifs.contains(child) && !child.wasAttachedInPreviousPass()) {
mLogger.logDelayingGroupRelease(group.getKey(), child.getKey());
mLogger.logDelayingGroupRelease(group, child);
return true;
}
}
mLogger.logDoneWaitingForGroupInflation(group.getKey());
mLogger.logDoneWaitingForGroupInflation(group);
return false;
}

View File

@@ -19,48 +19,51 @@ package com.android.systemui.statusbar.notification.collection.coordinator
import com.android.systemui.log.LogBuffer
import com.android.systemui.log.LogLevel
import com.android.systemui.log.dagger.NotificationLog
import com.android.systemui.statusbar.notification.collection.GroupEntry
import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.logKey
import javax.inject.Inject
class PreparationCoordinatorLogger @Inject constructor(
@NotificationLog private val buffer: LogBuffer
) {
fun logNotifInflated(key: String) {
fun logNotifInflated(entry: NotificationEntry) {
buffer.log(TAG, LogLevel.DEBUG, {
str1 = key
str1 = entry.logKey
}, {
"NOTIF INFLATED $str1"
})
}
fun logInflationAborted(key: String, reason: String) {
fun logInflationAborted(entry: NotificationEntry, reason: String) {
buffer.log(TAG, LogLevel.DEBUG, {
str1 = key
str1 = entry.logKey
str2 = reason
}, {
"NOTIF INFLATION ABORTED $str1 reason=$str2"
})
}
fun logDoneWaitingForGroupInflation(groupKey: String) {
fun logDoneWaitingForGroupInflation(group: GroupEntry) {
buffer.log(TAG, LogLevel.DEBUG, {
str1 = groupKey
str1 = group.logKey
}, {
"Finished inflating all members of group $str1, releasing group"
})
}
fun logGroupInflationTookTooLong(groupKey: String) {
fun logGroupInflationTookTooLong(group: GroupEntry) {
buffer.log(TAG, LogLevel.WARNING, {
str1 = groupKey
str1 = group.logKey
}, {
"Group inflation took too long for $str1, releasing children early"
})
}
fun logDelayingGroupRelease(groupKey: String, childKey: String) {
fun logDelayingGroupRelease(group: GroupEntry, child: NotificationEntry) {
buffer.log(TAG, LogLevel.DEBUG, {
str1 = groupKey
str2 = childKey
str1 = group.logKey
str2 = child.logKey
}, {
"Delaying release of group $str1 because child $str2 is still inflating"
})

View File

@@ -23,8 +23,10 @@ import com.android.systemui.log.LogLevel.WARNING
import com.android.systemui.log.dagger.NotificationLog
import com.android.systemui.statusbar.notification.collection.GroupEntry
import com.android.systemui.statusbar.notification.collection.ListEntry
import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.collection.listbuilder.pluggable.NotifFilter
import com.android.systemui.statusbar.notification.collection.listbuilder.pluggable.NotifPromoter
import com.android.systemui.statusbar.notification.logKey
import javax.inject.Inject
class ShadeListBuilderLogger @Inject constructor(
@@ -110,12 +112,17 @@ class ShadeListBuilderLogger @Inject constructor(
})
}
fun logDuplicateSummary(buildId: Int, groupKey: String, existingKey: String, newKey: String) {
fun logDuplicateSummary(
buildId: Int,
group: GroupEntry,
existingSummary: NotificationEntry,
newSummary: NotificationEntry
) {
buffer.log(TAG, WARNING, {
long1 = buildId.toLong()
str1 = groupKey
str2 = existingKey
str3 = newKey
str1 = group.logKey
str2 = existingSummary.logKey
str3 = newSummary.logKey
}, {
"""(Build $long1) Duplicate summary for group "$str1": "$str2" vs. "$str3""""
})
@@ -124,7 +131,7 @@ class ShadeListBuilderLogger @Inject constructor(
fun logDuplicateTopLevelKey(buildId: Int, topLevelKey: String) {
buffer.log(TAG, WARNING, {
long1 = buildId.toLong()
str1 = topLevelKey
str1 = logKey(topLevelKey)
}, {
"(Build $long1) Duplicate top-level key: $str1"
})
@@ -132,15 +139,15 @@ class ShadeListBuilderLogger @Inject constructor(
fun logEntryAttachStateChanged(
buildId: Int,
key: String,
entry: ListEntry,
prevParent: GroupEntry?,
newParent: GroupEntry?
) {
buffer.log(TAG, INFO, {
long1 = buildId.toLong()
str1 = key
str2 = prevParent?.key
str3 = newParent?.key
str1 = entry.logKey
str2 = prevParent?.logKey
str3 = newParent?.logKey
}, {
val action = if (str2 == null && str3 != null) {
@@ -160,8 +167,8 @@ class ShadeListBuilderLogger @Inject constructor(
fun logParentChanged(buildId: Int, prevParent: GroupEntry?, newParent: GroupEntry?) {
buffer.log(TAG, INFO, {
long1 = buildId.toLong()
str1 = prevParent?.key
str2 = newParent?.key
str1 = prevParent?.logKey
str2 = newParent?.logKey
}, {
if (str1 == null && str2 != null) {
"(Build $long1) Parent is {$str2}"
@@ -180,8 +187,8 @@ class ShadeListBuilderLogger @Inject constructor(
) {
buffer.log(TAG, INFO, {
long1 = buildId.toLong()
str1 = suppressedParent?.key
str2 = keepingParent?.key
str1 = suppressedParent?.logKey
str2 = keepingParent?.logKey
}, {
"(Build $long1) Change of parent to '$str1' suppressed; keeping parent '$str2'"
})
@@ -193,7 +200,7 @@ class ShadeListBuilderLogger @Inject constructor(
) {
buffer.log(TAG, INFO, {
long1 = buildId.toLong()
str1 = keepingParent?.key
str1 = keepingParent?.logKey
}, {
"(Build $long1) Group pruning suppressed; keeping parent '$str1'"
})
@@ -281,7 +288,7 @@ class ShadeListBuilderLogger @Inject constructor(
val entry = entries[i]
buffer.log(TAG, DEBUG, {
int1 = i
str1 = entry.key
str1 = entry.logKey
}, {
"[$int1] $str1"
})
@@ -289,7 +296,7 @@ class ShadeListBuilderLogger @Inject constructor(
if (entry is GroupEntry) {
entry.summary?.let {
buffer.log(TAG, DEBUG, {
str1 = it.key
str1 = it.logKey
}, {
" [*] $str1 (summary)"
})
@@ -298,7 +305,7 @@ class ShadeListBuilderLogger @Inject constructor(
val child = entry.children[j]
buffer.log(TAG, DEBUG, {
int1 = j
str1 = child.key
str1 = child.logKey
}, {
" [$int1] $str1"
})
@@ -308,7 +315,7 @@ class ShadeListBuilderLogger @Inject constructor(
}
fun logPipelineRunSuppressed() =
buffer.log(TAG, INFO, {}) { "Suppressing pipeline run during animation." }
buffer.log(TAG, INFO, {}) { "Suppressing pipeline run during animation." }
}
private const val TAG = "ShadeListBuilder"

View File

@@ -19,6 +19,7 @@ package com.android.systemui.statusbar.notification.collection.notifcollection
import android.os.RemoteException
import android.service.notification.NotificationListenerService
import android.service.notification.NotificationListenerService.RankingMap
import android.service.notification.StatusBarNotification
import com.android.systemui.log.LogBuffer
import com.android.systemui.log.LogLevel.DEBUG
import com.android.systemui.log.LogLevel.ERROR
@@ -65,9 +66,9 @@ fun cancellationReasonDebugString(@CancellationReason reason: Int) =
class NotifCollectionLogger @Inject constructor(
@NotificationLog private val buffer: LogBuffer
) {
fun logNotifPosted(key: String) {
fun logNotifPosted(entry: NotificationEntry) {
buffer.log(TAG, INFO, {
str1 = key
str1 = entry.logKey
}, {
"POSTED $str1"
})
@@ -75,49 +76,49 @@ class NotifCollectionLogger @Inject constructor(
fun logNotifGroupPosted(groupKey: String, batchSize: Int) {
buffer.log(TAG, INFO, {
str1 = groupKey
str1 = logKey(groupKey)
int1 = batchSize
}, {
"POSTED GROUP $str1 ($int1 events)"
})
}
fun logNotifUpdated(key: String) {
fun logNotifUpdated(entry: NotificationEntry) {
buffer.log(TAG, INFO, {
str1 = key
str1 = entry.logKey
}, {
"UPDATED $str1"
})
}
fun logNotifRemoved(key: String, @CancellationReason reason: Int) {
fun logNotifRemoved(sbn: StatusBarNotification, @CancellationReason reason: Int) {
buffer.log(TAG, INFO, {
str1 = key
str1 = sbn.logKey
int1 = reason
}, {
"REMOVED $str1 reason=${cancellationReasonDebugString(int1)}"
})
}
fun logNotifReleased(key: String) {
fun logNotifReleased(entry: NotificationEntry) {
buffer.log(TAG, INFO, {
str1 = key
str1 = entry.logKey
}, {
"RELEASED $str1"
})
}
fun logNotifDismissed(key: String) {
fun logNotifDismissed(entry: NotificationEntry) {
buffer.log(TAG, INFO, {
str1 = key
str1 = entry.logKey
}, {
"DISMISSED $str1"
})
}
fun logNonExistentNotifDismissed(key: String) {
fun logNonExistentNotifDismissed(entry: NotificationEntry) {
buffer.log(TAG, INFO, {
str1 = key
str1 = entry.logKey
}, {
"DISMISSED Non Existent $str1"
})
@@ -125,7 +126,7 @@ class NotifCollectionLogger @Inject constructor(
fun logChildDismissed(entry: NotificationEntry) {
buffer.log(TAG, DEBUG, {
str1 = entry.key
str1 = entry.logKey
}, {
"CHILD DISMISSED (inferred): $str1"
})
@@ -141,31 +142,31 @@ class NotifCollectionLogger @Inject constructor(
fun logDismissOnAlreadyCanceledEntry(entry: NotificationEntry) {
buffer.log(TAG, DEBUG, {
str1 = entry.key
str1 = entry.logKey
}, {
"Dismiss on $str1, which was already canceled. Trying to remove..."
})
}
fun logNotifDismissedIntercepted(key: String) {
fun logNotifDismissedIntercepted(entry: NotificationEntry) {
buffer.log(TAG, INFO, {
str1 = key
str1 = entry.logKey
}, {
"DISMISS INTERCEPTED $str1"
})
}
fun logNotifClearAllDismissalIntercepted(key: String) {
fun logNotifClearAllDismissalIntercepted(entry: NotificationEntry) {
buffer.log(TAG, INFO, {
str1 = key
str1 = entry.logKey
}, {
"CLEAR ALL DISMISSAL INTERCEPTED $str1"
})
}
fun logNotifInternalUpdate(key: String, name: String, reason: String) {
fun logNotifInternalUpdate(entry: NotificationEntry, name: String, reason: String) {
buffer.log(TAG, INFO, {
str1 = key
str1 = entry.logKey
str2 = name
str3 = reason
}, {
@@ -173,9 +174,9 @@ class NotifCollectionLogger @Inject constructor(
})
}
fun logNotifInternalUpdateFailed(key: String, name: String, reason: String) {
fun logNotifInternalUpdateFailed(sbn: StatusBarNotification, name: String, reason: String) {
buffer.log(TAG, INFO, {
str1 = key
str1 = sbn.logKey
str2 = name
str3 = reason
}, {
@@ -183,26 +184,33 @@ class NotifCollectionLogger @Inject constructor(
})
}
fun logNoNotificationToRemoveWithKey(key: String, @CancellationReason reason: Int) {
fun logNoNotificationToRemoveWithKey(
sbn: StatusBarNotification,
@CancellationReason reason: Int
) {
buffer.log(TAG, ERROR, {
str1 = key
str1 = sbn.logKey
int1 = reason
}, {
"No notification to remove with key $str1 reason=${cancellationReasonDebugString(int1)}"
})
}
fun logRankingMissing(key: String, rankingMap: RankingMap) {
buffer.log(TAG, WARNING, { str1 = key }, { "Ranking update is missing ranking for $str1" })
fun logRankingMissing(entry: NotificationEntry, rankingMap: RankingMap) {
buffer.log(TAG, WARNING, {
str1 = entry.logKey
}, {
"Ranking update is missing ranking for $str1"
})
buffer.log(TAG, DEBUG, {}, { "Ranking map contents:" })
for (entry in rankingMap.orderedKeys) {
buffer.log(TAG, DEBUG, { str1 = entry }, { " $str1" })
buffer.log(TAG, DEBUG, { str1 = logKey(entry) }, { " $str1" })
}
}
fun logRemoteExceptionOnNotificationClear(key: String, e: RemoteException) {
fun logRemoteExceptionOnNotificationClear(entry: NotificationEntry, e: RemoteException) {
buffer.log(TAG, WTF, {
str1 = key
str1 = entry.logKey
str2 = e.toString()
}, {
"RemoteException while attempting to clear $str1:\n$str2"
@@ -217,9 +225,9 @@ class NotifCollectionLogger @Inject constructor(
})
}
fun logLifetimeExtended(key: String, extender: NotifLifetimeExtender) {
fun logLifetimeExtended(entry: NotificationEntry, extender: NotifLifetimeExtender) {
buffer.log(TAG, INFO, {
str1 = key
str1 = entry.logKey
str2 = extender.name
}, {
"LIFETIME EXTENDED: $str1 by $str2"
@@ -227,12 +235,12 @@ class NotifCollectionLogger @Inject constructor(
}
fun logLifetimeExtensionEnded(
key: String,
entry: NotificationEntry,
extender: NotifLifetimeExtender,
totalExtenders: Int
) {
buffer.log(TAG, INFO, {
str1 = key
str1 = entry.logKey
str2 = extender.name
int1 = totalExtenders
}, {

View File

@@ -83,7 +83,7 @@ public class HeadsUpViewBinder {
params.setUseIncreasedHeadsUpHeight(useIncreasedHeadsUp);
params.requireContentViews(FLAG_CONTENT_VIEW_HEADS_UP);
CancellationSignal signal = mStage.requestRebind(entry, en -> {
mLogger.entryBoundSuccessfully(entry.getKey());
mLogger.entryBoundSuccessfully(entry);
en.getRow().setUsesIncreasedHeadsUpHeight(params.useIncreasedHeadsUpHeight());
// requestRebing promises that if we called cancel before this callback would be
// invoked, then we will not enter this callback, and because we always cancel before
@@ -94,7 +94,7 @@ public class HeadsUpViewBinder {
}
});
abortBindCallback(entry);
mLogger.startBindingHun(entry.getKey());
mLogger.startBindingHun(entry);
mOngoingBindCallbacks.put(entry, signal);
}
@@ -105,7 +105,7 @@ public class HeadsUpViewBinder {
public void abortBindCallback(NotificationEntry entry) {
CancellationSignal ongoingBindCallback = mOngoingBindCallbacks.remove(entry);
if (ongoingBindCallback != null) {
mLogger.currentOngoingBindingAborted(entry.getKey());
mLogger.currentOngoingBindingAborted(entry);
ongoingBindCallback.cancel();
}
}
@@ -116,7 +116,7 @@ public class HeadsUpViewBinder {
public void unbindHeadsUpView(NotificationEntry entry) {
abortBindCallback(entry);
mStage.getStageParams(entry).markContentViewsFreeable(FLAG_CONTENT_VIEW_HEADS_UP);
mLogger.entryContentViewMarkedFreeable(entry.getKey());
mStage.requestRebind(entry, e -> mLogger.entryUnbound(e.getKey()));
mLogger.entryContentViewMarkedFreeable(entry);
mStage.requestRebind(entry, e -> mLogger.entryUnbound(e));
}
}

View File

@@ -3,44 +3,46 @@ package com.android.systemui.statusbar.notification.interruption
import com.android.systemui.log.LogBuffer
import com.android.systemui.log.LogLevel.INFO
import com.android.systemui.log.dagger.NotificationHeadsUpLog
import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.logKey
import javax.inject.Inject
class HeadsUpViewBinderLogger @Inject constructor(@NotificationHeadsUpLog val buffer: LogBuffer) {
fun startBindingHun(key: String) {
fun startBindingHun(entry: NotificationEntry) {
buffer.log(TAG, INFO, {
str1 = key
str1 = entry.logKey
}, {
"start binding heads up entry $str1 "
})
}
fun currentOngoingBindingAborted(key: String) {
fun currentOngoingBindingAborted(entry: NotificationEntry) {
buffer.log(TAG, INFO, {
str1 = key
str1 = entry.logKey
}, {
"aborted potential ongoing heads up entry binding $str1 "
})
}
fun entryBoundSuccessfully(key: String) {
fun entryBoundSuccessfully(entry: NotificationEntry) {
buffer.log(TAG, INFO, {
str1 = key
str1 = entry.logKey
}, {
"heads up entry bound successfully $str1 "
})
}
fun entryUnbound(key: String) {
fun entryUnbound(entry: NotificationEntry) {
buffer.log(TAG, INFO, {
str1 = key
str1 = entry.logKey
}, {
"heads up entry unbound successfully $str1 "
})
}
fun entryContentViewMarkedFreeable(key: String) {
fun entryContentViewMarkedFreeable(entry: NotificationEntry) {
buffer.log(TAG, INFO, {
str1 = key
str1 = entry.logKey
}, {
"start unbinding heads up entry $str1 "
})

View File

@@ -16,11 +16,12 @@
package com.android.systemui.statusbar.notification.interruption
import android.service.notification.StatusBarNotification
import com.android.systemui.log.LogBuffer
import com.android.systemui.log.LogLevel.DEBUG
import com.android.systemui.log.LogLevel.INFO
import com.android.systemui.log.dagger.NotificationInterruptLog
import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.logKey
import javax.inject.Inject
class NotificationInterruptLogger @Inject constructor(
@@ -41,17 +42,17 @@ class NotificationInterruptLogger @Inject constructor(
})
}
fun logNoBubbleNotAllowed(sbn: StatusBarNotification) {
fun logNoBubbleNotAllowed(entry: NotificationEntry) {
buffer.log(TAG, DEBUG, {
str1 = sbn.key
str1 = entry.logKey
}, {
"No bubble up: not allowed to bubble: $str1"
})
}
fun logNoBubbleNoMetadata(sbn: StatusBarNotification) {
fun logNoBubbleNoMetadata(entry: NotificationEntry) {
buffer.log(TAG, DEBUG, {
str1 = sbn.key
str1 = entry.logKey
}, {
"No bubble up: notification: $str1 doesn't have valid metadata"
})
@@ -64,89 +65,89 @@ class NotificationInterruptLogger @Inject constructor(
})
}
fun logNoHeadsUpPackageSnoozed(sbn: StatusBarNotification) {
fun logNoHeadsUpPackageSnoozed(entry: NotificationEntry) {
buffer.log(TAG, DEBUG, {
str1 = sbn.key
str1 = entry.logKey
}, {
"No alerting: snoozed package: $str1"
})
}
fun logNoHeadsUpAlreadyBubbled(sbn: StatusBarNotification) {
fun logNoHeadsUpAlreadyBubbled(entry: NotificationEntry) {
buffer.log(TAG, DEBUG, {
str1 = sbn.key
str1 = entry.logKey
}, {
"No heads up: in unlocked shade where notification is shown as a bubble: $str1"
})
}
fun logNoHeadsUpSuppressedByDnd(sbn: StatusBarNotification) {
fun logNoHeadsUpSuppressedByDnd(entry: NotificationEntry) {
buffer.log(TAG, DEBUG, {
str1 = sbn.key
str1 = entry.logKey
}, {
"No heads up: suppressed by DND: $str1"
})
}
fun logNoHeadsUpNotImportant(sbn: StatusBarNotification) {
fun logNoHeadsUpNotImportant(entry: NotificationEntry) {
buffer.log(TAG, DEBUG, {
str1 = sbn.key
str1 = entry.logKey
}, {
"No heads up: unimportant notification: $str1"
})
}
fun logNoHeadsUpNotInUse(sbn: StatusBarNotification) {
fun logNoHeadsUpNotInUse(entry: NotificationEntry) {
buffer.log(TAG, DEBUG, {
str1 = sbn.key
str1 = entry.logKey
}, {
"No heads up: not in use: $str1"
})
}
fun logNoHeadsUpSuppressedBy(
sbn: StatusBarNotification,
entry: NotificationEntry,
suppressor: NotificationInterruptSuppressor
) {
buffer.log(TAG, DEBUG, {
str1 = sbn.key
str1 = entry.logKey
str2 = suppressor.name
}, {
"No heads up: aborted by suppressor: $str2 sbnKey=$str1"
})
}
fun logHeadsUp(sbn: StatusBarNotification) {
fun logHeadsUp(entry: NotificationEntry) {
buffer.log(TAG, DEBUG, {
str1 = sbn.key
str1 = entry.logKey
}, {
"Heads up: $str1"
})
}
fun logNoAlertingFilteredOut(sbn: StatusBarNotification) {
fun logNoAlertingFilteredOut(entry: NotificationEntry) {
buffer.log(TAG, DEBUG, {
str1 = sbn.key
str1 = entry.logKey
}, {
"No alerting: filtered notification: $str1"
})
}
fun logNoAlertingGroupAlertBehavior(sbn: StatusBarNotification) {
fun logNoAlertingGroupAlertBehavior(entry: NotificationEntry) {
buffer.log(TAG, DEBUG, {
str1 = sbn.key
str1 = entry.logKey
}, {
"No alerting: suppressed due to group alert behavior: $str1"
})
}
fun logNoAlertingSuppressedBy(
sbn: StatusBarNotification,
entry: NotificationEntry,
suppressor: NotificationInterruptSuppressor,
awake: Boolean
) {
buffer.log(TAG, DEBUG, {
str1 = sbn.key
str1 = entry.logKey
str2 = suppressor.name
bool1 = awake
}, {
@@ -154,65 +155,65 @@ class NotificationInterruptLogger @Inject constructor(
})
}
fun logNoAlertingRecentFullscreen(sbn: StatusBarNotification) {
fun logNoAlertingRecentFullscreen(entry: NotificationEntry) {
buffer.log(TAG, DEBUG, {
str1 = sbn.key
str1 = entry.logKey
}, {
"No alerting: recent fullscreen: $str1"
})
}
fun logNoPulsingSettingDisabled(sbn: StatusBarNotification) {
fun logNoPulsingSettingDisabled(entry: NotificationEntry) {
buffer.log(TAG, DEBUG, {
str1 = sbn.key
str1 = entry.logKey
}, {
"No pulsing: disabled by setting: $str1"
})
}
fun logNoPulsingBatteryDisabled(sbn: StatusBarNotification) {
fun logNoPulsingBatteryDisabled(entry: NotificationEntry) {
buffer.log(TAG, DEBUG, {
str1 = sbn.key
str1 = entry.logKey
}, {
"No pulsing: disabled by battery saver: $str1"
})
}
fun logNoPulsingNoAlert(sbn: StatusBarNotification) {
fun logNoPulsingNoAlert(entry: NotificationEntry) {
buffer.log(TAG, DEBUG, {
str1 = sbn.key
str1 = entry.logKey
}, {
"No pulsing: notification shouldn't alert: $str1"
})
}
fun logNoPulsingNoAmbientEffect(sbn: StatusBarNotification) {
fun logNoPulsingNoAmbientEffect(entry: NotificationEntry) {
buffer.log(TAG, DEBUG, {
str1 = sbn.key
str1 = entry.logKey
}, {
"No pulsing: ambient effect suppressed: $str1"
})
}
fun logNoPulsingNotImportant(sbn: StatusBarNotification) {
fun logNoPulsingNotImportant(entry: NotificationEntry) {
buffer.log(TAG, DEBUG, {
str1 = sbn.key
str1 = entry.logKey
}, {
"No pulsing: not important enough: $str1"
})
}
fun logPulsing(sbn: StatusBarNotification) {
fun logPulsing(entry: NotificationEntry) {
buffer.log(TAG, DEBUG, {
str1 = sbn.key
str1 = entry.logKey
}, {
"Pulsing: $str1"
})
}
fun keyguardHideNotification(key: String) {
fun keyguardHideNotification(entry: NotificationEntry) {
buffer.log(TAG, DEBUG, {
str1 = key
str1 = entry.logKey
}, {
"Keyguard Hide Notification: $str1"
})

View File

@@ -147,14 +147,14 @@ public class NotificationInterruptStateProviderImpl implements NotificationInter
}
if (!entry.canBubble()) {
mLogger.logNoBubbleNotAllowed(sbn);
mLogger.logNoBubbleNotAllowed(entry);
return false;
}
if (entry.getBubbleMetadata() == null
|| (entry.getBubbleMetadata().getShortcutId() == null
&& entry.getBubbleMetadata().getIntent() == null)) {
mLogger.logNoBubbleNoMetadata(sbn);
mLogger.logNoBubbleNoMetadata(entry);
return false;
}
@@ -203,23 +203,23 @@ public class NotificationInterruptStateProviderImpl implements NotificationInter
}
if (isSnoozedPackage(sbn)) {
mLogger.logNoHeadsUpPackageSnoozed(sbn);
mLogger.logNoHeadsUpPackageSnoozed(entry);
return false;
}
boolean inShade = mStatusBarStateController.getState() == SHADE;
if (entry.isBubble() && inShade) {
mLogger.logNoHeadsUpAlreadyBubbled(sbn);
mLogger.logNoHeadsUpAlreadyBubbled(entry);
return false;
}
if (entry.shouldSuppressPeek()) {
mLogger.logNoHeadsUpSuppressedByDnd(sbn);
mLogger.logNoHeadsUpSuppressedByDnd(entry);
return false;
}
if (entry.getImportance() < NotificationManager.IMPORTANCE_HIGH) {
mLogger.logNoHeadsUpNotImportant(sbn);
mLogger.logNoHeadsUpNotImportant(entry);
return false;
}
@@ -232,17 +232,17 @@ public class NotificationInterruptStateProviderImpl implements NotificationInter
boolean inUse = mPowerManager.isScreenOn() && !isDreaming;
if (!inUse) {
mLogger.logNoHeadsUpNotInUse(sbn);
mLogger.logNoHeadsUpNotInUse(entry);
return false;
}
for (int i = 0; i < mSuppressors.size(); i++) {
if (mSuppressors.get(i).suppressAwakeHeadsUp(entry)) {
mLogger.logNoHeadsUpSuppressedBy(sbn, mSuppressors.get(i));
mLogger.logNoHeadsUpSuppressedBy(entry, mSuppressors.get(i));
return false;
}
}
mLogger.logHeadsUp(sbn);
mLogger.logHeadsUp(entry);
return true;
}
@@ -254,38 +254,36 @@ public class NotificationInterruptStateProviderImpl implements NotificationInter
* @return true if the entry should ambient pulse, false otherwise
*/
private boolean shouldHeadsUpWhenDozing(NotificationEntry entry) {
StatusBarNotification sbn = entry.getSbn();
if (!mAmbientDisplayConfiguration.pulseOnNotificationEnabled(UserHandle.USER_CURRENT)) {
mLogger.logNoPulsingSettingDisabled(sbn);
mLogger.logNoPulsingSettingDisabled(entry);
return false;
}
if (mBatteryController.isAodPowerSave()) {
mLogger.logNoPulsingBatteryDisabled(sbn);
mLogger.logNoPulsingBatteryDisabled(entry);
return false;
}
if (!canAlertCommon(entry)) {
mLogger.logNoPulsingNoAlert(sbn);
mLogger.logNoPulsingNoAlert(entry);
return false;
}
if (!canAlertHeadsUpCommon(entry)) {
mLogger.logNoPulsingNoAlert(sbn);
mLogger.logNoPulsingNoAlert(entry);
return false;
}
if (entry.shouldSuppressAmbient()) {
mLogger.logNoPulsingNoAmbientEffect(sbn);
mLogger.logNoPulsingNoAmbientEffect(entry);
return false;
}
if (entry.getImportance() < NotificationManager.IMPORTANCE_DEFAULT) {
mLogger.logNoPulsingNotImportant(sbn);
mLogger.logNoPulsingNotImportant(entry);
return false;
}
mLogger.logPulsing(sbn);
mLogger.logPulsing(entry);
return true;
}
@@ -296,22 +294,20 @@ public class NotificationInterruptStateProviderImpl implements NotificationInter
* @return true if these checks pass, false if the notification should not alert
*/
private boolean canAlertCommon(NotificationEntry entry) {
StatusBarNotification sbn = entry.getSbn();
if (!mFlags.isNewPipelineEnabled() && mNotificationFilter.shouldFilterOut(entry)) {
mLogger.logNoAlertingFilteredOut(sbn);
mLogger.logNoAlertingFilteredOut(entry);
return false;
}
for (int i = 0; i < mSuppressors.size(); i++) {
if (mSuppressors.get(i).suppressInterruptions(entry)) {
mLogger.logNoAlertingSuppressedBy(sbn, mSuppressors.get(i), /* awake */ false);
mLogger.logNoAlertingSuppressedBy(entry, mSuppressors.get(i), /* awake */ false);
return false;
}
}
if (mKeyguardNotificationVisibilityProvider.shouldHideNotification(entry)) {
mLogger.keyguardHideNotification(entry.getKey());
mLogger.keyguardHideNotification(entry);
return false;
}
@@ -329,12 +325,12 @@ public class NotificationInterruptStateProviderImpl implements NotificationInter
// Don't alert notifications that are suppressed due to group alert behavior
if (sbn.isGroup() && sbn.getNotification().suppressAlertingDueToGrouping()) {
mLogger.logNoAlertingGroupAlertBehavior(sbn);
mLogger.logNoAlertingGroupAlertBehavior(entry);
return false;
}
if (entry.hasJustLaunchedFullScreenIntent()) {
mLogger.logNoAlertingRecentFullscreen(sbn);
mLogger.logNoAlertingRecentFullscreen(entry);
return false;
}
@@ -352,7 +348,7 @@ public class NotificationInterruptStateProviderImpl implements NotificationInter
for (int i = 0; i < mSuppressors.size(); i++) {
if (mSuppressors.get(i).suppressAwakeInterruptions(entry)) {
mLogger.logNoAlertingSuppressedBy(sbn, mSuppressors.get(i), /* awake */ true);
mLogger.logNoAlertingSuppressedBy(entry, mSuppressors.get(i), /* awake */ true);
return false;
}
}

View File

@@ -19,6 +19,7 @@ package com.android.systemui.statusbar.notification.row;
import static com.android.systemui.Dependency.ALLOW_NOTIFICATION_LONG_PRESS_NAME;
import static com.android.systemui.statusbar.NotificationRemoteInputManager.ENABLE_REMOTE_INPUT;
import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;
import static com.android.systemui.statusbar.notification.NotificationUtils.logKey;
import android.util.Log;
import android.view.View;
@@ -247,7 +248,7 @@ public class ExpandableNotificationRowController implements NotifViewController
@Override
@NonNull
public String getNodeLabel() {
return mView.getEntry().getKey();
return logKey(mView.getEntry());
}
@Override

View File

@@ -112,7 +112,8 @@ public final class NotifBindPipeline {
public void manageRow(
@NonNull NotificationEntry entry,
@NonNull ExpandableNotificationRow row) {
mLogger.logManagedRow(entry.getKey());
mLogger.logManagedRow(entry);
mLogger.logManagedRow(entry);
final BindEntry bindEntry = getBindEntry(entry);
if (bindEntry == null) {
@@ -154,12 +155,12 @@ public final class NotifBindPipeline {
* the real work once rather than repeatedly start and cancel it.
*/
private void requestPipelineRun(NotificationEntry entry) {
mLogger.logRequestPipelineRun(entry.getKey());
mLogger.logRequestPipelineRun(entry);
final BindEntry bindEntry = getBindEntry(entry);
if (bindEntry.row == null) {
// Row is not managed yet but may be soon. Stop for now.
mLogger.logRequestPipelineRowNotSet(entry.getKey());
mLogger.logRequestPipelineRowNotSet(entry);
return;
}
@@ -177,7 +178,7 @@ public final class NotifBindPipeline {
* callbacks when the run finishes. If a run is already in progress, it is restarted.
*/
private void startPipeline(NotificationEntry entry) {
mLogger.logStartPipeline(entry.getKey());
mLogger.logStartPipeline(entry);
if (mStage == null) {
throw new IllegalStateException("No stage was ever set on the pipeline");
@@ -193,7 +194,7 @@ public final class NotifBindPipeline {
final BindEntry bindEntry = getBindEntry(entry);
final Set<BindCallback> callbacks = bindEntry.callbacks;
mLogger.logFinishedPipeline(entry.getKey(), callbacks.size());
mLogger.logFinishedPipeline(entry, callbacks.size());
bindEntry.invalidated = false;
// Move all callbacks to separate list as callbacks may themselves add/remove callbacks.

View File

@@ -19,6 +19,8 @@ package com.android.systemui.statusbar.notification.row
import com.android.systemui.log.LogBuffer
import com.android.systemui.log.LogLevel.INFO
import com.android.systemui.log.dagger.NotificationLog
import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.logKey
import javax.inject.Inject
class NotifBindPipelineLogger @Inject constructor(
@@ -32,41 +34,41 @@ class NotifBindPipelineLogger @Inject constructor(
})
}
fun logManagedRow(notifKey: String) {
fun logManagedRow(entry: NotificationEntry) {
buffer.log(TAG, INFO, {
str1 = notifKey
str1 = entry.logKey
}, {
"Row set for notif: $str1"
})
}
fun logRequestPipelineRun(notifKey: String) {
fun logRequestPipelineRun(entry: NotificationEntry) {
buffer.log(TAG, INFO, {
str1 = notifKey
str1 = entry.logKey
}, {
"Request pipeline run for notif: $str1"
})
}
fun logRequestPipelineRowNotSet(notifKey: String) {
fun logRequestPipelineRowNotSet(entry: NotificationEntry) {
buffer.log(TAG, INFO, {
str1 = notifKey
str1 = entry.logKey
}, {
"Row is not set so pipeline will not run. notif = $str1"
})
}
fun logStartPipeline(notifKey: String) {
fun logStartPipeline(entry: NotificationEntry) {
buffer.log(TAG, INFO, {
str1 = notifKey
str1 = entry.logKey
}, {
"Start pipeline for notif: $str1"
})
}
fun logFinishedPipeline(notifKey: String, numCallbacks: Int) {
fun logFinishedPipeline(entry: NotificationEntry, numCallbacks: Int) {
buffer.log(TAG, INFO, {
str1 = notifKey
str1 = entry.logKey
int1 = numCallbacks
}, {
"Finished pipeline for notif $str1 with $int1 callbacks"

View File

@@ -57,7 +57,7 @@ public class RowContentBindStage extends BindStage<RowContentBindParams> {
@NonNull StageCallback callback) {
RowContentBindParams params = getStageParams(entry);
mLogger.logStageParams(entry.getKey(), params.toString());
mLogger.logStageParams(entry, params);
// Resolve content to bind/unbind.
@InflationFlag int inflationFlags = params.getContentViews();

View File

@@ -19,17 +19,19 @@ package com.android.systemui.statusbar.notification.row
import com.android.systemui.log.LogBuffer
import com.android.systemui.log.LogLevel.INFO
import com.android.systemui.log.dagger.NotificationLog
import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.logKey
import javax.inject.Inject
class RowContentBindStageLogger @Inject constructor(
@NotificationLog private val buffer: LogBuffer
) {
fun logStageParams(notifKey: String, stageParams: String) {
fun logStageParams(entry: NotificationEntry, stageParams: RowContentBindParams) {
buffer.log(TAG, INFO, {
str1 = notifKey
str2 = stageParams
str1 = entry.logKey
str2 = stageParams.toString()
}, {
"Invalidated notif $str1 with params: \n$str2"
"Invalidated notif $str1 with params: $str2"
})
}
}

View File

@@ -748,19 +748,20 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
}
}
private void logHunSkippedForUnexpectedState(String key, boolean expected, boolean actual) {
private void logHunSkippedForUnexpectedState(ExpandableNotificationRow enr,
boolean expected, boolean actual) {
if (mLogger == null) return;
mLogger.hunSkippedForUnexpectedState(key, expected, actual);
mLogger.hunSkippedForUnexpectedState(enr.getEntry(), expected, actual);
}
private void logHunAnimationSkipped(String key, String reason) {
private void logHunAnimationSkipped(ExpandableNotificationRow enr, String reason) {
if (mLogger == null) return;
mLogger.hunAnimationSkipped(key, reason);
mLogger.hunAnimationSkipped(enr.getEntry(), reason);
}
private void logHunAnimationEventAdded(String key, int type) {
private void logHunAnimationEventAdded(ExpandableNotificationRow enr, int type) {
if (mLogger == null) return;
mLogger.hunAnimationEventAdded(key, type);
mLogger.hunAnimationEventAdded(enr.getEntry(), type);
}
private void onDrawDebug(Canvas canvas) {
@@ -3174,7 +3175,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
if (isHeadsUp != row.isHeadsUp()) {
// For cases where we have a heads up showing and appearing again we shouldn't
// do the animations at all.
logHunSkippedForUnexpectedState(key, isHeadsUp, row.isHeadsUp());
logHunSkippedForUnexpectedState(row, isHeadsUp, row.isHeadsUp());
continue;
}
int type = AnimationEvent.ANIMATION_TYPE_HEADS_UP_OTHER;
@@ -3192,7 +3193,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
if (row.isChildInGroup()) {
// We can otherwise get stuck in there if it was just isolated
row.setHeadsUpAnimatingAway(false);
logHunAnimationSkipped(key, "row is child in group");
logHunAnimationSkipped(row, "row is child in group");
continue;
}
} else {
@@ -3200,7 +3201,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
if (viewState == null) {
// A view state was never generated for this view, so we don't need to animate
// this. This may happen with notification children.
logHunAnimationSkipped(key, "row has no viewState");
logHunAnimationSkipped(row, "row has no viewState");
continue;
}
if (isHeadsUp && (mAddedHeadsUpChildren.contains(row) || pinnedAndClosed)) {
@@ -3224,7 +3225,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
+ " onBottom=" + onBottom
+ " row=" + row.getEntry().getKey());
}
logHunAnimationEventAdded(key, type);
logHunAnimationEventAdded(row, type);
}
mHeadsUpChangeAnimations.clear();
mAddedHeadsUpChildren.clear();
@@ -4360,8 +4361,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
/**
* Update colors of "dismiss" and "empty shade" views.
*
* @param lightTheme True if light theme should be used.
*/
@ShadeViewRefactor(RefactorComponent.DECORATOR)
void updateDecorViews() {
@@ -4777,8 +4776,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
if (SPEW) {
Log.v(TAG, "generateHeadsUpAnimation: previous hun appear animation cancelled");
}
logHunAnimationSkipped(row.getEntry().getKey(),
"previous hun appear animation cancelled");
logHunAnimationSkipped(row, "previous hun appear animation cancelled");
return;
}
mHeadsUpChangeAnimations.add(new Pair<>(row, isHeadsUp));

View File

@@ -3,21 +3,27 @@ package com.android.systemui.statusbar.notification.stack
import com.android.systemui.log.LogBuffer
import com.android.systemui.log.LogLevel.INFO
import com.android.systemui.log.dagger.NotificationHeadsUpLog
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.AnimationEvent.*
import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.logKey
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_ADD
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_HEADS_UP_APPEAR
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_HEADS_UP_DISAPPEAR
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_HEADS_UP_DISAPPEAR_CLICK
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_HEADS_UP_OTHER
import javax.inject.Inject
class NotificationStackScrollLogger @Inject constructor(
@NotificationHeadsUpLog private val buffer: LogBuffer
) {
fun hunAnimationSkipped(key: String, reason: String) {
fun hunAnimationSkipped(entry: NotificationEntry, reason: String) {
buffer.log(TAG, INFO, {
str1 = key
str1 = entry.logKey
str2 = reason
}, {
"heads up animation skipped: key: $str1 reason: $str2"
})
}
fun hunAnimationEventAdded(key: String, type: Int) {
fun hunAnimationEventAdded(entry: NotificationEntry, type: Int) {
val reason: String
reason = if (type == ANIMATION_TYPE_HEADS_UP_DISAPPEAR) {
"HEADS_UP_DISAPPEAR"
@@ -33,16 +39,16 @@ class NotificationStackScrollLogger @Inject constructor(
type.toString()
}
buffer.log(TAG, INFO, {
str1 = key
str1 = entry.logKey
str2 = reason
}, {
"heads up animation added: $str1 with type $str2"
})
}
fun hunSkippedForUnexpectedState(key: String, expected: Boolean, actual: Boolean) {
fun hunSkippedForUnexpectedState(entry: NotificationEntry, expected: Boolean, actual: Boolean) {
buffer.log(TAG, INFO, {
str1 = key
str1 = entry.logKey
bool1 = expected
bool2 = actual
}, {

View File

@@ -3,6 +3,7 @@ package com.android.systemui.statusbar.notification.stack
import com.android.systemui.log.LogBuffer
import com.android.systemui.log.LogLevel
import com.android.systemui.log.dagger.NotificationHeadsUpLog
import com.android.systemui.statusbar.notification.logKey
import javax.inject.Inject
class StackStateLogger @Inject constructor(
@@ -10,7 +11,7 @@ class StackStateLogger @Inject constructor(
) {
fun logHUNViewDisappearing(key: String) {
buffer.log(TAG, LogLevel.INFO, {
str1 = key
str1 = logKey(key)
}, {
"Heads up view disappearing $str1 "
})
@@ -18,7 +19,7 @@ class StackStateLogger @Inject constructor(
fun logHUNViewAppearing(key: String) {
buffer.log(TAG, LogLevel.INFO, {
str1 = key
str1 = logKey(key)
}, {
"Heads up notification view appearing $str1 "
})
@@ -26,7 +27,7 @@ class StackStateLogger @Inject constructor(
fun logHUNViewDisappearingWithRemoveEvent(key: String) {
buffer.log(TAG, LogLevel.ERROR, {
str1 = key
str1 = logKey(key)
}, {
"Heads up view disappearing $str1 for ANIMATION_TYPE_REMOVE"
})
@@ -34,7 +35,7 @@ class StackStateLogger @Inject constructor(
fun logHUNViewAppearingWithAddEvent(key: String) {
buffer.log(TAG, LogLevel.ERROR, {
str1 = key
str1 = logKey(key)
}, {
"Heads up view disappearing $str1 for ANIMATION_TYPE_ADD"
})
@@ -42,7 +43,7 @@ class StackStateLogger @Inject constructor(
fun disappearAnimationEnded(key: String) {
buffer.log(TAG, LogLevel.INFO, {
str1 = key
str1 = logKey(key)
}, {
"Heads up notification disappear animation ended $str1 "
})
@@ -50,7 +51,7 @@ class StackStateLogger @Inject constructor(
fun appearAnimationEnded(key: String) {
buffer.log(TAG, LogLevel.INFO, {
str1 = key
str1 = logKey(key)
}, {
"Heads up notification appear animation ended $str1 "
})

View File

@@ -142,7 +142,7 @@ public abstract class HeadsUpManager extends AlertingNotificationManager {
protected void setEntryPinned(
@NonNull HeadsUpManager.HeadsUpEntry headsUpEntry, boolean isPinned) {
mLogger.logSetEntryPinned(headsUpEntry.mEntry.getKey(), isPinned);
mLogger.logSetEntryPinned(headsUpEntry.mEntry, isPinned);
NotificationEntry entry = headsUpEntry.mEntry;
if (entry.isRowPinned() != isPinned) {
entry.setRowPinned(isPinned);
@@ -183,7 +183,7 @@ public abstract class HeadsUpManager extends AlertingNotificationManager {
entry.setHeadsUp(false);
setEntryPinned((HeadsUpEntry) alertEntry, false /* isPinned */);
EventLogTags.writeSysuiHeadsUpStatus(entry.getKey(), 0 /* visible */);
mLogger.logNotificationActuallyRemoved(entry.getKey());
mLogger.logNotificationActuallyRemoved(entry);
for (OnHeadsUpChangedListener listener : mListeners) {
listener.onHeadsUpStateChanged(entry, false);
}

View File

@@ -20,6 +20,8 @@ import com.android.systemui.log.LogBuffer
import com.android.systemui.log.LogLevel.INFO
import com.android.systemui.log.LogLevel.VERBOSE
import com.android.systemui.log.dagger.NotificationHeadsUpLog
import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.logKey
import javax.inject.Inject
/** Logger for [HeadsUpManager]. */
@@ -56,9 +58,9 @@ class HeadsUpManagerLogger @Inject constructor(
})
}
fun logShowNotification(key: String) {
fun logShowNotification(entry: NotificationEntry) {
buffer.log(TAG, INFO, {
str1 = key
str1 = entry.logKey
}, {
"show notification $str1"
})
@@ -66,16 +68,16 @@ class HeadsUpManagerLogger @Inject constructor(
fun logRemoveNotification(key: String, releaseImmediately: Boolean) {
buffer.log(TAG, INFO, {
str1 = key
str1 = logKey(key)
bool1 = releaseImmediately
}, {
"remove notification $str1 releaseImmediately: $bool1"
})
}
fun logNotificationActuallyRemoved(key: String) {
fun logNotificationActuallyRemoved(entry: NotificationEntry) {
buffer.log(TAG, INFO, {
str1 = key
str1 = entry.logKey
}, {
"notification removed $str1 "
})
@@ -83,7 +85,7 @@ class HeadsUpManagerLogger @Inject constructor(
fun logUpdateNotification(key: String, alert: Boolean, hasEntry: Boolean) {
buffer.log(TAG, INFO, {
str1 = key
str1 = logKey(key)
bool1 = alert
bool2 = hasEntry
}, {
@@ -91,12 +93,12 @@ class HeadsUpManagerLogger @Inject constructor(
})
}
fun logUpdateEntry(key: String, updatePostTime: Boolean) {
fun logUpdateEntry(entry: NotificationEntry, updatePostTime: Boolean) {
buffer.log(TAG, INFO, {
str1 = key
str1 = entry.logKey
bool1 = updatePostTime
}, {
"update entry $key updatePostTime: $bool1"
"update entry $str1 updatePostTime: $bool1"
})
}
@@ -108,9 +110,9 @@ class HeadsUpManagerLogger @Inject constructor(
})
}
fun logSetEntryPinned(key: String, isPinned: Boolean) {
fun logSetEntryPinned(entry: NotificationEntry, isPinned: Boolean) {
buffer.log(TAG, VERBOSE, {
str1 = key
str1 = entry.logKey
bool1 = isPinned
}, {
"set entry pinned $str1 pinned: $bool1"

View File

@@ -72,32 +72,32 @@ public class HeadsUpViewBinderTest extends SysuiTestCase {
});
mViewBinder.bindHeadsUpView(mEntry, null);
verify(mLogger).startBindingHun(eq("key"));
verify(mLogger).startBindingHun(eq(mEntry));
verifyNoMoreInteractions(mLogger);
clearInvocations(mLogger);
callback.get().onBindFinished(mEntry);
verify(mLogger).entryBoundSuccessfully(eq("key"));
verify(mLogger).entryBoundSuccessfully(eq(mEntry));
verifyNoMoreInteractions(mLogger);
clearInvocations(mLogger);
mViewBinder.bindHeadsUpView(mEntry, null);
verify(mLogger).startBindingHun(eq("key"));
verify(mLogger).startBindingHun(eq(mEntry));
verifyNoMoreInteractions(mLogger);
clearInvocations(mLogger);
callback.get().onBindFinished(mEntry);
verify(mLogger).entryBoundSuccessfully(eq("key"));
verify(mLogger).entryBoundSuccessfully(eq(mEntry));
verifyNoMoreInteractions(mLogger);
clearInvocations(mLogger);
mViewBinder.unbindHeadsUpView(mEntry);
verify(mLogger).entryContentViewMarkedFreeable(eq("key"));
verify(mLogger).entryContentViewMarkedFreeable(eq(mEntry));
verifyNoMoreInteractions(mLogger);
clearInvocations(mLogger);
callback.get().onBindFinished(mEntry);
verify(mLogger).entryUnbound(eq("key"));
verify(mLogger).entryUnbound(eq(mEntry));
verifyNoMoreInteractions(mLogger);
clearInvocations(mLogger);
}
@@ -111,12 +111,12 @@ public class HeadsUpViewBinderTest extends SysuiTestCase {
});
mViewBinder.bindHeadsUpView(mEntry, null);
verify(mLogger).startBindingHun(eq("key"));
verify(mLogger).startBindingHun(eq(mEntry));
verifyNoMoreInteractions(mLogger);
clearInvocations(mLogger);
mViewBinder.abortBindCallback(mEntry);
verify(mLogger).currentOngoingBindingAborted(eq("key"));
verify(mLogger).currentOngoingBindingAborted(eq(mEntry));
verifyNoMoreInteractions(mLogger);
clearInvocations(mLogger);
@@ -135,18 +135,18 @@ public class HeadsUpViewBinderTest extends SysuiTestCase {
});
mViewBinder.bindHeadsUpView(mEntry, null);
verify(mLogger).startBindingHun(eq("key"));
verify(mLogger).startBindingHun(eq(mEntry));
verifyNoMoreInteractions(mLogger);
clearInvocations(mLogger);
mViewBinder.unbindHeadsUpView(mEntry);
verify(mLogger).currentOngoingBindingAborted(eq("key"));
verify(mLogger).entryContentViewMarkedFreeable(eq("key"));
verify(mLogger).currentOngoingBindingAborted(eq(mEntry));
verify(mLogger).entryContentViewMarkedFreeable(eq(mEntry));
verifyNoMoreInteractions(mLogger);
clearInvocations(mLogger);
callback.get().onBindFinished(mEntry);
verify(mLogger).entryUnbound(eq("key"));
verify(mLogger).entryUnbound(eq(mEntry));
verifyNoMoreInteractions(mLogger);
clearInvocations(mLogger);
}

View File

@@ -106,7 +106,7 @@ public class HeadsUpManagerTest extends AlertingNotificationManagerTest {
public void testHunRemovedLogging() {
mAlertEntry.mEntry = mEntry;
mHeadsUpManager.onAlertEntryRemoved(mAlertEntry);
verify(mLogger, times(1)).logNotificationActuallyRemoved(eq(mEntry.getKey()));
verify(mLogger, times(1)).logNotificationActuallyRemoved(eq(mEntry));
}
@Test