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

Commit 2567cf9e authored by Yining Liu's avatar Yining Liu
Browse files

Add logs for group child notification row transient views removal

Add logs when group child notifications' row transient views are removed through removeFromTransientContainer from NotificationChildrenContainer and NSSL.

Bug: 281628358
Test: `adb shell settings put global systemui/buffer/NotifRenderLog VERBOSE` and look for NotifRow in logcat
Change-Id: Id27cd7896573fbeb0a87ad04eb9af4a6e8d8dacf
parent daed9581
Loading
Loading
Loading
Loading
+67 −0
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ import android.view.MotionEvent;
import android.view.NotificationHeaderView;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.ViewStub;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
@@ -103,6 +104,7 @@ import com.android.systemui.statusbar.notification.stack.AmbientState;
import com.android.systemui.statusbar.notification.stack.AnimationProperties;
import com.android.systemui.statusbar.notification.stack.ExpandableViewState;
import com.android.systemui.statusbar.notification.stack.NotificationChildrenContainer;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
import com.android.systemui.statusbar.notification.stack.SwipeableView;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.policy.HeadsUpManager;
@@ -1627,6 +1629,32 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
                NotificationEntry child,
                NotificationEntry newParent
        );

        /**
         * Called when an ExpandableNotificationRow transient view is removed from the
         * NotificationChildrenContainer
         */
        void logRemoveTransientFromContainer(
                NotificationEntry childEntry,
                NotificationEntry containerEntry
        );

        /**
         * Called when an ExpandableNotificationRow transient view is removed from the
         * NotificationStackScrollLayout
         */
        void logRemoveTransientFromNssl(
                NotificationEntry childEntry
        );

        /**
         * Called when an ExpandableNotificationRow transient view is removed from a ViewGroup that
         * is not NotificationChildrenContainer or NotificationStackScrollLayout
         */
        void logRemoveTransientFromViewGroup(
                NotificationEntry childEntry,
                ViewGroup containerView
        );
    }

    /**
@@ -3714,4 +3742,43 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    public boolean getShowSnooze() {
        return mShowSnooze;
    }

    @Override
    public void removeFromTransientContainer() {
        final ViewGroup transientContainer = getTransientContainer();
        final ViewParent parent = getParent();
        // Only log when there is real removal of transient views
        if (transientContainer == null || transientContainer != parent) {
            super.removeFromTransientContainer();
            return;
        }
        logRemoveFromTransientContainer(transientContainer);
        super.removeFromTransientContainer();
    }

    /**
     * Log calls to removeFromTransientContainer when the container is NotificationChildrenContainer
     * or NotificationStackScrollLayout.
     */
    public void logRemoveFromTransientContainer(ViewGroup transientContainer) {
        if (mLogger == null) {
            return;
        }
        if (transientContainer instanceof NotificationChildrenContainer) {
            mLogger.logRemoveTransientFromContainer(
                    /* childEntry = */ getEntry(),
                    /* containerEntry = */ ((NotificationChildrenContainer) transientContainer)
                            .getContainingNotification().getEntry()
            );
        } else if (transientContainer instanceof NotificationStackScrollLayout) {
            mLogger.logRemoveTransientFromNssl(
                    /* childEntry = */ getEntry()
            );
        } else {
            mLogger.logRemoveTransientFromViewGroup(
                    /* childEntry = */ getEntry(),
                    /* containerView = */ transientContainer
            );
        }
    }
}
+23 −0
Original line number Diff line number Diff line
@@ -125,6 +125,29 @@ public class ExpandableNotificationRowController implements NotifViewController
                ) {
                    mLogBufferLogger.logSkipAttachingKeepInParentChild(child, newParent);
                }

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

                @Override
                public void logRemoveTransientFromNssl(
                        NotificationEntry childEntry
                ) {
                    mLogBufferLogger.logRemoveTransientFromNssl(childEntry);
                }

                @Override
                public void logRemoveTransientFromViewGroup(
                        NotificationEntry childEntry,
                        ViewGroup containerView
                ) {
                    mLogBufferLogger.logRemoveTransientFromViewGroup(childEntry, containerView);
                }
            };


+49 −1
Original line number Diff line number Diff line
@@ -17,14 +17,21 @@

package com.android.systemui.statusbar.notification.row

import android.view.ViewGroup
import com.android.systemui.log.LogBuffer
import com.android.systemui.log.LogLevel
import com.android.systemui.log.dagger.NotificationLog
import com.android.systemui.log.dagger.NotificationRenderLog
import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.logKey
import javax.inject.Inject

class NotificationRowLogger @Inject constructor(@NotificationLog private val buffer: LogBuffer) {
class NotificationRowLogger
@Inject
constructor(
    @NotificationLog private val buffer: LogBuffer,
    @NotificationRenderLog private val notificationRenderBuffer: LogBuffer
) {
    fun logKeepInParentChildDetached(child: NotificationEntry, oldParent: NotificationEntry?) {
        buffer.log(
            TAG,
@@ -48,6 +55,47 @@ class NotificationRowLogger @Inject constructor(@NotificationLog private val buf
            { "Skipping to attach $str1 to $str2, because it still flagged to keep in parent" }
        )
    }

    fun logRemoveTransientFromContainer(
        childEntry: NotificationEntry,
        containerEntry: NotificationEntry
    ) {
        notificationRenderBuffer.log(
            TAG,
            LogLevel.INFO,
            {
                str1 = childEntry.logKey
                str2 = containerEntry.logKey
            },
            { "RemoveTransientRow from ChildrenContainer: childKey: $str1 -- containerKey: $str2" }
        )
    }

    fun logRemoveTransientFromNssl(
        childEntry: NotificationEntry,
    ) {
        notificationRenderBuffer.log(
            TAG,
            LogLevel.INFO,
            { str1 = childEntry.logKey },
            { "RemoveTransientRow from Nssl: childKey: $str1" }
        )
    }

    fun logRemoveTransientFromViewGroup(
        childEntry: NotificationEntry,
        containerView: ViewGroup,
    ) {
        notificationRenderBuffer.log(
            TAG,
            LogLevel.WARNING,
            {
                str1 = childEntry.logKey
                str2 = containerView.toString()
            },
            { "RemoveTransientRow from other ViewGroup: childKey: $str1 -- ViewGroup: $str2" }
        )
    }
}

private const val TAG = "NotifRow"