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

Commit b3db1c7b authored by Yining Liu's avatar Yining Liu
Browse files

Add logs for NotificationStackScrollLayout traversal removal of transient...

Add logs for NotificationStackScrollLayout traversal removal of transient group child ExpandableNotificationRows

Add logs for NSSL traversal removal of transient group child ExpandableNotificationRows. These logs track when the transient views for group child ExpandableNotificationRows are cleaned by NSSL's traversal cleaning (when the Shade's collapsing finishes).

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

Change-Id: Ia4d4a78ac4a821ed51d24df5edc58eace850c1cd
parent 58ee34ab
Loading
Loading
Loading
Loading
+28 −4
Original line number Diff line number Diff line
@@ -3033,7 +3033,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
        if (!animationsEnabled) {
            mSwipedOutViews.clear();
            mChildrenToRemoveAnimated.clear();
            clearTemporaryViewsInGroup(this);
            clearTemporaryViewsInGroup(
                    /* viewGroup = */ this,
                    /* reason = */ "setAnimationsEnabled");
        }
    }

@@ -4008,24 +4010,46 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable

    private void clearTemporaryViews() {
        // lets make sure nothing is transient anymore
        clearTemporaryViewsInGroup(this);
        clearTemporaryViewsInGroup(
                /* viewGroup = */ this,
                /* reason = */ "clearTemporaryViews"
        );
        for (int i = 0; i < getChildCount(); i++) {
            ExpandableView child = getChildAtIndex(i);
            if (child instanceof ExpandableNotificationRow) {
                ExpandableNotificationRow row = (ExpandableNotificationRow) child;
                clearTemporaryViewsInGroup(row.getChildrenContainer());
                clearTemporaryViewsInGroup(
                        /* viewGroup = */ row.getChildrenContainer(),
                        /* reason = */ "clearTemporaryViewsInGroup(row.getChildrenContainer())"
                );
            }
        }
    }

    private void clearTemporaryViewsInGroup(ViewGroup viewGroup) {
    private void clearTemporaryViewsInGroup(ViewGroup viewGroup, String reason) {
        while (viewGroup != null && viewGroup.getTransientViewCount() != 0) {
            final View transientView = viewGroup.getTransientView(0);
            viewGroup.removeTransientView(transientView);
            if (transientView instanceof ExpandableView) {
                ((ExpandableView) transientView).setTransientContainer(null);
                if (transientView instanceof ExpandableNotificationRow) {
                    logTransientNotificationRowTraversalCleaned(
                            (ExpandableNotificationRow) transientView,
                            reason
                    );
                }
            }
        }
    }

    private void logTransientNotificationRowTraversalCleaned(
            ExpandableNotificationRow transientView,
            String reason
    ) {
        if (mLogger == null) {
            return;
        }
        mLogger.transientNotificationRowTraversalCleaned(transientView.getEntry(), reason);
    }

    void onPanelTrackingStarted() {
+12 −1
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ import com.android.systemui.log.dagger.NotificationHeadsUpLog
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.NotificationRenderLog
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
@@ -15,7 +16,8 @@ import com.google.errorprone.annotations.CompileTimeConstant
import javax.inject.Inject

class NotificationStackScrollLogger @Inject constructor(
    @NotificationHeadsUpLog private val buffer: LogBuffer
    @NotificationHeadsUpLog private val buffer: LogBuffer,
    @NotificationRenderLog private val notificationRenderBuffer: LogBuffer
) {
    fun hunAnimationSkipped(entry: NotificationEntry, reason: String) {
        buffer.log(TAG, INFO, {
@@ -77,6 +79,15 @@ class NotificationStackScrollLogger @Inject constructor(
                    "isTouchBelowNotification: $bool2 motionEvent: $str1"
        })
    }

    fun transientNotificationRowTraversalCleaned(entry: NotificationEntry, reason: String) {
        notificationRenderBuffer.log(TAG, INFO, {
            str1 = entry.logKey
            str2 = reason
        }, {
            "transientNotificationRowTraversalCleaned: key: $str1 reason: $str2"
        })
    }
}

private const val TAG = "NotificationStackScroll"
 No newline at end of file