1 package com.android.systemui.statusbar.notification.collection.coordinator 2 3 import android.util.Log 4 5 import com.android.systemui.log.dagger.NotificationHeadsUpLog 6 import com.android.systemui.log.LogBuffer 7 import com.android.systemui.log.core.LogLevel 8 import javax.inject.Inject 9 10 private const val TAG = "HeadsUpCoordinator" 11 12 class HeadsUpCoordinatorLogger constructor( 13 private val buffer: LogBuffer, 14 private val verbose: Boolean, 15 ) { 16 @Inject 17 constructor(@NotificationHeadsUpLog buffer: LogBuffer) : 18 this(buffer, Log.isLoggable(TAG, Log.VERBOSE)) 19 logPostedEntryWillEvaluatenull20 fun logPostedEntryWillEvaluate(posted: HeadsUpCoordinator.PostedEntry, reason: String) { 21 if (!verbose) return 22 buffer.log(TAG, LogLevel.VERBOSE, { 23 str1 = posted.key 24 str2 = reason 25 bool1 = posted.shouldHeadsUpEver 26 bool2 = posted.shouldHeadsUpAgain 27 }, { 28 "will evaluate posted entry $str1:" + 29 " reason=$str2 shouldHeadsUpEver=$bool1 shouldHeadsUpAgain=$bool2" 30 }) 31 } 32 logPostedEntryWillNotEvaluatenull33 fun logPostedEntryWillNotEvaluate(posted: HeadsUpCoordinator.PostedEntry, reason: String) { 34 if (!verbose) return 35 buffer.log(TAG, LogLevel.VERBOSE, { 36 str1 = posted.key 37 str2 = reason 38 }, { 39 "will not evaluate posted entry $str1: reason=$str2" 40 }) 41 } 42 logEvaluatingGroupsnull43 fun logEvaluatingGroups(numGroups: Int) { 44 if (!verbose) return 45 buffer.log(TAG, LogLevel.VERBOSE, { 46 int1 = numGroups 47 }, { 48 "evaluating groups for alert transfer: $int1" 49 }) 50 } 51 logEvaluatingGroupnull52 fun logEvaluatingGroup(groupKey: String, numPostedEntries: Int, logicalGroupSize: Int) { 53 if (!verbose) return 54 buffer.log(TAG, LogLevel.VERBOSE, { 55 str1 = groupKey 56 int1 = numPostedEntries 57 int2 = logicalGroupSize 58 }, { 59 "evaluating group for alert transfer: $str1" + 60 " numPostedEntries=$int1 logicalGroupSize=$int2" 61 }) 62 } 63 logEntryUpdatedByRankingnull64 fun logEntryUpdatedByRanking(key: String, shouldHun: Boolean, reason: String) { 65 buffer.log(TAG, LogLevel.DEBUG, { 66 str1 = key 67 bool1 = shouldHun 68 str2 = reason 69 }, { 70 "updating entry via ranking applied: $str1 updated shouldHeadsUp=$bool1 because $str2" 71 }) 72 } 73 logEntryUpdatedToFullScreennull74 fun logEntryUpdatedToFullScreen(key: String, reason: String) { 75 buffer.log(TAG, LogLevel.DEBUG, { 76 str1 = key 77 str2 = reason 78 }, { 79 "updating entry to launch full screen intent: $str1 because $str2" 80 }) 81 } 82 logEntryDisqualifiedFromFullScreennull83 fun logEntryDisqualifiedFromFullScreen(key: String, reason: String) { 84 buffer.log(TAG, LogLevel.DEBUG, { 85 str1 = key 86 str2 = reason 87 }, { 88 "updated entry no longer qualifies for full screen intent: $str1 because $str2" 89 }) 90 } 91 logSummaryMarkedInterruptednull92 fun logSummaryMarkedInterrupted(summaryKey: String, childKey: String) { 93 buffer.log(TAG, LogLevel.DEBUG, { 94 str1 = summaryKey 95 str2 = childKey 96 }, { 97 "marked group summary as interrupted: $str1 for alert transfer to child: $str2" 98 }) 99 } 100 } 101