Skip to content

Session Parameter Picker

星冉 edited this page Jul 23, 2026 · 2 revisions

Session Parameter Picker

中文

This page defines data and interaction constraints for VerticalOptionPicker in the session editor. The canonical implementation is in feature/session/ui/component/AddSessionDialog.kt; game-mode normalization is in SessionDialogState.kt.

Current parameters

Parameter Normal presets Game presets Custom
Maximum size 720, 1080, 1920, Original 720, 1080, 1920 Normal only; Original persists as 0
Video bitrate 700K, 1M, 2M, 4M, 8M, 12M, 20M, 40M, 80M, 120M 1M, 2M, 4M, 8M, 12M, 20M Normal only, K/M units
Maximum FPS 15, 30, 60, 90, 120 60, 90, 120 Normal only
Audio bitrate 64K, 128K, 192K, 256K 64K, 128K Both modes, K/M units

Enabling game mode disables full screen and normalizes size, video bitrate, and FPS to game presets. Empty values default to 720, 2M, and 60 respectively. A bitrate below the game range also normalizes to 2M, while an in-range value selects the nearest preset. normalizeGameVideoSettings() owns the rule; UI must not duplicate it.

Compatibility and rotation modes

  • Compatibility mode replaces scrcpy video/control with low-frame-rate ADB JPEG screenshots and ADB input. It is mutually exclusive with game mode and disables full screen, hardware decoding, ADB forwarding, audio, automatic clipboard synchronization, screen-off/cleanup-dependent controls, virtual display, and other scrcpy-only options.
  • Maximum size keeps the scrcpy long-edge rule. Compatibility JPEG quality is selected automatically: 55 at 720, 60 at 1080, 65 above 1080, and 70 for Original; custom values are capped at 8192 for the helper.
  • Rotation is an explicit Local/Target choice. Local removes the activity orientation restriction and lets this device rotate; Target restricts the activity to follow the target frame orientation.
  • Power off on close requires cleanup on disconnect. The launch command forces power_off_on_close=false when cleanup is disabled.

Custom values

  • Selecting Custom opens a numeric editor; only a positive integer can be confirmed.
  • Bitrate uses a separate K/M unit button to form the stored text. Size and FPS have no unit.
  • Cancelling a newly selected custom maximum size returns to Original. Other parameters retain the prior value or use the code default.
  • Saving parses values into integer ScrcpyConfig fields. Original maximum size is 0; bitrate is stored in bit/s.

Gesture and layout invariants

  • The viewport is 104dp × 42dp; inner margin and item gap are 2dp, leaving a 38dp visible item.
  • The current drag threshold per option is 50dp, while visual item pitch is 40dp.
  • Translation maps directly from accumulated drag distance; drag frames do not start tweens.
  • Index is clamped at both ends, and the picker consumes vertical drag immediately so the outer session page does not scroll.
  • The inner Column uses top-aligned unbounded content height and is clipped by the fixed viewport. Constrained measurement or default vertical centering compresses items or misaligns the selected value.

Change checklist

  • All four preset groups remain consistent with ScrcpyConfig save parsing.
  • Switching normal/game modes leaves allowed values and cannot bypass the full-screen constraint.
  • Custom confirm, cancel, empty state, and K/M units are covered.
  • Edge dragging does not jitter, adjacent borders are hidden at rest, and the outer page does not scroll during drag.
  • Game-rule changes update GAME_*_OPTIONS, UI presets, and SessionDialogGameVideoSettingsTest together.
  • Compatibility normalization remains covered by SessionDialogCompatibilityModeTest and CompatibilityCaptureSettingsTest; rotation policy remains covered by RemoteScreenOrientationTest.

Dimensions and gesture values are facts of the current UI implementation. If these constants change, update this page and visual regression in the same change.

Clone this wiki locally