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

Commit 3da74f10 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov Committed by Android (Google) Code Review
Browse files

Merge changes Ic3f96a03,Idd5bff29,I224f7e4d into main

* changes:
  [Pod] Move Diffable extension functions to log.table pod.
  [Pod] Move TableLogBuffer doc from impl to interface.
  [Pod] Rename interface & impl for TableLogBuffer, move interface to pod
parents aa63484d 32e39c07
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",
+2 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ java_library {
    srcs: [
        "*.kt",
    ],
    libs: ["com.android.systemui.util.kotlin"],
    static_libs: ["SystemUILogLib"],
    defaults: [
        "SystemUI_pod_defaults_api",
    ],
Loading