scrcpy
scrcpy copied to clipboard
Android 14 Issues
On the Android 14 beta, launching scrcpy from the lockscreen reboots the device, copy-paste is broken, and --turn-screen-off no longer works.
Launch logs:
PS C:\DATA\Utilities\scrcpy> .\scrcpy.exe --no-audio --turn-screen-off
scrcpy 2.0 <https://github.com/Genymobile/scrcpy>
C:\DATA\Utilities\scrcpy\scrcpy-server: 1 file pushed, 0 skipped. 79.3 MB/s (52867 bytes in 0.001s)
[server] INFO: Device: Google Pixel 6 (Android 13)
[server] ERROR: Could not invoke method
java.lang.NoSuchMethodException: android.content.IClipboard$Stub$Proxy.addPrimaryClipChangedListener [interface android.content.IOnPrimaryClipChangedListener, class java.lang.String, class java.lang.String, int]
at java.lang.Class.getMethod(Class.java:2890)
at java.lang.Class.getMethod(Class.java:2470)
at com.genymobile.scrcpy.wrappers.ClipboardManager.getAddPrimaryClipChangedListener(ClipboardManager.java:129)
at com.genymobile.scrcpy.wrappers.ClipboardManager.addPrimaryClipChangedListener(ClipboardManager.java:139)
at com.genymobile.scrcpy.Device.<init>(Device.java:100)
at com.genymobile.scrcpy.Server.scrcpy(Server.java:64)
at com.genymobile.scrcpy.Server.main(Server.java:381)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:359)
[server] ERROR: Could not invoke method
java.lang.NoSuchMethodException: android.view.SurfaceControl.getPhysicalDisplayIds []
at java.lang.Class.getMethod(Class.java:2890)
at java.lang.Class.getMethod(Class.java:2470)
at com.genymobile.scrcpy.wrappers.SurfaceControl.getGetPhysicalDisplayIdsMethod(SurfaceControl.java:137)
at com.genymobile.scrcpy.wrappers.SurfaceControl.getPhysicalDisplayIds(SurfaceControl.java:144)
at com.genymobile.scrcpy.Device.setScreenPowerMode(Device.java:282)
at com.genymobile.scrcpy.Controller.handleEvent(Controller.java:165)
at com.genymobile.scrcpy.Controller.control(Controller.java:83)
at com.genymobile.scrcpy.Controller.lambda$start$0$com-genymobile-scrcpy-Controller(Controller.java:90)
at com.genymobile.scrcpy.Controller$$ExternalSyntheticLambda0.run(Unknown Source:2)
at java.lang.Thread.run(Thread.java:1012)
[server] ERROR: Could not get physical display ids
INFO: Renderer: direct3d
INFO: Initial texture: 1080x2400
Error after copy pasting:
[server] ERROR: Could not invoke method
java.lang.NoSuchMethodException: android.content.IClipboard$Stub$Proxy.getPrimaryClip [class java.lang.String, class java.lang.String, int]
at java.lang.Class.getMethod(Class.java:2890)
at java.lang.Class.getMethod(Class.java:2470)
at com.genymobile.scrcpy.wrappers.ClipboardManager.getGetPrimaryClipMethod(ClipboardManager.java:35)
at com.genymobile.scrcpy.wrappers.ClipboardManager.getText(ClipboardManager.java:83)
at com.genymobile.scrcpy.Device.getClipboardText(Device.java:248)
at com.genymobile.scrcpy.Device.setClipboardText(Device.java:261)
at com.genymobile.scrcpy.Controller.setClipboard(Controller.java:394)
at com.genymobile.scrcpy.Controller.handleEvent(Controller.java:160)
at com.genymobile.scrcpy.Controller.control(Controller.java:83)
at com.genymobile.scrcpy.Controller.lambda$start$0$com-genymobile-scrcpy-Controller(Controller.java:90)
at com.genymobile.scrcpy.Controller$$ExternalSyntheticLambda0.run(Unknown Source:2)
at java.lang.Thread.run(Thread.java:1012)
I understand scrcpy isn't yet supported on Android 14 but I'm raising the issue as soon as possible to bring this to the projects attention.
Thank you for your report.
The unexpected reboot is probably a system bug in Android 14 beta. The clipboard issue is fixed on dev
. I have no solution for the "turn screen off" feature yet: https://github.com/Genymobile/scrcpy/issues/3784#issuecomment-1475755758
Google removed the SurfaceControl methods used to turn the screen off and moved them to internal classes in system_server, which I assume are not accessible by scrcpy. On (some?) qualcomm devices you can use the surfaceflinger backdoor code 20000 to turn the screen off, eg service call SurfaceFlinger 20000 i64 130 i32 2 where 130 is the id of the physical display (can be seen in dumpsys SurfaceFlinger --displays output)
Google must be having the same issue with turning screen off. I found this in AS setting, for their scrcpy clone baked into it. I haven't found any thread regarding it in their issue tracer, although, it may be just me not guessing correct magic words for searching.
Refs Android issue: https://issuetracker.google.com/issues/303565669
Refs another issue related to crop and video orientation in Android 14: https://github.com/Genymobile/scrcpy/issues/4011
Thank you for your report.
The unexpected reboot is probably a system bug in Android 14 beta. The clipboard issue is fixed on
dev
. I have no solution for the "turn screen off" feature yet: #3784 (comment)
Is there still no way to solve it now? My phone is Xiaomi 13, which has just updated its new MIUI14 system. The kernel is already Android 14, and I found that I cannot use Scrcpy's screen shutdown control function.
感谢您报告的信息。 意外重启可能是 Android 14 测试版中的系统错误。剪贴板问题已在 上修复。我还没有“关闭屏幕”功能的解决方案:#3784(评论)
dev
Is there still no way to solve it now?
Please turn off the full-page translation of the browser before clicking the quote reply on the GitHub issues interface.
感谢您报告的信息。 意外重启可能是 Android 14 测试版中的系统错误。剪贴板问题已在 上修复。我还没有“关闭屏幕”功能的解决方案:#3784(评论)
dev
Is there still no way to solve it now?
Please turn off the full-page translation of the browser before clicking the quote reply on the GitHub issues interface.
Is there still no way to solve it now? My phone is Xiaomi 13, which has just updated its new MIUI14 system. The kernel is already Android 14, and I found that I cannot use Scrcpy's screen shutdown control function.
Hi there! Got this issue on Pixel 7/Android 14, though updated scrcpy to the newest version. Glad if the issue will be solved because I really like using the app. Thanks anyway :)
Log:
[server] INFO: Device: [Google] google Pixel 7 (Android 14) INFO: Renderer: direct3d INFO: Textu[server] ERROR: Could not invoke method java.lang.NoSuchMethodException: android.view.SurfaceControl.getPhysicalDisplayIds [] at java.lang.Class.getMethod(Class.java:2937) at java.lang.Class.getMethod(Class.java:2449) at com.genymobile.scrcpy.wrappers.SurfaceControl.getGetPhysicalDisplayIdsMethod(SurfaceControl.java:137) at com.genymobile.scrcpy.wrappers.SurfaceControl.getPhysicalDisplayIds(SurfaceControl.java:144) at com.genymobile.scrcpy.Device.setScreenPowerMode(Device.java:319) at com.genymobile.scrcpy.Controller.handleEvent(Controller.java:169) at com.genymobile.scrcpy.Controller.control(Controller.java:83) at com.genymobile.scrcpy.Controller.lambda$start$0$com-genymobile-scrcpy-Controller(Controller.java:91) at com.genymobile.scrcpy.Controller$$ExternalSyntheticLambda1.run(Unknown Source:4) at java.lang.Thread.run(Thread.java:1012) [server] ERROR: Could not get physical display ids re: 1080x2400
You can use this to get the system server class loader and get DisplayControl
from it using reflection
val classLoader = ClassLoader.getSystemClassLoader()
val systemServerClasspath = Os.getenv("SYSTEMSERVERCLASSPATH")
val systemServerClassLoader = PathClassLoader(systemServerClasspath, null, classLoader) // classLoader may be null since API 24
Source: https://android.googlesource.com/platform/frameworks/base/+/master/core/java/com/android/internal/os/ZygoteInit.java#442
According to the commit linked in the android issue it accesses SurfaceComposerClient
in cpp same as before. This could work unless there's a permission issue.
Someone on Android 14 please test this:
- Download and unzip test.zip (source code at https://github.com/yume-chan/turn-off-screen)
- Run the following commands:
adb push ./test.jar /data/local/tmp
adb shell
LD_PRELOAD="/apex/com.android.adbd/lib64/libadb_pairing_server.so /apex/com.android.adbd/lib64/libadb_pairing_connection.so /apex/com.android.os.statsd/lib64/libstatspull.so /apex/com.android.os.statsd/lib64/libstatssocket.so /apex/com.android.runtime/lib64/bionic/libdl_android.so /apex/com.android.i18n/lib64/libandroidicu.so /system/lib64/libandroid_servers.so" app_process -cp /data/local/tmp/test.jar:/system/framework/services.jar / com.example.test.Main
Please check:
- Does it turn off your screen?
- Use Scrcpy when screen is off, does touch and keyboard work?
If it doesn't work, please attach its console output and logcat logs.
To turn the screen back on, press power button twice, or add a 2
at the end of the command (...services.jar / com.example.test.Main 2
)
Seems to work for me on a Pixel 7. I tried the above without scrcpy running (initially) and with scrcpy running already. Both scenarios had screen touch and keyboard access and the screen was off. ADB shell output:
...cu.so /system/lib64/libandroid_servers.so" app_process -cp /data/local/tmp/test.jar:/system/framework/services.jar / com.example.test.Main Start Mode: 0 Loaded libandroiod_servers.so displayControlClass: class com.android.server.display.DisplayControl getPhysicalDisplayIdsMethod: public static long[] com.android.server.display.DisplayControl.getPhysicalDisplayIds() getPhysicalDisplayTokenMethod: public static android.os.IBinder com.android.server.display.DisplayControl.getPhysicalDisplayToken(long) surfaceControlClass: class android.view.SurfaceControl setDisplayPowerModeMethod: public static void android.view.SurfaceControl.setDisplayPowerMode(android.os.IBinder,int) displayIds.length: 1 displayId: 4619827677550801152 token: android.os.BinderProxy@87b3a85 setDisplayPowerMode success
...u.so /system/lib64/libandroid_servers.so" app_process -cp /data/local/tmp/test.jar:/system/framework/services.jar / com.example.test.Main 2 Start Mode: 2 Loaded libandroiod_servers.so displayControlClass: class com.android.server.display.DisplayControl getPhysicalDisplayIdsMethod: public static long[] com.android.server.display.DisplayControl.getPhysicalDisplayIds() getPhysicalDisplayTokenMethod: public static android.os.IBinder com.android.server.display.DisplayControl.getPhysicalDisplayToken(long) surfaceControlClass: class android.view.SurfaceControl setDisplayPowerModeMethod: public static void android.view.SurfaceControl.setDisplayPowerMode(android.os.IBinder,int) displayIds.length: 1 displayId: 4619827677550801152 token: android.os.BinderProxy@fd9508b setDisplayPowerMode success
Someone on Android 14 please test this:
- Download and unzip test.zip (source code at https://github.com/yume-chan/turn-off-screen)
- Run the following commands:
adb push ./test.jar /data/local/tmp adb shell LD_PRELOAD="/apex/com.android.adbd/lib64/libadb_pairing_server.so /apex/com.android.adbd/lib64/libadb_pairing_connection.so /apex/com.android.os.statsd/lib64/libstatspull.so /apex/com.android.os.statsd/lib64/libstatssocket.so /apex/com.android.runtime/lib64/bionic/libdl_android.so /apex/com.android.i18n/lib64/libandroidicu.so /system/lib64/libandroid_servers.so" app_process -cp /data/local/tmp/test.jar:/system/framework/services.jar / com.example.test.Main
Please check:
- Does it turn off your screen?
- Use Scrcpy when screen is off, does touch and keyboard work?
If it doesn't work, please attach its console output and logcat logs.
To turn the screen back on, press power button twice, or add a
2
at the end of the command (...services.jar / com.example.test.Main 2
)
thans, this is work for me, the output:
Start Mode: 0 Loaded libandroiod_servers.so displayControlClass: class com.android.server.display.DisplayControl getPhysicalDisplayIdsMethod: public static long[] com.android.server.display.DisplayControl.getPhysicalDisplayIds() getPhysicalDisplayTokenMethod: public static android.os.IBinder com.android.server.display.DisplayControl.getPhysicalDisplayToken(long) surfaceControlClass: class android.view.SurfaceControl setDisplayPowerModeMethod: public static void android.view.SurfaceControl.setDisplayPowerMode(android.os.IBinder,int) displayIds.length: 1 displayId: 4630947082089526659 token: android.os.BinderProxy@798ef88 setDisplayPowerMode success
Someone on Android 14 please test this
Confirmed, works
在小米13,安卓内核14工作正常
- 能够关闭屏幕
- 能够正常使用键盘,鼠标控制
At Xiaomi 13, Android Core 14 works normally
- Ability to turn off the screen
- Able to use keyboard and mouse control normally
Hello. I also have the dreaded Pixel 7 with the horrible Android 14 (bought this used and it's just been a long series of excruciating headaches).
Is this the bug that is causing the screen to go blank at the unlock screen? Is there a work-around, perhaps a way to bypass the unlock screen? Thanks..
Hello. I also have the dreaded Pixel 7 with the horrible Android 14 (bought this used and it's just been a long series of excruciating headaches).
Is this the bug that is causing the screen to go blank at the unlock screen? Is there a work-around, perhaps a way to bypass the unlock screen? Thanks..
No, that's a security feature. Scrcpy will always display black on the lock screen. Only "bypass" would be a swipe lock (no security). This relates to Scrcpy's ability to turn off the display while still being able to manipulate/see the device on your PC.
Not working for my XiaoMi14 with Android 14.
Output from adb:
PS D:\App\scrcpy-win64> ./adb push ./test.jar /data/local/tmp
./test.jar: 1 file pushed, 0 skipped. 110.4 MB/s (3907362 bytes in 0.034s)
PS D:\App\scrcpy-win64> ./adb shell
rocess -cp /data/local/tmp/test.jar:/system/framework/services.jar / com.example.test.Main <
Start
Mode: 0
Loaded libandroiod_servers.so
displayControlClass: class com.android.server.display.DisplayControl
getPhysicalDisplayIdsMethod: public static long[] com.android.server.display.DisplayControl.getPhysicalDisplayIds()
getPhysicalDisplayTokenMethod: public static android.os.IBinder com.android.server.display.DisplayControl.getPhysicalDisplayToken(long)
surfaceControlClass: class android.view.SurfaceControl
setDisplayPowerModeMethod: public static void android.view.SurfaceControl.setDisplayPowerMode(android.os.IBinder,int)
displayIds.length: 1
displayId: 4630947082089526659
token: android.os.BinderProxy@ac3fcee
setDisplayPowerMode success
But Alt+O in scrcpy has the same error as before:
[server] ERROR: Could not invoke method
java.lang.NoSuchMethodException: android.view.SurfaceControl.getPhysicalDisplayIds []
at java.lang.Class.getMethod(Class.java:2937)
at java.lang.Class.getMethod(Class.java:2449)
at com.genymobile.scrcpy.wrappers.SurfaceControl.getGetPhysicalDisplayIdsMethod(SurfaceControl.java:137)
at com.genymobile.scrcpy.wrappers.SurfaceControl.getPhysicalDisplayIds(SurfaceControl.java:144)
at com.genymobile.scrcpy.Device.setScreenPowerMode(Device.java:319)
at com.genymobile.scrcpy.Controller.handleEvent(Controller.java:169)
at com.genymobile.scrcpy.Controller.control(Controller.java:83)
at com.genymobile.scrcpy.Controller.lambda$start$0$com-genymobile-scrcpy-Controller(Controller.java:91)
at com.genymobile.scrcpy.Controller$$ExternalSyntheticLambda1.run(Unknown Source:4)
at java.lang.Thread.run(Thread.java:1012)
[server] ERROR: Could not get physical display ids
Hello. I also have the dreaded Pixel 7 with the horrible Android 14 (bought this used and it's just been a long series of excruciating headaches). Is this the bug that is causing the screen to go blank at the unlock screen? Is there a work-around, perhaps a way to bypass the unlock screen? Thanks..
No, that's a security feature. Scrcpy will always display black on the lock screen. Only "bypass" would be a swipe lock (no security). This relates to Scrcpy's ability to turn off the display while still being able to manipulate/see the device on your PC.
There isn't a flag in scrcpy to disable this? Honestly, it's false security. Either the connection is encrypted or it isn't.
Edit: even better, if there is a way to bypass the swipe lock when using scrcpy that would be even better.
There isn't a flag in scrcpy to disable this? Honestly, it's false security.
This is the decision of the lock screen developers to set the "secure flag", and from Android developer to enforce the secure flag even with shell permissions (#2129).
Edit: even better, if there is a way to bypass the swipe lock when using scrcpy that would be even better.
MOD+m (shortcuts)
I have rooted my device, is there an easy way to temporarily turn off the screen?
Edit: even better, if there is a way to bypass the swipe lock when using scrcpy that would be even better.
MOD+m (shortcuts)
Your MacOS app has Mod-M bound to miniaturize screen
By default, MOD is Alt or Super (and you can change it).
Welp all it does is make the screen go blank. scrcpy is still 100% unusable because the only way to use it is to physically unlock the phone which defeats the entire purpose.
The only work-around I can see is to BLINDLY swipe the phone open. The process is, hopefully needless to say, dumb.
v2.2 works with me samsung android 14
[server] INFO: Device: [samsung] samsung SM-S908B (Android 14)
INFO: Renderer: direct3d
INFO: Texture: 1080x2312
[server] INFO: Device screen turned off
v2.2 works with me samsung android 14
[server] INFO: Device: [samsung] samsung SM-S908B (Android 14) INFO: Renderer: direct3d INFO: Texture: 1080x2312 [server] INFO: Device screen turned off
No change here with v2.2 on a Pixel 7 / Android 14
scrcpy v2.2 <https://github.com/Genymobile/scrcpy>
[server] INFO: Device: [Google] google Pixel 7 (Android 14)
INFO: Renderer: direct3d
I[server] ERROR: Could not invoke method
java.lang.NoSuchMethodException: android.view.SurfaceControl.getPhysicalDisplayIds []
at java.lang.Class.getMethod(Class.java:2937)
at java.lang.Class.getMethod(Class.java:2449)
at com.genymobile.scrcpy.wrappers.SurfaceControl.getGetPhysicalDisplayIdsMethod(SurfaceControl.java:137)
at com.genymobile.scrcpy.wrappers.SurfaceControl.getPhysicalDisplayIds(SurfaceControl.java:144)
at com.genymobile.scrcpy.Device.setScreenPowerMode(Device.java:319)
at com.genymobile.scrcpy.Controller.handleEvent(Controller.java:169)
at com.genymobile.scrcpy.Controller.control(Controller.java:83)
at com.genymobile.scrcpy.Controller.lambda$start$0$com-genymobile-scrcpy-Controller(Controller.java:91)
at com.genymobile.scrcpy.Controller$$ExternalSyntheticLambda1.run(Unknown Source:4)
at java.lang.Thread.run(Thread.java:1012)
[server] ERROR: Could not get physical display ids
NFO: Texture: 1080x2400
Please test #4446.
Please test #4446.
Pixel 5, Android 14. This works. Phone screen turns off.
C:\scrcpy\scrcpy-win64-v2.2-42-g623bf73eb>scrcpy --window-title=hooligeek --turn-screen-off --stay-awake --window-x=1 --window-y=31 --window-height=1008 scrcpy v2.2 https://github.com/Genymobile/scrcpy INFO: ADB device found: INFO: --> (usb) 0C101FDD4003AV device Pixel_5 C:\scrcpy\scrcpy-win64-v2.2-42-g623bf73eb\scrcpy-server: 1 file pushed, 0 skipped. 70.8 MB/s (66719 bytes in 0.001s) [server] INFO: Device: [Google] google Pixel 5 (Android 14) INFO: Renderer: direct3d INFO: Texture: 1080x2336 [server] INFO: Device screen turned off
Please test #4446.
Hey this one works nicely on my Pixel 6 with Android 14! Command is:
.../scrcpy-noconsole.vbs -S --always-on-top --stay-awake --no-audio
OS Build is: UP1A.231105.003
Yes, this PR (4446) into ScrCpy works as well as the proof of concept by @yume-chan above for me.
Pixel 7/Android 14/Nov 2023 patches