Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit db7864da authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[Pod] Rename interface & impl for TableLogBuffer, move interface to pod

Previously, the interface for TableLogBuffer was named
TableLogBufferBase, and the impl was named TableLogBuffer. To match our
new conventions, this CL renames the interface to TableLogBuffer and the
impl to TableLogBufferImpl.

Also, TableLogBufferBase was in the `plugins` directory so that classes
outside of SystemUI-core could access it. With pods, we can now move the
interface into a pod. It'll still be accessible by classes outside of
SystemUI-core, but now it has a dedicated `api` soong target.

Bug: 307607958
Flag: EXEMPT refactor
Test: m SystemUI-core
Test: m SystemUISharedLib
Change-Id: I224f7e4d91e2d51482db0e708ed0a805da2ba553
parent aa0e2348
Loading
Loading
Loading
Loading
+12 −69
Original line number Diff line number Diff line
@@ -52,12 +52,7 @@ class LogDiffsForTableTest : SysuiTestCase() {
    fun setUp() {
        systemClock = FakeSystemClock()
        tableLogBuffer =
            TableLogBuffer(
                MAX_SIZE,
                BUFFER_NAME,
                systemClock,
                LogcatEchoTrackerAlways(),
            )
            TableLogBufferImpl(MAX_SIZE, BUFFER_NAME, systemClock, LogcatEchoTrackerAlways())
    }

    // ---- Flow<Boolean> tests ----
@@ -66,12 +61,7 @@ class LogDiffsForTableTest : SysuiTestCase() {
    fun boolean_doesNotLogWhenNotCollected() {
        val flow = flowOf(true, true, false)

        flow.logDiffsForTable(
            tableLogBuffer,
            COLUMN_PREFIX,
            COLUMN_NAME,
            initialValue = false,
        )
        flow.logDiffsForTable(tableLogBuffer, COLUMN_PREFIX, COLUMN_NAME, initialValue = false)

        val logs = dumpLog()
        assertThat(logs).doesNotContain(COLUMN_PREFIX)
@@ -264,12 +254,7 @@ class LogDiffsForTableTest : SysuiTestCase() {
    fun int_doesNotLogWhenNotCollected() {
        val flow = flowOf(5, 6, 7)

        flow.logDiffsForTable(
            tableLogBuffer,
            COLUMN_PREFIX,
            COLUMN_NAME,
            initialValue = 1234,
        )
        flow.logDiffsForTable(tableLogBuffer, COLUMN_PREFIX, COLUMN_NAME, initialValue = 1234)

        val logs = dumpLog()
        assertThat(logs).doesNotContain(COLUMN_PREFIX)
@@ -370,12 +355,7 @@ class LogDiffsForTableTest : SysuiTestCase() {
            }

            val flowWithLogging =
                flow.logDiffsForTable(
                    tableLogBuffer,
                    COLUMN_PREFIX,
                    COLUMN_NAME,
                    initialValue = 1,
                )
                flow.logDiffsForTable(tableLogBuffer, COLUMN_PREFIX, COLUMN_NAME, initialValue = 1)

            val job = launch { flowWithLogging.collect() }

@@ -417,12 +397,7 @@ class LogDiffsForTableTest : SysuiTestCase() {
            }

            val flowWithLogging =
                flow.logDiffsForTable(
                    tableLogBuffer,
                    COLUMN_PREFIX,
                    COLUMN_NAME,
                    initialValue = 1,
                )
                flow.logDiffsForTable(tableLogBuffer, COLUMN_PREFIX, COLUMN_NAME, initialValue = 1)

            val job = launch { flowWithLogging.collect() }

@@ -518,12 +493,7 @@ class LogDiffsForTableTest : SysuiTestCase() {
    fun string_doesNotLogWhenNotCollected() {
        val flow = flowOf("val5", "val6", "val7")

        flow.logDiffsForTable(
            tableLogBuffer,
            COLUMN_PREFIX,
            COLUMN_NAME,
            initialValue = "val1234",
        )
        flow.logDiffsForTable(tableLogBuffer, COLUMN_PREFIX, COLUMN_NAME, initialValue = "val1234")

        val logs = dumpLog()
        assertThat(logs).doesNotContain(COLUMN_PREFIX)
@@ -780,18 +750,10 @@ class LogDiffsForTableTest : SysuiTestCase() {

    @Test
    fun diffable_doesNotLogWhenNotCollected() {
        val flow =
            flowOf(
                TestDiffable(1, "1", true),
                TestDiffable(2, "2", false),
            )
        val flow = flowOf(TestDiffable(1, "1", true), TestDiffable(2, "2", false))

        val initial = TestDiffable(0, "0", false)
        flow.logDiffsForTable(
            tableLogBuffer,
            COLUMN_PREFIX,
            initial,
        )
        flow.logDiffsForTable(tableLogBuffer, COLUMN_PREFIX, initial)

        val logs = dumpLog()
        assertThat(logs).doesNotContain(COLUMN_PREFIX)
@@ -804,19 +766,10 @@ class LogDiffsForTableTest : SysuiTestCase() {
    @Test
    fun diffable_logsInitialWhenCollected_usingLogFull() =
        testScope.runTest {
            val flow =
                flowOf(
                    TestDiffable(1, "1", true),
                    TestDiffable(2, "2", false),
                )
            val flow = flowOf(TestDiffable(1, "1", true), TestDiffable(2, "2", false))

            val initial = TestDiffable(1234, "string1234", false)
            val flowWithLogging =
                flow.logDiffsForTable(
                    tableLogBuffer,
                    COLUMN_PREFIX,
                    initial,
                )
            val flowWithLogging = flow.logDiffsForTable(tableLogBuffer, COLUMN_PREFIX, initial)

            systemClock.setCurrentTimeMillis(3000L)
            val job = launch { flowWithLogging.collect() }
@@ -888,12 +841,7 @@ class LogDiffsForTableTest : SysuiTestCase() {
                }
            }

            val flowWithLogging =
                flow.logDiffsForTable(
                    tableLogBuffer,
                    COLUMN_PREFIX,
                    initialValue,
                )
            val flowWithLogging = flow.logDiffsForTable(tableLogBuffer, COLUMN_PREFIX, initialValue)

            val job = launch { flowWithLogging.collect() }

@@ -1033,12 +981,7 @@ class LogDiffsForTableTest : SysuiTestCase() {
        testScope.runTest {
            val initialValue = TestDiffable(0, "string0", false)
            val flow = MutableStateFlow(initialValue)
            val flowWithLogging =
                flow.logDiffsForTable(
                    tableLogBuffer,
                    COLUMN_PREFIX,
                    initialValue,
                )
            val flowWithLogging = flow.logDiffsForTable(tableLogBuffer, COLUMN_PREFIX, initialValue)

            systemClock.setCurrentTimeMillis(50L)
            val job = launch { flowWithLogging.collect() }
+2 −2
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ class TableLogBufferTest : SysuiTestCase() {
        outputWriter = StringWriter()

        underTest =
            TableLogBuffer(
            TableLogBufferImpl(
                MAX_SIZE,
                NAME,
                systemClock,
@@ -65,7 +65,7 @@ class TableLogBufferTest : SysuiTestCase() {

    @Test(expected = IllegalArgumentException::class)
    fun maxSizeZero_throwsException() {
        TableLogBuffer(
        TableLogBufferImpl(
            maxSize = 0,
            "name",
            systemClock,
+2 −2
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ import com.android.systemui.SysuiTestCase
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.runTest
import com.android.systemui.kosmos.testScope
import com.android.systemui.plugins.log.TableLogBufferBase
import com.android.systemui.log.table.TableLogBuffer
import com.android.systemui.util.concurrency.FakeExecutor
import com.android.systemui.util.time.FakeSystemClock
import java.util.Arrays
@@ -52,7 +52,7 @@ class ConditionMonitorTest : SysuiTestCase() {
    private lateinit var conditions: HashSet<Condition>
    private val executor = FakeExecutor(FakeSystemClock())

    @Mock private lateinit var logBuffer: TableLogBufferBase
    @Mock private lateinit var logBuffer: TableLogBuffer

    private lateinit var conditionMonitor: Monitor

+0 −1
Original line number Diff line number Diff line
@@ -50,7 +50,6 @@ java_library {
    static_libs: [
        "androidx.annotation_annotation",
        "androidx-constraintlayout_constraintlayout",
        "com.android.systemui.log.table-api",
        "PlatformAnimationLib",
        "PluginCoreLib",
        "SystemUICommon",
+1 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ java_library {
    srcs: [
        "*.kt",
    ],
    static_libs: ["SystemUILogLib"],
    defaults: [
        "SystemUI_pod_defaults_api",
    ],
Loading