Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f8893543 authored by Steve Elliott's avatar Steve Elliott
Browse files

add bundle info to pipeline logging

Bug: 395698521
Test: atest SystemUITests
Flag: com.android.systemui.notification_bundle_ui
Change-Id: Idcee80ad4d94890938f3a551dae4216c24a6bd31
parent f313caf8
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -23,6 +23,11 @@ import com.android.systemui.statusbar.notification.collection.PipelineEntry
val PipelineEntry?.logKey: String?
    get() = this?.let { NotificationUtils.logKey(it) }

/** Get the notification key, reformatted for logging, for the entry */
@get:JvmName("getLogKeyNonNull")
val PipelineEntry.logKey: String
    get() = NotificationUtils.logKey(this)

/** Get the notification key, reformatted for logging, for the (optional) sbn */
val StatusBarNotification?.logKey: String?
    get() = this?.key?.let { NotificationUtils.logKey(it) }
+32 −12
Original line number Diff line number Diff line
@@ -523,10 +523,7 @@ public class ShadeListBuilder implements Dumpable, PipelineDumpable {

        Trace.beginSection("ShadeListBuilder.logEndBuildList");
        // Step 9: We're done!
        mLogger.logEndBuildList(
                mIterationCount,
                mReadOnlyNotifList.size(),
                countChildren(mReadOnlyNotifList),
        logEndBuildList(mLogger, mIterationCount, mReadOnlyNotifList,
                /* enforcedVisualStability */ !mNotifStabilityManager.isEveryChangeAllowed());
        if (mAlwaysLogList || mIterationCount % 10 == 0) {
            Trace.beginSection("ShadeListBuilder.logFinalList");
@@ -1733,17 +1730,40 @@ public class ShadeListBuilder implements Dumpable, PipelineDumpable {
        mChoreographer.schedule();
    }

    private static int countChildren(List<PipelineEntry> entries) {
        int count = 0;
        for (int i = 0; i < entries.size(); i++) {
            final PipelineEntry entry = entries.get(i);
            if (entry instanceof GroupEntry) {
                count += ((GroupEntry) entry).getChildren().size();
    private static void logEndBuildList(
            ShadeListBuilderLogger logger,
            int iterationCount,
            List<PipelineEntry> shadeList,
            boolean enforcedVisualStability) {
        Trace.beginSection("ShadeListBuilder.logEndBuildList");
        final int numTopLevelEntries = shadeList.size();
        int bundledCount = 0;
        int bundledChildCount = 0;
        int childCount = 0;
        for (int i = 0; i < numTopLevelEntries; i++) {
            final PipelineEntry entry = shadeList.get(i);
            if (entry instanceof GroupEntry groupEntry) {
                childCount += groupEntry.getChildren().size();
            } else if (entry instanceof BundleEntry bundleEntry) {
                // TODO(b/395698521): Handle BundleEntry
                int numBundleChildren = bundleEntry.getChildren().size();
                bundledCount += numBundleChildren;
                for (int j = 0; j < numBundleChildren; j++) {
                    final ListEntry bundleChild = bundleEntry.getChildren().get(j);
                    if (bundleChild instanceof GroupEntry bundleChildGroup) {
                        bundledChildCount += bundleChildGroup.getChildren().size();
                    }
                }
        return count;
            }
        }

        logger.logEndBuildList(
                iterationCount,
                numTopLevelEntries,
                childCount,
                bundledCount,
                bundledChildCount,
                /* enforcedVisualStability */ enforcedVisualStability);
        Trace.endSection();
    }

    private void dispatchOnBeforeTransformGroups(List<PipelineEntry> entries) {
+9 −1
Original line number Diff line number Diff line
@@ -58,6 +58,8 @@ constructor(
        buildId: Int,
        topLevelEntries: Int,
        numChildren: Int,
        numBundled: Int,
        numBundledChildren: Int,
        enforcedVisualStability: Boolean,
    ) {
        buffer.log(
@@ -67,10 +69,16 @@ constructor(
                long1 = buildId.toLong()
                int1 = topLevelEntries
                int2 = numChildren
                long2 = numBundled.toLong()
                double1 = numBundledChildren.toDouble()
                bool1 = enforcedVisualStability
            },
            {
                "(Build $long1) Build complete ($int1 top-level entries, $int2 children)" +
                "(Build $long1) Build complete (" +
                    "$int1 top-level entries, " +
                    "$int2 children, " +
                    "$long2 bundled, " +
                    "${double1.toInt()} bundled children)" +
                    " enforcedVisualStability=$bool1"
            },
        )
+6 −5
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import com.android.systemui.log.core.LogLevel.INFO
import com.android.systemui.log.core.LogLevel.WARNING
import com.android.systemui.log.core.LogLevel.WTF
import com.android.systemui.log.dagger.NotificationLog
import com.android.systemui.statusbar.notification.collection.BundleEntry
import com.android.systemui.statusbar.notification.collection.GroupEntry
import com.android.systemui.statusbar.notification.collection.NotifCollection
import com.android.systemui.statusbar.notification.collection.NotifCollection.CancellationReason
@@ -470,11 +471,11 @@ class NotifCollectionLogger @Inject constructor(@NotificationLog private val buf
    }

    private fun getParentLogKey(childEntry: NotificationEntry): String {
        return if (childEntry.parent is GroupEntry) {
            (childEntry.parent as? GroupEntry)?.summary?.logKey ?: "(null)"
        } else {
            // TODO(b/395698521): Handle BundleEntry
            "(null)"
        val parent = childEntry.parent
        return when (parent) {
            is GroupEntry -> parent.summary?.logKey ?: "(null)"
            is BundleEntry -> parent.logKey
            else -> "(null)"
        }
    }