Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
113.43k stars 10.81k forks source link

Features implemented in a fork #679

Open rom1v opened 5 years ago

rom1v commented 5 years ago

Here is a specific thread for https://github.com/Genymobile/scrcpy/issues/495#issuecomment-517322589 (@Lurker00):

Currently I've forked this project, and merged all my changes into the official 1.9 version. It is there. I only have Android 8.1 devices, so I'm not sure that all my changes will work for all. It requires additional app (my dirty build of ADBKeyBoard) to type any language and to sync device's orientation by PC. In general, I'm not sure should I try a pull request... But you may build both projects yourself and give it a try...

The full list of my changes (sorry for misuse this thread!): User visible changes:

  • 10-fingers multitouch support.
  • Any charset input support with an aid of ADBKeyBoard.
  • Quit command (Ctrl-Q)
  • Ctrl-Shift-O turns device screen on.
  • Connection timeout detector from the device side (useful with connection over wireless network).
  • Screen density and screen size can be set on the device during the session.
  • "Tablet mode": dim device screen, synchronize device screen orientation with PC (requires additional service on the device).

Internals:

  • The server "forks" itself for full life cycle control (adb may kill it instead preventing required cleanup).
  • Full cleanup at exit.
  • Expandable parameters to the server applet, allowing compatibility between versions.
  • Java NIO to simplify network I/O and not be limited to Unix sockets.
  • Different connection type: direct connect to the device instead of "adb forward".
  • Commands: actions with no parameters
rom1v commented 5 years ago

Hi,

Thank you for sharing all your work. :+1: You implemented a lot of things in your corner!

In general, I'm not sure should I try a pull request

When features are "general" enough and would benefit everyone, yes you should propose to merge them (one PR per feature based on the current dev branch) :) (and this would minimize the amount of work for you to keep your fork up to date :wink:)

  • 10-fingers multitouch support.

