linux,android屏蔽长按电源键弹框且直接关机
linux,android屏蔽长按电源键弹框且直接关机
·
文件路径:frameworks/base/services/corn/java/com/android/server/policy/PhoneWindowManager.java
所在函数:powerLongPress()
private void powerLongPress() {
final int behavior = getResolvedLongPressOnPowerBehavior();
switch (behavior) {
case LONG_PRESS_POWER_NOTHING:
break;
case LONG_PRESS_POWER_GLOBAL_ACTIONS:
mPowerKeyHandled = true;
if (!performHapticFeedbackLw(null, HapticFeedbackConstants.LONG_PRESS, false)) {
performAuditoryFeedbackForAccessibilityIfNeed();
}
try {
Runtime.getRuntime().exec("reboot -p"); //关机
} catch (IOException e) {
e.printStackTrace();
}
//showGlobalActionsInternal();
break;
case LONG_PRESS_POWER_SHUT_OFF:
case LONG_PRESS_POWER_SHUT_OFF_NO_CONFIRM:
mPowerKeyHandled = true;
performHapticFeedbackLw(null, HapticFeedbackConstants.LONG_PRESS, false);
sendCloseSystemWindows(SYSTEM_DIALOG_REASON_GLOBAL_ACTIONS);
mWindowManagerFuncs.shutdown(behavior == LONG_PRESS_POWER_SHUT_OFF);
break;
}
}
注释掉的为弹窗,增加的为直接关机
更多推荐
已为社区贡献7条内容
所有评论(0)