1 /* 2 * Copyright (c) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 * 16 */ 17 18 package com.android.systemui.statusbar.notification.row 19 20 import android.view.ViewGroup 21 import com.android.systemui.log.LogBuffer 22 import com.android.systemui.log.core.LogLevel 23 import com.android.systemui.log.dagger.NotificationLog 24 import com.android.systemui.log.dagger.NotificationRenderLog 25 import com.android.systemui.statusbar.notification.collection.NotificationEntry 26 import com.android.systemui.statusbar.notification.logKey 27 import javax.inject.Inject 28 29 class NotificationRowLogger 30 @Inject 31 constructor( 32 @NotificationLog private val buffer: LogBuffer, 33 @NotificationRenderLog private val notificationRenderBuffer: LogBuffer 34 ) { logKeepInParentChildDetachednull35 fun logKeepInParentChildDetached(child: NotificationEntry, oldParent: NotificationEntry?) { 36 buffer.log( 37 TAG, 38 LogLevel.DEBUG, 39 { 40 str1 = child.logKey 41 str2 = oldParent.logKey 42 }, 43 { "Detach child $str1 kept in parent $str2" } 44 ) 45 } 46 logSkipAttachingKeepInParentChildnull47 fun logSkipAttachingKeepInParentChild(child: NotificationEntry, newParent: NotificationEntry?) { 48 buffer.log( 49 TAG, 50 LogLevel.WARNING, 51 { 52 str1 = child.logKey 53 str2 = newParent.logKey 54 }, 55 { "Skipping to attach $str1 to $str2, because it still flagged to keep in parent" } 56 ) 57 } 58 logRemoveTransientFromContainernull59 fun logRemoveTransientFromContainer( 60 childEntry: NotificationEntry, 61 containerEntry: NotificationEntry 62 ) { 63 notificationRenderBuffer.log( 64 TAG, 65 LogLevel.INFO, 66 { 67 str1 = childEntry.logKey 68 str2 = containerEntry.logKey 69 }, 70 { "RemoveTransientRow from ChildrenContainer: childKey: $str1 -- containerKey: $str2" } 71 ) 72 } 73 logRemoveTransientFromNsslnull74 fun logRemoveTransientFromNssl( 75 childEntry: NotificationEntry, 76 ) { 77 notificationRenderBuffer.log( 78 TAG, 79 LogLevel.INFO, 80 { str1 = childEntry.logKey }, 81 { "RemoveTransientRow from Nssl: childKey: $str1" } 82 ) 83 } 84 logRemoveTransientFromViewGroupnull85 fun logRemoveTransientFromViewGroup( 86 childEntry: NotificationEntry, 87 containerView: ViewGroup, 88 ) { 89 notificationRenderBuffer.log( 90 TAG, 91 LogLevel.WARNING, 92 { 93 str1 = childEntry.logKey 94 str2 = containerView.toString() 95 }, 96 { "RemoveTransientRow from other ViewGroup: childKey: $str1 -- ViewGroup: $str2" } 97 ) 98 } 99 logAddTransientRownull100 fun logAddTransientRow( 101 childEntry: NotificationEntry, 102 containerEntry: NotificationEntry, 103 index: Int 104 ) { 105 notificationRenderBuffer.log( 106 TAG, 107 LogLevel.ERROR, 108 { 109 str1 = childEntry.logKey 110 str2 = containerEntry.logKey 111 int1 = index 112 }, 113 { "addTransientRow to row: childKey: $str1 -- containerKey: $str2 -- index: $int1" } 114 ) 115 } 116 logRemoveTransientRownull117 fun logRemoveTransientRow( 118 childEntry: NotificationEntry, 119 containerEntry: NotificationEntry, 120 ) { 121 notificationRenderBuffer.log( 122 TAG, 123 LogLevel.ERROR, 124 { 125 str1 = childEntry.logKey 126 str2 = containerEntry.logKey 127 }, 128 { "removeTransientRow from row: childKey: $str1 -- containerKey: $str2" } 129 ) 130 } 131 } 132 133 private const val TAG = "NotifRow" 134