Loading packages/SystemUI/src/com/android/systemui/dump/DumpHandler.kt +3 −6 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.os.Trace import com.android.systemui.CoreStartable import com.android.systemui.R import com.android.systemui.dump.DumpHandler.Companion.PRIORITY_ARG_CRITICAL import com.android.systemui.dump.DumpHandler.Companion.PRIORITY_ARG_HIGH import com.android.systemui.dump.DumpHandler.Companion.PRIORITY_ARG_NORMAL import com.android.systemui.dump.nano.SystemUIProtoDump import com.android.systemui.plugins.log.LogBuffer Loading Loading @@ -148,12 +147,12 @@ class DumpHandler @Inject constructor( } private fun dumpCritical(pw: PrintWriter, args: ParsedArgs) { dumpManager.dumpDumpables(pw, args.rawArgs) dumpManager.dumpCritical(pw, args.rawArgs) dumpConfig(pw) } private fun dumpNormal(pw: PrintWriter, args: ParsedArgs) { dumpManager.dumpBuffers(pw, args.tailLength) dumpManager.dumpNormal(pw, args.rawArgs, args.tailLength) logBufferEulogizer.readEulogyIfPresent(pw) } Loading Loading @@ -349,14 +348,12 @@ class DumpHandler @Inject constructor( companion object { const val PRIORITY_ARG = "--dump-priority" const val PRIORITY_ARG_CRITICAL = "CRITICAL" const val PRIORITY_ARG_HIGH = "HIGH" const val PRIORITY_ARG_NORMAL = "NORMAL" const val PROTO = "--proto" } } private val PRIORITY_OPTIONS = arrayOf(PRIORITY_ARG_CRITICAL, PRIORITY_ARG_HIGH, PRIORITY_ARG_NORMAL) private val PRIORITY_OPTIONS = arrayOf(PRIORITY_ARG_CRITICAL, PRIORITY_ARG_NORMAL) private val COMMANDS = arrayOf( "bugreport-critical", Loading packages/SystemUI/src/com/android/systemui/dump/DumpManager.kt +81 −8 Original line number Diff line number Diff line Loading @@ -40,20 +40,54 @@ open class DumpManager @Inject constructor() { private val buffers: MutableMap<String, RegisteredDumpable<LogBuffer>> = ArrayMap() /** * Register a dumpable to be called during a bug report. The dumpable will be called during the * CRITICAL section of the bug report, so don't dump an excessive amount of stuff here. * Registers a dumpable to be called during the CRITICAL section of the bug report. * * The CRITICAL section gets very high priority during a dump, but also a very limited amount of * time to do the dumping. So, please don't dump an excessive amount of stuff using CRITICAL. * * See [registerDumpable]. */ fun registerCriticalDumpable(name: String, module: Dumpable) { registerDumpable(name, module, DumpPriority.CRITICAL) } /** * Registers a dumpable to be called during the NORMAL section of the bug report. * * The NORMAL section gets a lower priority during a dump, but also more time. This should be * used by [LogBuffer] instances, [ProtoDumpable] instances, and any [Dumpable] instances that * dump a lot of information. */ fun registerNormalDumpable(name: String, module: Dumpable) { registerDumpable(name, module, DumpPriority.NORMAL) } /** * Register a dumpable to be called during a bug report. * * @param name The name to register the dumpable under. This is typically the qualified class * name of the thing being dumped (getClass().getName()), but can be anything as long as it * doesn't clash with an existing registration. * @param priority the priority level of this dumpable, which affects at what point in the bug * report this gets dump. By default, the dumpable will be called during the CRITICAL section of * the bug report, so don't dump an excessive amount of stuff here. * * TODO(b/259973758): Replace all calls to this method with calls to [registerCriticalDumpable] * or [registerNormalDumpable] instead. */ @Synchronized fun registerDumpable(name: String, module: Dumpable) { @JvmOverloads @Deprecated("Use registerCriticalDumpable or registerNormalDumpable instead") fun registerDumpable( name: String, module: Dumpable, priority: DumpPriority = DumpPriority.CRITICAL, ) { if (!canAssignToNameLocked(name, module)) { throw IllegalArgumentException("'$name' is already registered") } dumpables[name] = RegisteredDumpable(name, module) dumpables[name] = RegisteredDumpable(name, module, priority) } /** Loading Loading @@ -81,7 +115,10 @@ open class DumpManager @Inject constructor() { if (!canAssignToNameLocked(name, buffer)) { throw IllegalArgumentException("'$name' is already registered") } buffers[name] = RegisteredDumpable(name, buffer) // All buffers must be priority NORMAL, not CRITICAL, because they often contain a lot of // data. buffers[name] = RegisteredDumpable(name, buffer, DumpPriority.NORMAL) } /** Loading Loading @@ -140,7 +177,35 @@ open class DumpManager @Inject constructor() { } /** * Dumps all registered dumpables to [pw] * Dumps all registered dumpables with critical priority to [pw] */ @Synchronized fun dumpCritical(pw: PrintWriter, args: Array<String>) { for (dumpable in dumpables.values) { if (dumpable.priority == DumpPriority.CRITICAL) { dumpDumpable(dumpable, pw, args) } } } /** * To [pw], dumps (1) all registered dumpables with normal priority; and (2) all [LogBuffer]s. */ @Synchronized fun dumpNormal(pw: PrintWriter, args: Array<String>, tailLength: Int = 0) { for (dumpable in dumpables.values) { if (dumpable.priority == DumpPriority.NORMAL) { dumpDumpable(dumpable, pw, args) } } for (buffer in buffers.values) { dumpBuffer(buffer, pw, tailLength) } } /** * Dump all the instances of [Dumpable]. */ @Synchronized fun dumpDumpables(pw: PrintWriter, args: Array<String>) { Loading Loading @@ -232,7 +297,15 @@ open class DumpManager @Inject constructor() { private data class RegisteredDumpable<T>( val name: String, val dumpable: T val dumpable: T, val priority: DumpPriority, ) private const val TAG = "DumpManager" /** * The priority level for a given dumpable, which affects at what point in the bug report this gets * dumped. */ enum class DumpPriority { CRITICAL, NORMAL, } packages/SystemUI/src/com/android/systemui/flags/FeatureFlagsDebugStartable.kt +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ constructor( ) : CoreStartable { init { dumpManager.registerDumpable(FeatureFlagsDebug.TAG) { pw, args -> dumpManager.registerCriticalDumpable(FeatureFlagsDebug.TAG) { pw, args -> featureFlags.dump(pw, args) } } Loading packages/SystemUI/src/com/android/systemui/flags/FeatureFlagsReleaseStartable.kt +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ class FeatureFlagsReleaseStartable constructor(dumpManager: DumpManager, featureFlags: FeatureFlags) : CoreStartable { init { dumpManager.registerDumpable(FeatureFlagsRelease.TAG) { pw, args -> dumpManager.registerCriticalDumpable(FeatureFlagsRelease.TAG) { pw, args -> featureFlags.dump(pw, args) } } Loading packages/SystemUI/src/com/android/systemui/shade/transition/ShadeTransitionController.kt +1 −1 Original line number Diff line number Diff line Loading @@ -78,7 +78,7 @@ constructor( }) shadeExpansionStateManager.addExpansionListener(this::onPanelExpansionChanged) shadeExpansionStateManager.addStateListener(this::onPanelStateChanged) dumpManager.registerDumpable("ShadeTransitionController") { printWriter, _ -> dumpManager.registerCriticalDumpable("ShadeTransitionController") { printWriter, _ -> dump(printWriter) } } Loading Loading
packages/SystemUI/src/com/android/systemui/dump/DumpHandler.kt +3 −6 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.os.Trace import com.android.systemui.CoreStartable import com.android.systemui.R import com.android.systemui.dump.DumpHandler.Companion.PRIORITY_ARG_CRITICAL import com.android.systemui.dump.DumpHandler.Companion.PRIORITY_ARG_HIGH import com.android.systemui.dump.DumpHandler.Companion.PRIORITY_ARG_NORMAL import com.android.systemui.dump.nano.SystemUIProtoDump import com.android.systemui.plugins.log.LogBuffer Loading Loading @@ -148,12 +147,12 @@ class DumpHandler @Inject constructor( } private fun dumpCritical(pw: PrintWriter, args: ParsedArgs) { dumpManager.dumpDumpables(pw, args.rawArgs) dumpManager.dumpCritical(pw, args.rawArgs) dumpConfig(pw) } private fun dumpNormal(pw: PrintWriter, args: ParsedArgs) { dumpManager.dumpBuffers(pw, args.tailLength) dumpManager.dumpNormal(pw, args.rawArgs, args.tailLength) logBufferEulogizer.readEulogyIfPresent(pw) } Loading Loading @@ -349,14 +348,12 @@ class DumpHandler @Inject constructor( companion object { const val PRIORITY_ARG = "--dump-priority" const val PRIORITY_ARG_CRITICAL = "CRITICAL" const val PRIORITY_ARG_HIGH = "HIGH" const val PRIORITY_ARG_NORMAL = "NORMAL" const val PROTO = "--proto" } } private val PRIORITY_OPTIONS = arrayOf(PRIORITY_ARG_CRITICAL, PRIORITY_ARG_HIGH, PRIORITY_ARG_NORMAL) private val PRIORITY_OPTIONS = arrayOf(PRIORITY_ARG_CRITICAL, PRIORITY_ARG_NORMAL) private val COMMANDS = arrayOf( "bugreport-critical", Loading
packages/SystemUI/src/com/android/systemui/dump/DumpManager.kt +81 −8 Original line number Diff line number Diff line Loading @@ -40,20 +40,54 @@ open class DumpManager @Inject constructor() { private val buffers: MutableMap<String, RegisteredDumpable<LogBuffer>> = ArrayMap() /** * Register a dumpable to be called during a bug report. The dumpable will be called during the * CRITICAL section of the bug report, so don't dump an excessive amount of stuff here. * Registers a dumpable to be called during the CRITICAL section of the bug report. * * The CRITICAL section gets very high priority during a dump, but also a very limited amount of * time to do the dumping. So, please don't dump an excessive amount of stuff using CRITICAL. * * See [registerDumpable]. */ fun registerCriticalDumpable(name: String, module: Dumpable) { registerDumpable(name, module, DumpPriority.CRITICAL) } /** * Registers a dumpable to be called during the NORMAL section of the bug report. * * The NORMAL section gets a lower priority during a dump, but also more time. This should be * used by [LogBuffer] instances, [ProtoDumpable] instances, and any [Dumpable] instances that * dump a lot of information. */ fun registerNormalDumpable(name: String, module: Dumpable) { registerDumpable(name, module, DumpPriority.NORMAL) } /** * Register a dumpable to be called during a bug report. * * @param name The name to register the dumpable under. This is typically the qualified class * name of the thing being dumped (getClass().getName()), but can be anything as long as it * doesn't clash with an existing registration. * @param priority the priority level of this dumpable, which affects at what point in the bug * report this gets dump. By default, the dumpable will be called during the CRITICAL section of * the bug report, so don't dump an excessive amount of stuff here. * * TODO(b/259973758): Replace all calls to this method with calls to [registerCriticalDumpable] * or [registerNormalDumpable] instead. */ @Synchronized fun registerDumpable(name: String, module: Dumpable) { @JvmOverloads @Deprecated("Use registerCriticalDumpable or registerNormalDumpable instead") fun registerDumpable( name: String, module: Dumpable, priority: DumpPriority = DumpPriority.CRITICAL, ) { if (!canAssignToNameLocked(name, module)) { throw IllegalArgumentException("'$name' is already registered") } dumpables[name] = RegisteredDumpable(name, module) dumpables[name] = RegisteredDumpable(name, module, priority) } /** Loading Loading @@ -81,7 +115,10 @@ open class DumpManager @Inject constructor() { if (!canAssignToNameLocked(name, buffer)) { throw IllegalArgumentException("'$name' is already registered") } buffers[name] = RegisteredDumpable(name, buffer) // All buffers must be priority NORMAL, not CRITICAL, because they often contain a lot of // data. buffers[name] = RegisteredDumpable(name, buffer, DumpPriority.NORMAL) } /** Loading Loading @@ -140,7 +177,35 @@ open class DumpManager @Inject constructor() { } /** * Dumps all registered dumpables to [pw] * Dumps all registered dumpables with critical priority to [pw] */ @Synchronized fun dumpCritical(pw: PrintWriter, args: Array<String>) { for (dumpable in dumpables.values) { if (dumpable.priority == DumpPriority.CRITICAL) { dumpDumpable(dumpable, pw, args) } } } /** * To [pw], dumps (1) all registered dumpables with normal priority; and (2) all [LogBuffer]s. */ @Synchronized fun dumpNormal(pw: PrintWriter, args: Array<String>, tailLength: Int = 0) { for (dumpable in dumpables.values) { if (dumpable.priority == DumpPriority.NORMAL) { dumpDumpable(dumpable, pw, args) } } for (buffer in buffers.values) { dumpBuffer(buffer, pw, tailLength) } } /** * Dump all the instances of [Dumpable]. */ @Synchronized fun dumpDumpables(pw: PrintWriter, args: Array<String>) { Loading Loading @@ -232,7 +297,15 @@ open class DumpManager @Inject constructor() { private data class RegisteredDumpable<T>( val name: String, val dumpable: T val dumpable: T, val priority: DumpPriority, ) private const val TAG = "DumpManager" /** * The priority level for a given dumpable, which affects at what point in the bug report this gets * dumped. */ enum class DumpPriority { CRITICAL, NORMAL, }
packages/SystemUI/src/com/android/systemui/flags/FeatureFlagsDebugStartable.kt +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ constructor( ) : CoreStartable { init { dumpManager.registerDumpable(FeatureFlagsDebug.TAG) { pw, args -> dumpManager.registerCriticalDumpable(FeatureFlagsDebug.TAG) { pw, args -> featureFlags.dump(pw, args) } } Loading
packages/SystemUI/src/com/android/systemui/flags/FeatureFlagsReleaseStartable.kt +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ class FeatureFlagsReleaseStartable constructor(dumpManager: DumpManager, featureFlags: FeatureFlags) : CoreStartable { init { dumpManager.registerDumpable(FeatureFlagsRelease.TAG) { pw, args -> dumpManager.registerCriticalDumpable(FeatureFlagsRelease.TAG) { pw, args -> featureFlags.dump(pw, args) } } Loading
packages/SystemUI/src/com/android/systemui/shade/transition/ShadeTransitionController.kt +1 −1 Original line number Diff line number Diff line Loading @@ -78,7 +78,7 @@ constructor( }) shadeExpansionStateManager.addExpansionListener(this::onPanelExpansionChanged) shadeExpansionStateManager.addStateListener(this::onPanelStateChanged) dumpManager.registerDumpable("ShadeTransitionController") { printWriter, _ -> dumpManager.registerCriticalDumpable("ShadeTransitionController") { printWriter, _ -> dump(printWriter) } } Loading