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.plugins.log.LogBuffer 7 import com.android.systemui.plugins.log.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) { 65 buffer.log(TAG, LogLevel.DEBUG, { 66 str1 = key 67 bool1 = shouldHun 68 }, { 69 "updating entry via ranking applied: $str1 updated shouldHeadsUp=$bool1" 70 }) 71 } 72 logEntryUpdatedToFullScreennull73 fun logEntryUpdatedToFullScreen(key: String) { 74 buffer.log(TAG, LogLevel.DEBUG, { 75 str1 = key 76 }, { 77 "updating entry to launch full screen intent: $str1" 78 }) 79 } 80 logSummaryMarkedInterruptednull81 fun logSummaryMarkedInterrupted(summaryKey: String, childKey: String) { 82 buffer.log(TAG, LogLevel.DEBUG, { 83 str1 = summaryKey 84 str2 = childKey 85 }, { 86 "marked group summary as interrupted: $str1 for alert transfer to child: $str2" 87 }) 88 } 89 } 90