Merge "Reduce logs from NodeSpecBuilder/NotificationEntryMgr" into tm-qpr-dev am: 35dfc1e31d

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18914147

Change-Id: Id56bb70323472f0d718b9218142a68ac2b568cf6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Jeff DeCew
2022-06-27 21:06:11 +00:00
committed by Automerger Merge Worker
2 changed files with 27 additions and 9 deletions

View File

@@ -17,18 +17,32 @@
package com.android.systemui.statusbar.notification package com.android.systemui.statusbar.notification
import com.android.systemui.log.LogBuffer import com.android.systemui.log.LogBuffer
import com.android.systemui.log.LogLevel
import com.android.systemui.log.LogLevel.DEBUG import com.android.systemui.log.LogLevel.DEBUG
import com.android.systemui.log.LogLevel.INFO import com.android.systemui.log.LogLevel.INFO
import com.android.systemui.log.LogLevel.WARNING import com.android.systemui.log.LogLevel.WARNING
import com.android.systemui.log.LogMessage
import com.android.systemui.log.dagger.NotificationLog import com.android.systemui.log.dagger.NotificationLog
import com.android.systemui.util.Compile
import javax.inject.Inject import javax.inject.Inject
/** Logger for [NotificationEntryManager]. */ /** Logger for [NotificationEntryManager]. */
class NotificationEntryManagerLogger @Inject constructor( class NotificationEntryManagerLogger @Inject constructor(
notifPipelineFlags: NotifPipelineFlags,
@NotificationLog private val buffer: LogBuffer @NotificationLog private val buffer: LogBuffer
) { ) {
private val devLoggingEnabled by lazy { notifPipelineFlags.isDevLoggingEnabled() }
private inline fun devLog(
level: LogLevel,
initializer: LogMessage.() -> Unit,
noinline printer: LogMessage.() -> String
) {
if (Compile.IS_DEBUG && devLoggingEnabled) buffer.log(TAG, level, initializer, printer)
}
fun logNotifAdded(key: String) { fun logNotifAdded(key: String) {
buffer.log(TAG, INFO, { devLog(INFO, {
str1 = key str1 = key
}, { }, {
"NOTIF ADDED $str1" "NOTIF ADDED $str1"
@@ -36,7 +50,7 @@ class NotificationEntryManagerLogger @Inject constructor(
} }
fun logNotifUpdated(key: String) { fun logNotifUpdated(key: String) {
buffer.log(TAG, INFO, { devLog(INFO, {
str1 = key str1 = key
}, { }, {
"NOTIF UPDATED $str1" "NOTIF UPDATED $str1"
@@ -44,7 +58,7 @@ class NotificationEntryManagerLogger @Inject constructor(
} }
fun logInflationAborted(key: String, status: String, reason: String) { fun logInflationAborted(key: String, status: String, reason: String) {
buffer.log(TAG, DEBUG, { devLog(DEBUG, {
str1 = key str1 = key
str2 = status str2 = status
str3 = reason str3 = reason
@@ -54,7 +68,7 @@ class NotificationEntryManagerLogger @Inject constructor(
} }
fun logNotifInflated(key: String, isNew: Boolean) { fun logNotifInflated(key: String, isNew: Boolean) {
buffer.log(TAG, DEBUG, { devLog(DEBUG, {
str1 = key str1 = key
bool1 = isNew bool1 = isNew
}, { }, {
@@ -63,7 +77,7 @@ class NotificationEntryManagerLogger @Inject constructor(
} }
fun logRemovalIntercepted(key: String) { fun logRemovalIntercepted(key: String) {
buffer.log(TAG, INFO, { devLog(INFO, {
str1 = key str1 = key
}, { }, {
"NOTIF REMOVE INTERCEPTED for $str1" "NOTIF REMOVE INTERCEPTED for $str1"
@@ -71,7 +85,7 @@ class NotificationEntryManagerLogger @Inject constructor(
} }
fun logLifetimeExtended(key: String, extenderName: String, status: String) { fun logLifetimeExtended(key: String, extenderName: String, status: String) {
buffer.log(TAG, INFO, { devLog(INFO, {
str1 = key str1 = key
str2 = extenderName str2 = extenderName
str3 = status str3 = status
@@ -81,7 +95,7 @@ class NotificationEntryManagerLogger @Inject constructor(
} }
fun logNotifRemoved(key: String, removedByUser: Boolean) { fun logNotifRemoved(key: String, removedByUser: Boolean) {
buffer.log(TAG, INFO, { devLog(INFO, {
str1 = key str1 = key
bool1 = removedByUser bool1 = removedByUser
}, { }, {
@@ -90,7 +104,7 @@ class NotificationEntryManagerLogger @Inject constructor(
} }
fun logFilterAndSort(reason: String) { fun logFilterAndSort(reason: String) {
buffer.log(TAG, INFO, { devLog(INFO, {
str1 = reason str1 = reason
}, { }, {
"FILTER AND SORT reason=$str1" "FILTER AND SORT reason=$str1"

View File

@@ -19,20 +19,24 @@ package com.android.systemui.statusbar.notification.collection.render
import com.android.systemui.log.LogBuffer import com.android.systemui.log.LogBuffer
import com.android.systemui.log.LogLevel import com.android.systemui.log.LogLevel
import com.android.systemui.log.dagger.NotificationLog import com.android.systemui.log.dagger.NotificationLog
import com.android.systemui.statusbar.notification.NotifPipelineFlags
import com.android.systemui.statusbar.notification.collection.listbuilder.NotifSection import com.android.systemui.statusbar.notification.collection.listbuilder.NotifSection
import com.android.systemui.util.Compile import com.android.systemui.util.Compile
import javax.inject.Inject import javax.inject.Inject
class NodeSpecBuilderLogger @Inject constructor( class NodeSpecBuilderLogger @Inject constructor(
notifPipelineFlags: NotifPipelineFlags,
@NotificationLog private val buffer: LogBuffer @NotificationLog private val buffer: LogBuffer
) { ) {
private val devLoggingEnabled by lazy { notifPipelineFlags.isDevLoggingEnabled() }
fun logBuildNodeSpec( fun logBuildNodeSpec(
oldSections: Set<NotifSection?>, oldSections: Set<NotifSection?>,
newHeaders: Map<NotifSection?, NodeController?>, newHeaders: Map<NotifSection?, NodeController?>,
newCounts: Map<NotifSection?, Int>, newCounts: Map<NotifSection?, Int>,
newSectionOrder: List<NotifSection?> newSectionOrder: List<NotifSection?>
) { ) {
if (!Compile.IS_DEBUG) if (!(Compile.IS_DEBUG && devLoggingEnabled))
return return
buffer.log(TAG, LogLevel.DEBUG, { buffer.log(TAG, LogLevel.DEBUG, {