fix(session): a fixed portrait resolution applies when landscape is set to Follow screen (#3124)

This commit is contained in:
The412Banner authored and GitHub committed 2026-11-24 17:19:50 -05:00
1 parent 7630173b24
commit a573f8b14f
4 files changed
+45 -12

No files matched your search

@@ -875,9 +875,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
cornerTap = SessionPrefs.drawerCornerTap(this)
applyOutputPacing()
if (!SessionState.running) {
SessionState.followScreen = followChoice()
SessionState.followScale = followScale()
SessionState.followScales = SessionPrefs.followScales(this, displayMode(),
com.droiddeck.launcher.session.SessionDisplay.panelSize(this))
}
applyFollowChoice()
applyFollowOrientation(resources.configuration)
goFullscreen()
volumeControlStream = android.media.AudioManager.STREAM_MUSIC
@@ -2995,16 +2996,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
private fun followPortrait(): Boolean = glassesScreen == null && SessionPrefs.portrait(this)
private fun followScale(): Float {
val mode = displayMode()
val choice = SessionPrefs.resolutionChoice(this, mode, com.droiddeck.launcher.session.SessionDisplay.panelSize(this), followPortrait())
return com.droiddeck.launcher.session.SessionDisplay.followScale(choice) ?: 1f
}
private fun followChoice(): Boolean {
val mode = displayMode()
return com.droiddeck.launcher.session.SessionDisplay.isFollow(
SessionPrefs.resolutionChoice(this, mode, com.droiddeck.launcher.session.SessionDisplay.panelSize(this), followPortrait()))
private fun applyFollowChoice() {
val scale = SessionState.followScales.let { if (followPortrait()) it.second else it.first }
SessionState.followScreen = scale != null
SessionState.followScale = scale ?: 1f
}
private fun applyFollowOrientation(config: android.content.res.Configuration) {
@@ -3018,6 +3013,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
SessionService.setActivityDisplay(this, sessionActivityDisplayId)
}
cancelTouchGestures()
applyFollowChoice()
applyFollowOrientation(newConfig)
applyNotchInset()
applyUnfoldedControls()
@@ -1343,6 +1343,10 @@ object SessionPrefs {
SessionDisplay.effectiveChoice(
resolutionStored(context, mode, panel, false), resolutionStored(context, mode, panel, true), portrait)
fun followScales(context: Context, mode: String, panel: Pair<Int, Int>): Pair<Float?, Float?> =
SessionDisplay.followScale(resolutionChoice(context, mode, panel, false)) to
SessionDisplay.followScale(resolutionChoice(context, mode, panel, true))
fun resolutionStored(context: Context, mode: String, panel: Pair<Int, Int>, portrait: Boolean): String {
if (!portrait) return landscapeResolutionStored(context, mode, panel)
val value = prefs(context).getString("displayResolution.portrait.$mode", null) ?: return SessionDisplay.LINK_LANDSCAPE
@@ -148,6 +148,9 @@ object SessionState {
@Volatile
var outputSize: Pair<Int, Int> = Pair(1920, 1080)
@Volatile
var followScales: Pair<Float?, Float?> = null to null
@Volatile
var followScreen = false
var followScale = 1f