Romain Vimont
411bb0d18e
Move init and cleanup to a separate method
...
PR #2802 <https://github.com/Genymobile/scrcpy/pull/2802 >
3 years ago
Romain Vimont
cc0902b13c
Read/write settings via command on Android >= 12
...
Before Android 8, executing the "settings" command from a shell was
very slow (~1 second), because it spawned a new app_process to execute
Java code. Therefore, to access settings without performance issues,
scrcpy used private APIs to read from and write to settings.
However, since Android 12, this is not possible anymore, due to
permissions changes.
To make it work again, execute the "settings" command on Android 12 (or
on previous version if the other method failed). This method is faster
than before Android 8 (~100ms).
Fixes #2671 <https://github.com/Genymobile/scrcpy/issues/2671 >
Fixes #2788 <https://github.com/Genymobile/scrcpy/issues/2788 >
PR #2802 <https://github.com/Genymobile/scrcpy/pull/2802 >
3 years ago
Romain Vimont
48b572c272
Add throwable parameter to Log.w()
...
When an exception occurs, we might want to log a warning instead of an
error.
PR #2802 <https://github.com/Genymobile/scrcpy/pull/2802 >
3 years ago
Romain Vimont
94feae71f2
Report settings errors via Exceptions
...
Settings read/write errors were silently ignored. Report them via a
SettingsException so that the caller can handle them.
This allows to log a proper error message, and will also allow to
fallback to a different settings method in case of failure.
PR #2802 <https://github.com/Genymobile/scrcpy/pull/2802 >
3 years ago
Romain Vimont
67170437f1
Wrap settings management into a Settings class
...
Until now, the code that needed to read/write the Android settings had
to explicitly open and close a ContentProvider.
Wrap these details into a Settings class.
This paves the way to provide an alternative implementation of settings
read/write for Android >= 12.
PR #2802 <https://github.com/Genymobile/scrcpy/pull/2802 >
3 years ago
LuXu
57fb08e443
Update Simplified Chinese README to 1.20
...
PR #2786 <https://github.com/Genymobile/scrcpy/pull/2786 >
Signed-off-by: Romain Vimont <rom@rom1v.com>
3 years ago
Alex Burdusel
02ae0db6cd
Fix wrong package to install for Ubuntu/Debian
...
Without this package, meson fails:
Run-time dependency libusb-1.0 found: NO (tried pkgconfig and cmake)
app/meson.build:88:8: ERROR: Dependency "libusb-1.0" not found, tried pkgconfig and cmake
PR #2790 <https://github.com/Genymobile/scrcpy/pull/2790 >
Signed-off-by: Romain Vimont <rom@rom1v.com>
3 years ago
Romain Vimont
9cb14b5166
Inherit only specific handles on Windows
...
To be able to communicate with a child process via stdin, stdout and
stderr, the CreateProcess() parameter bInheritHandles must be set to
TRUE. But this causes *all* handles to be inherited, including sockets.
As a result, the server socket was inherited by the process running adb
to execute the server on the device, so it could not be closed properly,
causing other scrcpy instances to fail.
To fix the issue, use an extended API to explicitly set the HANDLEs to
inherit:
- <https://stackoverflow.com/a/28185363/1987178 >
- <https://devblogs.microsoft.com/oldnewthing/20111216-00/?p=8873 >
Fixes #2779 <https://github.com/Genymobile/scrcpy/issues/2779 >
PR #2783 <https://github.com/Genymobile/scrcpy/pull/2783 >
3 years ago
Romain Vimont
9cb8766220
Factorize resource release after CreateProcess()
...
Free the wide characters string in all cases before checking for errors.
3 years ago
Romain Vimont
fd4ec784e0
Remove useless assignments on error
...
Leave the output parameter untouched on error.
3 years ago
Romain Vimont
52cebe1597
Fix Windows sc_pipe function names
...
The implementation name was incorrect (it was harmless, because they are
not used on Windows).
3 years ago
Romain Vimont
6a27062f48
Stop connection attempts if interrupted
...
If the interruptor is interrupted, every network call will fail, but the
retry-on-error mechanism must also be stopped.
3 years ago
Romain Vimont
739ff9dce0
Fix compilation errors with old SDL versions
...
SDL_PixelFormatEnum has been introduced in SDL 2.0.10:
<cc6a8ac87e
>
SDL_PIXELFORMAT_BGR444 has been introduced in SDL 2.0.12:
<a1c11854f2
>
Fixes #2777 <https://github.com/Genymobile/scrcpy/issues/2777 >
PR #2781 <https://github.com/Genymobile/scrcpy/pull/2781 >
Reviewed-by: Yu-Chen Lin <npes87184@gmail.com>
3 years ago
Romain Vimont
65b023ac6d
Update links to v1.20
3 years ago
Romain Vimont
a045e28df8
Bump version to 1.20
3 years ago
Romain Vimont
52138fd921
Update script to build without gradle to SDK 31
...
Build tools 31.x.x do not ship dx anymore. Use d8 instead.
Refs 8bf28e9f53
3 years ago
Romain Vimont
1bb0df5da1
Extract ANDROID_JAR path in build script
...
This will allow to reuse it.
3 years ago
Romain Vimont
562ec6e9b3
Merge branch 'master' into dev
3 years ago
Romain Vimont
1be5daf999
Fix word order in README
3 years ago
Romain Vimont
57387fa707
Mention crash on Android 12 on old scrcpy in FAQ
3 years ago
Romain Vimont
4e811a4a68
Adapt icon in README
...
Use SVG format, align to the right, and reduce its size.
3 years ago
Romain Vimont
99a4a48477
Replace "connected on" to "connected via"
...
I'm not sure "connected on USB" is correct.
3 years ago
Romain Vimont
1d97d77032
Improve scrcpy presentation in README
3 years ago
Romain Vimont
45b0f8123a
Increase delay to inject HID on Ctrl+v
...
2 milliseconds turn out to be insufficient sometimes. It seems that 5
milliseconds is enough (and still not noticeable).
3 years ago
Romain Vimont
c1a34881d7
Use sc_ prefix for server
3 years ago
Romain Vimont
057c7a4df4
Move str_util to str
...
Simplify naming.
3 years ago
Romain Vimont
979ce64dc0
Improve string util API
...
Use prefixed names and improve documentation.
3 years ago
Romain Vimont
9a0bd545d5
Rename SC_INVALID_SOCKET to SC_SOCKET_NONE
...
For consistency with SC_PROCESS_NONE.
3 years ago
Romain Vimont
c4d008b96a
Extract adb tunnel to a separate component
...
This simplifies the server code.
3 years ago
Romain Vimont
0d45c29d13
Move IPV4_LOCALHOST to net.h
...
This constant will be used from several files.
3 years ago
Romain Vimont
37c840a4c8
Interrupt on process terminated
...
Interrupt any blocking call on process terminated, like on
server_stop().
This allows to interrupt any blocking accept() with correct
synchronization without additional complexity.
3 years ago
Romain Vimont
f488cbd7e7
Make server interruptible
...
Use an interruptor to immediately wake up blocking calls on
server_stop().
3 years ago
Romain Vimont
40340509d9
Add interruptor utilities
...
Expose wrapper functions for interrupting blocking calls, for process
and sockets.
3 years ago
Romain Vimont
e0896142db
Introduce interruptor tool
...
An interruptor instance will help to wake up a blocking call from
another thread (typically to terminate immediately on Ctrl+C).
3 years ago
Romain Vimont
0426708544
Run the server from a dedicated thread
...
Define server callbacks, start the server asynchronously and listen to
connection events to initialize scrcpy properly.
It will help to simplify the server code, and allows to run the UI event
loop while the server is connecting. In particular, this will allow to
receive SIGINT/Ctrl+C events during connection to interrupt immediately.
3 years ago
Romain Vimont
5b9c88693e
Wait using a condition variable in server
...
Currently, server_stop() is called from the same thread as
server_connect_to(), so interruption may never happen.
This is a step to prepare executing the server from a dedicated thread.
3 years ago
Romain Vimont
a54dc8212f
Reorder server functions
...
This will avoid forward declarations in future commits.
3 years ago
Romain Vimont
882e4cff5f
Copy server params
...
This is a preliminary step necessary to move the server to a separate
thread.
3 years ago
Romain Vimont
9fa4d1cd4a
Reorder server and server_params
...
This will allow to define a server_params field in server.
3 years ago
Romain Vimont
0bfa75a48b
Split socket creation and connect/listen
...
This will allow to assign the socket to a variable before connecting or
listening, so that it can be interrupted from another thread.
3 years ago
Romain Vimont
ed19901db1
Set video and control sockets only on success
...
Store the video and control sockets only if server_connect_to() returns
successfully.
3 years ago
Romain Vimont
e69356c550
Initialize tunnel_enabled flag internally
...
Set the flag from the inner methods, to avoid bypassing the assignment
by mistake (on error for example).
3 years ago
Romain Vimont
03de9224fc
Introduce process observer
...
Add a tool to easily observe process termination.
This allows to move this complexity out of the server code.
3 years ago
Romain Vimont
aa011832c1
Improve process API
...
Prefix symbols and constants names and improve documentation.
3 years ago
Romain Vimont
7e93abcf6d
Factorize common impl of process_execute()
...
Both implementations are the same. Move them to the common process.c.
3 years ago
Romain Vimont
e80e6631e4
Remove duplicate function declaration
...
The function process_terminate() was declared twice.
3 years ago
Romain Vimont
fcc04f967b
Improve file API
...
Prefix symbols and constants names and improve documentation.
3 years ago
Romain Vimont
d4c262301f
Move functions from process to file
...
Move filesystem-related functions from process.[ch] to file.[ch].
3 years ago
Romain Vimont
be55e250ca
Make screen_render() static
...
It is only used from screen.c.
3 years ago
Romain Vimont
c548f017bf
Upgrade junit to 4.13.1
3 years ago