This is definitely a feature to merge (#22). I investigated locally, especially to support pinch-to-zoom (#24) with Shift+click or something. Both features should share a lot of code.

  • Any charset input support with an aid of ADBKeyBoard.

(didn't look yet, also see https://github.com/Genymobile/scrcpy/issues/431#issuecomment-471245573)

  • Quit command (Ctrl-Q)

Is it necessary? (every system already has it own shortcut, typically Alt+F4, don't they?)

  • Ctrl-Shift-O turns device screen on.

I disabled a similar feature on purpose before the last release: 8c8649cfcd710859ce18eab557ed2af8cedb9a42. Is it the same?

  • "Tablet mode": dim device screen, synchronize device screen orientation with PC (requires additional service on the device).

Could you explain what it does and what is the use case?

  • The server "forks" itself for full life cycle control (adb may kill it instead preventing required cleanup).
  • Full cleanup at exit.

Did you implemented additional cleanup on the server side on exit? What is the required cleanup?

  • Expandable parameters to the server applet, allowing compatibility between versions.

(the client installs its associated server, so using an old server with a new client is not a goal, and it would require far more than backward compatibility of command-line arguments)

  • Java NIO to simplify network I/O and not be limited to UNIX sockets.

Indeed, I removed (before the first release) the NIO usage on this specific part to use Unix sockets on the device side (because we don't need TCP here), and NIO/channels does not support UNIX sockets.

Why do you need a TCP socket on the device side? (oh, the answer is probably in the next point)

  • Different connection type: direct connect to the device instead of "adb forward".

IIUC, you start the server then connect over TCP directly? The problem I see here is that anyone on your network can connect (with the right timing) to your device without any authentication. If you use adb forward, it requires that adb is authorized.

https://github.com/Lurker00/scrcpy/commit/32b0fb045ad9bab2a4076ff8e32b9b7e85fdde81?full#diff-2b1a6238bf364c50a82e0f738e186e23R40-R41

My understanding is that this flag only impacts the "sender":

   TCP_NODELAY
          If set, disable the Nagle algorithm.  This means  that  segments
          are  always  sent  as  soon as possible, even if there is only a
          small amount of data.  When not  set,  data  is  buffered  until
          there  is  a sufficient amount to send out, thereby avoiding the
          frequent sending of small packets, which results  in  poor  uti‐
          lization of the network.

The purpose here is to send the control messages earlier?

https://github.com/Lurker00/scrcpy/commit/32b0fb045ad9bab2a4076ff8e32b9b7e85fdde81?full#diff-2b1a6238bf364c50a82e0f738e186e23R43-R44 https://github.com/Lurker00/scrcpy/commit/32b0fb045ad9bab2a4076ff8e32b9b7e85fdde81?full#diff-bdecf0d14db2a1fac70f95f687544d01R101

I just set these flags locally, I still receive packets of 4096 bytes. Probably due to the adb tunnel (adb reverse).

Lurker00 commented 5 years ago

one PR per feature based

It's a huge work! I was very limited in time: tomorrow going to vacations for full August to the place with very poor Internet, and I need this my scrcpy mod fully working. Now I have to separate different parts... Definitely not now :(

Ctrl-Q: Is it necessary?

My notebook has no F-keys. Alt-Fn-4 didn't work well with 1.8 on the previous (already died!) notebook for a reason... Now I see it works, but Ctrl-Q still works better for me.

Ctrl-Shift-O: I disabled a similar feature on purpose

I see... Yes, sometimes it works weird, but it was handy for tests - to save power, but sometimes to look to the phone. I don't insist :)

Tablet mode: Could you explain

This is my primary goal, and what I can't live without! I have small phone (Unihertz Atom, 2.45" 240x432 screen), and a small convertible notebook (One Netbook Mix 3, 8.4" 2560x1600 screen). With my mod of scrcpy, I connect Atom to Mix 3 in full screen mode, forcing high resolution and low DPI on the phone, and I end up with powerful Android tablet! Notebook rotation forces Android screen rotation (even apps that, in general, refuse landscape, work in landscape), screen is dimmed to save power. Lots of apps (banking, messengers with video and pics) require Android, but work better on big screens.

On the other hand, a person with very high resolution device and lower resolution notebook/PC may want to decrease device's screen resolution, and decrease density to force tablet mode of Android.

What is the required cleanup?

I found my approach of passing parameters is more convenient during development, and more easy to maintain. No magic numbers, all in all!

NIO/channels does not support UNIX sockets

NIO does implement WritableByteChannel directly. In fact, I've deleted your IO.java, because channels work with ByteBuffer directly. The resulting code is shorter and, I think, faster, even via Unix sockets.

Why do you need a TCP socket on the device side?

To eliminate adb as the proxy via WiFi. With NIO and TCP I have direct connection with full control. I even disconnect adb from the device in such a use.

The problem I see here is that anyone on your network can connect (with the right timing)

The server listens only for two connections (video and control), then stops listening. The "right timing" is a few milliseconds during the startup. Moreover, the listening port is assigned by the client side, and can be changed from the command line. I see no a problem here.

But in my use, I set up the device as the WiFi access point, connect notebook to it, and nobody else exists in this private network. No problems whatsoever.

TCP_NODELAY: My understanding is that this flag only impacts the "sender"

Yes. It works for direct TCP connection over WiFi, to minimize delays between touch, mouse, keyboard events. Touch and mouse events are assigned timestamps on the device, and a touch may become long touch, or vice versa.

Probably due to the adb tunnel

That's why I eliminated adb as the proxy!

I just have committed a number of more changes that I forgot yesterday:

For the remaining hours (before I go to vacations), I plan to write a public description and release a binary build for those who wants to try. But this is also my last day at work before long vacations...

rom1v commented 5 years ago

Thank you for your answer.

It's a huge work! I was very limited in time: tomorrow going to vacations for full August to the place with very poor Internet, and I need this my scrcpy mod fully working. Now I have to separate different parts... Definitely not now :(

OK, I understand. Could I take parts of your code if I need to? (probably not now too :wink:)

Executing cleanup even if adb is killed can indeed be interesting (for example for issues #96 #101 #181). I always considered that a wrapper script was sufficient for this "advanced usage", but it is better if it always cleanup. I keep that in mind. :+1:

Btw, maybe it is possible to use nohup instead of forking (but I'm not sure it is available on all devices). Alternatively, a solution could be to set a signal handler on SIGHUP, but it's probably not possible directly from Java. But starting a new process is a good solution.

NIO does implement WritableByteChannel directly.

Not for UNIX sockets.

In fact, I've deleted your IO.java, because channels work with ByteBuffer directly. The resulting code is shorter and, I think, faster, even via Unix sockets.

It seems you either don't use channels for UNIX sockets or add just add a wrapper to the OutputStream.

Touch and mouse events are assigned timestamps on the device, and a touch may become long touch, or vice versa.

Oh, that's bad. (TBH I never use scrcpy over wifi)

Lurker00 commented 5 years ago

Could I take parts of your code if I need to?

Of course! If you save me some time merging all the useful changes yourself, it would be great! That's what I've published my changes for - to be used by other developers, just like I've used your product.

just add a wrapper to the OutputStream

Yes: Channels.newChannel(localVideoSocket.getOutputStream());

I never use scrcpy over wifi

I found it quite useful in a long trip in a bus or train: phone in the belt pouch, little notebook in hands, I can switch between Android and Windows, and no wires. Small lags are acceptable.

For me, scrcpy is the app that I use several times per day. Clipboard transfer from Android to Windows in 1.9 was the feature pushed me to perform the merge. Did I thank you? I will! :)

Lurker00 commented 5 years ago

Published Windows 64-bit package for those who want to test it.

Daniel-Brum commented 5 years ago

If I follow the default build instructions, can I make this fork work on Linux?

Lurker00 commented 5 years ago

I think it should work. Build it per original instruction. You may extract ADBKeyBoard's apk file from my Windows release package.

I never tried it under native Linux myself, but it worked somehow with Ubuntu 18.04 LTS from WLS and an X-server under Windows.

You may try and let me know :)

Daniel-Brum commented 5 years ago

I tried yesterday and couldn't get it to work. But since I don't recall ever building anything, I'm probably doing something wrong. Building using the prebuilt server goes perfectly until the ninja command, when I try to install or run things start going wrong (when installing I get

WARNING: Duplicate name in Manifest: Manifest-Version.
Ensure that the manifest does not have duplicate entries, and
that blank lines separate individual sections in both your
manifest and in the META-INF/MANIFEST.MF entry in the jar file.
ago 06, 2019 12:03:27 AM java.util.jar.Attributes read
WARNING: Duplicate name in Manifest: Built-By.
Ensure that the manifest does not have duplicate entries, and
that blank lines separate individual sections in both your
manifest and in the META-INF/MANIFEST.MF entry in the jar file.
ago 06, 2019 12:03:27 AM java.util.jar.Attributes read
WARNING: Duplicate name in Manifest: Created-By.
Ensure that the manifest does not have duplicate entries, and
that blank lines separate individual sections in both your
manifest and in the META-INF/MANIFEST.MF entry in the jar file.

, when running the application I get

[server] ERROR: Exception on thread Thread[main,5,main]
java.lang.IllegalArgumentException: Expecting 5 parameters
    at com.genymobile.scrcpy.Server.createOptions(Server.java:71)
    at com.genymobile.scrcpy.Server.main(Server.java:132)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:251)

). Building the server the application fails at the ninja part (I'm pretty sure that is because I couldn't set up the Android SDK in PATH correctly). I'll try again tomorrow and do some more research, and then I'll report the results here.

Lurker00 commented 5 years ago

You may use prebuild server from my Windows package as well.

Daniel-Brum commented 5 years ago

When using your prebuilt server and trying to 'sudo ninja install', I get the same error I got when I last tried:

WARNING: Duplicate name in Manifest: Manifest-Version.
Ensure that the manifest does not have duplicate entries, and
that blank lines separate individual sections in both your
manifest and in the META-INF/MANIFEST.MF entry in the jar file.
ago 06, 2019 8:03:36 PM java.util.jar.Attributes read
WARNING: Duplicate name in Manifest: Built-By.
Ensure that the manifest does not have duplicate entries, and
that blank lines separate individual sections in both your
manifest and in the META-INF/MANIFEST.MF entry in the jar file.
ago 06, 2019 8:03:36 PM java.util.jar.Attributes read
WARNING: Duplicate name in Manifest: Created-By.
Ensure that the manifest does not have duplicate entries, and
that blank lines separate individual sections in both your
manifest and in the META-INF/MANIFEST.MF entry in the jar file.

And when I try to run the application I get a different error:

[server] ERROR: Exception on thread Thread[main,5,main]
java.lang.AssertionError: java.lang.ClassNotFoundException: android.app.IActivityManager$Stub
    at com.genymobile.scrcpy.wrappers.ServiceManager.getService(ServiceManager.java:39)
    at com.genymobile.scrcpy.wrappers.ServiceManager.getActivityManager(ServiceManager.java:87)
    at com.genymobile.scrcpy.DeviceControl.<init>(DeviceControl.java:43)
    at com.genymobile.scrcpy.Server.main(Server.java:192)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:251)
Caused by: java.lang.ClassNotFoundException: android.app.IActivityManager$Stub
    at java.lang.Class.classForName(Native Method)
    at java.lang.Class.forName(Class.java:324)
    at java.lang.Class.forName(Class.java:285)
    at com.genymobile.scrcpy.wrappers.ServiceManager.getService(ServiceManager.java:36)
    ... 5 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.app.IActivityManager$Stub" on path: DexPathList[[zip file "/data/local/tmp/scrcpy-server.jar"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
    ... 9 more
    Suppressed: java.lang.ClassNotFoundException: android.app.IActivityManager$Stub
        at java.lang.Class.classForName(Native Method)
        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
        ... 10 more
    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
Lurker00 commented 5 years ago

What Android version do you have on your device?

ср, 7 авг. 2019 г. в 03:12, Daniel-Brum notifications@github.com:

When using your prebuilt server and trying to 'sudo ninja install', I get the same error I got when I last tried:

WARNING: Duplicate name in Manifest: Manifest-Version. Ensure that the manifest does not have duplicate entries, and that blank lines separate individual sections in both your manifest and in the META-INF/MANIFEST.MF entry in the jar file. ago 06, 2019 8:03:36 PM java.util.jar.Attributes read WARNING: Duplicate name in Manifest: Built-By. Ensure that the manifest does not have duplicate entries, and that blank lines separate individual sections in both your manifest and in the META-INF/MANIFEST.MF entry in the jar file. ago 06, 2019 8:03:36 PM java.util.jar.Attributes read WARNING: Duplicate name in Manifest: Created-By. Ensure that the manifest does not have duplicate entries, and that blank lines separate individual sections in both your manifest and in the META-INF/MANIFEST.MF entry in the jar file.

And when I try to run the application I get a different error:

[server] ERROR: Exception on thread Thread[main,5,main] java.lang.AssertionError: java.lang.ClassNotFoundException: android.app.IActivityManager$Stub at com.genymobile.scrcpy.wrappers.ServiceManager.getService(ServiceManager.java:39) at com.genymobile.scrcpy.wrappers.ServiceManager.getActivityManager(ServiceManager.java:87) at com.genymobile.scrcpy.DeviceControl.(DeviceControl.java:43) at com.genymobile.scrcpy.Server.main(Server.java:192) at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:251) Caused by: java.lang.ClassNotFoundException: android.app.IActivityManager$Stub at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:324) at java.lang.Class.forName(Class.java:285) at com.genymobile.scrcpy.wrappers.ServiceManager.getService(ServiceManager.java:36) ... 5 more Caused by: java.lang.ClassNotFoundException: Didn't find class "android.app.IActivityManager$Stub" on path: DexPathList[[zip file "/data/local/tmp/scrcpy-server.jar"],nativeLibraryDirectories=[/vendor/lib, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at java.lang.ClassLoader.loadClass(ClassLoader.java:469) ... 9 more Suppressed: java.lang.ClassNotFoundException: android.app.IActivityManager$Stub at java.lang.Class.classForName(Native Method) at java.lang.BootClassLoader.findClass(ClassLoader.java:781) at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) at java.lang.ClassLoader.loadClass(ClassLoader.java:504) ... 10 more Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Genymobile/scrcpy/issues/679?email_source=notifications&email_token=ACCHAZVXV5WWIVLQTR5SPJTQDIANFA5CNFSM4IIWDWG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3WW6QQ#issuecomment-518876994, or mute the thread https://github.com/notifications/unsubscribe-auth/ACCHAZWCTHTTSG7R3USTTDDQDIANFANCNFSM4IIWDWGQ .

