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

Commit 9e68755f authored by Yining Liu's avatar Yining Liu
Browse files

Add logs for all ExpandableNotificationRow transient views adding to and...

Add logs for all ExpandableNotificationRow transient views adding to and removing from ExpandableNotificationRow

Add logs for all ExpandableNotificationRow transient views that are added to and removed from ExpandableNotificationRow. To help with:
1. determining if the known additions and removals are working as intended (especially in a good order) .
2. discovering unknown additions and removals of transient rows.

Bug: 281628358
Test: `adb shell settings put global systemui/buffer/NotifRenderLog
VERBOSE` and look for NotifRow tag in logcat

Change-Id: Ie05df2479c119de258d6e95ccd3262ddf58e5ebb
parent f8277c1d
Loading
Loading
Loading
Loading
+49 −0
Original line number Diff line number Diff line
@@ -1657,6 +1657,25 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
                NotificationEntry childEntry,
                ViewGroup containerView
        );

        /**
         * Called when an ExpandableNotificationRow transient view is added to this
         * ExpandableNotificationRow
         */
        void logAddTransientRow(
                NotificationEntry childEntry,
                NotificationEntry containerEntry,
                int index
        );

        /**
         * Called when an ExpandableNotificationRow transient view is removed from this
         * ExpandableNotificationRow
         */
        void logRemoveTransientRow(
                NotificationEntry childEntry,
                NotificationEntry containerEntry
        );
    }

    /**
@@ -3786,4 +3805,34 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
            );
        }
    }

    @Override
    public void addTransientView(View view, int index) {
        if (view instanceof ExpandableNotificationRow) {
            logAddTransientRow((ExpandableNotificationRow) view, index);
        }
        super.addTransientView(view, index);
    }

    private void logAddTransientRow(ExpandableNotificationRow row, int index) {
        if (mLogger == null) {
            return;
        }
        mLogger.logAddTransientRow(row.getEntry(), getEntry(), index);
    }

    @Override
    public void removeTransientView(View view) {
        if (view instanceof ExpandableNotificationRow) {
            logRemoveTransientRow((ExpandableNotificationRow) view);
        }
        super.removeTransientView(view);
    }

    private void logRemoveTransientRow(ExpandableNotificationRow row) {
        if (mLogger == null) {
            return;
        }
        mLogger.logRemoveTransientRow(row.getEntry(), getEntry());
    }
}
+17 −0
Original line number Diff line number Diff line
@@ -150,6 +150,23 @@ public class ExpandableNotificationRowController implements NotifViewController
                ) {
                    mLogBufferLogger.logRemoveTransientFromViewGroup(childEntry, containerView);
                }

                @Override
                public void logAddTransientRow(
                        NotificationEntry childEntry,
                        NotificationEntry containerEntry,
                        int index
                ) {
                    mLogBufferLogger.logAddTransientRow(childEntry, containerEntry, index);
                }

                @Override
                public void logRemoveTransientRow(
                        NotificationEntry childEntry,
                        NotificationEntry containerEntry
                ) {
                    mLogBufferLogger.logRemoveTransientRow(childEntry, containerEntry);
                }
            };


+32 −0
Original line number Diff line number Diff line
@@ -96,6 +96,38 @@ constructor(
            { "RemoveTransientRow from other ViewGroup: childKey: $str1 -- ViewGroup: $str2" }
        )
    }

    fun logAddTransientRow(
        childEntry: NotificationEntry,
        containerEntry: NotificationEntry,
        index: Int
    ) {
        notificationRenderBuffer.log(
            TAG,
            LogLevel.ERROR,
            {
                str1 = childEntry.logKey
                str2 = containerEntry.logKey
                int1 = index
            },
            { "addTransientRow to row: childKey: $str1 -- containerKey: $str2 -- index: $int1" }
        )
    }

    fun logRemoveTransientRow(
        childEntry: NotificationEntry,
        containerEntry: NotificationEntry,
    ) {
        notificationRenderBuffer.log(
            TAG,
            LogLevel.ERROR,
            {
                str1 = childEntry.logKey
                str2 = containerEntry.logKey
            },
            { "removeTransientRow from row: childKey: $str1 -- containerKey: $str2" }
        )
    }
}

private const val TAG = "NotifRow"