Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
111.53k stars 10.69k forks source link

‘-- turn screen off’ #4205

Open xiezy1 opened 1 year ago

xiezy1 commented 1 year ago

Hello, I would like to know how the '-- turn screen off' instruction in scrcpy is implemented

My requirement is to use ADB to turn off the screen backlight instead of locking the screen, similar to the '-- turn screen off' command

Can I use the adb command to achieve this now? I only found that the 'adb shell input keyevent 26/223' effect is different from what I thought

Thanks

yume-chan commented 1 year ago

https://github.com/Genymobile/scrcpy/blob/1ee46970e373ea3c34c3d9b632fef34982d7a52b/server/src/main/java/com/genymobile/scrcpy/Device.java#L316-L340

It's not possible with ADB commands. And it won't work after Android 14.

rom1v commented 1 year ago

Also see #2888

BlackRule commented 9 months ago

The --turn-screen-off is just displaying black screen instead of really turning off my IPS screen so I assume it's not saving power. I have Poco M4 Pro 5g Android 13. Is it a bug or intentional behavior?

rom1v commented 9 months ago

It depends on the device, scrcpy just request sto set the power mode to "off", how the device reacts is device-specific.

ArturBieniek4 commented 7 months ago

The --turn-screen-off is just displaying black screen instead of really turning off my IPS screen so I assume it's not saving power. I have Poco M4 Pro 5g Android 13. Is it a bug or intentional behavior?

On every OLED screen, making it black will save you power. On most LCD screens, making the whole screen black will also actually cut off the backlight.