Daniel-Brum commented 5 years ago

I have Android 6.0.1.

Lurker00 commented 5 years ago

I just published a new release: https://github.com/Lurker00/scrcpy/releases/latest The ClassNotFoundException should gone. You may try the new server build, and to build the client from the updated sources.

But I have no pure Android 6 device in hands, only with MIUI under which almost everything does not work silently.

Daniel-Brum commented 5 years ago

I'm still unable to sudo ninja install, with the same warnings from before. But I could run scrcpy just fine. Thanks a lot for helping me! (Editted because I sent the first line without typing the rest accidentally)

Edit 2: The warnings didn't actually get in the way or anything, it looks like the application is installed correctly. Sorry for my hasty complain, and thank you again!

rom1v commented 5 years ago

with the same warnings from before.

WARNING: Duplicate name in Manifest: Manifest-Version. Ensure that the manifest does not have duplicate entries, and that blank lines separate individual sections in both your manifest and in the META-INF/MANIFEST.MF entry in the jar file. ago 06, 2019 8:03:36 PM java.util.jar.Attributes read

These are just warnings, not errors. See https://github.com/Genymobile/scrcpy/issues/458#issuecomment-473711107

Daniel-Brum commented 5 years ago

Oh, I see. Dunno why, but I simply assumed the program wouldn't be installed properly because of that, I should've searched about it first. I'm sorry and thank you.

