feat(dual-screen): single-screen mode on the Retroid Pocket Duo and AYN Thor while another window holds the bottom screen (#1979)

* feat(dual-screen): step aside on the Retroid Pocket Duo's bottom screen while another window holds it

When the Duo's double-Home performance panel or another app (Chrome, YouTube) is on the bottom screen, DroidDeck switches to single-screen mode: the launcher's bottom panel and the in-game bottom controls close and the top screen takes its single-screen layout. When the bottom screen is back on its home screen, dual-screen mode returns, with the in-game controls reopening in the mode they had.

The DroidDeck shortcuts accessibility service watches the bottom screen's windows on the Duo only. An app opened under DroidDeck's panel is caught by its window opening on that display; the Retroid panel and any app on top are read from the window list.

* fix(dual-screen): log the bottom screen's holders only when they change

* fix(dual-screen): the topmost window other than DroidDeck's decides who holds the bottom screen

Apps opened under DroidDeck's bottom panel are still listed beneath it, so DroidDeck's own windows are skipped and the next full-size window decides. Fallback home screens such as Settings' boot-time one no longer count as a home screen.

* fix(dual-screen): catch apps opened under the in-game bottom controls

The in-game bottom controls hide the windows beneath them from the window list, so an app opening a window on the bottom screen while only DroidDeck is listed now holds the screen until the list can see it.

* fix(dual-screen): keyboards never hold the bottom screen; watch the built-in panel only

Keyboard windows opening on the bottom screen no longer count as an app arriving, so typing with the in-game bottom keyboard keeps the controls up. Only the built-in bottom panel is watched, so an external display can't close the controls. An arrival recorded while a check runs is kept for the next check, and stopping the watcher clears the held state after any running check.

* feat(dual-screen): step aside on the AYN Thor's bottom screen too

The bottom-screen watch now runs on every handheld in DualScreen's known dual-screen models, the Retroid Pocket Duo and the AYN Thor, including model names that extend them such as AYN Thor Max.

* fix(dual-screen): only the current bottom-screen watch publishes; Thor variants match when the display type is hidden

* fix: session drawer top row scrolls and Stop stays an icon-only button

* fix: docked drawer drops the second-screen page; tapping the active mode returns to none

* fix: docked drawer drops the bottom-screen mode icons; the Mode page keeps them

* fix: restore the second-screen drawer page when docked

* feat: dual screen launcher and dual screen sessions are separate Automatic/On/Off settings

* fix: session drawer top row keeps its right alignment

---------

Co-authored-by: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com>
This commit is contained in:
MaxsTechReviewandKurt Himebauch authored and GitHub committed 2026-11-01 23:14:18 -05:00
1 parent 92ec0929ae
commit 313b6a59d2
47 files changed
+358 -235

No files matched your search

@@ -0,0 +1,76 @@
package com.droiddeck.launcher.input
import android.os.Looper
import android.view.accessibility.AccessibilityWindowInfo
import com.droiddeck.launcher.input.BottomScreenGuests.Top
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import org.robolectric.Shadows.shadowOf
import org.robolectric.annotation.Config
@RunWith(RobolectricTestRunner::class)
@Config(manifest = Config.NONE)
class BottomScreenGuestsTest {
private val homes = setOf("com.android.launcher3", "com.retroidpocket.gamelauncher")
@After fun clear() = DualScreen.setTaken(emptySet())
@Test fun onlyTheRetroidPocketDuoAndAynThorWatchTheirBottomScreen() {
assertTrue(BottomScreenGuests.supported("Retroid Pocket Duo", 36))
assertTrue(BottomScreenGuests.supported(" retroid pocket duo ", 33))
assertFalse(BottomScreenGuests.supported("Retroid Pocket Duo", 32))
assertTrue(BottomScreenGuests.supported("AYN Thor", 33))
assertTrue(BottomScreenGuests.supported("AYN Thor Max", 34))
assertFalse(BottomScreenGuests.supported("AYN Odin 2", 36))
assertFalse(BottomScreenGuests.supported("Pixel 8", 36))
}
@Test fun anyWindowButTheHomeScreenHoldsTheScreen() {
assertEquals(Top.HOME, BottomScreenGuests.classify("com.android.launcher3", homes))
assertEquals(Top.GUEST, BottomScreenGuests.classify("com.android.chrome", homes))
assertEquals(Top.GUEST, BottomScreenGuests.classify("com.retroidpocket.dualscreen.assistant", homes))
assertEquals(Top.NONE, BottomScreenGuests.classify(null, homes))
}
@Test fun theWindowListDecidesWhenItSeesPastDroidDeck() {
assertEquals("com.android.chrome", BottomScreenGuests.holder("com.android.chrome", null, homes))
assertEquals(null, BottomScreenGuests.holder("com.android.launcher3", "com.android.chrome", homes))
}
@Test fun anAppOpenedUnderDroidDeckHoldsTheScreenUntilTheListSeesIt() {
assertEquals("com.google.android.youtube", BottomScreenGuests.holder(null, "com.google.android.youtube", homes))
assertEquals(null, BottomScreenGuests.holder(null, "com.android.launcher3", homes))
assertEquals(null, BottomScreenGuests.holder(null, null, homes))
}
@Test fun keyboardsAndOverlaysNeverTakeTheScreen() {
assertTrue(BottomScreenGuests.ignorable(AccessibilityWindowInfo.TYPE_INPUT_METHOD))
assertTrue(BottomScreenGuests.ignorable(AccessibilityWindowInfo.TYPE_ACCESSIBILITY_OVERLAY))
assertFalse(BottomScreenGuests.ignorable(AccessibilityWindowInfo.TYPE_APPLICATION))
assertFalse(BottomScreenGuests.ignorable(AccessibilityWindowInfo.TYPE_SYSTEM))
}
@Test fun listenersHearWhenTheScreenIsTakenAndFreed() {
var calls = 0
val listener: () -> Unit = { calls++ }
DualScreen.watchTaken(listener)
DualScreen.setTaken(setOf(2))
shadowOf(Looper.getMainLooper()).idle()
assertTrue(DualScreen.taken(2))
assertFalse(DualScreen.taken(0))
DualScreen.setTaken(setOf(2))
DualScreen.setTaken(emptySet())
shadowOf(Looper.getMainLooper()).idle()
assertFalse(DualScreen.taken(2))
assertEquals(2, calls)
DualScreen.unwatchTaken(listener)
DualScreen.setTaken(setOf(2))
shadowOf(Looper.getMainLooper()).idle()
assertEquals(2, calls)
}
}
@@ -29,6 +29,7 @@ class DualScreenTest {
@Test fun knownModelsCountWhenTheTypeIsHidden() {
assertTrue(DualScreen.isBuiltIn(null, "Retroid Pocket Duo"))
assertTrue(DualScreen.isBuiltIn(null, " AYN Thor "))
assertTrue(DualScreen.isBuiltIn(null, "AYN Thor Max"))
assertFalse(DualScreen.isBuiltIn(null, "Pixel 8"))
}
@@ -65,4 +66,19 @@ class DualScreenTest {
SessionPrefs.setDualScreenMode(context, DualScreen.MODE_OFF)
assertEquals(DualScreen.MODE_OFF, SessionPrefs.dualScreenMode(context))
}
@Test fun launcherAndSessionsKeepSeparateModes() {
SessionPrefs.setDualScreenMode(context, DualScreen.MODE_OFF)
assertEquals(DualScreen.MODE_OFF, SessionPrefs.dualScreenMode(context))
assertEquals(DualScreen.MODE_AUTO, SessionPrefs.dualScreenSessionMode(context))
SessionPrefs.setDualScreenSessionMode(context, DualScreen.MODE_ON)
assertEquals(DualScreen.MODE_OFF, SessionPrefs.dualScreenMode(context))
assertEquals(DualScreen.MODE_ON, SessionPrefs.dualScreenSessionMode(context))
}
@Test fun anOldDisabledMenuToggleTurnsBothOff() {
context.getSharedPreferences("session", Context.MODE_PRIVATE).edit().putBoolean("dualScreenLauncher", false).commit()
assertEquals(DualScreen.MODE_OFF, SessionPrefs.dualScreenMode(context))
assertEquals(DualScreen.MODE_OFF, SessionPrefs.dualScreenSessionMode(context))
}
}