Android Things:Raspberry Pi 屏幕超时 [英] Android Things: Raspberry Pi screen timeout
问题描述
我正在使用 Android Things 在 Raspberry Pi 上构建应用程序,并且我有 7 英寸触摸屏,但屏幕永远不会关闭.
I'm building app on Raspberry Pi with Android Things and I have 7 inch touch screen, but the screen never turns off.
是否可以像在 Android 手机中那样设置超时?或强制关闭/打开.
Is it possible to set timeout like in Android phones? or force it to turn off/on.
如果我拔掉电源线重新插入屏幕,它会在我重新启动之前无法工作.
If I remove the power line and inserted again the screen, it will not work until I reboot.
推荐答案
有两个系统设置可以控制此过程:STAY_ON_WHILE_PLUGGED_IN 和 SCREEN_OFF_TIMEOUT
There are two system settings that control this process: STAY_ON_WHILE_PLUGGED_IN and SCREEN_OFF_TIMEOUT
STAY_ON_WHILE_PLUGGED_IN
设置默认设置为 BATTERY_PLUGGED_AC
.您可以使用 Settings
API 以编程方式在应用程序代码中更改此值:
The STAY_ON_WHILE_PLUGGED_IN
setting is set to BATTERY_PLUGGED_AC
by default. You can programmatically change this value in your application code with the Settings
API:
Settings.Global.putInt(getContentResolver(),
Settings.Global.STAY_ON_WHILE_PLUGGED_IN, 0);
如果更方便,您也可以从命令行进行此更改:
You can also make this change from the command line if it is more convenient:
$ adb shell settings put global stay_on_while_plugged_in 0
这篇关于Android Things:Raspberry Pi 屏幕超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!