codycodes commented 5 years ago

Just wanted to give my experience here; @rom1v I attempted to run your changes from the latest release, and while I get a message stating scrcpy started: processid1234? (not sure if it's a process id or not), the window doesn't open like it does when running scrcpy from Genymobile. Is there something additional I'm missing to be able to see scrcpy with your fork? Also wanted to put in a +1 for tablet mode as it'd dramatically help my workflow:

  1. plug in android phone
  2. android phone will not sleep with Tasker task
  3. screen on android phone goes dark but is visible on PC
  4. can use surface pro in multiple orientations with android phone switching automagically
  5. when unplugging, android phone screen turns back on and potentially reverts orientation
Lurker00 commented 5 years ago

@codycodes, Sorry, I overlooked an additional thread introduced in 1.9, which caused malfunction sometimes. I've comitted the fix. Here is an update: https://github.com/Lurker00/scrcpy/releases/latest

Note: you must use both server and client binaries from my fork! The typical session is like this:

[server] INFO: scrcpy is forking: 14191
[server] INFO: scrcpy forked
[server] INFO: scrcpy started: 14200
[server] INFO: DeviceControl started
[server] INFO: Connected to desktop
[server] INFO: bitRate: 8000000 frameRate: 60 iFrameInterval: 5 repeatFrameDelay: 6
[server] INFO: Command QUIT received
[server] INFO: Controller stopped

where 14191 is a PID of the server launched from PC via adb, and 14200 is the secondary copy of the server, which actually performs the job in my fork.

Please note that while this build works for me, I have no abilities to perform thorough tests with different devices, but I try to resolve reported problems.

I use the following command line: scrcpy-noconsole.exe --density 240 --fullscreen --tablet-mode --ime -s ATOMHZ0000005703 --render-expired-frames Of course, the density and serial is up to you. It works for me as you described, but I don't use Tasker.

Pixelstudio commented 5 years ago

I have the same problem, starting your latest release version i only get this in my console : [server] INFO: scrcpy is forking: 22392 [server] INFO: scrcpy forked [server] INFO: scrcpy started: 22402

Then nothing, no window opens... Any idea?

Lurker00 commented 5 years ago

@Pixelstudio , is it L2 build for Windows, or a custom build for Linux (then which revision)? Which Android version do you have? Is it pure stock Android or what? Currently I can only answer that it works for me flawlessly ;)

