mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-25 07:46:01 +00:00
fix(session): remove the keep-top guard from other displays (#2937)
* fix(session): remove the keep-top guard from other displays #2763 put a transparent KeepTopActivity on every other display while a session was on top, so lmkd killing that display's home could not move focus off the session. A/B on a 12 GB AYN Thor (Android 13) and a Retroid Pocket Duo (Android 16) found no case where it kept a session alive: with steady pressure the bottom home (stock launcher or Cocoon) was killed up to 400 times per run without taking focus, and a burst big enough to matter makes lmkd kill the session at adj 0 with or without the guard. Its side effects were real: - Android's ActivityRecordInputSink made the bottom screen ignore touch (worked around in #2910 by stepping aside on touch). - Cocoon tracks each display's top activity, so it could not suspend or resume DroidDeck cleanly. - The Thor's Game Assistant gives every app with an activity on top of the bottom display that display's volume, so DroidDeck's audio followed the bottom screen's volume slider. Removes KeepTopActivity, the focus bounce and light pause, the memory pressure trigger and their tests. onPause runs its departure cleanup every time again. tools/memory_guard_ab.py gains a burst mode, reads oom_score_adj without su (lmkd kills the root manager app and su can then open its request screen over the game), handles Android 13 dumps, a hung stop and a session that does not start. docs/development/memory-guard-ab.md has the Thor results. * test(session): the guard A/B fill mode starts its counter again, and a pressure run with no completed run fails * test(session): the burst seed is rebuilt unless it is exactly 256 MiB * test(session): the guard A/B burst takes its last partial chunk, and only a hog run that finished counts
This commit is contained in:
1 parent
acb2cba970
commit
d0022a35f9
11 files changed
+149
-380
No files matched your search
@@ -1,56 +0,0 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class LightPauseTest {
|
||||
@Test
|
||||
fun theBounceAloneResumesLight() {
|
||||
val pause = LightPause()
|
||||
pause.paused(bounces = 3)
|
||||
assertEquals(LightPause.Resume.LIGHT, pause.resumed(bounces = 4))
|
||||
assertFalse(pause.timedOut())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun anUnrelatedPauseWithoutABounceCleansUpAtTheTimeout() {
|
||||
val pause = LightPause()
|
||||
pause.paused(bounces = 3)
|
||||
assertTrue(pause.timedOut())
|
||||
assertEquals(LightPause.Resume.NORMAL, pause.resumed(bounces = 3))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aBounceWhileAnotherActivityHoldsThePauseStillCleansUpAtTheTimeout() {
|
||||
val pause = LightPause()
|
||||
pause.paused(bounces = 3)
|
||||
assertTrue(pause.timedOut())
|
||||
assertEquals(LightPause.Resume.NORMAL, pause.resumed(bounces = 4))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aResumeBeforeTheTimeoutWithoutABounceCleansUpFirst() {
|
||||
val pause = LightPause()
|
||||
pause.paused(bounces = 3)
|
||||
assertEquals(LightPause.Resume.CLEANUP_FIRST, pause.resumed(bounces = 3))
|
||||
assertFalse(pause.timedOut())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aStopAfterALightPauseCleansUpOnce() {
|
||||
val pause = LightPause()
|
||||
pause.paused(bounces = 3)
|
||||
assertTrue(pause.stopped())
|
||||
assertFalse(pause.timedOut())
|
||||
assertEquals(LightPause.Resume.NORMAL, pause.resumed(bounces = 4))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aNormalPauseIsUntouched() {
|
||||
val pause = LightPause()
|
||||
assertFalse(pause.stopped())
|
||||
assertEquals(LightPause.Resume.NORMAL, pause.resumed(bounces = 0))
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import android.content.ComponentCallbacks2
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class TopUnderPressureTest {
|
||||
@Test
|
||||
fun onlyRunningLevelsCountAsPressure() {
|
||||
assertTrue(TopUnderPressure.isPressure(ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL))
|
||||
assertTrue(TopUnderPressure.isPressure(ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW))
|
||||
assertFalse(TopUnderPressure.isPressure(ComponentCallbacks2.TRIM_MEMORY_RUNNING_MODERATE))
|
||||
assertFalse(TopUnderPressure.isPressure(ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun reclaimsOnlyDuringASessionShortlyAfterPressure() {
|
||||
assertTrue(TopUnderPressure.shouldReclaim(10_000, 9_500, sessionRunning = true, finishing = false))
|
||||
assertFalse(TopUnderPressure.shouldReclaim(20_000, 9_500, sessionRunning = true, finishing = false))
|
||||
assertFalse(TopUnderPressure.shouldReclaim(10_000, 0, sessionRunning = true, finishing = false))
|
||||
assertFalse(TopUnderPressure.shouldReclaim(10_000, 9_500, sessionRunning = false, finishing = false))
|
||||
assertFalse(TopUnderPressure.shouldReclaim(10_000, 9_500, sessionRunning = true, finishing = true))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user