feat(dual-screen): bottom-screen HUD, Line strip, strip under every bottom tab, Bottom screen HUD settings (#1982)

- In-game stats shows a bottom-screen HUD while no game sends dashboard data: 11 styles, tap to change; it reads the game's frames and the device itself, so it works with the top-screen HUD off.
- Line strip: one line like the top HUD's Strip (API + FPS, frame-time graph, 1 / 0.1 / 0.01 % lows, GPU, CPU with temperature, VRAM, RAM, clock); default strip above a game's dashboard; numbers that do not fit are left out by importance.
- The same strip under the tabs on every other bottom page during a session.
- Bottom screen HUD settings, shown even with the top HUD off: one switch for the whole bottom HUD, strip on every tab, and which numbers the Line strip shows.
- The bottom HUD redraws about 10 times a second (was about 3) and reads device stats twice a second.
- GPU load, clock and VRAM readers also run while the bottom HUD shows them (BottomHudPresence).
- Night style stays dim instead of flickering with the FPS.
- Review fixes: slow-frame ring 2048, tab strip redraw without gamescope frames, Proton name per game, Graphs' duration from the kept readings, Fahrenheit in Tiles, Rings and Cores.
This commit is contained in:
The412Banner authored and GitHub committed 2026-11-01 19:23:31 -05:00
1 parent 6a30a9bb4b
commit e1d241d723
22 files changed
+1393 -92

No files matched your search

@@ -68,6 +68,30 @@ class FrameStatsTest {
assertFalse(feed.poll(now + 1))
}
@Test fun slowFramesCountOnlyFramesOver33MsInTheWindow() {
val stats = FrameStats()
var now = 1_000_000_000L
for (ft in listOf(16_666_667L, 40_000_000L, 16_666_667L, 50_000_000L, 2_000_000_000L, 16_666_667L)) {
now += ft
stats.add(ft, now)
}
assertEquals(2, stats.slowFrames(now, 60_000_000_000L))
assertEquals(0, stats.slowFrames(now + 120_000_000_000L, 60_000_000_000L))
stats.reset()
assertEquals(0, stats.slowFrames(now, 60_000_000_000L))
}
@Test fun compositorFramesDoNotCountAsLiveGamescopeFrames() {
val feed = GameFrameFeed(java.io.File("/nonexistent/droiddeck-hud/frames"))
var now = 1_000_000_000L
assertFalse(feed.live)
feed.onCompositorFrame(now)
now += 16_666_667L
feed.onCompositorFrame(now)
feed.poll(now)
assertFalse(feed.live)
}
@Test fun aCompletedPeriodIsCountedWhenMangoHudWouldRedraw() {
val stats = FrameStats()
var now = 1_000_000_000L
@@ -5,16 +5,30 @@ import org.junit.Test
class StatsLayoutTest {
@Test fun unknownIdsFallBackToTheDefaults() {
assertEquals(StatsStrip.PANEL, StatsStrip.from(null))
assertEquals(StatsStrip.LINE, StatsStrip.from(null))
assertEquals(StatsStrip.LINE, StatsStrip.from("gone"))
assertEquals(StatsStrip.PANEL, StatsStrip.from("panel"))
assertEquals(StatsStrip.RINGS, StatsStrip.from("rings"))
assertEquals(StatsDash.AUTO, StatsDash.from("gone"))
assertEquals(StatsDash.TRACE, StatsDash.from("trace"))
}
@Test fun tappingTheStripCyclesThroughEveryStyle() {
assertEquals(StatsStrip.PANEL, StatsStrip.LINE.next())
assertEquals(StatsStrip.TILES, StatsStrip.PANEL.next())
assertEquals(StatsStrip.RINGS, StatsStrip.TILES.next())
assertEquals(StatsStrip.PANEL, StatsStrip.RINGS.next())
assertEquals(StatsStrip.LINE, StatsStrip.RINGS.next())
}
@Test fun stripNumbersStartWithEverythingButTheGpuTemperature() {
assertEquals(StripMetric.entries.toSet() - StripMetric.GPU_TEMP, StripMetric.parse(null))
}
@Test fun stripNumbersSurviveSavingAndSkipUnknownIds() {
val picked = setOf(StripMetric.GPU, StripMetric.RAM, StripMetric.CLOCK)
assertEquals(picked, StripMetric.parse(StripMetric.encode(picked)))
assertEquals(setOf(StripMetric.CPU), StripMetric.parse("cpu,gone, "))
assertEquals(emptySet<StripMetric>(), StripMetric.parse(""))
}
@Test fun autoPicksTheDashByTheGamesFormat() {
@@ -0,0 +1,33 @@
package com.droiddeck.launcher.ui
import org.junit.Assert.assertEquals
import org.junit.Test
class HistoryTest {
@Test fun theSpanIsTheTimeTheKeptReadingsCover() {
val h = History(3)
h.add(1f, 1_000L)
h.add(2f, 1_500L)
assertEquals(1, h.spanSeconds())
h.add(3f, 2_000L)
h.add(4f, 4_000L)
assertEquals(listOf(2f, 3f, 4f), h.snapshot())
assertEquals(3, h.spanSeconds())
}
@Test fun aHistoryThatStopsBeingFedKeepsItsSpan() {
val h = History(4)
h.add(1f, 10_000L)
h.add(2f, 20_000L)
assertEquals(10, h.spanSeconds())
assertEquals(10, h.spanSeconds())
}
@Test fun readingsWithoutATimeHaveNoSpan() {
val h = History(2)
h.add(1f)
assertEquals(0, h.spanSeconds())
assertEquals(0, History(2).spanSeconds())
assertEquals(0, History(2).apply { add(1f, 5_000L) }.spanSeconds())
}
}
@@ -0,0 +1,26 @@
package com.droiddeck.launcher.ui
import org.junit.Assert.assertArrayEquals
import org.junit.Test
class StripFitTest {
@Test fun everythingFitsOnAWideLine() {
assertArrayEquals(booleanArrayOf(true, true, true), fitByPriority(intArrayOf(10, 20, 30), intArrayOf(0, 1, 2), 5, 100))
}
@Test fun theLeastImportantItemsAreLeftOutFirst() {
assertArrayEquals(booleanArrayOf(true, false, true), fitByPriority(intArrayOf(10, 20, 30), intArrayOf(0, 2, 1), 5, 60))
}
@Test fun anItemThatDoesNotFitEndsTheLine() {
assertArrayEquals(booleanArrayOf(true, false, false), fitByPriority(intArrayOf(10, 50, 5), intArrayOf(0, 1, 2), 2, 40))
}
@Test fun equalPrioritiesKeepTheirOrder() {
assertArrayEquals(booleanArrayOf(true, true, false), fitByPriority(intArrayOf(10, 10, 10), intArrayOf(0, 0, 0), 0, 25))
}
@Test fun nothingFitsInNoRoom() {
assertArrayEquals(booleanArrayOf(false, false), fitByPriority(intArrayOf(10, 10), intArrayOf(0, 1), 0, 5))
}
}