codycodes commented 5 years ago

Also tested but not working here. I'm on a Surface Pro so hoping to be able to use these features at some point. I have the same output, which is nothing after the info logs. Thanks for your work and help!

On Thu, Aug 22, 2019 at 12:45 AM Lurker00 notifications@github.com wrote:

@Pixelstudio https://github.com/Pixelstudio , is it L2 build for Windows https://github.com/Lurker00/scrcpy/releases/tag/v1.9L2, or a custom build for Linux (then which revision)? Which Android version do you have? Is it pure stock Android or what? Currently I can only answer that it works for me flawlessly ;)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Genymobile/scrcpy/issues/679?email_source=notifications&email_token=AB5CPWLC7G6JDGFRYU6YFSLQFY7YLA5CNFSM4IIWDWG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD44GPJY#issuecomment-523790247, or mute the thread https://github.com/notifications/unsubscribe-auth/AB5CPWKJN6LFM2JURLDQEP3QFY7YLANCNFSM4IIWDWGQ .

Lurker00 commented 5 years ago

@codycodes , again:

You (all who experience problem with my build) may also type adb logcat -d > logcat.txt

open logcat.txt in a text editor and search for possible exception stack traces for scrcpy, to provide a clue. I'd glad to make this fork to work for more people, but I need details about the problems.

