diff options
author | Jeff Brown <jeffbrown@google.com> | 2010-10-11 14:20:19 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2010-10-11 17:54:12 -0700 |
commit | e20c9e0264190f94324197a8271cf03811a4ca58 (patch) | |
tree | e482829d555d313e57ead50bc24102897dde9b36 /policy | |
parent | 182e5cf105aa71effbdee15628f020214b54774c (diff) | |
download | frameworks_base-e20c9e0264190f94324197a8271cf03811a4ca58.zip frameworks_base-e20c9e0264190f94324197a8271cf03811a4ca58.tar.gz frameworks_base-e20c9e0264190f94324197a8271cf03811a4ca58.tar.bz2 |
Fix an event injection bug when the policy is bypassed.
Added the concept of a "trusted" event to distinguish between events from
attached input devices or trusted injectors vs. other applications.
This change enables us to move certain policy decisions out of the
dispatcher and into the policy itself where they can be handled more
systematically.
Cherry pick of b931a1b4 from gingerbread into master.
Change-Id: I700a5f07b8b227878cea9437a289a45a245c0424
Diffstat (limited to 'policy')
-rwxr-xr-x | policy/src/com/android/internal/policy/impl/PhoneWindowManager.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 68e0e32..449bd4c 100755 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -1123,6 +1123,10 @@ 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); @@ -1149,7 +1153,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (!down) { mHomePressed = false; - if (! canceled) { + if (!canceled) { // If an incoming call is ringing, HOME is totally disabled. // (The user is already on the InCallScreen at this point, // and his ONLY options are to answer or reject the call.) @@ -1831,7 +1835,14 @@ 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); + } + final boolean isWakeKey = (policyFlags & (WindowManagerPolicy.FLAG_WAKE | WindowManagerPolicy.FLAG_WAKE_DROPPED)) != 0; |