Android按电源键关机弹窗的删除
当前的项目中,没有屏幕,点击电源键需要投屏显示关机弹窗,然后点击关机选项才能关闭,怎样点击按键直接关闭呢
一问题:
点击电源键直接关机不需要弹窗二次选择
当前点击电源键如下:
目标是点击电源键,直接关闭不需要这个弹窗:
二分析修改:
在/androidDev/android_source/android10_d3/frameworks/base/core/res/res/values/config.xml
<!-- Control the behavior when the user long presses the power button.0 - Nothing1 - Global actions menu2 - Power off (with confirmation)3 - Power off (without confirmation)4 - Go to voice assist5 - Go to assistant (Settings.Secure.ASSISTANT)--><integer name="config_longPressOnPowerBehavior">1</integer>
看以上注释说明,当前是1代表弹窗选项,选择3是关机不需要确认,我们之间修改为3就可以了
测试 通过