• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.stack.MagneticNotificationRowManagerImpl
26 import javax.inject.Inject
27 
28 class NotificationRowLogger
29 @Inject
30 constructor(
31     @NotificationLog private val buffer: LogBuffer,
32     @NotificationRenderLog private val notificationRenderBuffer: LogBuffer,
33 ) {
logKeepInParentChildDetachednull34     fun logKeepInParentChildDetached(child: String, oldParent: String?) {
35         buffer.log(
36             TAG,
37             LogLevel.DEBUG,
38             {
39                 str1 = child
40                 str2 = oldParent
41             },
42             { "Detach child $str1 kept in parent $str2" },
43         )
44     }
45 
logSkipAttachingKeepInParentChildnull46     fun logSkipAttachingKeepInParentChild(child: String, newParent: String?) {
47         buffer.log(
48             TAG,
49             LogLevel.WARNING,
50             {
51                 str1 = child
52                 str2 = newParent
53             },
54             { "Skipping to attach $str1 to $str2, because it still flagged to keep in parent" },
55         )
56     }
57 
logRemoveTransientFromContainernull58     fun logRemoveTransientFromContainer(
59         childEntry: String,
60         containerEntry: String,
61     ) {
62         notificationRenderBuffer.log(
63             TAG,
64             LogLevel.INFO,
65             {
66                 str1 = childEntry
67                 str2 = containerEntry
68             },
69             { "RemoveTransientRow from ChildrenContainer: childKey: $str1 -- containerKey: $str2" },
70         )
71     }
72 
logRemoveTransientFromNsslnull73     fun logRemoveTransientFromNssl(childEntry: String) {
74         notificationRenderBuffer.log(
75             TAG,
76             LogLevel.INFO,
77             { str1 = childEntry },
78             { "RemoveTransientRow from Nssl: childKey: $str1" },
79         )
80     }
81 
logRemoveTransientFromViewGroupnull82     fun logRemoveTransientFromViewGroup(childEntry: String, containerView: ViewGroup) {
83         notificationRenderBuffer.log(
84             TAG,
85             LogLevel.WARNING,
86             {
87                 str1 = childEntry
88                 str2 = containerView.toString()
89             },
90             { "RemoveTransientRow from other ViewGroup: childKey: $str1 -- ViewGroup: $str2" },
91         )
92     }
93 
logAddTransientRownull94     fun logAddTransientRow(
95         childEntry: String,
96         containerEntry: String,
97         index: Int,
98     ) {
99         notificationRenderBuffer.log(
100             TAG,
101             LogLevel.ERROR,
102             {
103                 str1 = childEntry
104                 str2 = containerEntry
105                 int1 = index
106             },
107             { "addTransientRow to row: childKey: $str1 -- containerKey: $str2 -- index: $int1" },
108         )
109     }
110 
logRemoveTransientRownull111     fun logRemoveTransientRow(childEntry: String, containerEntry: String) {
112         notificationRenderBuffer.log(
113             TAG,
114             LogLevel.ERROR,
115             {
116                 str1 = childEntry
117                 str2 = containerEntry
118             },
119             { "removeTransientRow from row: childKey: $str1 -- containerKey: $str2" },
120         )
121     }
122 
logResetAllContentAlphasnull123     fun logResetAllContentAlphas(entry: String) {
124         notificationRenderBuffer.log(
125             TAG,
126             LogLevel.INFO,
127             { str1 = entry },
128             { "resetAllContentAlphas: $str1" },
129         )
130     }
131 
logSkipResetAllContentAlphasnull132     fun logSkipResetAllContentAlphas(entry: String) {
133         notificationRenderBuffer.log(
134             TAG,
135             LogLevel.INFO,
136             { str1 = entry },
137             { "Skip resetAllContentAlphas: $str1" },
138         )
139     }
140 
logStartAppearAnimationnull141     fun logStartAppearAnimation(entry: String, isAppear: Boolean) {
142         notificationRenderBuffer.log(
143             TAG,
144             LogLevel.DEBUG,
145             {
146                 str1 = entry
147                 bool1 = isAppear
148             },
149             { "startAppearAnimation childKey: $str1 isAppear:$bool1" },
150         )
151     }
152 
logCancelAppearDrawingnull153     fun logCancelAppearDrawing(entry: String, wasDrawing: Boolean) {
154         notificationRenderBuffer.log(
155             TAG,
156             LogLevel.WARNING,
157             {
158                 str1 = entry
159                 bool1 = wasDrawing
160             },
161             { "cancelAppearDrawing childKey: $str1 wasDrawing:$bool1" },
162         )
163     }
164 
logAppearAnimationStartednull165     fun logAppearAnimationStarted(entry: String, isAppear: Boolean) {
166         notificationRenderBuffer.log(
167             TAG,
168             LogLevel.DEBUG,
169             {
170                 str1 = entry
171                 bool1 = isAppear
172             },
173             { "onAppearAnimationStarted childKey: $str1 isAppear:$bool1" },
174         )
175     }
176 
logAppearAnimationSkippednull177     fun logAppearAnimationSkipped(entry: String, isAppear: Boolean) {
178         notificationRenderBuffer.log(
179             TAG,
180             LogLevel.WARNING,
181             {
182                 str1 = entry
183                 bool1 = isAppear
184             },
185             { "Skipped an appear animation childKey: $str1 isAppear:$bool1" },
186         )
187     }
188 
logAppearAnimationFinishednull189     fun logAppearAnimationFinished(
190         entry: String,
191         isAppear: Boolean,
192         cancelled: Boolean,
193     ) {
194         notificationRenderBuffer.log(
195             TAG,
196             LogLevel.DEBUG,
197             {
198                 str1 = entry
199                 bool1 = isAppear
200                 bool2 = cancelled
201             },
202             { "onAppearAnimationFinished childKey: $str1 isAppear:$bool1 cancelled:$bool2" },
203         )
204     }
205 
logMagneticAndRoundableTargetsNotSetnull206     fun logMagneticAndRoundableTargetsNotSet(
207         state: MagneticNotificationRowManagerImpl.State,
208         entry: String,
209     ) {
210         buffer.log(
211             TAG,
212             LogLevel.ERROR,
213             {
214                 str1 = entry
215                 str2 = state.name
216             },
217             { "Failed to set magnetic and roundable targets for $str1 on state $str2." },
218         )
219     }
220 
logMagneticRowTranslationNotSetnull221     fun logMagneticRowTranslationNotSet(
222         state: MagneticNotificationRowManagerImpl.State,
223         entry: String,
224     ) {
225         buffer.log(
226             TAG,
227             LogLevel.ERROR,
228             {
229                 str1 = entry
230                 str2 = state.name
231             },
232             { "Failed to set magnetic row translation for $str1 on state $str2." },
233         )
234     }
235 }
236 
237 private const val TAG = "NotifRow"
238