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

Commit 078a8491 authored by Yining Liu's avatar Yining Liu
Browse files

Add logs to monitor NSSL height-related changes

Add more logs to monitor NSSL height-related changes.

Test: manual
Bug: 330387368
Flag: EXEMPT log only update
Change-Id: I4d2a4dcabe7edb31a31021995223945f45f37a2f
parent ce19c2b7
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -2585,7 +2585,8 @@ public class NotificationStackScrollLayout
        final int notificationsHeight = (int) mNotificationStackSizeCalculator.computeHeight(
                /* notificationStackScrollLayout= */ this,
                mMaxDisplayedNotifications,
                shelfIntrinsicHeight
                shelfIntrinsicHeight,
                "updateIntrinsicStackHeight"
        );
        if (mScrollViewFields.getIntrinsicStackHeight() != notificationsHeight) {
            mScrollViewFields.setIntrinsicStackHeight(notificationsHeight);
@@ -2605,7 +2606,7 @@ public class NotificationStackScrollLayout
        final float height =
                (int) scrimTopPadding + (int) mNotificationStackSizeCalculator.computeHeight(
                        /* notificationStackScrollLayout= */ this, mMaxDisplayedNotifications,
                        shelfIntrinsicHeight);
                        shelfIntrinsicHeight, "updateContentHeight");
        setIntrinsicContentHeight(height);

        // The topPadding can be bigger than the regular padding when qs is expanded, in that
@@ -4487,6 +4488,9 @@ public class NotificationStackScrollLayout
        ExpandableView firstVisibleChild =
                firstSection == null ? null : firstSection.getFirstVisibleChild();
        if (row != null) {
            if (mLogger != null) {
                mLogger.childHeightUpdated(row, needsAnimation);
            }
            if (row == firstVisibleChild
                    || row.getNotificationParent() == firstVisibleChild) {
                updateAlgorithmLayoutMinHeight();
@@ -5294,6 +5298,9 @@ public class NotificationStackScrollLayout

    public void setMaxDisplayedNotifications(int maxDisplayedNotifications) {
        if (mMaxDisplayedNotifications != maxDisplayedNotifications) {
            if (mLogger != null) {
                mLogger.setMaxDisplayedNotifications(maxDisplayedNotifications);
            }
            mMaxDisplayedNotifications = maxDisplayedNotifications;
            if (SceneContainerFlag.isEnabled()) {
                updateIntrinsicStackHeight();
+22 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ import com.android.systemui.log.core.LogLevel.INFO
import com.android.systemui.log.dagger.NotificationHeadsUpLog
import com.android.systemui.log.dagger.NotificationRenderLog
import com.android.systemui.log.dagger.ShadeLog
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_ADD
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_HEADS_UP_APPEAR
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_HEADS_UP_DISAPPEAR
@@ -211,6 +212,27 @@ constructor(
            },
        )
    }

    fun childHeightUpdated(row: ExpandableNotificationRow, needsAnimation: Boolean) {
        notificationRenderBuffer.log(
            TAG,
            INFO,
            {
                str1 = row.key
                bool1 = needsAnimation
            },
            { "childHeightUpdated: childKey: $str1 -- needsAnimation: $bool1" },
        )
    }

    fun setMaxDisplayedNotifications(maxDisplayedNotifications: Int) {
        notificationRenderBuffer.log(
            TAG,
            INFO,
            { int1 = maxDisplayedNotifications },
            { "setMaxDisplayedNotifications: $int1" },
        )
    }
}

private const val TAG = "NotificationStackScroll"
+21 −10
Original line number Diff line number Diff line
@@ -109,6 +109,7 @@ constructor(
            log { "\tallowedByPolicy = false" }
            false
        } else {
            log { "\tallowedByPolicy = true" }
            true
        }

@@ -293,9 +294,10 @@ constructor(
        stack: NotificationStackScrollLayout,
        maxNotifs: Int,
        shelfHeight: Float,
        reason: String? = null,
    ): Float {
        log { "\n" }
        log { "computeHeight ---" }
        log { "computeHeight --- reason: $reason" }

        val stackHeightSequence = computeHeightPerNotificationLimit(stack, shelfHeight)

@@ -407,23 +409,32 @@ constructor(
                    spaceBeforeShelf + shelfHeight
                }

            var bucket: Int? = null
            if (counter != null) {
                bucket =
                    if (NotificationBundleUi.isEnabled) {
                        val entryAdapter =
                            (currentNotification as? ExpandableNotificationRow)?.entryAdapter
                    counter.incrementForBucket(entryAdapter?.sectionBucket)
                        entryAdapter?.sectionBucket
                    } else {
                        val entry = (currentNotification as? ExpandableNotificationRow)?.entryLegacy
                    counter.incrementForBucket(entry?.bucket)
                        entry?.bucket
                    }
                counter.incrementForBucket(bucket)
            }

            val forceIntoShelf = counter?.shouldForceIntoShelf() ?: false
            val row = currentNotification as? ExpandableNotificationRow

            log {
                "\tcomputeHeightPerNotificationLimit i=$i notifs=$notifications " +
                    "notifsHeightSavingSpace=$notifsWithCollapsedHun" +
                    " shelfWithSpaceBefore=$shelfWithSpaceBefore" +
                    " isOnLockScreen=$onLockscreen" +
                    " limitLockScreenToOneImportant: $limitLockScreenToOneImportant"
                    " limitLockScreenToOneImportant: $limitLockScreenToOneImportant" +
                    " forceIntoShelf: $forceIntoShelf" +
                    " child: ${row?.key}" +
                    " bucket: $bucket"
            }
            yield(
                StackHeight(
+2 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ constructor(
    keyguardInteractor: KeyguardInteractor,
    deviceEntryUdfpsInteractor: DeviceEntryUdfpsInteractor,
    largeScreenHeaderHelperLazy: Lazy<LargeScreenHeaderHelper>,
    private val logger: SharedNotificationContainerInteractorLogger?,
) {

    private val _topPosition = MutableStateFlow(0f)
@@ -115,6 +116,7 @@ constructor(

    /** An internal modification was made to notifications */
    fun notificationStackChanged() {
        logger?.notificationStackChanged()
        _notificationStackChanged.value = _notificationStackChanged.value + 1
    }

+32 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 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.domain.interactor

import com.android.systemui.log.LogBuffer
import com.android.systemui.log.core.LogLevel
import com.android.systemui.log.dagger.NotificationRenderLog
import javax.inject.Inject

class SharedNotificationContainerInteractorLogger
@Inject
constructor(@NotificationRenderLog private val notificationRenderBuffer: LogBuffer) {
    fun notificationStackChanged() {
        notificationRenderBuffer.log(TAG, LogLevel.INFO, {}, { "notificationStackChanged" })
    }
}

private const val TAG = "NotifContainerInteractor"
Loading