Assign the FakeContext instance to ActivityManager.mContext to avoid a
permission error:
Permission Denial: package=android does not belong to uid=2000
Fixes#6523 <https://github.com/Genymobile/scrcpy/issues/6523>
A test for Java deserialization of the START_APP control message was
already present, but the corresponding C-side serialization test was
missing.
Refs 13ce277e1f1eec6312350c5a3a3ac3be7b9be6e1
Between the calls to CONSOLE_ERR.print() and
printStackTrace(CONSOLE_ERR), logs from other threads may be inserted.
Synchronizing access to CONSOLE_ERR ensures that logs from different
threads do not mix.
PR #6487 <https://github.com/Genymobile/scrcpy/pull/6487>
Signed-off-by: valord577 <valord577@gmail.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
The default handler was mistakenly retrieved after our custom handler
was set, causing it to reference itself. As a result, this led to
infinite recursion.
Bug introduced by eee3f24739dfcff2ebc428e9b2b19eb823641849.
Rename "common" to "_init" because it not only exposes common functions
but also initializes environment variables.
Call _init in a single line in all dependency build scripts.
ANDROID_PLATFORM is not always an integer; it can also be a value like
"36.1". Handle such cases properly.
This fixes the following error:
server/build_without_gradle.sh: line 89:
[[: 36.1: syntax error: invalid arithmetic operator (error token is ".1")
PR #6408 <https://github.com/Genymobile/scrcpy/pull/6408>
Signed-off-by: Romain Vimont <rom@rom1v.com>
The function update_texture() calls update_texture_internal() and falls
back to set_pending_frame() if it fails.
When the frame passed is the pending frame, call only the _internal()
version instead.
This will prevent issues with frame reference counts by ensuring the
source and destination frames are never the same.
Refs 6298ef095ffa9a2cdd2b4d245e71280743b5a59e
Refs #6357 <https://github.com/Genymobile/scrcpy/issues/6357>
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 afaca80b375a2fbdb966c15f52645abb578071f4
Fixes#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>
This ensures the process can terminate properly when a CTRL_BREAK_EVENT
signal is sent programmatically.
PR #6244 <https://github.com/Genymobile/scrcpy/pull/6244>
Signed-off-by: Romain Vimont <rom@rom1v.com>
The field gl_context is initialized from SDL_GL_CreateContext(), which
returns a raw SDL_GLContext, not a pointer.
The type mismatch was silently ignored by SDL2 because SDL_GLContext
was defined as an alias to `void *` (in SDL3, it is instead an alias to
`struct SDL_GLContextState *`, so compilation fails).
Refs #3895 <https://github.com/Genymobile/scrcpy/pull/3895>
PR #6259 <https://github.com/Genymobile/scrcpy/pull/6259>
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] cc0902b13c87fc98b1ed90b0700cc53ac4d7ee3c
Refs [2] 91373d906b100349de959f49172d4605f66f64b2
Refs #6224 comment <https://github.com/Genymobile/scrcpy/issues/6224#issuecomment-3078418268>
The ninja package is already installed, so this triggered a warning:
> ninja 1.13.0 is already installed and up-to-date. To reinstall 1.13.0,
> run: brew reinstall ninja
Over HID, only integral scroll values can be sent. When SDL precise
scrolling is active, scroll events may include fractional values (e.g.,
0.05), which are truncated to 0 in the HID event.
To fix the problem, use the integral scroll value reported by SDL, which
internally accumulates fractional deltas.
Fixes#6156 <https://github.com/Genymobile/scrcpy/issues/6156>
PR #6172 <https://github.com/Genymobile/scrcpy/pull/6172>
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 looper must be initialized before listing apps, to avoid the
following error:
> Can't create handler inside thread that has not called
> Looper.prepare()
Refs 283326b2f6fa3fdaeecc181f69a3a4bcd429c06a
Fixes#6165 <https://github.com/Genymobile/scrcpy/issues/6165>
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 8a02e3c2f58cffc3fdd8c08b26aae04bbf9d5a97
Fixes#6151 <https://github.com/Genymobile/scrcpy/issues/6151>