Skip to content
Snippets Groups Projects
Commit acb9fe85 authored by Fabian Kozynski's avatar Fabian Kozynski Committed by Android (Google) Code Review
Browse files

Merge "Add missing commands to DumpHandler" into tm-qpr-dev

parents af699641 1f13e02f
No related branches found
No related tags found
No related merge requests found
......@@ -235,6 +235,7 @@ class DumpHandler @Inject constructor(
pw.println("$ <invocation> buffers")
pw.println("$ <invocation> bugreport-critical")
pw.println("$ <invocation> bugreport-normal")
pw.println("$ <invocation> config")
pw.println()
pw.println("Targets can be listed:")
......@@ -313,13 +314,21 @@ class DumpHandler @Inject constructor(
const val PRIORITY_ARG_CRITICAL = "CRITICAL"
const val PRIORITY_ARG_HIGH = "HIGH"
const val PRIORITY_ARG_NORMAL = "NORMAL"
const val PROTO = "--sysui_proto"
}
}
private val PRIORITY_OPTIONS =
arrayOf(PRIORITY_ARG_CRITICAL, PRIORITY_ARG_HIGH, PRIORITY_ARG_NORMAL)
private val COMMANDS = arrayOf("bugreport-critical", "bugreport-normal", "buffers", "dumpables")
private val COMMANDS = arrayOf(
"bugreport-critical",
"bugreport-normal",
"buffers",
"dumpables",
"config",
"help"
)
private class ParsedArgs(
val rawArgs: Array<String>,
......
......@@ -17,11 +17,13 @@
package com.android.systemui.dump
import androidx.test.filters.SmallTest
import com.android.systemui.CoreStartable
import com.android.systemui.Dumpable
import com.android.systemui.SysuiTestCase
import com.android.systemui.log.LogBuffer
import com.android.systemui.shared.system.UncaughtExceptionPreHandlerManager
import com.android.systemui.util.mockito.any
import com.google.common.truth.Truth.assertThat
import org.junit.Before
import org.junit.Test
import org.mockito.Mock
......@@ -30,6 +32,8 @@ import org.mockito.Mockito.never
import org.mockito.Mockito.verify
import org.mockito.MockitoAnnotations
import java.io.PrintWriter
import java.io.StringWriter
import javax.inject.Provider
@SmallTest
class DumpHandlerTest : SysuiTestCase() {
......@@ -66,7 +70,9 @@ class DumpHandlerTest : SysuiTestCase() {
mContext,
dumpManager,
logBufferEulogizer,
mutableMapOf(),
mutableMapOf(
EmptyCoreStartable::class.java to Provider { EmptyCoreStartable() }
),
exceptionHandlerManager
)
}
......@@ -154,4 +160,20 @@ class DumpHandlerTest : SysuiTestCase() {
verify(buffer1).dump(pw, 0)
verify(buffer2).dump(pw, 0)
}
}
\ No newline at end of file
@Test
fun testConfigDump() {
// GIVEN a StringPrintWriter
val stringWriter = StringWriter()
val spw = PrintWriter(stringWriter)
// When a config dump is requested
dumpHandler.dump(spw, arrayOf("config"))
assertThat(stringWriter.toString()).contains(EmptyCoreStartable::class.java.simpleName)
}
private class EmptyCoreStartable : CoreStartable {
override fun start() {}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment