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

Commit b6e7d1b8 authored by Behnam Heydarshahi's avatar Behnam Heydarshahi
Browse files

QSTileLogger: use TileSpec for logbuffer map key

The key used to be of type String, which was inconsistent with the type
of the key in LogModule. This fault resulted in a build failure when
QSTileLogger was being referenced in PolicyModule.

Flag: NONE
Fixes: 310008787
Test: manual. mp droid should not fail when adding a tile that uses
QSTileLogger.
Test: atest QSTileLoggerTest

Change-Id: I546b934309d77e65f56a74dca8a69ae5a392dc49
parent 4939c456
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ import javax.inject.Inject
class QSTileLogger
@Inject
constructor(
    @QSTilesLogBuffers logBuffers: Map<String, LogBuffer>,
    @QSTilesLogBuffers logBuffers: Map<TileSpec, LogBuffer>,
    private val factory: LogBufferFactory,
    private val mStatusBarStateController: StatusBarStateController,
) {
@@ -162,7 +162,7 @@ constructor(

    private fun TileSpec.getLogBuffer(): LogBuffer =
        synchronized(logBufferCache) {
            logBufferCache.getOrPut(this.spec) {
            logBufferCache.getOrPut(this) {
                factory.create(
                    this.getLogTag(),
                    BUFFER_MAX_SIZE /* maxSize */,
+2 −5
Original line number Diff line number Diff line
@@ -55,12 +55,9 @@ class QSTileLoggerTest : SysuiTestCase() {
    fun setup() {
        MockitoAnnotations.initMocks(this)
        whenever(logBufferFactory.create(any(), any(), any())).thenReturn(logBuffer)
        val tileSpec: TileSpec = TileSpec.create("chatty_tile")
        underTest =
            QSTileLogger(
                mapOf("chatty_tile" to chattyLogBuffer),
                logBufferFactory,
                statusBarController
            )
            QSTileLogger(mapOf(tileSpec to chattyLogBuffer), logBufferFactory, statusBarController)
    }

    @Test