New Android versions may add methods to IDisplayWindowListener.aidl.
When these methods are called by the system, they result in an
AbstractMethodError because they are not implemented on the scrcpy side.
To avoid releasing a new version for each newly added method, ignore
them at the Binder level.
Refs afaca80b37Fixes#6362 <https://github.com/Genymobile/scrcpy/issues/6362>
With this flag, apps with baked in two-screen support can see the
virtual display as an external display they can present to.
PR #6344 <https://github.com/Genymobile/scrcpy/pull/6344>
Signed-off-by: Romain Vimont <rom@rom1v.com>
For Android >= 12, scrcpy executed "settings" commands (in a new
process) rather than using the ContentProvider directly, due to
permission issues [1].
However, these permission issues were resolved by introducing
FakeContext.getContentResolver() [2].
Therefore, remove the use of "settings" commands and use the
ContentProvider directly in all cases.
Refs [1] cc0902b13c
Refs [2] 91373d906b
Refs #6224 comment <https://github.com/Genymobile/scrcpy/issues/6224#issuecomment-3078418268>
SDL precise scrolling can sometimes produce values greater than 1 or
less than -1.
On the wire, the value is encoded as a 16-bit fixed-point number.
Previously, the range was interpreted as [-1, 1], using 1 bit for the
integral part (the sign) and 15 bits for the fractional part.
To support larger values, interpret the range as [-16, 16] instead,
using 5 bits for the integral part and 11 bits for the fractional part
(which is more than enough).
PR #6172 <https://github.com/Genymobile/scrcpy/pull/6172>
The ClipboardManager is instantiated by the first call to
ServiceManager.getClipboardManager().
Now that scrcpy uses android.content.ClipboardManager directly, it must
ensure that it is created on the main thread (or at least on a thread
with a Looper), to avoid the following error:
> Can't create handler inside thread that has not called
> Looper.prepare()
Refs 8a02e3c2f5Fixes#6151 <https://github.com/Genymobile/scrcpy/issues/6151>
Since a main looper is explicitly run in the main process, the
initialization of workarounds no longer calls
Looper.prepareMainLooper(), leading to a crash:
java.lang.RuntimeException: Can't create handler inside thread
Thread[main,5,main] that has not called Looper.prepare()
As a result, --power-off-on-close was broken.
Refs 283326b2f6Fixes#6146 <https://github.com/Genymobile/scrcpy/issues/6146>
Some devices require a specific option to be enabled in Developer
Options to avoid a permission issue when injecting input events.
When this error occurs, hide the stack trace and print a human-readable
message explaining how to fix the issue.
PR #6080 <https://github.com/Genymobile/scrcpy/pull/6080>
Store the target audio source integer (one of the constants from
android.media.MediaRecorder.AudioSource) in the AudioSource enum (or -1
if not relevant).
This will simplify adding new audio sources.
PR #5870 <https://github.com/Genymobile/scrcpy/pull/5870>
The default OPUS and FLAC encoders on Android rewrite the input PTS so
that they exactly match the number of samples.
As a consequence:
- audio clock drift is not compensated
- implicit silences (without packets) are ignored
To work around this behavior, generate new PTS based on the current time
(after encoding) and the packet duration.
PR #5870 <https://github.com/Genymobile/scrcpy/pull/5870>
Add an option to select where the IME should be displayed.
Possible values are "local", "fallback" and "hide".
PR #5703 <https://github.com/Genymobile/scrcpy/pull/5703>
Signed-off-by: Romain Vimont <rom@rom1v.com>
This allows users to compile and run the project in a dev environment.
meson setup x
meson compile -C x
meson devenv -C x
scrcpy
This is an alternative to `./run x`.
PR #5658 <https://github.com/Genymobile/scrcpy/pull/5658>
Signed-off-by: Romain Vimont <rom@rom1v.com>
Some options, such as --show-touches or --stay-awake, modify Android
settings and must be restored upon exit.
If scrcpy terminates (e.g. due to an early error) in the middle of the
clean up configuration, the device may be left in an inconsistent state
(some settings might be changed but not restored).
This issue can be reproduced with high probability by forcing scrcpy to
fail:
scrcpy --show-touches --video-encoder=fail
To prevent this problem, ensure that the clean up thread is not
interrupted until the clean up process is started.
Refs #5601 <https://github.com/Genymobile/scrcpy/issues/5601>
PR #5613 <https://github.com/Genymobile/scrcpy/pull/5613>