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

Commit e9011c20 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 NotificationChildrenContainer

Add logs for all ExpandableNotificationRow transient views that are added to and removed from NotificationChildrenContainer. 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.

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

Change-Id: I15dafc75d224890643b5ce6b9bbfa45d03ebe14e
parent 2567cf9e
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -104,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.NotificationChildrenContainerLogger;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
import com.android.systemui.statusbar.notification.stack.SwipeableView;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
@@ -172,6 +173,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    private PeopleNotificationIdentifier mPeopleNotificationIdentifier;
    private Optional<BubblesManager> mBubblesManagerOptional;
    private MetricsLogger mMetricsLogger;
    private NotificationChildrenContainerLogger mChildrenContainerLogger;
    private NotificationDismissibilityProvider mDismissibilityProvider;
    private FeatureFlags mFeatureFlags;
    private int mIconTransformContentShift;
@@ -1696,6 +1698,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
            NotificationGutsManager gutsManager,
            NotificationDismissibilityProvider dismissibilityProvider,
            MetricsLogger metricsLogger,
            NotificationChildrenContainerLogger childrenContainerLogger,
            SmartReplyConstants smartReplyConstants,
            SmartReplyController smartReplyController,
            FeatureFlags featureFlags,
@@ -1734,6 +1737,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        mBubblesManagerOptional = bubblesManagerOptional;
        mNotificationGutsManager = gutsManager;
        mMetricsLogger = metricsLogger;
        mChildrenContainerLogger = childrenContainerLogger;
        mDismissibilityProvider = dismissibilityProvider;
        mFeatureFlags = featureFlags;
    }
@@ -1902,6 +1906,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
            mChildrenContainer.setIsLowPriority(mIsLowPriority);
            mChildrenContainer.setContainingNotification(ExpandableNotificationRow.this);
            mChildrenContainer.onNotificationUpdated();
            mChildrenContainer.setLogger(mChildrenContainerLogger);

            mTranslateableViews.add(mChildrenContainer);
        });
+5 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ import com.android.systemui.statusbar.notification.people.PeopleNotificationIden
import com.android.systemui.statusbar.notification.row.dagger.AppName;
import com.android.systemui.statusbar.notification.row.dagger.NotificationKey;
import com.android.systemui.statusbar.notification.row.dagger.NotificationRowScope;
import com.android.systemui.statusbar.notification.stack.NotificationChildrenContainerLogger;
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.policy.HeadsUpManager;
@@ -88,6 +89,7 @@ public class ExpandableNotificationRowController implements NotifViewController
    private final ExpandableNotificationRow.OnExpandClickListener mOnExpandClickListener;
    private final StatusBarStateController mStatusBarStateController;
    private final MetricsLogger mMetricsLogger;
    private final NotificationChildrenContainerLogger mChildrenContainerLogger;
    private final ExpandableNotificationRow.CoordinateOnClickListener mOnFeedbackClickListener;
    private final NotificationGutsManager mNotificationGutsManager;
    private final OnUserInteractionCallback mOnUserInteractionCallback;
@@ -158,6 +160,7 @@ public class ExpandableNotificationRowController implements NotifViewController
            RemoteInputViewSubcomponent.Factory rivSubcomponentFactory,
            MetricsLogger metricsLogger,
            NotificationRowLogger logBufferLogger,
            NotificationChildrenContainerLogger childrenContainerLogger,
            NotificationListContainer listContainer,
            SmartReplyConstants smartReplyConstants,
            SmartReplyController smartReplyController,
@@ -211,6 +214,7 @@ public class ExpandableNotificationRowController implements NotifViewController
        mBubblesManagerOptional = bubblesManagerOptional;
        mDragController = dragController;
        mMetricsLogger = metricsLogger;
        mChildrenContainerLogger = childrenContainerLogger;
        mLogBufferLogger = logBufferLogger;
        mSmartReplyConstants = smartReplyConstants;
        mSmartReplyController = smartReplyController;
@@ -245,6 +249,7 @@ public class ExpandableNotificationRowController implements NotifViewController
                mNotificationGutsManager,
                mDismissibilityProvider,
                mMetricsLogger,
                mChildrenContainerLogger,
                mSmartReplyConstants,
                mSmartReplyController,
                mFeatureFlags,
+29 −0
Original line number Diff line number Diff line
@@ -132,6 +132,8 @@ public class NotificationChildrenContainer extends ViewGroup
    private boolean mContainingNotificationIsFaded = false;
    private RoundableState mRoundableState;

    private NotificationChildrenContainerLogger mLogger;

    public NotificationChildrenContainer(Context context) {
        this(context, null);
    }
@@ -1507,6 +1509,33 @@ public class NotificationChildrenContainer extends ViewGroup
        return mNotificationHeaderWrapper;
    }

    public void setLogger(NotificationChildrenContainerLogger logger) {
        mLogger = logger;
    }

    @Override
    public void addTransientView(View view, int index) {
        if (mLogger != null && view instanceof ExpandableNotificationRow) {
            mLogger.addTransientRow(
                    ((ExpandableNotificationRow) view).getEntry(),
                    getContainingNotification().getEntry(),
                    index
            );
        }
        super.addTransientView(view, index);
    }

    @Override
    public void removeTransientView(View view) {
        if (mLogger != null && view instanceof ExpandableNotificationRow) {
            mLogger.removeTransientRow(
                    ((ExpandableNotificationRow) view).getEntry(),
                    getContainingNotification().getEntry()
            );
        }
        super.removeTransientView(view);
    }

    public String debugString() {
        return TAG + " { "
                + "visibility: " + getVisibility()
+64 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

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.NotificationRenderLog
import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.logKey
import javax.inject.Inject

class NotificationChildrenContainerLogger
@Inject
constructor(@NotificationRenderLog private val notificationRenderBuffer: LogBuffer) {
    fun addTransientRow(
        childEntry: NotificationEntry,
        containerEntry: NotificationEntry,
        index: Int
    ) {
        notificationRenderBuffer.log(
            TAG,
            LogLevel.INFO,
            {
                str1 = childEntry.logKey
                str2 = containerEntry.logKey
                int1 = index
            },
            { "addTransientRow: childKey: $str1 -- containerKey: $str2 -- index: $int1" }
        )
    }

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

    companion object {
        private const val TAG = "NotifChildrenContainer"
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import com.android.systemui.statusbar.notification.collection.render.GroupMember
import com.android.systemui.statusbar.notification.logging.NotificationLogger
import com.android.systemui.statusbar.notification.people.PeopleNotificationIdentifier
import com.android.systemui.statusbar.notification.stack.NotificationChildrenContainer
import com.android.systemui.statusbar.notification.stack.NotificationChildrenContainerLogger
import com.android.systemui.statusbar.notification.stack.NotificationListContainer
import com.android.systemui.statusbar.phone.KeyguardBypassController
import com.android.systemui.statusbar.policy.HeadsUpManager
@@ -107,6 +108,7 @@ class ExpandableNotificationRowControllerTest : SysuiTestCase() {
                rivSubComponentFactory,
                metricsLogger,
                logBufferLogger,
                mock<NotificationChildrenContainerLogger>(),
                listContainer,
                smartReplyConstants,
                smartReplyController,
Loading