fix(hud): bind the GPU clock and load nodes even when the HUD starts hidden

With the overlay hidden at session start the blocked feeds have no value,
so cur_freq and perf_now were never written before the binds were taken
and stayed unbound for the whole session.
This commit is contained in:
angelrenefm committed 2026-11-04 00:07:13 +01:00
1 parent 7901e76561
commit 3ad13b1b66
2 files changed
+32

No files matched your search

@@ -0,0 +1,27 @@
package com.droiddeck.launcher.session
import java.io.File
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TemporaryFolder
class GpuStatsBindsTest {
@get:Rule val tmp = TemporaryFolder()
@Test fun feedsWithNoValueYetAreStillBound() {
val dir = tmp.newFolder("kgsl-3d0")
GpuStatsComponent.createMissing(listOf(File(dir, "perf_now"), File(dir, "cur_freq")))
val binds = GpuStatsComponent(dir, tmp.root).binds()
assertTrue(binds.contains(File(dir, "perf_now").path + ":" + GpuStatsComponent.MSM_LOAD))
assertTrue(binds.contains(File(dir, "cur_freq").path + ":" + GpuStatsComponent.MSM_CLOCK))
}
@Test fun aWrittenValueIsKept() {
val dir = tmp.newFolder("kgsl-3d0")
File(dir, "cur_freq").writeText("586000000 \n")
GpuStatsComponent.createMissing(listOf(File(dir, "cur_freq")))
assertEquals("586000000 \n", File(dir, "cur_freq").readText())
}
}