diff options
author | Jeff Brown <jeffbrown@google.com> | 2010-10-12 01:04:16 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-10-12 01:04:16 -0700 |
commit | 4b255a23041225103a6870e77a236f78c2816eda (patch) | |
tree | 97afc0304575b68c913b09990e4fd8d9a5d8d2c8 /policy/src | |
parent | b99db0c70e0ee18e0a691126134b9394f30f7f03 (diff) | |
parent | 03aa28fb36589a3d601be08e75c08a24c4344d6f (diff) | |
download | frameworks_base-4b255a23041225103a6870e77a236f78c2816eda.zip frameworks_base-4b255a23041225103a6870e77a236f78c2816eda.tar.gz frameworks_base-4b255a23041225103a6870e77a236f78c2816eda.tar.bz2 |
am 03aa28fb: Merge "Improve the input policy handling a bit." into gingerbread
Merge commit '03aa28fb36589a3d601be08e75c08a24c4344d6f' into gingerbread-plus-aosp
* commit '03aa28fb36589a3d601be08e75c08a24c4344d6f':
Improve the input policy handling a bit.
Diffstat (limited to 'policy/src')
-rwxr-xr-x | policy/src/com/android/internal/policy/impl/PhoneWindowManager.java | 32 |
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 d9bceec..3cf4360 100755 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -1057,10 +1057,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); @@ -1739,9 +1735,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); @@ -1749,7 +1742,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 @@ -1848,7 +1848,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()); @@ -1871,12 +1871,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; } |