Pixelstudio commented 5 years ago

Here are some details (i cannot find something that would cause an error)...

I'm using your latest win64 build "scrcpy-win64-0.9-L2" The latest version of the official scrcpy works as expected, without any problems I'm testing on a win10 pc, my phone is an Pixel 2 XL, Android version 9, build number PQ3A.190801.002

here is part of the logcat:

08-22 12:22:43.728 10420 10420 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 2000 <<<<<<
08-22 12:22:43.848 10420 10420 D AndroidRuntime: Calling main entry com.genymobile.scrcpy.Server
08-22 12:22:43.848 10420 10420 I scrcpy  : scrcpy is forking: 10420
08-22 12:22:43.851 10420 10420 I scrcpy  : scrcpy forked
08-22 12:22:44.006 10429 10429 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 2000 <<<<<<
08-22 12:22:44.102 10429 10429 D AndroidRuntime: Calling main entry com.genymobile.scrcpy.Server
08-22 12:22:44.104 10429 10429 I scrcpy  : scrcpy started: 10429
08-22 12:22:44.229  1190  2673 D ConnectivityService: Returning BLOCKED NetworkInfo to uid=10096
08-22 12:22:45.745  2686  2703 D udp     : receiveTime:590 port:7888
08-22 12:22:46.279  2686  2702 D udp     : receiveTime:590 port:7765
08-22 12:22:48.933  2686  2703 D udp     : receiveTime:591 port:7888
08-22 12:22:49.144  8823  8823 W FastPrintWriter: Write failure
08-22 12:22:49.144  8823  8823 W FastPrintWriter: java.io.IOException: write failed: EPIPE (Broken pipe)
08-22 12:22:49.144  8823  8823 W FastPrintWriter:   at libcore.io.IoBridge.write(IoBridge.java:531)
08-22 12:22:49.144  8823  8823 W FastPrintWriter:   at java.io.FileOutputStream.write(FileOutputStream.java:381)
08-22 12:22:49.144  8823  8823 W FastPrintWriter:   at com.android.internal.util.FastPrintWriter.flushBytesLocked(FastPrintWriter.java:352)
08-22 12:22:49.144  8823  8823 W FastPrintWriter:   at com.android.internal.util.FastPrintWriter.flushLocked(FastPrintWriter.java:375)
08-22 12:22:49.144  8823  8823 W FastPrintWriter:   at com.android.internal.util.FastPrintWriter.appendLocked(FastPrintWriter.java:320)
08-22 12:22:49.144  8823  8823 W FastPrintWriter:   at com.android.internal.util.FastPrintWriter.appendLocked(FastPrintWriter.java:313)
08-22 12:22:49.144  8823  8823 W FastPrintWriter:   at com.android.internal.util.FastPrintWriter.print(FastPrintWriter.java:497)
08-22 12:22:49.144  8823  8823 W FastPrintWriter:   at java.io.PrintWriter.println(PrintWriter.java:739)
08-22 12:22:49.144  8823  8823 W FastPrintWriter:   at android.util.PrintWriterPrinter.println(PrintWriterPrinter.java:38)
08-22 12:22:49.144  8823  8823 W FastPrintWriter:   at cja.dump(PG:96)
08-22 12:22:49.144  8823  8823 W FastPrintWriter:   at jqu.dump(PG:14)
08-22 12:22:49.144  8823  8823 W FastPrintWriter:   at djq.a(PG:1717)
08-22 12:22:49.144  8823  8823 W FastPrintWriter:   at djq.dump(PG:1712)
08-22 12:22:49.144  8823  8823 W FastPrintWriter:   at android.inputmethodservice.IInputMethodWrapper.executeMessage(IInputMethodWrapper.java:151)
08-22 12:22:49.144  8823  8823 W FastPrintWriter:   at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:37)
08-22 12:22:49.144  8823  8823 W FastPrintWriter:   at android.os.Handler.dispatchMessage(Handler.java:106)
08-22 12:22:49.144  8823  8823 W FastPrintWriter:   at android.os.Looper.loop(Looper.java:193)
08-22 12:22:49.144  8823  8823 W FastPrintWriter:   at android.app.ActivityThread.main(ActivityThread.java:6718)
08-22 12:22:49.144  8823  8823 W FastPrintWriter:   at java.lang.reflect.Method.invoke(Native Method)
08-22 12:22:49.144  8823  8823 W FastPrintWriter:   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
08-22 12:22:49.144  8823  8823 W FastPrintWriter:   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
08-22 12:22:49.144  8823  8823 W FastPrintWriter: Caused by: android.system.ErrnoException: write failed: EPIPE (Broken pipe)
08-22 12:22:49.144  8823  8823 W FastPrintWriter:   at libcore.io.Linux.writeBytes(Native Method)
08-22 12:22:49.144  8823  8823 W FastPrintWriter:   at libcore.io.Linux.write(Linux.java:288)
08-22 12:22:49.144  8823  8823 W FastPrintWriter:   at libcore.io.BlockGuardOs.write(BlockGuardOs.java:348)
08-22 12:22:49.144  8823  8823 W FastPrintWriter:   at libcore.io.IoBridge.write(IoBridge.java:526)
08-22 12:22:49.144  8823  8823 W FastPrintWriter:   ... 20 more
08-22 12:22:49.146  8823  8823 I OD-RecognizerModule: dump()
Lurker00 commented 5 years ago

