Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
112.08k stars 10.72k forks source link

[WARNING][PSA] Possible soft-lock with Scrcpy is a real problem. Beware! #843

Closed rdlf4 closed 4 years ago

rdlf4 commented 5 years ago

OK so this report comes from my personal experience with Scrcpy. As stated on this thread, the one inconvenience I came across about Scrcpy is because recharging the phone using the USB cable does break ADB over TCP connection, which is the one you're probably using to remotely control your phone with Scrcpy. However, the big problem is what comes up next. So after my phone is fully charged, I did:

adb forward tcp:5555 tcp:7612

And then:

adb tcpip 7612

Prior to unplugging it from the USB port. I chose to go with port 7612, but that's irrelevant, even if you do adb tcpip 5555 in order to "keep connected" to your phone after it's been unplugged, if you decide to run a processor-intensive application (for example, a game) from within Scrcpy, chances are your phone will hang and you'll think Scrcpy has frozen on you. But the fact is, your phone has been soft-locked.

And this is bad news for those new-gen phones that have it's back glued together, as the only way to make your phone usable again is if you remove the battery and insert it again, then turn your phone back on.

This has been the case with SimCity Build it. I also tried with less-demanding tasks, but those seem to not trigger this behavior. Additionally, after doing the steps above and launching the game, it took a few tries (got one the third time I launched the game when using Scrcpy, sometimes, it happens the first time after the phone has been disconnected from the USB port); One other game I tried was Townsmen, which did soft-lock my phone but the screen would stay on, the time and pretty much everything won't change. But with Townsmen, I did manage to get this piece of code, which I hope will be helpful to Scrcpy's devs figure it out:

INFO: scrcpy 1.10 <https://github.com/Genymobile/scrcpy>
/usr/local/share/scrcpy/scrcpy-server.jar: 1 file pushed. 0.8 MB/s (22546 bytes in 0.025s)
error: more than one device/emulator
ERROR: "adb reverse" returned with value 1
WARN: 'adb reverse' failed, fallback to 'adb forward'
/usr/share/libdrm/amdgpu.ids: No such file or directory
[server] ERROR: Exception on thread Thread[main,5,main]
java.lang.AssertionError: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference
    at com.genymobile.scrcpy.wrappers.DisplayManager.getDisplayInfo(DisplayManager.java:25)
    at com.genymobile.scrcpy.Device.computeScreenInfo(Device.java:49)
    at com.genymobile.scrcpy.Device.<init>(Device.java:28)
    at com.genymobile.scrcpy.Server.scrcpy(Server.java:17)
    at com.genymobile.scrcpy.Server.main(Server.java:133)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:262)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference
    at com.genymobile.scrcpy.wrappers.DisplayManager.getDisplayInfo(DisplayManager.java:17)

If there's a way to dive even further in order to get more information that may be relevant to the devs, please let me know how to do it and I'll be happy to provide the details.

rom1v commented 5 years ago

Something probably crashed on the device. If you still have access to adb, check adb logcat (or run it continuously).