Romain Vimont
42ab8fd611
List available encoders on invalid name specified
...
If an invalid encoder name is given via the --encoder option, list all
the H.264 encoders available on the device.
2020-11-08 21:07:20 +01:00
Romain Vimont
363eeea19e
Log encoder name
...
When the encoder is selected automatically, log the name of the selected
encoder.
2020-11-08 21:07:20 +01:00
Tzah Mazuz
76c2c6e69d
Adding new option --encoder
...
Some devices have more than one encoder, and some encoders may cause
issues or crash. With this option we can specify which encoder we want
the device to use.
PR #1827 <https://github.com/Genymobile/scrcpy/pull/1827 >
Fixes #1810 <https://github.com/Genymobile/scrcpy/issues/1810 >
Signed-off-by: Romain Vimont <rom@rom1v.com>
2020-11-08 21:07:17 +01:00
Romain Vimont
adc547fa6e
Add an option to forward all clicks
...
Add --forward-all-clicks to disable mouse shortcuts and forward middle
and right clicks to the device instead.
Fixes #1302 <https://github.com/Genymobile/scrcpy/issues/1302 >
Fixes #1613 <https://github.com/Genymobile/scrcpy/issues/1613 >
2020-11-03 17:12:26 +01:00
Romain Vimont
2edf192e3a
Remove deprecation warning
...
As a workaround for some devices, we need to prepare the main looper.
The method is now deprecated, but we still want to call it.
2020-10-05 21:09:47 +02:00
Romain Vimont
ae758f99d6
Adapt call() on ContentProvider for Android 11
...
This commit in AOSP framework_base added a parameter "attributionTag" to
the call() method:
12ac3f406f
%5E%21/#F17
As a consequence, the method did not exist, so scrcpy used the legacy
call() method (using the authority "unknown") as a fallback, which fails
for security reasons.
Fixes #1468 <https://github.com/Genymobile/scrcpy/issues/1468 >
2020-09-15 13:31:10 +02:00
brunoais
0bf110dd5c
Reset power mode only if screen is on
...
PR #1670 <https://github.com/Genymobile/scrcpy/pull/1670 >
Signed-off-by: Romain Vimont <rom@rom1v.com>
2020-08-21 12:34:59 +02:00
Romain Vimont
0c5e0a4f6d
Make Device methods static when possible
...
The behavior of some methods do not depend on the user-provided options.
These methods can be static. This will allow to call them directly from
the cleanup process.
2020-08-21 12:34:50 +02:00
Romain Vimont
95f1ea0d80
Fix clipboard paste condition
...
To avoid possible copy-paste loops between the computer and the device,
the device clipboard is not set if it already contains the expected
content.
But the condition was wrong: it was not set also if it was empty.
Refs 1223a72eb8
Fixes #1658 <https://github.com/Genymobile/scrcpy/issues/1658 >
2020-08-10 14:37:32 +02:00
Romain Vimont
38940ffe89
Revert "Inject WAKEUP instead of POWER"
...
WAKEUP does not work on some devices.
Fixes #1655 <https://github.com/Genymobile/scrcpy/issues/1655 >
This reverts commit 322f1512ea
.
2020-08-09 17:10:27 +02:00
brunoais
cf9d44979c
Keep the screen off on powering on
...
PR #1577 <https://github.com/Genymobile/scrcpy/pull/1577 >
Fixes #1573 <https://github.com/Genymobile/scrcpy/issues/1573 >
Signed-off-by: Romain Vimont <rom@rom1v.com>
2020-08-03 19:51:58 +02:00
Romain Vimont
1223a72eb8
Set device clipboard only if necessary
...
Do not explicitly set the clipboard text if it already contains the
expected content. This avoids possible copy-paste loops between the
computer and the device.
2020-08-01 16:31:31 +02:00
Romain Vimont
eabaf6f7bd
Simplify PASTE option for "set clipboard"
...
When the client requests to set the clipboard, it may request to press
the PASTE key in addition. To be a bit generic, it was stored as a flag
in ControlMessage.java.
But flags suggest that it represents a bitwise union. Use a simple
boolean instead.
2020-07-17 00:00:42 +02:00
Romain Vimont
322f1512ea
Inject WAKEUP instead of POWER
...
To power the device on, inject KEYCODE_WAKEUP to avoid a possible
race condition (the device might become off between the test
isScreenOn() and the POWER keycode injection).
2020-07-15 12:03:44 +02:00
brunoais
30714aba34
Restore power mode to normal on cleanup
...
This avoids to let the device screen turned off (as enabled by Ctrl+o or
--turn-screen-off).
PR #1576 <https://github.com/Genymobile/scrcpy/pull/1576 >
Fixes #1572 <https://github.com/Genymobile/scrcpy/issues/1572 >
2020-07-09 22:33:11 +02:00
Romain Vimont
a973757fd1
Warn on ignored touch event
...
In theory, this was expected to only happen when a touch event is sent
just before the device is rotated, but some devices do not respect the
encoding size, causing an unexpected mismatch.
Refs #1518 <https://github.com/Genymobile/scrcpy/issues/1518 >
2020-07-09 22:32:14 +02:00
Romain Vimont
5fa46ad0c7
Fix constants name in comment
2020-07-07 15:47:25 +02:00
Romain Vimont
334964c380
Make setScreenPowerMode() method static
...
Its implementation does not use the instance at all.
2020-07-07 15:34:34 +02:00
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 >
2020-07-03 08:53:51 +02:00
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>
2020-06-19 22:30:17 +02:00
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 >
2020-06-11 23:11:20 +02:00
Romain Vimont
245999aec4
Serialize text size on 4 bytes
...
This will allow to send text having a size greater than 65535 bytes.
2020-06-11 23:11:17 +02:00
Romain Vimont
a00a8763d6
Avoid additional copy on Java text parsing
...
Directly pass the buffer range to the String constructor.
2020-06-11 23:06:02 +02:00
Romain Vimont
8f314c74b0
Reorganize message size constants
...
Make the max clipboard text length depend on the max message size.
2020-06-11 22:58:54 +02:00
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.
2020-05-27 18:26:39 +02:00
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.
2020-05-27 12:05:29 +02:00
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 >
2020-05-25 20:59:21 +02:00
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.
2020-05-25 03:28:33 +02:00
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.
2020-05-25 03:28:33 +02:00
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.
2020-05-25 03:28:33 +02:00
Romain Vimont
81573d81a0
Pass a Locale to toUpperCase()
...
Make lint happy.
2020-05-25 03:28:15 +02:00
Romain Vimont
5c2cf88a1d
Rename THRESHOLD to threshold
...
Since the field is not final anymore, lint expects the name not to be
capitalized.
2020-05-25 03:22:07 +02:00
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.
2020-05-24 21:14:25 +02:00
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>
2020-05-24 14:54:34 +02:00
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 >
2020-05-24 14:33:43 +02:00
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 >
2020-05-24 14:33:23 +02:00
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 >
2020-05-24 14:31:49 +02:00
Romain Vimont
73e722784d
Remove useless exception declaration
...
The interface declares it can throw a RemoteException, but the
implementation never throws such exception.
2020-05-23 18:21:54 +02:00
Romain Vimont
e1cd75792c
Simplify rotation watcher call
...
Remove unnecessary private method (which was wrongly public).
2020-05-23 14:39:09 +02:00
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 >
2020-05-07 15:08:11 +02:00
Romain Vimont
74ece9b45b
Simplify ScreenEncoder more
...
Commit 927d655ff6
removed the
iFrameInternal field and constructor argument.
Also remove it from createFormat() arguments.
2020-05-05 19:01:44 +02:00
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 >
2020-05-02 02:14:25 +02:00
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.
2020-05-02 01:55:30 +02:00
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.
2020-05-02 01:22:18 +02:00
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).
2020-05-02 01:22:18 +02:00
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".
2020-05-02 01:22:10 +02:00
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 >
2020-05-01 19:42:31 +02:00
Tzah Mazuz
125c5561e8
Use MediaFormat constant for MIME type
...
Replace "video/avc" by MIMETYPE_VIDEO_AVC.
Signed-off-by: Romain Vimont <rom@rom1v.com>
2020-04-18 02:14:42 +02:00
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 >
2020-04-16 20:54:00 +02:00
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.
2020-04-13 19:38:43 +02:00