Loading policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +7 −4 Original line number Original line Diff line number Diff line Loading @@ -2649,6 +2649,12 @@ public class PhoneWindowManager implements WindowManagerPolicy { performHapticFeedbackLw(null, HapticFeedbackConstants.VIRTUAL_KEY, false); performHapticFeedbackLw(null, HapticFeedbackConstants.VIRTUAL_KEY, false); } } if (keyCode == KeyEvent.KEYCODE_POWER) { policyFlags |= WindowManagerPolicy.FLAG_WAKE; } final boolean isWakeKey = (policyFlags & (WindowManagerPolicy.FLAG_WAKE | WindowManagerPolicy.FLAG_WAKE_DROPPED)) != 0; // Basic policy based on screen state and keyguard. // Basic policy based on screen state and keyguard. // FIXME: This policy isn't quite correct. We shouldn't care whether the screen // FIXME: This policy isn't quite correct. We shouldn't care whether the screen // is on or off, really. We should care about whether the device is in an // is on or off, really. We should care about whether the device is in an Loading @@ -2658,16 +2664,13 @@ public class PhoneWindowManager implements WindowManagerPolicy { // the device some other way (which is why we have an exemption here for injected // the device some other way (which is why we have an exemption here for injected // events). // events). int result; int result; if (isScreenOn || isInjected) { if (isScreenOn || (isInjected && !isWakeKey)) { // When the screen is on or if the key is injected pass the key to the application. // When the screen is on or if the key is injected pass the key to the application. result = ACTION_PASS_TO_USER; result = ACTION_PASS_TO_USER; } else { } else { // When the screen is off and the key is not injected, determine whether // When the screen is off and the key is not injected, determine whether // to wake the device but don't pass the key to the application. // to wake the device but don't pass the key to the application. result = 0; result = 0; final boolean isWakeKey = (policyFlags & (WindowManagerPolicy.FLAG_WAKE | WindowManagerPolicy.FLAG_WAKE_DROPPED)) != 0; if (down && isWakeKey) { if (down && isWakeKey) { if (keyguardActive) { if (keyguardActive) { // If the keyguard is showing, let it decide what to do with the wake key. // If the keyguard is showing, let it decide what to do with the wake key. Loading Loading
policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +7 −4 Original line number Original line Diff line number Diff line Loading @@ -2649,6 +2649,12 @@ public class PhoneWindowManager implements WindowManagerPolicy { performHapticFeedbackLw(null, HapticFeedbackConstants.VIRTUAL_KEY, false); performHapticFeedbackLw(null, HapticFeedbackConstants.VIRTUAL_KEY, false); } } if (keyCode == KeyEvent.KEYCODE_POWER) { policyFlags |= WindowManagerPolicy.FLAG_WAKE; } final boolean isWakeKey = (policyFlags & (WindowManagerPolicy.FLAG_WAKE | WindowManagerPolicy.FLAG_WAKE_DROPPED)) != 0; // Basic policy based on screen state and keyguard. // Basic policy based on screen state and keyguard. // FIXME: This policy isn't quite correct. We shouldn't care whether the screen // FIXME: This policy isn't quite correct. We shouldn't care whether the screen // is on or off, really. We should care about whether the device is in an // is on or off, really. We should care about whether the device is in an Loading @@ -2658,16 +2664,13 @@ public class PhoneWindowManager implements WindowManagerPolicy { // the device some other way (which is why we have an exemption here for injected // the device some other way (which is why we have an exemption here for injected // events). // events). int result; int result; if (isScreenOn || isInjected) { if (isScreenOn || (isInjected && !isWakeKey)) { // When the screen is on or if the key is injected pass the key to the application. // When the screen is on or if the key is injected pass the key to the application. result = ACTION_PASS_TO_USER; result = ACTION_PASS_TO_USER; } else { } else { // When the screen is off and the key is not injected, determine whether // When the screen is off and the key is not injected, determine whether // to wake the device but don't pass the key to the application. // to wake the device but don't pass the key to the application. result = 0; result = 0; final boolean isWakeKey = (policyFlags & (WindowManagerPolicy.FLAG_WAKE | WindowManagerPolicy.FLAG_WAKE_DROPPED)) != 0; if (down && isWakeKey) { if (down && isWakeKey) { if (keyguardActive) { if (keyguardActive) { // If the keyguard is showing, let it decide what to do with the wake key. // If the keyguard is showing, let it decide what to do with the wake key. Loading