Romain Vimont
1bb0df5da1
Extract ANDROID_JAR path in build script
...
This will allow to reuse it.
2021-11-14 01:25:24 +01:00
Romain Vimont
c548f017bf
Upgrade junit to 4.13.1
2021-11-12 22:44:18 +01:00
Romain Vimont
0c9666b733
Upgrade Android checkstyle to 9.0.1
...
Adapt checkstyle.xml to match the latest version, and remove a line
break between imports which trigger a checkstyle volation.
2021-10-30 11:23:51 +02:00
Romain Vimont
8bf28e9f53
Upgrade Android SDK to 31
2021-10-30 11:23:51 +02:00
Romain Vimont
8df42cec82
Fix workarounds for Meizu
...
Workarounds.fillAppInfo() is necessary for Meizu devices even before the
first call to internalStreamScreen(), but it is harmful on other
devices (#940 ).
Therefore, simplify the workaround, by calling fillAppInfo() only if
Build.BRAND equals "meizu" (case insensitive).
Fixes #240 <https://github.com/Genymobile/scrcpy/issues/240 > (again)
Fixes #2656 <https://github.com/Genymobile/scrcpy/issues/2656 >
2021-09-22 15:33:17 +02:00
Romain Vimont
fa100b814b
Add support for expandNotificationsPanel() variant
...
Some custom vendor ROM added an int as a parameter.
Fixes #2551 <https://github.com/Genymobile/scrcpy/issues/2551 >
2021-09-11 10:46:25 +02:00
Romain Vimont
228e2c15f4
Bump version to 1.19
2021-09-10 21:40:08 +02:00
Romain Vimont
116acc8d25
Use SOURCE_MOUSE for scroll events
...
This has no practical impact (AFAIK), but a scroll events should come
from a mouse.
Refs #2602 <https://github.com/Genymobile/scrcpy/issues/2602 >
2021-08-28 23:14:56 +02:00
Romain Vimont
60c4e886d4
Bump version to 1.18
...
Make the versionCode a decimal representation of the scrcpy version.
This will for example allow to correctly number the versionCode of
v1.17.1 after a v1.18 is released:
- v1.18 -> 11800
- v1.17.1 -> 11701
- v1.18.1 -> 11801
2021-06-20 22:01:07 +02:00
Marti Raudsepp
937fa704a6
Add --verbosity=verbose log level
...
PR #2371 <https://github.com/Genymobile/scrcpy/pull/2371 >
Signed-off-by: Romain Vimont <rom@rom1v.com>
2021-06-20 12:34:19 +02:00
Romain Vimont
b846d3a085
Adapt call() on ContentProvider for Android 12
...
Android 12 changed one of the call() overloads with a new parameter
AttributionSource. Adapt the wrapper.
Fixes #2402 <https://github.com/Genymobile/scrcpy/issues/2402 >
2021-06-19 22:59:48 +02:00
Romain Vimont
16a63e0917
Use non-secure display for Android 12 preview
...
Android 12 preview identifies as Android 11, but its codename is "S".
Refs #2129 <https://github.com/Genymobile/scrcpy/issues/2129 >
2021-06-11 10:02:52 +02:00
Romain Vimont
f7533e8896
Use non-secure display for Android >= 12
...
Since Android 12, secure displays could not be created with shell
permissions anymore.
Refs commit 1fdde490fd
Fixes #2129 <https://github.com/Genymobile/scrcpy/issues/2129 >
2021-06-11 09:37:29 +02:00
Romain Vimont
969bfd4374
Serialize clean-up configuration
...
This avoids to pass each option as individual parameter and parse them
manually (it's still "manual" in the Parcelable implementation).
Refs #824 <https://github.com/Genymobile/scrcpy/pull/824#issuecomment-780319422 >
Reviewed-by: Yu-Chen Lin <npes87184@gmail.com>
2021-06-11 09:33:29 +02:00
Romain Vimont
233f8e6cc4
Rename keycode injection method
...
Make it explicit that it injects both "press" and "release" events.
2021-04-30 23:07:37 +02:00
Romain Vimont
9a7d351d67
Simplify non-static injectEvent() implementation
...
Just call the static version (having a displayId) from the non-static
version (using the displayId field).
2021-04-30 23:07:37 +02:00
Romain Vimont
d00ee640c0
Simplify Device.java
...
Remove useless intermediate method with a "mode" parameter (it's always
called with the same mode).
This also avoids the need for a specific injectEventOnDisplay() method,
since it does not conflict with another injectEvent() method anymore.
2021-04-30 23:07:29 +02:00
Romain Vimont
fd0dc6c0cd
Add --lock-video-orientation=initial
...
Add a new mode to the --lock-video-orientation option, to lock the
initial orientation of the device.
This avoids to pass an explicit value (0, 1, 2 or 3) and think about
which is the right one.
2021-04-25 14:55:54 +02:00
brunoais
50eecdab28
Add control message to expand settings panel
...
PR #2260 <https://github.com/Genymobile/scrcpy/pull/2260 >
Signed-off-by: Romain Vimont <rom@rom1v.com>
2021-04-25 14:36:48 +02:00
brunoais
66c581851f
Rename control message type to COLLAPSE_PANELS
...
The collapsing action collapses any panels.
By the way, the Android method is named collapsePanels().
PR #2260 <https://github.com/Genymobile/scrcpy/pull/2260 >
Signed-off-by: Romain Vimont <rom@rom1v.com>
2021-04-25 14:36:48 +02:00
Romain Vimont
bb4614d558
Reverse boolean logic for readability
...
Refs #2260 <https://github.com/Genymobile/scrcpy/pull/2260#issuecomment-823508759 >
2021-04-25 14:36:48 +02:00
Romain Vimont
d0739911a3
Forward DOWN and UP separately for right-click
...
The shortcut "back on screen on" is a bit special: the control is
requested by the client, but the actual event injection (POWER or BACK)
is determined on the device.
To properly inject DOWN and UP events for BACK, transmit the action as
a control parameter.
If the screen is off:
- on DOWN, inject POWER (DOWN and UP) (wake up the device immediately)
- on UP, do nothing
If the screen is on:
- on DOWN, inject BACK DOWN
- on UP, inject BACK UP
A corner case is when the screen turns off between the DOWN and UP
event. In that case, a BACK UP event will be injected, so it's harmless.
As a consequence of this change, the BACK button is now handled by
Android on mouse released. This is consistent with the keyboard shortcut
(Mod+b) behavior.
PR #2259 <https://github.com/Genymobile/scrcpy/pull/2259 >
Refs #2258 <https://github.com/Genymobile/scrcpy/pull/2258 >
2021-04-19 20:16:45 +02:00
Yu-Chen Lin
1d615a0d51
Support power off on close
...
PR #824 <https://github.com/Genymobile/scrcpy/pull/824 >
Signed-off-by: Yu-Chen Lin <npes87184@gmail.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
2021-03-16 21:12:35 +01:00
Yu-Chen Lin
fb0bcaebc2
Export static method to power off screen in Device
...
PR #824 <https://github.com/Genymobile/scrcpy/pull/824 >
Signed-off-by: Yu-Chen Lin <npes87184@gmail.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
2021-03-16 21:12:29 +01:00
Romain Vimont
0308ef43f2
Do not set buttons on touch events
...
BUTTON_PRIMARY must not be set for touch events:
> This button constant is not set in response to simple touches with a
> finger or stylus tip. The user must actually push a button.
<https://developer.android.com/reference/android/view/MotionEvent#BUTTON_PRIMARY >
Fixes #2169 <https://github.com/Genymobile/scrcpy/issues/2169 >
2021-03-15 18:46:56 +01:00
Romain Vimont
40febf4a91
Use device id 0 for touch/mouse events
...
Virtual device is only for keyboard sources, not mouse or touchscreen
sources. Here is the value of InputDevice.getDevice(-1).toString():
Input Device -1: Virtual
Descriptor: ...
Generation: 2
Location: built-in
Keyboard Type: alphabetic
Has Vibrator: false
Has mic: false
Sources: 0x301 ( keyboard dpad )
InputDevice.getDeviceId() documentation says:
> An id of zero indicates that the event didn't come from a physical
> device and maps to the default keymap.
<https://developer.android.com/reference/android/view/InputEvent#getDeviceId() >
However, injecting events with a device id of 0 causes event.getDevice()
to be null on the client-side.
Commit 26529d377f
used -1 as a workaround
to avoid a NPE on a specific Android TV device. But this is a bug in the
device system, which wrongly assumes that input device may not be null.
A similar issue was present in Flutter, but it is now fixed:
- <https://github.com/flutter/flutter/issues/30665 >
- <https://github.com/flutter/engine/pull/7986 >
On the other hand, using an id of -1 for touchscreen events (which is
invalid) causes issues for some apps:
<https://github.com/Genymobile/scrcpy/issues/2125#issuecomment-790535792 >
Therefore, use a device id of 0.
An alternative could be to find an existing device matching the source,
like "adb shell input" does. See getInputDeviceId():
<https://android.googlesource.com/platform/frameworks/base.git/+/master/cmds/input/src/com/android/commands/input/Input.java >
But it seems better to indicate that the event didn't come from a
physical device, and it would not solve #962 anyway, because an Android
TV has no touchscreen.
Refs #962 <https://github.com/Genymobile/scrcpy/issues/962 >
Fixes #2125 <https://github.com/Genymobile/scrcpy/issues/2125 >
2021-03-14 18:30:56 +01:00
Romain Vimont
429fdef04f
Fix encoder parameter suggestion
...
The option is --encoder, not --encoder-name.
2021-03-11 10:55:12 +01:00
Romain Vimont
218636dc10
Inject touch events with smallest detectable size
...
A value of 1 means the "largest detectable size", a value of 0 means the
"smallest detectable size".
https://developer.android.com/reference/android/view/MotionEvent.PointerCoords#size
https://developer.android.com/reference/android/view/MotionEvent#AXIS_SIZE
Fixes #2125 <https://github.com/Genymobile/scrcpy/issues/2125 >
2021-03-03 18:22:54 +01:00
Romain Vimont
f682b87ba5
Bump version to 1.17
2021-01-02 00:53:32 +01:00
Romain Vimont
90f8356630
Interrupt device threads on stop
...
The (non-daemon) threads were not interrupted on video stream stopped,
leaving the server process alive.
Interrupt them to wake up their blocking call so that they terminate
properly.
Refs #1992 <https://github.com/Genymobile/scrcpy/issues/1992 >
2021-01-01 17:32:34 +01:00
Romain Vimont
ea12783bbc
Upgrade JUnit to 4.13
2020-12-17 10:53:35 +01:00
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
d662f73bdc
Upgrade Android SDK to 30
2020-09-15 14:54:22 +02:00
Luís Ferreira
02a882a0a2
Use a more portable shebang for bash
...
This should increase the portability of bash scripts across various *nix
systems such as BSD-like distributions.
PR #1716 <https://github.com/Genymobile/scrcpy/pull/1716 >
Signed-off-by: Luís Ferreira <contact@lsferreira.net>
Signed-off-by: Romain Vimont <rom@rom1v.com>
2020-09-15 13:52:50 +02:00
CapsLock
cf7bf3148c
Use "/usr/bin/env bash" for build-wrapper.sh
...
PR #426 <https://github.com/Genymobile/scrcpy/pull/426 >
Signed-off-by: Romain Vimont <rom@rom1v.com>
2020-09-15 13:44:02 +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
d7779d08e8
Bump version to 1.16
2020-08-10 20:09:28 +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
Romain Vimont
633a51e9c4
Bump version to 1.15.1
2020-08-07 12:01:34 +02:00
Romain Vimont
edc4f7675f
Bump version to 1.15
2020-08-06 21:00:48 +02:00
Romain Vimont
da63e3774b
Merge branch 'master' into dev
2020-08-06 21:00:15 +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