Romain Vimont
e0b117de13
Fix checkstyle warning
2019-12-05 21:05:45 +01:00
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 >
2019-12-04 22:03:25 +01:00
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.
2019-12-04 19:34:20 +01:00
Romain Vimont
525d6d4a75
Try new methods before legacy ones
...
Use the legacy methods when the new ones do not exist.
2019-12-04 19:32:38 +01:00
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.
2019-11-30 10:46:22 +01:00
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 >
2019-11-29 14:31:19 +01:00
Romain Vimont
6abb8fd0cd
Reformat Java code
...
Reformated by Android studio to match the 150 characters column defined
in checkstyle.
2019-11-25 17:33:42 +01:00
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 >
2019-11-24 11:58:40 +01:00
Romain Vimont
ebdc2ee8b5
Rename variable for consistency
...
Use suffix "Field" for fields variables.
2019-11-24 11:55:42 +01:00
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 >
2019-11-22 15:23:57 +01:00
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>
2019-11-20 17:16:46 +01:00
Romain Vimont
2aa65015bc
Bump version to 1.11
2019-11-19 23:05:39 +01:00
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>
2019-11-19 22:23:08 +01:00
Romain Vimont
213c468c20
Move workarounds to a separate class
...
Extract workarounds (currently only one) to a separate class to avoid
polluting the main code.
2019-11-19 22:23:08 +01:00
Romain Vimont
601b0fecdd
Extract DEBUG flag in build_without_gradle.sh
2019-11-18 14:33:14 +01:00
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.
2019-11-18 14:32:07 +01:00
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 >
2019-11-17 22:10:39 +01:00
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.
2019-11-17 22:10:33 +01:00
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>
2019-11-13 12:00:50 +01:00
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>
2019-11-09 20:31:57 +01:00
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.
2019-10-31 10:54:29 +01:00
Romain Vimont
c72f677435
Merge branch 'master' into dev
2019-10-30 23:29:44 +01:00
Romain Vimont
d841718956
Add a script to build the server without gradle
...
Gradle versions may sometimes cause problems. This script offers an
alternative.
2019-10-30 21:47:20 +01:00
Romain Vimont
f9938dbf88
Inject button state for touch/mouse events
...
The buttons state was forwarded, but ignored by the server.
2019-10-25 11:04:04 +02:00
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 >
2019-10-17 23:25:00 +02:00
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 >.
2019-10-17 22:21:47 +02:00
Romain Vimont
5b7a0cd8e9
Extract String literal to static constant
2019-10-17 22:11:39 +02:00
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.
2019-10-17 22:09:54 +02:00
Romain Vimont
6220456def
Merge mouse and touch events
...
Both are handled the very same way on the device.
2019-10-03 20:37:49 +02:00
Romain Vimont
7e1d52c119
Rename "touch pointer" to "pointer"
...
There are only touch pointers now, mouse pointers have been removed.
2019-10-03 20:27:28 +02:00
Romain Vimont
280d5b718c
Use common pointers for mouse and touch
...
The mouse is a pointer like any other.
2019-10-03 20:05:29 +02:00
Romain Vimont
f765aae352
Inject touch events on the server
...
On receiving an "inject touch" control message, update the local
pointers state and inject touches.
2019-10-03 20:05:29 +02:00
Romain Vimont
77f876e29c
Add "inject touch" control message
...
Add a control message type in the protocol to forward touch events to
the device.
2019-10-03 20:05:27 +02:00
Romain Vimont
d90549d1e6
Rename "pointer" to "mouse pointer"
...
This will help to distinguish them from "touch pointers".
2019-10-02 21:40:26 +02:00
Romain Vimont
7d1932b907
Fix gradle warnings in tests
2019-09-28 12:23:54 +02:00
Romain Vimont
6e38e0cbfe
Rename variable names "event" to "msg"
...
Some variable names had not been renamed when "event" was renamed to
"message" (28980bbc90
).
2019-09-15 17:29:03 +02:00
Romain Vimont
7040e8abc4
Fix control message reader test
...
The mouse event test actually tested a key event control message.
2019-09-15 17:29:03 +02:00
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.
2019-08-09 15:15:28 +02:00
toddsierens
27eacc3c11
Update WindowManager.java
2019-08-08 17:17:48 -04:00
Romain Vimont
c28619e4e8
Bump version to 1.10
2019-08-04 16:41:04 +02:00
Romain Vimont
6b3d9e3eab
Add unit test for device message serialization
...
There was a test for the deserialization, but not for the serialization.
2019-07-30 12:17:33 +02:00
Romain Vimont
056e47e752
Replace "cannot" by "could not"
2019-06-23 20:52:03 +02:00
Romain Vimont
439b009a79
Fix expected parameters count in error message
2019-06-23 20:47:21 +02:00
Romain Vimont
4940746bcb
Remove useless else
...
The if-block ends with a return.
2019-06-14 10:15:53 +02:00
Romain Vimont
fe758e6e15
Improve comment
...
Rephrase to simplify and add a link to the issue.
2019-06-14 10:11:15 +02:00
Arne Schwabe
b769083a5b
Use getPhysicalDisplayToken on Anroid Q+ instead of getBuiltInDisplay
...
This makes the -S (screen off) parameter work on Android Q beta 4
Closes #586
2019-06-13 13:30:54 +02:00
Romain Vimont
259d3aee93
Bump version to 1.9
2019-06-11 21:50:29 +02:00
Romain Vimont
90859f1dcf
Upgrade tarketSdkVersion to 29
...
This fixes a lint warning.
2019-06-11 21:49:14 +02:00
Romain Vimont
1afe9ce2ee
Fix deprecation warning in Java unit test
2019-06-11 21:48:58 +02:00
Romain Vimont
273cec8a92
Fix typo in test name
2019-06-11 21:47:31 +02:00