Android 종료 PopUp
Android 기기의 Power key Long Press에 의해 나타나는 Dialog Flow 정리.
- Power Key 를 500ms 이상 누르고 있을 경우, 종료 팝업 D/P
PhoneWindowManager.java ( frameworks/base/policy/src/com/android/internal/policy/impl )
private final Runnable mPowerLongPress = new Runnable() {
case LONG_PRESS_POWER_GLOBAL_ACTIONS:
mPowerKeyHandled = true;
if (!performHapticFeedbackLw(null, HapticFeedbackConstants.LONG_PRESS, false)) {
performAuditoryFeedbackForAccessibilityIfNeed();
}
sendCloseSystemWindows(SYSTEM_DIALOG_REASON_GLOBAL_ACTIONS);
showGlobalActionsDialog();
private void interceptPowerKeyDown(boolean handled) {
mPowerKeyHandled = handled;
if (!handled) {
mHandler.postDelayed(mPowerLongPress, ViewConfiguration.getGlobalActionKeyTimeout());
}
}
ViewConfiguration.java ( frameworks/base/core/java/android/view/ )
/**
* Defines the duration in milliseconds a user needs to hold down the
* appropriate button to bring up the global actions dialog (power off,
* lock screen, etc).
*/
private static final int GLOBAL_ACTIONS_KEY_TIMEOUT = 500;
/**
* The amount of time a user needs to press the relevant key to bring up
* the global actions dialog.
*
* @return how long a user needs to press the relevant key to bring up
* the global actions dialog.
*/
public static long getGlobalActionKeyTimeout() {
return GLOBAL_ACTIONS_KEY_TIMEOUT;
}