20231128让RK3399的挖掘机开发板在Andorid12系统下永不休眠
2023/11/28 7:56
适用于SOC以及系统版本:
RK3399:Android10/11/12
RK3568:Android11/12
RK3588:Android12
缘起,调试的时候,RK3399的挖掘机开发板在Andorid12系统下刷机之后开机一会【一分钟】就休眠了!
【刚刷机的那一次不会自己休眠】
在调试的时候非常不方便!
那就将休眠时间改得尽可能大了!
百度搜搜:
<integer name="def_screen_off_timeout">60000</integer>
Z:\rk_android12_220722\frameworks\base\packages\SettingsProvider\res\values\defaults.xml
<resources>
<bool name="def_dim_screen">true</bool>
<integer name="def_screen_off_timeout">60000</integer>
<integer name="def_sleep_timeout">-1</integer>
<bool name="def_airplane_mode_on">false</bool>
<bool name="def_theater_mode_on">false</bool>
<!-- Comma-separated list of bluetooth, wifi, and cell. -->
<string name="def_airplane_mode_radios" translatable="false">cell,bluetooth,wifi,nfc,wimax</string>
<string name="airplane_mode_toggleable_radios" translatable="false">bluetooth,wifi,nfc</string>
<string name="def_bluetooth_disabled_profiles" translatable="false">0</string>
<bool name="def_auto_time">true</bool>
<bool name="def_auto_time_zone">true</bool>
<bool name="def_accelerometer_rotation">false</bool>
<!-- Default screen brightness, from 0 to 255. 102 is 40%. -->
<integer name="def_screen_brightness">102</integer>
<bool name="def_screen_brightness_automatic_mode">false</bool>
<fraction name="def_window_animation_scale">100%</fraction>
<fraction name="def_window_transition_scale">100%</fraction>
<bool name="def_haptic_feedback">true</bool>
修改为:
<resources>
<bool name="def_dim_screen">true</bool>
<integer name="def_screen_off_timeout">2147483647</integer>
<integer name="def_sleep_timeout">-1</integer>
<bool name="def_airplane_mode_on">false</bool>
<bool name="def_theater_mode_on">false</bool>
<!-- Comma-separated list of bluetooth, wifi, and cell. -->
<string name="def_airplane_mode_radios" translatable="false">cell,bluetooth,wifi,nfc,wimax</string>
<string name="airplane_mode_toggleable_radios" translatable="false">bluetooth,wifi,nfc</string>
<string name="def_bluetooth_disabled_profiles" translatable="false">0</string>
<bool name="def_auto_time">true</bool>
<bool name="def_auto_time_zone">true</bool>
<bool name="def_accelerometer_rotation">false</bool>
<!-- Default screen brightness, from 0 to 255. 102 is 40%. -->
<integer name="def_screen_brightness">102</integer>
<bool name="def_screen_brightness_automatic_mode">false</bool>
<fraction name="def_window_animation_scale">100%</fraction>
<fraction name="def_window_transition_scale">100%</fraction>
<bool name="def_haptic_feedback">true</bool>
由于def_screen_off_timeout的单位为ms毫秒,定义为unsigned int型
2147483647ms=2147483s=596.5h
256*256*256*256=4294967296
4294967296/2=2147483648
2147483648-1=2147483647
可以不用设置的地方:
Z:\11d\device\rockchip\common\device.mk
ifeq ($(strip $(TARGET_BOARD_PLATFORM_PRODUCT)), box)
include device/rockchip/common/samba/rk31_samba.mk
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/init.box.samba.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.box.samba.rc \
device/rockchip/common/cifsmanager.sh:system/bin/cifsmanager.sh
PRODUCT_PROPERTY_OVERRIDES += \
ro.rk.screenoff_time=2147483647
else
PRODUCT_PROPERTY_OVERRIDES += \
#ro.rk.screenoff_time=60000
ro.rk.screenoff_time=2147483647
endif
Z:\11d\device\rockchip\rk3399\overlay_screenoff\frameworks\base\packages\SettingsProvider\res\values\defaults.xml
<resources>
<integer name="def_screen_off_timeout">0x7fffffff</integer>
<!-- Initial value for the Settings.Secure.IMMERSIVE_MODE_CONFIRMATIONS setting,
which is a comma separated list of packages that no longer need confirmation
for immersive mode.
Override to disable immersive mode confirmation for certain packages. -->
<string name="def_immersive_mode_confirmations" translatable="false">confirmed</string>
</resources>
参考资料:
https://blog.csdn.net/Nio96/article/details/39001195
Android 禁止屏幕休眠和锁屏的方法
我们通过查看源码便知道, Settings.System.SCREEN_OFF_TIMEOUT没有初始化的话(系统首次启动,这个字段肯定是没 有初始化的),系统将会利用资源中的R.integer.def_screen_off_timeout来初始化。我们为了让系统永不锁屏,只需要把资源 R.integer.def_screen_off_timeout设为-1即可。查看文件在这里:
frameworks/base/packages/SettingsProvider/res/values/defaults.xml
可以找到R.integer.def_screen_off_timeout的定义
[xhtml] view plain copy
<integer name="def_screen_off_timeout">60000</integer>
发现默认值为60000ms,也就是60s。我们只需要把这个参数改为-1。然后重新编译SettingsProvider模块,就OK了。
但有时候也会有这样的情况发生,用户进入系统后,修改锁屏时间,为了这样的情况发生我们得在Setting模块中删除对锁屏时间的设置。这样Android设备就不锁屏了。
我们这里还要处理一种情况,就是让系统一启动我们就禁用锁屏的功能,很简单,我们只要把系统锁 屏 功能的的初始默认开关给改以下就可以了,如下找到这个类:
frameworks/policies/base/phone/com/android/internal/policy/impl/KeyguardViewMediator.java
https://blog.csdn.net/weixin_34043301/article/details/85571147
Android屏幕相关设置
https://blog.csdn.net/b1480521874/article/details/83587822
Android系统属性服务
https://blog.csdn.net/ismartv_dagou2/article/details/125413451
AOSP ~ 默认属性值
https://blog.csdn.net/qq_38607166/article/details/122493237
我的RK笔记
https://blog.csdn.net/Bleen1009/article/details/39376075
Android系统取消自动锁定屏幕
https://blog.csdn.net/qq1226176787/article/details/122648926
RK Android11 系统常见修改