-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android 14 turn screen off issue #3927
Comments
Thank you for your report. The unexpected reboot is probably a system bug in Android 14 beta. The clipboard issue is fixed on |
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 |
Refs Android issue: https://issuetracker.google.com/issues/303565669 Refs another issue related to crop and video orientation in Android 14: #4011 |
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? |
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:
|
You can use this to get the system server class loader and get val classLoader = ClassLoader.getSystemClassLoader()
val systemServerClasspath = Os.getenv("SYSTEMSERVERCLASSPATH")
val systemServerClassLoader = PathClassLoader(systemServerClasspath, null, classLoader) // classLoader may be null since API 24 According to the commit linked in the android issue it accesses |
Someone on Android 14 please test this:
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:
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 |
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 ...u.so /system/lib64/libandroid_servers.so" app_process -cp /data/local/tmp/test.jar:/system/framework/services.jar / com.example.test.Main 2 |
thans, this is work for me, the output:Start |
Confirmed, works |
在小米13,安卓内核14工作正常
At Xiaomi 13, Android Core 14 works 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.. |
No, that's a security feature. Scrcpy will always display black on the lock screen. Only "bypass" would be a swipe lock (no security). |
On Android 14, execute a separate process with a different classpath and LD_PRELOAD to execute the methods required to turn the device screen off. Fixes #3927 <#3927> Refs #3927 comment <#3927 (comment)> Co-authored-by: Simon Chan <1330321+yume-chan@users.noreply.github.com>
On Android 14, execute a separate process with a different classpath and LD_PRELOAD to execute the methods required to turn the device screen off. Fixes #3927 <#3927> Refs #3927 comment <#3927 (comment)> Co-authored-by: Simon Chan <1330321+yume-chan@users.noreply.github.com>
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 |
Hey this one works nicely on my Pixel 6 with Android 14! .../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 |
Please test the new binary on #4446 (it should take less time to turn the screen off or on with shortcuts). |
Tested and it does seem to turn off the screen faster. C:\scrcpy\scrcpy-win64-v2.2-43-gc5c2734db>scrcpy --window-title=hooligeek --turn-screen-off --stay-awake --window-x=1 --window-y=31 --window-height=1008 |
Worked on my XiaoMi14 Android 14, Bravo!!! |
On Android 14, the methods to access the display have been moved to DisplayControl, which is not in the core framework. Use a specific ClassLoader to access this class and its native dependencies. Fixes #3927 <#3927> Refs #3927 comment <#3927 (comment)> Refs #4446 comment <#4446 (comment)> PR #4456 <#4456> Co-authored-by: Simon Chan <1330321+yume-chan@users.noreply.github.com>
A simpler and faster alternative (thanks to @yume-chan): please test #4456. |
@rom1v Why is it better? Faster ? More stable? |
It is faster because it runs the code in the scrcpy server process, without spawning a new dedicated Java process (which takes a few hundred milliseconds, like in #4446) to change the display power mode. And the code is much simpler. |
@rom1v Thank you . Hope will work well. |
Thank you all for your tests. I will probably publish a new version soon. Could some of you check that the fix that will be merged (#4456) works correctly for you please? |
I might be wrong, but I think that sometimes, after some long time of it being used, ScrCpy is closed on its own, and the display gets turned on again (which is good in general in case the tool is closed). Can anyone confirm? |
In the console, do you get https://github.com/Genymobile/scrcpy/blob/master/FAQ.md#device-disconnected |
@rom1v I don't use the console as I prefer to have a single window. Any way to send you logs when it occurs? If so, where is the logs file, or how do I tell it to generate them? |
Thank you all for fixing this! I can confirm it's working on Pixel 6 / Android 14 / November 23 update |
Hello @yume-chan, I hope this message finds you well. I noticed your expertise in building JAR files and I'm seeking guidance on a particular issue I'm facing. I'm currently working on a project where I need to custom from your source code. I've attempted to create the JAR using the following Gradle kotlin DSL script:
While I can run the generated JAR file successfully using java -jar main.jar, I encounter a ClassNotFoundException when attempting to run it on an Android device by run
Could you please provide guidance on how to modify the Gradle script or any additional steps needed to ensure compatibility with Android devices? Any assistance or suggestions you can provide would be greatly appreciated. Thank you in advance for your help! |
@thiendn160794 I know absolutely nothing about Gradle. My projects start from the "No Activity" template in Android Studio. Then I removed everything in AndroidManifest.xml (https://github.com/yume-chan/turn-off-screen/blob/main/app/src/main/AndroidManifest.xml) and res folder (I think it doesn't affect the result, only to make the bundle smaller). Dependencies and source files are added like normal Android apps. It can be built directly in Android Studio, or by running |
Thank you, @yume-chan, for your response. It took me three days to realize that simply building the .apk and then renaming it to .jar was the solution. However, the issue lies in the large size of the .jar file, which is approximately 4MB, due to its contents:
|
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:
Error after copy pasting:
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.
The text was updated successfully, but these errors were encountered: