## Summary
Splits the session resolution setting into two: **Landscape resolution**
and **Portrait resolution**. Each has the same options as the old
Resolution row, plus a Follow option so one orientation can mirror the
other.
## Why
A single resolution has to serve both orientations. Presets and Match
screen flip automatically in portrait, but a custom size is used exactly
as typed, so a landscape size in a portrait session is wrong. Users who
play in both orientations couldn't pick a good size for each.
## Behavior
- The Display tab shows **Landscape resolution** and, underneath it,
**Portrait resolution**. Both offer the full existing list: presets,
Match screen, Follow screen, scaled follow options and Custom.
- Each row has an extra option at the top. **Follow portrait** (on the
landscape row) and **Follow landscape** (on the portrait row) use the
other orientation's choice, so someone can set one resolution and let
the other mirror it. The label shows the size it resolves to.
- A session picks the landscape or portrait choice from its orientation.
This uses the same orientation check as the output size, so the
unfolded-controls layout still counts as landscape.
- Custom WxH sizes are flipped to match the target orientation when
followed, e.g. portrait following 1280x720 uses 720x1280.
- If both rows would follow each other, the other row is set to the
concrete size it currently resolves to, so there is never a loop and
nothing visibly changes.
- The glasses output keeps using the landscape resolution.
- Applies to the Steam and Desktop Display tabs, which share the same
row.
## Compatibility
- The existing saved choice (`displayResolution.<mode>`) is now the
landscape resolution, so existing users keep their setting.
- The portrait choice is stored as `displayResolution.portrait.<mode>`
and defaults to Follow landscape, so portrait sessions behave as before
until it is changed. The settings reset covers it through the existing
`displayResolution.` prefix.
- One visible difference: a typed landscape custom size, used as typed
in portrait before, now flips to portrait while portrait follows
landscape.
## Known limitation
"Follow screen" is still decided once when the session starts, not on
every rotation. Re-evaluating it on rotation could make the window
orientation flip repeatedly when no orientation is pinned.
## Changes
- `SessionDisplay`: `LINK_LANDSCAPE` / `LINK_PORTRAIT`, `isLink`,
`orientCustom`, `effectiveChoice`
- `SessionPrefs`: `resolutionStored` (raw value per orientation),
`resolutionChoice(..., portrait)`, `setResolutionChoice(..., portrait)`
with the loop guard, `resolutionChosen(..., portrait)`
- `SessionActivity`: `portraitOutput()` drives the output size,
follow-screen choice and follow scale; the Match-screen default for
programs that draw at the panel size checks the matching orientation
- `ResolutionRow`, `ModeSettingsDialog`, `FrontEndActivity`: two rows,
the Follow option, state and actions
- `DeviceReport`: logs landscape and portrait separately
- Strings: `display_resolution_landscape`,
`display_resolution_portrait`, `display_follow_landscape`,
`display_follow_portrait` in all 33 locales; the unused
`display_resolution` is removed
- Tests: `PortraitResolutionTest`
## Testing
- Unit tests added for the preference logic, follow resolution, loop
guard and reset.
* feat(input): restore controller-specific overlay designs
* fix(input): restore portrait controller layouts
* fix(input): fix duplicates, rotation and tablet placement in the controller overlays
- Hide the below-game controls while the layout editor is open, and give the
editor the same cutout insets and optional Steam controls as the game view,
so the editor never shows a second copy of a control.
- Keep a separate portrait frame for layouts edited in portrait. A layout
edited in one orientation keeps the stock kit positions in the other instead
of being stretched across.
- Anchor the overlay to the bottom of the screen and cap the portrait panel's
physical size, so tablets keep the controls in the lower half.
- Put L2/L1 and R1/R2 side by side in every kit.
- List deleted stock controls in the editor's Add dialog so they can be
restored, and keep removed rear buttons and trackpads removed.
* fix(input): scale edited overlay layouts around the controller artwork positions
* fix(input): keep stock landscape controls, color setting, keyboard action and displayed frame edits consistent
* fix(input): draw the layout editor with the kit artwork at the size it will be saved
The editor placed its controls in onSizeChanged, which runs during layout, so
the preview canvas was rebuilt or remeasured too late: new controls were laid
out at 0x0 and existing ones kept stale sizes, losing the kit D-pad artwork.
Placement now happens in onMeasure, before the canvas measures its children.
The editor preview used the saved button size instead of the slider value, so
the slider showed a different layout from the one Done saved.
D-pad pieces that joined or left the kit cross were never redrawn, so moving
one piece hid all four.
* fix(input): keep portrait rear buttons and trackpads where they were saved
A portrait save stores the rear buttons and trackpads only in the rotated
frame, but loading that frame only moved controls that already existed in the
main frame, so they were regenerated at the screen edges.
* fix(input): adopt the displayed portrait frame for layouts edited only in landscape
Button size and reset positions now switch to the frame on screen whenever the edited layout's
orientation differs from the editor, not only when a rotated frame exists, so a portrait change
is saved as the portrait frame instead of overwriting the landscape edits. The tools panel stays
open while that happens.
* fix(input): keep a separate button size for the rotated frame
* fix(input): take the shown frame's button size whenever editing switches orientation
---------
Co-authored-by: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com>
Accept generated portrait sizes on reload, use the right orientation and output target when deciding follow screen, show the real size behind each Follow option, treat a saved portrait Desktop resolution as chosen, and update the orientation hint in every locale.
Landscape and Portrait resolution rows with the same options, each with a Follow option so one can mirror the other. Existing choices stay as the landscape resolution and portrait follows landscape by default, so nothing changes until portrait is set.
Map activity-level mouse and pen events into the surface's space, size the unfolded layout from the padded content area, re-evaluate the inset when the output moves to glasses, the bottom screen or cardboard, and use a clearer Arabic label.
Keeps the Steam session picture, controls and overlays inside the display cutout's safe area so the notch no longer covers part of the image, in landscape or portrait. Off by default.
* feat(input): restyle Steam Deck buttons
* feat(input): add Steam overlay options
* fix(input): align floating overlay previews
* fix(input): polish floating Steam trackpads
* fix(input): restore overlay options on startup
* fix(input): restore original Steam Deck artwork
* fix(input): restore Steam Deck overlay geometry
* fix(input): keep the Steam Deck shortcut row apart on small screens
The Steam pill sits right of the keyboard by a density-based margin while
Select and Start sit at unit-scaled offsets from the middle, so on a small,
dense surface (800x450 at xxxhdpi) the Steam pill covered Select. Lay out
Steam, Select, Start and Quick Access left to right with an 8 dp gap.
* fix(input): fit the Steam Deck shortcut row inside the safe area
Clamping each pill on its own after spacing could move Quick Access back
onto Start when a cutout inset narrows the right side. Fit the keyboard,
Steam, Select, Start and Quick Access as one row: push each right past its
neighbour, pull the row back inside the right edge, and shrink the 8 dp gap
only when the row would not fit otherwise.
---------
Co-authored-by: K11MCH1 <81425424+K11MCH1@users.noreply.github.com>
* feat(display): zero-copy presentation toggle and compositor display buffers
Adds a Zero-copy presentation switch under Steam Settings, Display,
Session Display (on by default), and a display-buffer allocator in the
compositor: a Vulkan driver that states displayBuffers asks it for the
memory of the images it exports, so frames presented through the nested
compositor are gralloc buffers that go on the display layer without a
copy. Compressed buffers are offered only where the device's allocator
matches the layout the drivers render to; everything else stays on the
copy path.
The private buffer protocol is renamed to droiddeck-ahb-v1.
* fix(display): zero-copy frames keep the full refresh rate
Two buffers set on the game layer inside one refresh replaced each other, and a frame that slipped into the next refresh made the compositor hold and drop the on-time frame behind it. The layer now queues buffers, and a refresh takes a second frame when the one before it took none. The pacing tool no longer counts its dump time in the frame rate.
* Keep cropped scenes on the display layer and pace layer frames evenly
Accept any in-bounds source crop for the display layer and map the draw
geometry the same way the copy path does. Time layer frames against the
display's frame timeline, and when the game's rate is a steady whole
fraction of the refresh rate show each frame a fixed number of refreshes
after the last so uneven arrivals no longer reach the screen.
* List zero-copy in the settings map
* Hold display buffers until the display releases them
A buffer the game or gamescope rendered straight into went back to its
client as soon as the next one was latched, with the display's release
fence attached to the dma-buf. The KGSL driver does not wait on that
fence, so the client could draw into a buffer the panel was still
reading. Display buffers now wait for the release fence before the
release event, and gamescope composites only into output images the
host has released.
* Keep the game picture copy-free when an overlay has no display layer
When the display cannot give a second layer of its own to an overlay,
the compositor tells gamescope how many planes it can show directly.
gamescope then composes its overlays into the game picture, which still
reaches the display without a copy.
* feat(session): the panel refresh rate follows the session's frame rate
The session learns the panel's refresh rates and reports the refresh rate and
frame rate it wants. The panel moves to the highest rate the frame rate divides
evenly, frame generation counts at its output rate, and a panel whose rate the
system holds offers only that rate.
* feat(session): the panel follows a frame rate the game holds on its own
The compositor reports the game's frame rate once a second. A rate that
holds for three seconds and divides a panel rate becomes the content
rate when neither the app's limit nor the session's limiter is setting
the pace, so a game capped in its own settings gets a panel rate its
frames divide into. A rate that was dropped has to hold twice as long
before it is used again.
* Show generated frames on the game's display layer
With frame generation on, the game's own frames stay on their display
layer untouched and each generated frame is placed on the same layer
between them, timed across the game's frame interval. The compositor
pass is kept when effects, HDR routing or a cursor need it, or when the
panel cannot show the multiplied rate.
* Keep scaling, generated frames and HDR on the display layer
A scaler or frame generation with zero-copy on now draws once into the
display layer instead of falling back to the copied surface. HDR output
goes to the layer when the panel supports it; on a panel without HDR the
picture is tone-mapped on the same path, and the toggle is labelled to
match what the panel can do.
* Spread a frame limit the refresh rate does not divide evenly across refreshes
* Cover the spare-tick and panel-rate paths in the compositor source tests
* Pin the gamescope build with the display-plane, release, refresh and limiter patches
* Give the layer and terminal-caller harnesses the black fill state they compile against
* feat(display): switch HDR during a session without restarting the app
The compositor now offers HDR whenever the device can present it, and the
HDR setting only decides whether the session uses it. Both HDR switches set
gamescope's hdr_enabled, the compositor's HDR output and zero-copy for the
running session. gamescope patch 0139 lets hdr_enabled change after start.
The 'Restart the app to apply.' hint is removed from every locale.
* Remake the output images in the new format when HDR is switched during a session
* Pin the gamescope build that switches HDR during a session
* Apply a saved HDR opt-out at session start and keep HDR retries with their session
* Serialise the HDR output switch with the gate opening
* feat(display): keep the client's HDR setting and the session's in step
The session publishes its HDR state with the other device controls and the
client helper applies it to the client's own display setting. A change made in
the client is reported back and goes through the same switch the drawer and
Session Display use, so all three always show one value.
* fix(desktop): keep the display-buffer socket when the runtime directory is cleared
The desktop launcher removed everything in the runtime directory except the
compositor's Wayland socket, which took the display-buffer socket with it, so
no desktop program could ask for display buffers and every frame was copied.
* fix(display): the client's HDR setting follows the session in every client mode
The bridge only ran when a variable nothing sets was present, so the client's
HDR setting and the session's never met. It now runs whenever the session
publishes an HDR state, and a client that has no such setting is asked again
only every ten seconds.
* fix(display): harden display-buffer hand-off, layer fallbacks and HDR sync
- Stop closing a buffer handle's descriptor the allocator still owns, and free an allocation whose reply could not be sent.
- Rebuild the advertised buffer formats when zero-copy is switched during a session.
- Fall back to the copy path when a layer buffer cannot be allocated, and hide the game layer when it is skipped for a frame.
- Keep a release fence that has not signalled instead of rendering into a buffer the display still reads.
- Ignore a refresh-target reset from a client that does not own the target.
- Restart the content-rate measurement after a pause, clear it when the game stops, and lengthen engagement only for a rate that was released before.
- Compare colour conversions by their values, and read padded cursor buffers at their row width.
- Use the running session's mode for the HDR and zero-copy settings, probe the display before screen effects are pushed, retry a held panel mode, and ignore callbacks after the activity is destroyed.
- Write a newer HDR value while an earlier write is settling, and reapply the value after the bridge is reinstalled.
* feat(input): describe on-screen layout choices, scope per-game layouts and delete unused ones
- The layout menu says what each choice is: "DroidDeck controls" work in
every game and are edited here; "Steam touch controls" are each game's
controls from Steam, for Steam games only.
- Layouts made with "+ New for <game>" (or "Just this game") are listed
only for that game, marked "Just for <game>". Older ones are recognised
by carrying the name of the game that draws them.
- Saved layouts nothing uses get a delete button in the menu. Deleting one
also removes a profile that still uses it but can no longer be chosen,
such as copies made by the old profile screen.
- A game set to Steam touch controls that runs without Steam shows a note
under Layout instead of silently using the default.
* fix(input): a layout the built-in profile still lists can be deleted once another is chosen
Applying a layout used to write it into the Game profile; choosing another
now goes on top, so the profile's part is no longer drawn. Only parts a mode
actually draws count as in use, and deleting points the built-in profile
back at the stock layout.
* 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
* fix(session): Home suspends a game another app launched, so Cocoon can resume it
A game launched from another front end (Cocoon, ES-DE, Daijisho...) or a
home-screen shortcut went into picture in picture on Home. Cocoon brings a
suspended player back by moving its task to the front, which Android ignores
for a task in picture in picture, and the floating game covered Cocoon's
Resume/Close bar. The game kept running instead of suspending, Cocoon's
Resume did nothing, and the only way back was the picture itself.
Automatic picture in picture now applies only to games DroidDeck launched
itself. For games launched by another app (the existing returnHome launch),
Home suspends the session, which is what Cocoon expects. The picture in
picture button still works for those games.
* fix(session): a new launch intent refreshes the automatic picture in picture rule at once
* feat(ui): one screen picker replaces the D button and the Second screen tab
The bottom screen's bar showed the panel's name as plain text, a D
button opened the menu, and the menu's Second screen tab picked the
panel. Now the panel's name is a dropdown right of the X. It lists
"DroidDeck menu" first, then the panels, with a check on the one in
use, so switching panels takes two taps instead of three.
The docked menu's header shows the same dropdown, labelled
"DroidDeck menu", in place of the highlighted D button. Opened there,
focus starts on the last panel, so one press of A goes back to it.
When the menu is on the top screen, the dropdown lists None and the
panels without the menu entry.
The Second screen tab is gone. Its "Show the game on" and display
choices are a Second screen group at the end of the Display tab. The
mode list's hint and its Mode heading are removed with their strings.
Previews of the docked menu (Controller and Display) and of a panel's
bar are added to the rendered preview cases.
* feat(ui): the swap button on the Keyboard + trackpad and Terminal panels
Every bottom-screen panel now has the swap button when the game can move
to the bottom screen; it was only on Deck grips, Profile controls,
Dashboard and Desktop. The swapped top-screen view already shows both
panels.
* fix(session): the bottom screen takes touch again while a game runs
Since #2763, a transparent KeepTopActivity covers every other display while a
session is on top. Its window is NOT_TOUCHABLE, but Android gives a
translucent activity alone in its task an ActivityRecordInputSink that eats
every touch on that display (ENABLE_TOUCH_OPAQUE_ACTIVITIES, on for this
target SDK). With the dual-screen panel closed, the bottom screen's launcher,
Cocoon or any other app could not be touched until the session ended, and
the guard stayed over it after Home/PiP as well.
- The guard now takes touches itself: a touch removes it from that display.
- It comes back when the session is top-resumed again, or after 5 s if the
session kept the top spot (the user touched the bottom screen once and
stayed in the game).
- Stopping or entering PiP removes the guards; PiP keeps the session at adj
50 with or without them, so they protected nothing there.
A/B on a Retroid Pocket Duo (Android 16, Cocoon as bottom home): the guard
is on top in every state it was on top on main, except the 5 s after a
bottom touch and PiP. Under lmkd pressure (kills down to adj 50, bottom
home killed 14-31 times per run) neither build lost the top spot.
* test(session): A/B tool for the keep-top guard on rooted dual screens, with Duo findings
* test(session): the guard A/B tool stops on a failed session start and cleans up an interrupted pressure run
* Log the GPU ceiling, steps and mid-session clock hold changes
The clock log now records the GPU frequency steps and floor once in
its header, probes each limit file as readable or refused, and adds
the allowed GPU maximum to every sample in the CPU cur/max(of top)
style, so a vendor or thermal cap on the GPU ceiling shows up and
changes during a session are visible. Samples are unchanged when no
limit file is readable.
The limit reading is shared with the device info GPU clock range.
Turning the GPU clock hold on or off during a session now logs the
same line the session start logs.
* Ignore a zero GPU ceiling and log hold changes in order
A ceiling file that reads zero is no longer printed as a limit and is listed
as refused, matching how the step list is read. The hold state line is logged
under the same lock as the state change, so overlapping toggles cannot log
out of order.
* Find a GPU ceiling that turns readable later and probe step tables as tables
A ceiling file that read zero at session start is looked for again on each
sample until one is found, and the log notes where it came from. Step and
floor sources are probed with the same parser that reads them, so a table
with a leading zero is listed as readable.
* fix(session): show the recorded reason when a session fails to start
The ended screen now shows any recorded start-up failure message except a plain guest exit, not only PROOT_MISSING. The graphics runtime staging and game environment publish failures now record GRAPHICS_RUNTIME_FAILED and GAME_ENVIRONMENT_FAILED with their own messages instead of looking like a guest exit.
* i18n(session): translate the start failure messages
---------
Co-authored-by: Tapuuk <177422350+Tapuuk@users.noreply.github.com>
Co-authored-by: maxjivi05 <maxjividen@gmail.com>
* fix(input): keep held keyboard keys when pointer capture ends
When a game gives up its pointer lock, Android pointer capture is
released and the session dropped every held input, including keyboard
keys. In a windowed session with Relative mouse on Auto, holding W to
run and releasing the mouse button after steering stopped the
character, because the key press is never sent again.
Losing pointer capture now releases only the mouse buttons, the pen and
the mouse back-button input. Keys are still released when the window
loses focus.
* fix(input): release held keys when pointer capture ends for the session menu
Opening the session menu releases pointer capture, and the menu then
consumes key events, including the key-up. A key held at that moment
would stay pressed in the guest after the menu closed. Capture loss with
the menu open now releases keys as before; other capture loss keeps them.
* fix(input): release held keys whenever another surface takes the keyboard
Capture loss released keys only while the session menu was open. The
other places that take input from the guest (on-screen keyboard,
achievements, input settings, WoW chat, touch editor, picture in picture)
have the same problem, so keys are now kept only when the session still
owns input and the game itself dropped its pointer lock.
* fix(input): release held keys when the session menu opens
While the menu is open it takes every key event, including the key-up,
so a key held when it opened stayed pressed in the guest. The keys are
now released when the menu opens, whether or not pointer capture was
active.
---------
Co-authored-by: zdennisz <15849186+zdennisz@users.noreply.github.com>
* chore: consistent code branding
* fix: carry legacy overrides, queues and live sync rows across the rename
* fix: keep queued legacy overrides on a failed rename and separate merged queue entries
* fix(dual-screen): allow game swap to external second screens
* fix(dual-screen): name external screens primary and secondary in the game screen choice
* Keep the selected game screen in step with display changes and session mode
* Refresh the game output when the screen is picked automatically
* Keep the game screen when controls open automatically
* Keep the external game screen across restarts and show the controls on the primary screen
* fix(dual-screen): preserve selected game display
* fix(dual-screen): retain fallback selection and keyboard access
* fix(input): clear field keyboard ownership on transitions
* fix(dual-screen): route keyboard when selected display is occupied
* fix(dual-screen): enable keyboard fallback routing
* fix(dual-screen): defer keyboard requests until focus returns
* fix(dual-screen): recheck keyboard destination on focus return and ignore stale hide events
* fix(dual-screen): end guest keyboard ownership on real dismissals
* fix(input): screen taps move the pointer without clicking while an on-screen mouse button is shown
* fix(input): keep tap-to-click with the stock Desktop on-screen gamepad
Only mouse buttons the user bound, not the profile base's stock bindings, make screen taps pointer-only.
* fix(input): count mouse buttons on the second-screen and foldable panels
* fix(input): keep tap clicks off on the swapped panel, copied stock panels and the scroll layer
* fix(input): move the pointer before the desktop gesture buffer when an on-screen mouse button clicks
* fix(input): the on-screen button gate leaves uninitialized gestures alone
---------
Co-authored-by: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com>
* Add integer scaling mode
* Fix integer scaling view-space input bounds
* Improve integer scaling tolerance
* Add Fit and Auto scaling toggle to session drawer
* Translate Fit and Integer scaling labels
* Clarify integer scaling cropping hint
* Update integer scaling hint across translations
* Fix integer scaling settings and translations
* Fix controller input for integer scaling
* Complete integer scaling hint translations
* Fix integer scaling hint translations
* Restore XML declaration quote style
* Use double quotes in XML declarations
* Add missing norugeuingz translatisn
* fix: include math.h for roundf integer scaling
* fix: link math library in Vulkan caller tests
* Fix integer scaling translations
* Fix Italian integer scaling string
* Fix Italian scaling hint apostrophe
* fix(proot): ship proot in the APK and run it from the native library directory
* fix(native): start rootfs programs through an APK-shipped exec loader where data files may not be executed
* fix(audio): start PulseAudio through the system linker where data files may not be executed
* feat: target Android 14 (SDK 34) so Play Protect installs DroidDeck without a warning
* fix: ask for all-files access on Android 11+, reject unloadable ELFs before exec, keep checking the proot pack
* fix: hand host scripts to the kernel, skip startup launch while all-files Settings is open
* fix: run proot from its add-on pack through Android's linker, so the APK carries no proot
* fix: declare high sampling rate sensors for controller gyro at target 34
* fix: offer the rootfs proot fallback only where Android lets proot exec its loader
* test: install the runtime's proot pack in GameFileSync fixtures
* feat(display): black frame insertion on 100 Hz and faster screens
* feat(display): black frame insertion lives in Screen effects
* test(compositor): cover black frame insertion in the render-on-commit harness
* fix(display): keep HDR and pacing intact around black frame insertion
* fix(display): gate black frame insertion on the panel's refresh, not the tick rate
BFI checked the 100 Hz minimum against g_refresh_ns, an average of the time
between handled vsync ticks. BFI presents on every tick, so under load the
ticks run late, the average fell to 95-100 Hz on a 120 Hz panel, and BFI
switched off and on again many times a second (3793 times in one session on
a Retroid Pocket Duo). That showed as uneven flicker.
Use the display mode's refresh (g_output_refresh_mhz) instead, which only
changes when the mode does.
* fix(display): offer black frame insertion for the bottom screen and while it is on
* fix(display): capture a picture, not a black refresh, while black frame insertion strobes
* fix(display): hold black frame insertion off until the last capture ends
* fix(display): keep the game composed while a capture holds black frame insertion
* test(display): a picture hold presents only pictures while black frame insertion runs
* fix(rockstar): ship the launcher service as an add-on pack, not inside the APK
* fix: ship the DiRT ws2_32 stand-in as an add-on pack and reject Windows executables in the APK
* fix(release): reject APK entries under a packed path even when the manifest omits them
* fix(dirt): fetch the ws2_32 stand-in pack once the Linux runtime is installed
* fix(input): read a USB mouse directly where Android won't capture it, as in REDMAGIC cast mode
REDMAGIC's cast mode shows the session on a virtual display while its own
mirror activity keeps focus on the phone's display. Android only grants
pointer capture on the focused display, so the session got a cursor that
stopped at the screen edge and the camera stopped turning in mouse-look games.
When capture is wanted but not granted within 500 ms, the session claims the
mouse's USB HID boot interface instead, reads its reports with the layout from
its report descriptor (boot protocol if that can't be read), and sends motion,
five buttons and the wheel the way captured motion goes. The mouse goes back
to Android whenever capture is no longer wanted.
* feat(input): hold the middle button still to open the session menu while the mouse is read over USB
While the session reads the mouse over USB, Android has no cursor, so the
mouse can't reach REDMAGIC's cast-mode panel or anything else outside the
session. Holding the middle button for two seconds without moving opens the
session menu, which hands the mouse back to Android until the menu closes.
Quick middle clicks and middle-button drags still reach the game.
Relative motion sent to a locked pointer now hides the session's own cursor,
as pad pointer motion already does. A desktop keeps its grab while the menu
is open, so a click made with Android's cursor on the way back showed the
session cursor, which then stayed where the click was.
* fix(input): give a USB mouse back to Android when the app starts after being killed while reading it
A process killed while it reads the mouse, by a crash or an update, leaves
the mouse's interface with no driver, so Android has no mouse until it is
replugged. At startup, any permitted USB boot mouse that can be claimed
without force has no driver, and releasing it reattaches Android's.
* fix(input): only sessions shown off the phone's screen fall back to reading the USB mouse
Android grants pointer capture on the focused display, which the phone's own
screen is, so a session there never needs the USB mouse. Checking the display
keeps a slow capture grant from ever asking for the mouse's USB access there.
* fix(input): reject out-of-range HID report sizes and counts, and release USB buttons when the mouse is lost
A report descriptor can give any 32-bit report count or size, which drove the
field loop for billions of iterations and could overflow bit offsets into a
negative index on the reader thread. Items outside 32 bits and 4096 fields are
rejected, so such a mouse falls back to the boot protocol.
A mouse that stops responding while it is read over USB now releases the
buttons it held and cancels a pending menu hold, through a separate onLost
callback, since the session's own release path only runs while the grab is
still active.
* test(input): an oversized report count is rejected even when X and Y follow it
The earlier case had no X or Y fields, so it returned null without the count
check too. A 4097-field item before valid X and Y is now rejected, and a
4096-field one still parses.
* fix(input): Auto relative mouse sees a mouse read over USB, and re-checks when it is lost
The Auto relative-mouse decision from #2305 reads mouseAttached() on the
relative-mouse thread, which counts a mouse read over USB, so the grab's
state is now volatile. Losing that mouse re-runs the decision, as removing
an Android mouse does.
* fix(input): set up the USB mouse on its reader thread, select report protocol, and retry a failed permission request
Opening the receiver and its descriptor and protocol transfers now run on the
reader thread, so an unresponsive receiver can't stall the session for up to
two seconds. A release during setup lets the thread clean up as it already
did. A mouse that fails setup isn't tried again until it is replugged, since
releasing it re-adds Android's mouse, which would start another attempt.
A parsed report descriptor now selects report protocol first: HID 1.11
7.2.6 says a host must not assume the protocol a device is in.
A permission request that throws no longer marks the mouse as asked.
* fix(input): a cancelled or overlapping USB reader can't claim the mouse or mark it failed
A new reader waits for the previous one to let go of the interface, so a
quick release and grab, like toggling the session menu, no longer fails the
claim. A reader released before or during setup doesn't claim the interface
or keeps going. Failing to open or claim leaves the mouse with Android without
marking it failed, since nothing re-adds it to start another attempt; only a
failure after claiming, or a lost mouse, marks it, and only for the current
reader.
If SET_PROTOCOL(report) fails, setup tries boot protocol before giving up,
so the decoder always matches the protocol the mouse was set to.
* fix(input): release can't slip between the USB reader's cancellation check and its claim
The reader checked `running` and then claimed the interface, so a release in
between still let it claim and start setup. The check and claim now share a
lock with release, so the reader either never claims or claims first and sees
the release before setup.
* fix(input): hand the mouse back to Android while the WoW chat bar is on top
appUiOwnsPointer() already shows Android's pointer for the on-top chat bar,
but pointer capture, and now the USB mouse, stayed on, so that pointer
couldn't reach the bar. The bar on top now ends capture and USB reading like
the session menus do, and its changes re-run the capture decision.
* feat(compositor): pen samples drive the pointer like a mouse
Input record 13 carries the pen's state (in proximity, tip, right and
middle button) and its position in input space as 24.8 fixed point.
Hover moves the pointer, the tip holds the left button, and a record
without the in-proximity bit releases every button. Under a pointer
lock only the buttons pass. A button pressed or released mid-stroke
keeps the implicit grab on the window the stroke started in, unless
that window closed.
* feat(input): a pen moves the pointer while hovering, clicks with its tip and right-clicks with its side button
In Mouse mode (the default) a pen's hover moves the pointer, the tip
holds the left button and the side button right-clicks; Touch keeps it a
finger. The side button can send a middle click or nothing instead, and
a Bluetooth pen key counts as the side button while the pen is near.
With glasses or a program's pointer lock the pen drives the touchpad.
A hover exit followed within 50 ms by more hover or a touch keeps the
pen near, so a pen at the edge of its hover range does not flicker out,
and a hover that sends nothing for 2 s leaves proximity. On the desktop
a pen that comes near releases KWin's grab of a hardware mouse, so the
pen moves KWin's pointer. Whatever cancels touches also ends the pen,
and stylus devices no longer count as hardware mice.
* feat(input): pen mode and side button settings in the Controls tab and the session drawer
A Pen group follows the touch settings once the phone has a stylus
device or a pen event was seen, which is remembered as penSeen and kept
by a settings reset. It holds Pen (Mouse, Touch) and Side button (Right
click, Middle click, Off); Side button is hidden in Touch. Before
Android 14 a touchscreen reports the stylus source without a pen, so
there it counts only with its first pen event. The strings are
translated into all 32 languages.
* docs: describe pen input and its limits
---------
Co-authored-by: alien2003 <11610652+alien2003@users.noreply.github.com>