mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 20:36:04 +00:00
Preserve custom profiles when opening second-screen fallbacks
Only migrate stock controls for explicitly saved legacy panel modes. Automatic fallbacks retain the active profile layout and bindings without persisting an override. Add session regressions for automatic fallbacks, unavailable panels, explicit legacy migration and existing quick selections. Validation: all 986 input/UI tests passed.
This commit is contained in:
1 parent
c2d7765619
commit
281c2aea1b
2 files changed
+122
-9
No files matched your search
@@ -3316,16 +3316,19 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
private fun showSecondScreen(requested: SecondScreenMode) {
|
||||
if (pipUi || !started) return
|
||||
val mode = if (requested == SecondScreenMode.DECK_CONTROLS || requested == SecondScreenMode.KEYBOARD_TRACKPAD) {
|
||||
val desktop = SessionState.mode == SessionService.MODE_DESKTOP
|
||||
val library = com.droiddeck.launcher.input.InputLibraries.read(this)
|
||||
val key = if (desktop) InputProfile.DESKTOP else InputProfile.GAME
|
||||
if (key !in library.selections) {
|
||||
val preset = if (requested == SecondScreenMode.DECK_CONTROLS) com.droiddeck.launcher.input.InputStockLayouts.DECK else com.droiddeck.launcher.input.InputStockLayouts.TRACKPAD
|
||||
runCatching { com.droiddeck.launcher.input.InputLibraries.update(this) { it.selectPart(desktop, InputRole.SECONDARY, preset) } }
|
||||
.onSuccess { refreshInputProfile() }
|
||||
.onFailure { Log.w(TAG, "could not migrate the saved second-screen selection", it) }
|
||||
val remembered = SessionPrefs.secondScreenPanel(this)
|
||||
if (remembered == SecondScreenMode.DECK_CONTROLS.id || remembered == SecondScreenMode.KEYBOARD_TRACKPAD.id) {
|
||||
val desktop = SessionState.mode == SessionService.MODE_DESKTOP
|
||||
val library = com.droiddeck.launcher.input.InputLibraries.read(this)
|
||||
val key = if (desktop) InputProfile.DESKTOP else InputProfile.GAME
|
||||
if (key !in library.selections) {
|
||||
val preset = if (requested == SecondScreenMode.DECK_CONTROLS) com.droiddeck.launcher.input.InputStockLayouts.DECK else com.droiddeck.launcher.input.InputStockLayouts.TRACKPAD
|
||||
runCatching { com.droiddeck.launcher.input.InputLibraries.update(this) { it.selectPart(desktop, InputRole.SECONDARY, preset) } }
|
||||
.onSuccess { refreshInputProfile() }
|
||||
.onFailure { Log.w(TAG, "could not migrate the saved second-screen selection", it) }
|
||||
}
|
||||
SessionPrefs.setSecondScreenPanel(this, SecondScreenMode.CUSTOM_CONTROLS.id)
|
||||
}
|
||||
SessionPrefs.setSecondScreenPanel(this, SecondScreenMode.CUSTOM_CONTROLS.id)
|
||||
SecondScreenMode.CUSTOM_CONTROLS
|
||||
} else requested
|
||||
val target = displayManager.getDisplay(selectedSecondScreenDisplay)
|
||||
|
||||
Reference in new issue
Block a user