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

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

Format NotificationStackScrollLogger

Run ktfmt to format NotificationStackScrollLogger.

Test: manual
Bug: 330387368
Flag: EXEMPT refactor
Change-Id: I5051ae439cd2fd01b91c02c1f4c38b97697a6319
parent 35d361e8
Loading
Loading
Loading
Loading
+119 −102
Original line number Diff line number Diff line
@@ -3,13 +3,11 @@ package com.android.systemui.statusbar.notification.stack
import android.view.ViewGroup
import com.android.systemui.log.LogBuffer
import com.android.systemui.log.core.LogLevel.DEBUG
import com.android.systemui.log.core.LogLevel.INFO
import com.android.systemui.log.core.LogLevel.ERROR
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.collection.NotificationEntry
import com.android.systemui.statusbar.notification.logKey
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
@@ -18,22 +16,29 @@ import com.android.systemui.statusbar.notification.stack.NotificationStackScroll
import com.google.errorprone.annotations.CompileTimeConstant
import javax.inject.Inject

class NotificationStackScrollLogger @Inject constructor(
class NotificationStackScrollLogger
@Inject
constructor(
    @NotificationHeadsUpLog private val buffer: LogBuffer,
    @NotificationRenderLog private val notificationRenderBuffer: LogBuffer,
    @ShadeLog private val shadeLogBuffer: LogBuffer,
) {
    fun hunAnimationSkipped(entry: String, reason: String) {
        buffer.log(TAG, INFO, {
        buffer.log(
            TAG,
            INFO,
            {
                str1 = entry
                str2 = reason
        }, {
            "heads up animation skipped: key: $str1 reason: $str2"
        })
            },
            { "heads up animation skipped: key: $str1 reason: $str2" },
        )
    }

    fun hunAnimationEventAdded(entry: String, type: Int) {
        val reason: String
        reason = if (type == ANIMATION_TYPE_HEADS_UP_DISAPPEAR) {
        reason =
            if (type == ANIMATION_TYPE_HEADS_UP_DISAPPEAR) {
                "HEADS_UP_DISAPPEAR"
            } else if (type == ANIMATION_TYPE_HEADS_UP_DISAPPEAR_CLICK) {
                "HEADS_UP_DISAPPEAR_CLICK"
@@ -46,23 +51,31 @@ class NotificationStackScrollLogger @Inject constructor(
            } else {
                type.toString()
            }
        buffer.log(TAG, INFO, {
        buffer.log(
            TAG,
            INFO,
            {
                str1 = entry
                str2 = reason
        }, {
            "heads up animation added: $str1 with type $str2"
        })
            },
            { "heads up animation added: $str1 with type $str2" },
        )
    }

    fun hunSkippedForUnexpectedState(entry: String, expected: Boolean, actual: Boolean) {
        buffer.log(TAG, INFO, {
        buffer.log(
            TAG,
            INFO,
            {
                str1 = entry
                bool1 = expected
                bool2 = actual
        }, {
            },
            {
                "HUN animation skipped for unexpected hun state: " +
                    "key: $str1 expected: $bool1 actual: $bool2"
        })
            },
        )
    }

    fun logShadeDebugEvent(@CompileTimeConstant msg: String) = shadeLogBuffer.log(TAG, DEBUG, msg)
@@ -71,68 +84,76 @@ class NotificationStackScrollLogger @Inject constructor(
        isBelowLastNotification: Boolean,
        statusBarState: Int,
        touchIsClick: Boolean,
        motionEventDesc: String
        motionEventDesc: String,
    ) {
        shadeLogBuffer.log(TAG, DEBUG, {
        shadeLogBuffer.log(
            TAG,
            DEBUG,
            {
                int1 = statusBarState
                bool1 = touchIsClick
                bool2 = isBelowLastNotification
                str1 = motionEventDesc
        }, {
            },
            {
                "handleEmptySpaceClick: statusBarState: $int1 isTouchAClick: $bool1 " +
                    "isTouchBelowNotification: $bool2 motionEvent: $str1"
        })
            },
        )
    }

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

    fun addTransientChildNotificationToChildContainer(
            childEntry: String,
            containerEntry: String,
    ) {
        notificationRenderBuffer.log(TAG, INFO, {
    fun addTransientChildNotificationToChildContainer(childEntry: String, containerEntry: String) {
        notificationRenderBuffer.log(
            TAG,
            INFO,
            {
                str1 = childEntry
                str2 = containerEntry
        }, {
            },
            {
                "addTransientChildToContainer from onViewRemovedInternal: childKey: $str1 " +
                    "-- containerKey: $str2"
        })
            },
        )
    }

    fun addTransientChildNotificationToNssl(
            childEntry: String,
    ) {
        notificationRenderBuffer.log(TAG, INFO, {
            str1 = childEntry
        }, {
            "addTransientRowToNssl from onViewRemovedInternal: childKey: $str1"
        })
    fun addTransientChildNotificationToNssl(childEntry: String) {
        notificationRenderBuffer.log(
            TAG,
            INFO,
            { str1 = childEntry },
            { "addTransientRowToNssl from onViewRemovedInternal: childKey: $str1" },
        )
    }

    fun addTransientChildNotificationToViewGroup(
            childEntry: String,
            container: ViewGroup
    ) {
        notificationRenderBuffer.log(TAG, ERROR, {
    fun addTransientChildNotificationToViewGroup(childEntry: String, container: ViewGroup) {
        notificationRenderBuffer.log(
            TAG,
            ERROR,
            {
                str1 = childEntry
                str2 = container.toString()
        }, {
            },
            {
                "addTransientRowTo unhandled ViewGroup from onViewRemovedInternal: childKey: $str1 " +
                    "-- ViewGroup: $str2"
        })
            },
        )
    }

    fun addTransientRow(
            childEntry: String,
            index: Int
    ) {
    fun addTransientRow(childEntry: String, index: Int) {
        notificationRenderBuffer.log(
            TAG,
            INFO,
@@ -140,20 +161,16 @@ class NotificationStackScrollLogger @Inject constructor(
                str1 = childEntry
                int1 = index
            },
                { "addTransientRow to NSSL: childKey: $str1 -- index: $int1" }
            { "addTransientRow to NSSL: childKey: $str1 -- index: $int1" },
        )
    }

    fun removeTransientRow(
            childEntry: String,
    ) {
    fun removeTransientRow(childEntry: String) {
        notificationRenderBuffer.log(
            TAG,
            INFO,
                {
                    str1 = childEntry
                },
                { "removeTransientRow from NSSL: childKey: $str1" }
            { str1 = childEntry },
            { "removeTransientRow from NSSL: childKey: $str1" },
        )
    }