Make it possible to build scrcpy-server and Windows binaries in
parallel from different GitHub Actions workflows, and to package
everything as a final step.
PR #5306 <https://github.com/Genymobile/scrcpy/pull/5306>
Scrcpy requires Android 5.0+, so there is no point testing for older
versions.
Btw, there were two mistakes:
- the constant name in AndroidVersions should have been
API_20_ANDROID_4_4W (Android 4.4 without 'W' is API 19)
- the method isInteractive() was introduced in Android 5.0, not 4.4W:
<037c33eae7%5E%21/>
Also adapt the call to build-tools/35.0.0/aidl, which now requires an
import path (-I. for the current directory).
Otherwise, it fails with:
ERROR: android/view/IRotationWatcher.aidl:23.1-10: directory ./ is not found in any of the import paths:
-
Also upgrade AGP (8.7.1) and Gradle (8.9), required for SDK 35.
<https://developer.android.com/build/releases/gradle-plugin#updating-gradle>
The server params were passed from the main thread to the server thread,
so a deep copy was performed in case the caller instance was destroyed.
But in practice, it only contains memory that lives until the end of the
program (command line arguments), so simply reference it. Several copies
of string fields were missing anyway.
With the old macros definitions, the type of the result depended on the
type of `sec`.
In particular, if sec is a 32-bit type, sec * 1000000 was likely to
overflow (even if the result was assigned to a sc_tick by the caller of
the macro).
This was the case on Windows, where the long type is a 32-bit signed
integer: the --time-limit argument, expressed in seconds, was first
parsed to a long value, then multiplied by 1000000 by the
SC_TICK_FROM_SEC() macro, causing an overflow when the value was greater
than 2147 (2^31 / 1000000).
Fixes#5355 <https://github.com/Genymobile/scrcpy/issues/5355>
Os.write() did not update the ByteBuffer position before Android 6.
A workaround was added by commit
b882322f73, which fixed part of the
problem, but the position was still not updated across calls, causing
the wrong chunk to be written.
Refs <d9f7e57f5d%5E%21/>
Replace argument suggestion:
--video-encoder='c2.android.avc.encoder'
by:
--video-encoder=c2.android.avc.encoder
On Linux, the quotes are interpreted by the shell, but on Windows they
are passed as is.
This was harmless, because even transmitted as is, they were interpreted
by the shell on the device. However, special characters are now
validated since commit bec3321fff, making
the command fail.
Fixes#5329 <https://github.com/Genymobile/scrcpy/issues/5329>
The audio player had 2 roles:
- handle the SDL audio output device;
- resample input samples to maintain a target latency.
Extract the latter to a separate component (an "audio regulator"),
independent of SDL.
Moving classes into subpackages changed the expected imports order.
Reorganize them all at once automatically to avoid spurious changes in
future commits.
Capture the gamepads even when the window is not focused.
Note: In theory, with this flag set, we could capture gamepad events
even without a window (--no-window). In practice, scrcpy still requires
a window, because --no-window implies --no-control, and the input
manager is owned by the sc_screen instance, which does not exist if
there is no window. Supporting this use case would require a lot of
refactors.
Refs <https://github.com/Genymobile/scrcpy/pull/5270#issuecomment-2339360460>
PR #5270 <https://github.com/Genymobile/scrcpy/pull/5270>
Suggested-by: Luiz Henrique Laurini <luizhenriquelaurini@gmail.com>
The sc_uhid_devices instance is initialized only when there is a UHID
keyboard.
The device message receiver assumed that it could not receive HID output
reports without a sc_uhid_devices instance (i.e. without a UHID
keyboard), but in practice, a UHID driver implementation on the device
may decide to send UHID output reports for mouse or for gamepads (and we
must just ignore them).
So remove the assert().
PR #5270 <https://github.com/Genymobile/scrcpy/pull/5270>
There was a registration mechanism to listen to HID outputs with a
specific HID id.
However, the UHID gamepad processor handles several ids, so it cannot
work. We could complexify the registration mechanism, but instead,
directly dispatch to the expected processor based on the UHID id.
Concretely, instead of passing a sc_uhid_devices instance to construct a
sc_keyboard_uhid, so that it can register itself, construct the
sc_uhid_devices with all the UHID instances (currently only
sc_keyboard_uhid) so that it can dispatch HID outputs directly.
PR #5270 <https://github.com/Genymobile/scrcpy/pull/5270>
Initialize UHID devices with a custom name:
- "scrcpy: $GAMEPAD_NAME" for gamepads
- "scrcpy" for keyboard and mouse (or if no gamepad name is available)
The name may appear in Android apps.
PR #5270 <https://github.com/Genymobile/scrcpy/pull/5270>
For convenience, short options were added to select UHID input modes:
- -K for --keyboard=uhid
- -M for --mouse=uhid
- -G for --gamepad=uhid
In OTG mode, UHID is not available, so the short options should select
AOA instead.
PR #5270 <https://github.com/Genymobile/scrcpy/pull/5270>