Loading packages/SystemUI/src/com/android/systemui/dump/DumpManager.kt +4 −7 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ open class DumpManager @Inject constructor() { /** See [registerCriticalDumpable]. */ fun registerCriticalDumpable(module: Dumpable) { registerCriticalDumpable(module::class.java.canonicalName, module) registerCriticalDumpable(module::class.java.name, module) } /** Loading @@ -62,7 +62,7 @@ open class DumpManager @Inject constructor() { /** See [registerNormalDumpable]. */ fun registerNormalDumpable(module: Dumpable) { registerNormalDumpable(module::class.java.canonicalName, module) registerNormalDumpable(module::class.java.name, module) } /** Loading Loading @@ -104,13 +104,10 @@ open class DumpManager @Inject constructor() { dumpables[name] = DumpableEntry(module, name, priority) } /** * Same as the above override, but automatically uses the canonical class name as the dumpable * name. */ /** Same as the above override, but automatically uses the class name as the dumpable name. */ @Synchronized fun registerDumpable(module: Dumpable) { registerDumpable(module::class.java.canonicalName, module) registerDumpable(module::class.java.name, module) } /** Unregisters a previously-registered dumpable. */ Loading packages/SystemUI/tests/src/com/android/systemui/dump/DumpManagerTest.kt +16 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.log.LogBuffer import com.android.systemui.log.table.TableLogBuffer import com.google.common.truth.Truth.assertThat import java.io.PrintWriter import org.junit.Assert.assertThrows import org.junit.Before import org.junit.Test Loading Loading @@ -130,6 +131,21 @@ class DumpManagerTest : SysuiTestCase() { // No exception thrown } @Test fun registerDumpable_supportsAnonymousDumpables() { val anonDumpable = object : Dumpable { override fun dump(pw: PrintWriter, args: Array<out String>) { pw.println("AnonDumpable") } } // THEN registration with implicit names should succeed dumpManager.registerCriticalDumpable(anonDumpable) // No exception thrown } @Test fun getDumpables_returnsSafeCollection() { // GIVEN a variety of registered dumpables Loading Loading
packages/SystemUI/src/com/android/systemui/dump/DumpManager.kt +4 −7 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ open class DumpManager @Inject constructor() { /** See [registerCriticalDumpable]. */ fun registerCriticalDumpable(module: Dumpable) { registerCriticalDumpable(module::class.java.canonicalName, module) registerCriticalDumpable(module::class.java.name, module) } /** Loading @@ -62,7 +62,7 @@ open class DumpManager @Inject constructor() { /** See [registerNormalDumpable]. */ fun registerNormalDumpable(module: Dumpable) { registerNormalDumpable(module::class.java.canonicalName, module) registerNormalDumpable(module::class.java.name, module) } /** Loading Loading @@ -104,13 +104,10 @@ open class DumpManager @Inject constructor() { dumpables[name] = DumpableEntry(module, name, priority) } /** * Same as the above override, but automatically uses the canonical class name as the dumpable * name. */ /** Same as the above override, but automatically uses the class name as the dumpable name. */ @Synchronized fun registerDumpable(module: Dumpable) { registerDumpable(module::class.java.canonicalName, module) registerDumpable(module::class.java.name, module) } /** Unregisters a previously-registered dumpable. */ Loading
packages/SystemUI/tests/src/com/android/systemui/dump/DumpManagerTest.kt +16 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.log.LogBuffer import com.android.systemui.log.table.TableLogBuffer import com.google.common.truth.Truth.assertThat import java.io.PrintWriter import org.junit.Assert.assertThrows import org.junit.Before import org.junit.Test Loading Loading @@ -130,6 +131,21 @@ class DumpManagerTest : SysuiTestCase() { // No exception thrown } @Test fun registerDumpable_supportsAnonymousDumpables() { val anonDumpable = object : Dumpable { override fun dump(pw: PrintWriter, args: Array<out String>) { pw.println("AnonDumpable") } } // THEN registration with implicit names should succeed dumpManager.registerCriticalDumpable(anonDumpable) // No exception thrown } @Test fun getDumpables_returnsSafeCollection() { // GIVEN a variety of registered dumpables Loading