Romain Vimont
5fa46ad0c7
Fix constants name in comment
4 years ago
Romain Vimont
334964c380
Make setScreenPowerMode() method static
...
Its implementation does not use the instance at all.
4 years ago
Romain Vimont
f7d4b6d0db
Do not crash on missing clipboard manager
...
Some devices have no clipboard manager.
In that case, do not try to enable clipboard synchronization to avoid
a crash.
Fixes #1440 <https://github.com/Genymobile/scrcpy/issues/1440 >
Fixes #1556 <https://github.com/Genymobile/scrcpy/issues/1556 >
4 years ago
xeropresence
3c1ed5d86c
Handle repeating keycodes
...
Initialize "repeat" count on key events.
PR #1519 <https://github.com/Genymobile/scrcpy/pull/1519 >
Refs #1013 <https://github.com/Genymobile/scrcpy/pull/1013 >
Signed-off-by: Romain Vimont <rom@rom1v.com>
4 years ago
Romain Vimont
488d22d4e2
Increase clipboard size from 4k to 256k
...
Beyond 256k, SDL_GetClipboardText() returns an empty string on my
computer.
Fixes #1117 <https://github.com/Genymobile/scrcpy/issues/1117 >
4 years ago
Romain Vimont
245999aec4
Serialize text size on 4 bytes
...
This will allow to send text having a size greater than 65535 bytes.
4 years ago
Romain Vimont
a00a8763d6
Avoid additional copy on Java text parsing
...
Directly pass the buffer range to the String constructor.
4 years ago
Romain Vimont
8f314c74b0
Reorganize message size constants
...
Make the max clipboard text length depend on the max message size.
4 years ago
Louis Leseur
1b73eff3c9
Add missing file in build_without_gradle.sh
...
Fixes #1481 <https://github.com/Genymobile/scrcpy/issues/1481 >
PR #1482 <https://github.com/Genymobile/scrcpy/pull/1482 >
Signed-off-by: Louis Leseur <louis.leseur@gmail.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
4 years ago
Romain Vimont
44fa4a090e
Bump version to 1.14
4 years ago
Romain Vimont
93a5c5149d
Push clipboard text only if not null
...
In practice, it does not change anything (it just avoids a spurious
wake-up), but semantically, it makes no sense to call
pushClipboardText() with a null value.
4 years ago
Romain Vimont
d499ee53c9
Initialize a default log level
...
Clean up has been broken by 3df63c579d
.
The verbosity was correctly initialized for the Server process, but not
for the CleanUp process.
To avoid the problem, initialize a default log level.
4 years ago
Romain Vimont
fc1dec0270
Paste on "set clipboard" if possible
...
Ctrl+Shift+v synchronizes the computer clipboard to the Android device
clipboard. This feature had been added to provide a way to copy UTF-8
text from the computer to the device.
To make such a paste more straightforward, if the device runs at least
Android 7, also send a PASTE keycode to paste immediately.
<https://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_PASTE >
Fixes #786 <https://github.com/Genymobile/scrcpy/issues/786 >
4 years ago
Romain Vimont
4bbabfb4ef
Move injection methods to Device
...
Only the main injection method was exposed on Device, the convenience
methods were implemented in Controller.
For consistency, move them all to the Device class.
4 years ago
Romain Vimont
ffc57512b3
Avoid clipboard synchronization loop
...
The Android device listens for clipboard changes to synchronize with the
computer clipboard.
However, if the change comes from scrcpy (for example via Ctrl+Shift+v),
do not notify the change.
4 years ago
Romain Vimont
c7a33fac36
Log actions on the caller side
...
Some actions are exposed by the Device class, but logging success should
be done by the caller.
4 years ago
Romain Vimont
81573d81a0
Pass a Locale to toUpperCase()
...
Make lint happy.
4 years ago
Romain Vimont
5c2cf88a1d
Rename THRESHOLD to threshold
...
Since the field is not final anymore, lint expects the name not to be
capitalized.
4 years ago
Romain Vimont
3df63c579d
Configure server verbosity from the client
...
Send the requested log level from the client.
This paves the way to configure it via a command-line argument.
4 years ago
Tzah Mazuz
080a4ee365
Add --codec-options
...
Add a command-line parameter to pass custom options to the device
encoder (as a comma-separated list of "key[:type]=value").
The list of possible codec options is available in the Android
documentation:
<https://d.android.com/reference/android/media/MediaFormat >
PR #1325 <https://github.com/Genymobile/scrcpy/pull/1325 >
Refs #1226 <https://github.com/Genymobile/scrcpy/pull/1226 >
Co-authored-by: Romain Vimont <rom@rom1v.com>
4 years ago
Romain Vimont
c7155a1954
Add unit test for big "set clipboard" event
...
Add a unit test to avoid regressions.
Refs #1425 <https://github.com/Genymobile/scrcpy/issues/1425 >
4 years ago
Romain Vimont
517dbd9c85
Increase buffer size to fix "set clipboard" event
...
The buffer size must be greater than any event message.
Clipboard events may take up to 4096 bytes, so increase the buffer size.
Fixes #1425 <https://github.com/Genymobile/scrcpy/issues/1425 >
4 years ago
Romain Vimont
acc4ef31df
Synchronize device clipboard to computer
...
Automatically synchronize the device clipboard to the computer any time
it changes.
This allows seamless copy-paste from Android to the computer.
Fixes #1056 <https://github.com/Genymobile/scrcpy/issues/1056#issuecomment-631363684 >
PR #1423 <https://github.com/Genymobile/scrcpy/pull/1423 >
4 years ago
Romain Vimont
73e722784d
Remove useless exception declaration
...
The interface declares it can throw a RemoteException, but the
implementation never throws such exception.
4 years ago
Romain Vimont
e1cd75792c
Simplify rotation watcher call
...
Remove unnecessary private method (which was wrongly public).
4 years ago
Romain Vimont
e2d5f0e7fc
Send scroll events as a touchscreen
...
Scroll events were sent with a mouse input device. When scrolling on a
list, this could cause the whole list to be focused, and drawn with the
focus color as background.
Send scroll events with a touchscreen input device instead (like motion
events).
Fixes #1362 <https://github.com/Genymobile/scrcpy/issues/1362 >
4 years ago
Romain Vimont
74ece9b45b
Simplify ScreenEncoder more
...
Commit 927d655ff6
removed the
iFrameInternal field and constructor argument.
Also remove it from createFormat() arguments.
4 years ago
Romain Vimont
c77024314d
Add an option to keep the device awake
...
Add an option to prevent the device to sleep:
scrcpy --stay-awake
scrcpy -w
The initial state is restored on exit.
Fixes #631 <https://github.com/Genymobile/scrcpy/issues/631 >
4 years ago
Romain Vimont
4668638ee1
Handle "show touches" on the device-side
...
Now that the server can access the Android settings and clean up
properly, handle the "show touches" option from the server.
The initial state is now correctly restored, even on device
disconnection.
4 years ago
Romain Vimont
dbb0df607c
Move constants to ServiceManager
...
PACKAGE_NAME and USER_ID could be use by several "managers", so move
them to the service manager.
4 years ago
Romain Vimont
2f74ec2518
Add a clean up process on the device
...
In order to clean up on close, use a separate process which is not
killed when the device is disconnected (even if the main process itself
is killed).
4 years ago
Romain Vimont
8c6799297b
Implement access to settings without Context
...
Expose methods to access the Android settings using private APIs.
This allows to read and write settings values immediately without
starting a new process to call "settings".
4 years ago
Romain Vimont
62c0c1321f
Apply workarounds only on error
...
To avoid NullPointerException on some devices, workarounds have been
implemented. But these workaround produce (harmless) internal errors
causing exceptions to be printed in the console.
To avoid this problem, apply the workarounds only if it fails without
them.
Fixes #994 <https://github.com/Genymobile/scrcpy/issues/994 >
Refs #365 <https://github.com/Genymobile/scrcpy/issues/365 >
Refs #940 <https://github.com/Genymobile/scrcpy/issues/940 >
4 years ago
Romain Vimont
9babe26805
Bump version to 1.13
4 years ago
Tzah Mazuz
125c5561e8
Use MediaFormat constant for MIME type
...
Replace "video/avc" by MIMETYPE_VIDEO_AVC.
Signed-off-by: Romain Vimont <rom@rom1v.com>
5 years ago
Romain Vimont
94a7f1a0f8
Disable input events when necessary
...
Disable input events on secondary displays before Android 10, even if
FLAG_PRESENTATION is not set.
Refs #1288 <https://github.com/Genymobile/scrcpy/issues/1288 >
5 years ago
Romain Vimont
eb8f7a1f28
Require Meson 0.48 to get rid of warnings
...
Debian buster (stable) provides Meson 0.49, which is also available in
stretch (oldstable) backports. It's time to abandon Meson 0.37.
Ref: 20b3f101a4
5 years ago
Romain Vimont
270d0bf639
Rename max length constant for text injection
...
To avoid confusion with the max text size for clipboard, rename the
constant limiting the text injection length.
5 years ago
Romain Vimont
927d655ff6
Simplify ScreenEncoder
...
Do not handle iFrameInterval field and parameter, it is never used
dynamically.
5 years ago
Romain Vimont
ee2894779a
Remove unused lockedVideoOrientation field
...
During PR #1151 , this field has been moved to ScreenInfo, but has not
been removed from ScreenEncoder.
5 years ago
Kostiantyn Luzan
c1ebea26e6
Register rotation watcher on selected display
...
PR #1275 <https://github.com/Genymobile/scrcpy/pull/1275 >
Signed-off-by: Kostiantyn Luzan <vblack2006@gmail.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
5 years ago
Romain Vimont
f07d21f050
Suppress DiscouragedPrivateApi lint warning
5 years ago
Romain Vimont
bea1c11f8e
Do not log success on failure
...
If calling the private API does not work, an exception is printed. In
that case, do not log that the action succeeded.
5 years ago
e_vigurskiy
4150eedcdf
Add display id parameter
...
Add --display command line parameter to specify a display id.
PR #1238 <https://github.com/Genymobile/scrcpy/pull/1238 >
Signed-off-by: Romain Vimont <rom@rom1v.com>
5 years ago
Romain Vimont
5031b2c8ff
Remove MagicNumber checkstyle
...
There are a lot of "magic numbers" that we really don't want to extract
as a constant.
Until now, many @SuppressWarnings annotations were added, but it makes
no sense to check for magic number if we silent the warnings everywhere.
5 years ago
Romain Vimont
4adf5fde6d
Log device details on server start
5 years ago
Romain Vimont
3504c0016b
Add tests for control message length
...
This will avoid regressions for #1245 .
<https://github.com/Genymobile/scrcpy/issues/1245 >
5 years ago
Romain Vimont
89d1602185
Fix expected message length for touch events
...
The expected length for a touch event control message was incorrect. As
a consequence, a BufferUnderflowException could occur.
Fixes #1245 <https://github.com/Genymobile/scrcpy/issues/1245 >
5 years ago
Romain Vimont
566ba766af
Remove unused constant
...
It has not been removed when mouse and touch events have been merged.
5 years ago
Tzah Mazuz
a0af402d96
Fix the printed versions (were opposite)
...
PR #1224 <https://github.com/Genymobile/scrcpy/pull/1224 >
Signed-off-by: Romain Vimont <rom@rom1v.com>
5 years ago
Romain Vimont
ae2d094362
Handle locked video orientation from ScreenInfo
...
Centralize video size management in ScreenInfo.
This allows to always send the correct initial video size to the client
if the video orientation is locked.
5 years ago
Romain Vimont
c5f5d1e456
Rename "rotation" to "device rotation"
...
This paves the way to reduce confusion in ScreenInfo when it will handle
locked video orientation.
5 years ago
Romain Vimont
63286424bb
Compute all screen info from ScreenInfo
...
Screen information was partially initialized from Device. Move this
initialization to ScreenInfo.
5 years ago
Romain Vimont
da18c9cdab
Remove useles import
5 years ago
George Stamoulis
1982bc439b
Add option to lock video orientation
...
PR #1151 <https://github.com/Genymobile/scrcpy/pull/1151 >
Signed-off-by: Romain Vimont <rom@rom1v.com>
5 years ago
Romain Vimont
ef56cc6ff7
Retrieve screen info once
...
The method getScreenInfo() is synchronized, and the result may change
between calls.
Call it once and store the result in a local variable.
5 years ago
Romain Vimont
96bd2c974d
Do not report workarounds errors
...
Some workarounds are needed on some devices. But applying them may cause
exceptions on other devices, where they are not necessary anyway.
Do not report these errors in release builds.
Closes #994 <https://github.com/Genymobile/scrcpy/issues/994 >
5 years ago
Romain Vimont
83d48267a7
Accept --max-fps before Android 10
...
KEY_MAX_FPS_TO_ENCODER existed privately before Android 10:
<https://github.com/Genymobile/scrcpy/issues/488#issuecomment-567321437 >
5 years ago
Romain Vimont
4687a0ebac
Bump version to 1.12.1
5 years ago
Romain Vimont
a0f8e7fd9f
Bump version to 1.12
5 years ago
Romain Vimont
e0b117de13
Fix checkstyle warning
5 years ago
Romain Vimont
eb0f339271
Add shortcut to rotate screen
...
On Ctrl+r, disable auto-rotation (if enabled), set the screen rotation
and re-enable auto-rotation (if it was enabled).
Closes #11 <https://github.com/Genymobile/scrcpy/issues/11 >
5 years ago
Romain Vimont
bdd05b4a16
Refactor wrappers for Android SDK classes
...
Internally, a failure to invoke a method via reflection was partially
managed using exceptions, partially using a null return value.
Handle all errors at the same place, by not catching
NoSuchMethodException too early.
5 years ago
Romain Vimont
525d6d4a75
Try new methods before legacy ones
...
Use the legacy methods when the new ones do not exist.
5 years ago
Romain Vimont
8a694a9785
Suggest workaround for error 0xfffffc0e
...
When the hardware encoder is not able to encode at the given definition,
it fails with an error 0xfffffc0e.
It is documented in the FAQ:
<https://github.com/Genymobile/scrcpy/blob/master/FAQ.md#i-get-an-error-could-not-open-video-stream >
But it is better to directly suggest the workaround in the console.
5 years ago
Romain Vimont
26529d377f
Use virtual device id to avoid NPE
...
Inject mouse events using id -1 (virtual device) instead of 0 which
does not exist (and causes the InputDevice to be null).
Fixes <https://github.com/Genymobile/scrcpy/issues/962 >
5 years ago
Romain Vimont
6abb8fd0cd
Reformat Java code
...
Reformated by Android studio to match the 150 characters column defined
in checkstyle.
5 years ago
Romain Vimont
2b845680b0
Initialize Application object to avoid NPE
...
When an ApplicationInfo is set (commit
90293240cc
), some devices (Nvidia Shield
TV) attempt to access the Application object, causing a
NullPointerException.
As a workaround, initialize an Application object.
Fixes <https://github.com/Genymobile/scrcpy/issues/940 >
5 years ago
Romain Vimont
ebdc2ee8b5
Rename variable for consistency
...
Use suffix "Field" for fields variables.
5 years ago
Romain Vimont
83ace84280
Restore the .jar extension on the device side
...
Commit 3da95b52bd
renamed
'scrcpy-server.jar' to 'scrcpy-server' to avoid issues on the client
side.
However, removing the extension may cause issues with app_process, so
restore the extension only on the device side.
Fixes <https://github.com/Genymobile/scrcpy/issues/944 >
5 years ago
yangfl
7d7f3daff2
Fix aidl option in build_without_gradle.sh
...
Debian's aidl complains about the missing path for -o option.
Signed-off-by: Romain Vimont <rom@rom1v.com>
5 years ago
Romain Vimont
2aa65015bc
Bump version to 1.11
5 years ago
act262
90293240cc
Fix meizu 16th NPE
...
Fill AppInfo to avoid NullPointerException on some devices.
Fixes <https://github.com/Genymobile/scrcpy/issues/365 >
Signed-off-by: Romain Vimont <rom@rom1v.com>
5 years ago
Romain Vimont
213c468c20
Move workarounds to a separate class
...
Extract workarounds (currently only one) to a separate class to avoid
polluting the main code.
5 years ago
Romain Vimont
601b0fecdd
Extract DEBUG flag in build_without_gradle.sh
5 years ago
Romain Vimont
7fd800d583
Generate VERSION_NAME in build_without_gradle.sh
...
Since commit b963a3b9d5
, the server uses
BuildConfig.VERSION_NAME.
Generate this field manually for building without gradle.
5 years ago
Romain Vimont
1d97d7213d
Add option --max-fps
...
Add an option to limit the capture frame rate. It only works for devices
with Android >= 10.
Fixes <https://github.com/Genymobile/scrcpy/issues/488 >
5 years ago
Romain Vimont
fb976816f9
Do not expose frame rate in ScreenEncoder
...
The KEY_FRAME_RATE parameter value is necessary for the configuration of
the encoder, but its actual value does not impact the frame rate (only
resources used by the encoder).
Therefore, it's an internal detail and should not be exposed by the
ScreenEncoder class.
5 years ago
Yu-Chen Lin
b963a3b9d5
Check client and server mismatch
...
Send client version as first parameter and check it at server start.
Signed-off-by: Yu-Chen Lin <npes87184@gmail.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
5 years ago
olbb
e282100d0b
Call Looper.prepareMainLooper() to avoid exception
...
Some devices internally create a Handler when creating an input Surface,
causing an exception:
> Surface: java.lang.RuntimeException: Can't create handler inside
> thread that has not called Looper.prepare()
As a workaround, call Looper.prepareMainLooper() beforehand.
Fixes:
- <https://github.com/Genymobile/scrcpy/issues/240 >
- <https://github.com/Genymobile/scrcpy/issues/921 >
Signed-off-by: Romain Vimont <rom@rom1v.com>
5 years ago
Romain Vimont
3da95b52bd
Rename scrcpy-server.jar to scrcpy-server
...
The server name ending with .jar has several drawbacks:
- meson requires the jar executable to attempt to modify it:
<https://github.com/Genymobile/scrcpy/issues/404#issuecomment-456065923 >
<https://github.com/mesonbuild/meson/issues/4844 >
- meson warns during "ninja install"
<https://github.com/Genymobile/scrcpy/issues/458 >
- some users try to execute it on the computer as a java executable
Removing the extension solves all these problems.
5 years ago
Romain Vimont
c72f677435
Merge branch 'master' into dev
5 years ago
Romain Vimont
d841718956
Add a script to build the server without gradle
...
Gradle versions may sometimes cause problems. This script offers an
alternative.
5 years ago
Romain Vimont
f9938dbf88
Inject button state for touch/mouse events
...
The buttons state was forwarded, but ignored by the server.
5 years ago
Romain Vimont
c33a147fd0
Fix "turn screen off" on Android Q
...
Call getInternalDisplayToken(), which retrieve the id of the first
physical display (which is not necessarily 0 anymore).
Fixes <https://github.com/Genymobile/scrcpy/issues/835 >
5 years ago
Romain Vimont
8b33c6c108
Adapt copy-paste methods for Android 10
...
The methods getPrimaryClip() and setPrimaryClip() expect an additional
parameter since Android 10.
Fixes <https://github.com/Genymobile/scrcpy/issues/796 >.
5 years ago
Romain Vimont
5b7a0cd8e9
Extract String literal to static constant
5 years ago
Romain Vimont
bab9361948
Do not crash on control error
...
Some devices do not have some methods that we invoke via reflection, or
their call do not return the expected value. In that case, do not crash
the whole controller.
5 years ago
Romain Vimont
6220456def
Merge mouse and touch events
...
Both are handled the very same way on the device.
5 years ago
Romain Vimont
7e1d52c119
Rename "touch pointer" to "pointer"
...
There are only touch pointers now, mouse pointers have been removed.
5 years ago
Romain Vimont
280d5b718c
Use common pointers for mouse and touch
...
The mouse is a pointer like any other.
5 years ago
Romain Vimont
f765aae352
Inject touch events on the server
...
On receiving an "inject touch" control message, update the local
pointers state and inject touches.
5 years ago
Romain Vimont
77f876e29c
Add "inject touch" control message
...
Add a control message type in the protocol to forward touch events to
the device.
5 years ago
Romain Vimont
d90549d1e6
Rename "pointer" to "mouse pointer"
...
This will help to distinguish them from "touch pointers".
5 years ago
Romain Vimont
7d1932b907
Fix gradle warnings in tests
5 years ago
Romain Vimont
6e38e0cbfe
Rename variable names "event" to "msg"
...
Some variable names had not been renamed when "event" was renamed to
"message" (28980bbc90
).
5 years ago
Romain Vimont
7040e8abc4
Fix control message reader test
...
The mouse event test actually tested a key event control message.
5 years ago
Romain Vimont
20b3f101a4
Print gradle output on compiling
...
Enable the attribute "console" of custom_target() introduced in meson
0.48. This allows to get a feedback of what gradle does (which can takes
a very long time).
This produces warnings because we declare to support meson >= 0.37, but
we don't want to stop supporting older versions for that. Older versions
just ignore the option:
> WARNING: Unknown keyword arguments in target scrcpy-server: console
Newer meson versions use it, but warn because we declare supporting
older versions:
> WARNING: Project targetting '>= 0.37' but tried to use feature
> introduced in '0.48.0': console arg in custom_target
Meson does not support conditional branches to suppress such warnings,
so just keep the warnings.
5 years ago
toddsierens
27eacc3c11
Update WindowManager.java
5 years ago
Romain Vimont
c28619e4e8
Bump version to 1.10
5 years ago