Sorry, but this dump gives no a clue :( I just published v1.9L3. It has no a fix for you, but please try it - it should provide more info to the console in case of problems. I've also enabled Issues for my fork, so we may continue there.

Pixelstudio commented 5 years ago

Sorry, but this dump gives no a clue :( I just published v1.9L3. It has no a fix for you, but please try it - it should provide more info to the console in case of problems. I've also enabled Issues for my fork, so we may continue there.

I tested this version, same problem. Also nothing in the logcat

Lurker00 commented 5 years ago

@Pixelstudio , I thought it would be more information in the Windows console, right after [server] INFO: scrcpy started: ... line. Is there something new?

Pixelstudio commented 5 years ago

Nope nothing in the console

Lurker00 commented 5 years ago

I'll have to find Android 9 device or install a simulator to work it out, but this may happen not earlier than September.

Lurker00 commented 5 years ago

1.10-L0 tested against Android 5-10 emulators (before merge with 1.10, if it matters). Includes recent changes made after the official 1.10 build (up to da5b0ec).

parkerlreed commented 5 years ago

I am so excited to report that the multitouch also works great with the KMS/DRM support. Don't even need X or Wayland running!

https://www.youtube.com/watch?v=RHK5P3_FrSo

parkerlreed commented 5 years ago

How is the IME implemented? (Along with wireless mode)

I compiled the fork along with compiling the server jar in the same step. I don't see anything extra on the phone when connecting.

parkerlreed commented 5 years ago

Oh I see now. I didn't realize ADBKeyboard was its own aplication.

parkerlreed commented 5 years ago

Tested wireless here (killing adb after launch)

Works well (for wireless)

Only note is that after exit: it still tried to run adb disconnect (I assume because it wasn't aware I killed manually)

Lurker00 commented 5 years ago

@parkerlreed, thank you for the report! My build of ADBKeyBoard (included into Windows packages) has an additional service to force Android screen rotation.

it still tried to run adb disconnect

Actually, when it connects directly (with -s address:port parameter), it connects adb by itself, and disconnects adb after reaching the server, and calls redundant disconnect at the end. It does not harm.

parkerlreed commented 5 years ago

@Lurker00 If I kill the adb wifi from the phone side, the program exits. Does it still rely on that running?

Lurker00 commented 5 years ago

I can't reproduce it: my phone is not rooted. I may only guess that killing adbd also kills its child processes. adbd with direct connection is only used to proxy server's stdout. For Windows, there is -noconsole build that outputs nothing from the server.

rom1v commented 5 years ago

I started to implement multitouch, but I have no touch screen, so I cannot test.

If someone want to test (and help to fix if it does not work), I pushed a branch: finger.

@Lurker00 you could probably avoid your timestamps stuff to avoid duplicated events: 907e55a66b750b234f0e1843a98f5cbaababad6f

rom1v commented 5 years ago

Seems to work now: finger.5.

Please give me your feedbacks. I will rewrite the commits properly when I have time.

parkerlreed commented 5 years ago

@rom1v :+1:

2019-10-03_20-34

Added benefit of not crashing scrcpy when show pointer location is enabled :)

sandriaas commented 5 years ago

thank you so much for this form!! love it!! btw is it possible to use desktop mode function on android q to be used in scrcpy?

Lurker00 commented 5 years ago

you could probably avoid your timestamps stuff to avoid duplicated events: 907e55a

Thanks for finding! Yes, it works, but I've also added the same check into input_manager_process_mouse_button().

rom1v commented 5 years ago

(just for info, multitouch is now implemented on dev and will be in the next release)

parkerlreed commented 5 years ago

thank you so much for this form!! love it!! btw is it possible to use desktop mode function on android q to be used in scrcpy?

This would be fantastic. If you want to spin up an issue for it, I'd be happy to chime in and help test any possible implementations.

Lurker00 commented 5 years ago

@andrizmitnick, @parkerlreed: don't know about desktop mode, but, from my experience, Android switches from phone to tablet mode with lower density. You may try --density command line option in my fork to see if it works for you.

parkerlreed commented 5 years ago

@Lurker00 That was waaaay back on 4.4.2 and earlier. This new desktop mode is activated somehow and gives you floating windows and such.

https://www.androidauthority.com/android-q-desktop-mode-demo-991055/

Granted it not in that form yet but there's some basic things in place

https://youtu.be/Q7lW62_2Grs?t=93