android 11.0禁用电源键(屏蔽关机短按长按事件)

在11.0定制化开发中,有需求是用开关按钮控制电源键是否可操作,电源按键事件是通过驱动事件上报到PhoneWindowManager中来处理的
短按事件
有powerPress(long eventTime, boolean interactive, int count)来处理

private void powerPress(long eventTime, boolean interactive, int count) {
   
    
    
if (mDefaultDisplayPolicy.isScreenOnEarly() && !mDefaultDisplayPolicy.isScreenOnFully()) {
   
    
    
Slog.i(TAG, "Suppressed redundant power key press while "
+ 

猜你喜欢

转载自blog.csdn.net/baidu_41666295/article/details/124893996