summaryrefslogtreecommitdiffstats
path: root/policy
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2010-10-13 17:02:48 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-10-13 17:02:48 -0700
commitcd4af421ca6b102cabd2cf1ff63488e086c32c44 (patch)
tree65c60516db0a95bb1eb6ae4d0b751c36cbc676e4 /policy
parentbad553ba34dbf9b6764c9c6b72f0082f011b577c (diff)
parent4b255a23041225103a6870e77a236f78c2816eda (diff)
downloadframeworks_base-cd4af421ca6b102cabd2cf1ff63488e086c32c44.zip
frameworks_base-cd4af421ca6b102cabd2cf1ff63488e086c32c44.tar.gz
frameworks_base-cd4af421ca6b102cabd2cf1ff63488e086c32c44.tar.bz2
am 4b255a23: am 03aa28fb: Merge "Improve the input policy handling a bit." into gingerbread
Merge commit '4b255a23041225103a6870e77a236f78c2816eda' * commit '4b255a23041225103a6870e77a236f78c2816eda': Improve the input policy handling a bit.
Diffstat (limited to 'policy')
-rwxr-xr-xpolicy/src/com/android/internal/policy/impl/PhoneWindowManager.java32
1 files changed, 17 insertions, 15 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index ec5b098..c6898d4 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -1124,10 +1124,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
@Override
public boolean interceptKeyBeforeDispatching(WindowState win, int action, int flags,
int keyCode, int metaState, int repeatCount, int policyFlags) {
- if ((policyFlags & WindowManagerPolicy.FLAG_TRUSTED) == 0) {
- return false;
- }
-
final boolean keyguardOn = keyguardOn();
final boolean down = (action == KeyEvent.ACTION_DOWN);
final boolean canceled = ((flags & KeyEvent.FLAG_CANCELED) != 0);
@@ -1860,9 +1856,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
public int interceptKeyBeforeQueueing(long whenNanos, int keyCode, boolean down,
int policyFlags, boolean isScreenOn) {
int result = ACTION_PASS_TO_USER;
- if ((policyFlags & WindowManagerPolicy.FLAG_TRUSTED) == 0) {
- return result;
- }
if (down && (policyFlags & WindowManagerPolicy.FLAG_VIRTUAL) != 0) {
performHapticFeedbackLw(null, HapticFeedbackConstants.VIRTUAL_KEY, false);
@@ -1870,7 +1863,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
final boolean isWakeKey = (policyFlags
& (WindowManagerPolicy.FLAG_WAKE | WindowManagerPolicy.FLAG_WAKE_DROPPED)) != 0;
-
+
+ // If the key is injected, pretend that the screen is on and don't let the
+ // device go to sleep. This feature is mainly used for testing purposes.
+ final boolean isInjected = (policyFlags & WindowManagerPolicy.FLAG_INJECTED) != 0;
+ if (isInjected) {
+ isScreenOn = true;
+ }
+
// If screen is off then we treat the case where the keyguard is open but hidden
// the same as if it were open and in front.
// This will prevent any keys other than the power button from waking the screen
@@ -1969,7 +1969,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|| (handled && hungUp && keyCode == KeyEvent.KEYCODE_POWER)) {
mShouldTurnOffOnKeyUp = false;
} else {
- // only try to turn off the screen if we didn't already hang up
+ // Only try to turn off the screen if we didn't already hang up.
mShouldTurnOffOnKeyUp = true;
mHandler.postDelayed(mPowerLongPress,
ViewConfiguration.getGlobalActionKeyTimeout());
@@ -1992,12 +1992,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
if (keyguardActive
|| (sleeps && !gohome)
|| (gohome && !goHome() && sleeps)) {
- // they must already be on the keyguad or home screen,
- // go to sleep instead
- Log.d(TAG, "I'm tired mEndcallBehavior=0x"
- + Integer.toHexString(mEndcallBehavior));
- result &= ~ACTION_POKE_USER_ACTIVITY;
- result |= ACTION_GO_TO_SLEEP;
+ // They must already be on the keyguard or home screen,
+ // go to sleep instead unless the event was injected.
+ if (!isInjected) {
+ Log.d(TAG, "I'm tired mEndcallBehavior=0x"
+ + Integer.toHexString(mEndcallBehavior));
+ result &= ~ACTION_POKE_USER_ACTIVITY;
+ result |= ACTION_GO_TO_SLEEP;
+ }
}
result &= ~ACTION_PASS_TO_USER;
}