summaryrefslogtreecommitdiffstats
path: root/libs/ui/InputDispatcher.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Mouse pointer integration.Jeff Brown2011-01-041-3710/+0
| | | | | | | | | | Added support for loading the pointer icon from a resource. Moved the system server related bits of the input manager out of libui and into libinput since they do not need to be linked into applications. Change-Id: Iec11e0725b3add2b905c51f8ea2c3b4b0d1a2d67
* Add initial support for cursor-based pointing devices.Jeff Brown2010-12-291-4/+4
| | | | | | | Some parts stubbed out but you can plug in a mouse and move a green cursor around to interact with the UI. Change-Id: I80d597a7f11d3bd92041890f74b3c77326975e6e
* Fix race condition in fallback key processing.Jeff Brown2010-12-091-4/+12
| | | | | | | Need to ensure that the channel is still valid before proceeding. Bug: 3271482 Change-Id: Ia6863cbedd9b53cbc5c9c8815e9ea90bef3d2218
* Add support for fallback keycodes.Jeff Brown2010-12-071-18/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | This change enables the framework to synthesize key events to implement default behavior when an application does not handle a key. For example, this change enables numeric keypad keys to perform their associated special function when numlock is off. The application is informed that it is processing a fallback keypress so it can choose to ignore it. Added a new keycode for switching applications. Added ALT key deadkeys. New default key mappings: - ESC -> BACK - Meta+ESC -> HOME - Alt+ESC -> MENU - Meta+Space -> SEARCH - Meta+Tab -> APP_SWITCH Fixed some comments. Fixed some tests. Change-Id: Id7f3b6645f3a350275e624547822f72652f3defe
* Improve support for external keyboards.Jeff Brown2010-12-021-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | Use Vendor ID, Product ID and optionally the Version to locate keymaps and configuration files for external devices. Moved virtual key definition parsing to native code so that EventHub can identify touch screens with virtual keys and load the appropriate key layout file. Cleaned up a lot of old code in EventHub. Fixed a regression in ViewRoot's fallback event handling. Fixed a minor bug in FileMap that caused it to try to munmap or close invalid handled when released if the attempt to map the file failed. Added a couple of new String8 conveniences for formatting strings. Modified Tokenizer to fall back to open+read when mmap fails since we can't mmap sysfs files as needed to open the virtual key definition files in /sys/board_properties/. Change-Id: I6ca5e5f9547619fd082ddac47e87ce185da69ee6
* Ensure the ShortcutManager uses the correct key character map.Jeff Brown2010-11-301-14/+35
| | | | | | | | | | | | | | | | | The ShortcutManager used to only receive the key code of the key event that triggered the shortcut. This change now provides the shortcut manager with the whole key event so it can look up the associated character using the correct key character map. To make this more efficient, added a mechanism for recycling key events. At the moment it is only used by key events owned by the system process, since clients of the existing API (such as Views) might continue to hold on to key events after dispatch has finished so they would break if the key event were recycled by the framework. Deprecated KeyCharacterMap.BUILT_IN_KEYBOARD. Change-Id: I4313725dd63f2be01c350c005a41c7fde9bc67e8
* Enable touch splitting for all windows by default.Jeff Brown2010-11-121-9/+7
| | | | | | | | | | | New default only applies to applications with targetSdkVersion >= HONEYCOMB. Old applications default to no touch splitting for their windows. In addition, enabled split touch for various system windows. Bug: 3049580 Change-Id: Idc8da9baa2cd8e1e4e76af8967d7b6a5ccb94427
* The CHEEK_TOUCH stuff never worked. Remove it.Joe Onorato2010-11-081-18/+1
| | | | | Bug: 3104906 Change-Id: Ia37236ba1775fc3ec8c111e2e0b85b105e0dea6a
* Tell system server whether the app handled input events.Jeff Brown2010-11-081-13/+46
| | | | | | | | | | Refactored ViewRoot, NativeActivity and related classes to tell the dispatcher whether an input event was actually handled by the application. This will be used to move more of the global default key processing into the system server instead of the application. Change-Id: If06b98b6f45c543e5ac5b1eae2b3baf9371fba28
* Fix a key repeating bug.Jeff Brown2010-11-021-40/+40
| | | | | | | | | | This change fixes a bug in the dispatcher where the window manager policy would incorrectly receive a key repeat count of 0 in the case where the key repeat was generated by the hardware or driver. Long-press on HOME was broken as a result. Bug: 3159581 Change-Id: If0f02662313f5b879a4e566fbb461389e274a550
* am 7ab5d2d9: am a87ea46c: Fix bugs related to cheek event suppression.Jeff Brown2010-11-021-3/+3
|\ | | | | | | | | * commit '7ab5d2d951792c9b1a1e7cfb279280c2d076506f': Fix bugs related to cheek event suppression.
| * Fix bugs related to cheek event suppression.Jeff Brown2010-11-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Two issues: 1. First, due to an inverted conditional in the input dispatcher, we were reporting touches as long touches and vice-versa to the power manager. 2. Power manager user activity cheek event suppression also suppresses touch events (but not long touch or up events). As a result, if cheek event suppression was enabled, touches would not poke the user activity timer. However due to the above logic inversion, this actually affected long touches. Net result, if cheek suppression was enabled in the power manager and you held your thumb on the screen long enough, the phone would go to sleep! Cheek event suppression is commonly turned on when making a phone call. Interestingly, it does not seem to get turned off afterward... This change fixes the logic inversion and exempts touches from the cheek suppression. The reason we do the latter is because the old behavior was actually harmful in other ways too: a touch down would be suppressed but not a long touch or the touch up. This would cause bizarre behavior if you touched the screen while it was dimmed. Instead of brightening immediately, it would brighten either when you lifted your finger or 300ms later, whichever came first. Bug: 3154895 Change-Id: Ied9ccec6718fbe86506322ff47a4e3eb58f81834
* | Fix policy issues when screen is off.Jeff Brown2010-11-011-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rewrote interceptKeyBeforeQueueing to make the handling more systematic. Behavior should be identical except: - We never pass keys to applications when the screen is off and the keyguard is not showing (the proximity sensor turned off the screen). Previously we passed all non-wake keys through in this case which caused a bug on Crespo where the screen would come back on if a soft key was held at the time of power off because the resulting key up event would sneak in just before the keyguard was shown. It would then be passed through to the dispatcher which would poke user activity and wake up the screen. - We propagate the key flags when broadcasting media keys which ensures that recipients can tell when the key is canceled. - We ignore endcall or power if canceled (shouldn't happen anyways). Changed the input dispatcher to not poke user activity for canceled events since they are synthetic and should not wake the device. Changed the lock screen so that it does not poke the wake lock when the grab handle is released. This fixes a bug where the screen would come back on immediately if the power went off while the user was holding one of the grab handles because the sliding tab would receive an up event after screen turned off and release the grab handles. Fixed a couple of issues where media keys were being handled inconsistently or not at all, particularly in the case of the new PAUSE, PLAY and RECORD keys. Bug: 3144874 Change-Id: Ie630f5fb6f128cfdf94845f9428067045f42892c
* | resolved conflicts for merge of df3cccf3 to masterJeff Brown2010-10-271-1/+23
|\ \ | |/ | | | | Change-Id: I425496a9fc4e9cbc50ad6938e9dccb14827d9558
| * Drop all dispatcher state when dispatcher is disabled.Jeff Brown2010-10-271-1/+23
| | | | | | | | | | | | | | | | | | | | | | This patch makes the dispatcher drop all of its state when it is disabled (when the screen turns off). This ensures that the dispatcher does not get stuck thinking a pointer is still down if the screen turned off while the user was touching the display (such as a fat touch while hitting the power button). Bug: 3098344 Change-Id: If50ef5804870aa1acd3179fd4b40e3cda58dd39d
* | Tweak log messages a bit.Jeff Brown2010-10-251-2/+5
| | | | | | | | Change-Id: Ifadf78c1ab8db49106216c70086f98860795c65f
* | am 2ef36763: am 860c2df4: Merge "Add unit tests for native input and fix ↵Jeff Brown2010-10-241-2/+9
|\ \ | |/ | | | | | | | | | | | | | | bugs identified." into gingerbread Merge commit '2ef36763700eff5679d6012e7f078c57f1a4c465' * commit '2ef36763700eff5679d6012e7f078c57f1a4c465': Add unit tests for native input and fix bugs identified.
| * Add unit tests for native input and fix bugs identified.Jeff Brown2010-10-231-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed a bug where we would lose the first touch point when swiping out of the virtual key area. Fixed a bug where we would not send an ACTION_MOVE event in cases where individual pointers went down/up and the remaining pointers actually moved. This is important since many applications do not handle pointer movements during ACTION_POINTER_DOWN or ACTION_POINTER_UP. In the case of ACTION_POINTER_UP the movement was completely lost since all pointers were dispatched using their old location rather than the new location. Improved motion event validation to check for duplicate pointer ids. Added an input source constant that was missing from the NDK api but defined in the framework api. Added a timestamp when reporting added/removed devices in EventHub. Bug: 3070082 Change-Id: I3206a030f43b7616e2f48006e5a9d522c4d92e56
* | am f2c40603: am 7689dd49: Merge "Fix bug where home presses were not poking ↵Jeff Brown2010-10-191-40/+28
|\ \ | |/ | | | | | | | | | | | | | | user activity." into gingerbread Merge commit 'f2c406030874b355ca9e4e67cc0e3aff6103c23e' * commit 'f2c406030874b355ca9e4e67cc0e3aff6103c23e': Fix bug where home presses were not poking user activity.
| * Fix bug where home presses were not poking user activity.Jeff Brown2010-10-181-40/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We now poke user activity twice: once upon dequeueing an event for dispatch and then again just before we dispatch it. The second poke is to compensate for the fact that it can take a few seconds to identify the dispatch target (if the application is responding slowly) but we want to keep the display from going to sleep for X amount of time after the app gets a chance to actually receive the event. This mirrors pre-Gingerbread behavior. Removed some unnecessary code that filters user activity pokes when sending events to KeyGuard. We don't need this because KeyGuard already tells the power manager to disable user activity. Bug: 3101397 Change-Id: I8c3a77601fdef8f584e84cfdd11aa79da0ff51db
* | am 9e0e0543: am 36e65ffd: Merge "Fix a native crash in input dispatcher when ↵Jeff Brown2010-10-181-1/+1
|\ \ | |/ | | | | | | | | | | | | | | windows are removed." into gingerbread Merge commit '9e0e054388689fd618c84a283c28ee484477b44d' * commit '9e0e054388689fd618c84a283c28ee484477b44d': Fix a native crash in input dispatcher when windows are removed.
| * Fix a native crash in input dispatcher when windows are removed.Jeff Brown2010-10-151-1/+1
| | | | | | | | | | Bug: 3101826 Change-Id: I040838600a6105c8d9f3235025dc0a7b5b27da2e
| * Add support for secure system overlays. (DO NOT MERGE)Jeff Brown2010-10-151-2/+3
| | | | | | | | | | | | | | | | | | | | This change adds a new window type for secure system overlays created by the system itself from non-secure system overlays that might be created by applications that have the system alert permission. Secure views ignore the presence of secure system overlays. Bug: 3098519 Change-Id: I8f8398f4fdeb0469e5d71124c21bedf121bd8c07
* | Add support for secure system overlays.Jeff Brown2010-10-151-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | Manual merge from Gingerbread. This change adds a new window type for secure system overlays created by the system itself from non-secure system overlays that might be created by applications that have the system alert permission. Secure views ignore the presence of secure system overlays. Bug: 3098519 Change-Id: Id876736fd8bf332ff9a5428bde59f5268aa49c3a
* | am 4b255a23: am 03aa28fb: Merge "Improve the input policy handling a bit." ↵Jeff Brown2010-10-131-8/+6
|\ \ | |/ | | | | | | | | | | | | | | into gingerbread Merge commit '4b255a23041225103a6870e77a236f78c2816eda' * commit '4b255a23041225103a6870e77a236f78c2816eda': Improve the input policy handling a bit.
| * Improve the input policy handling a bit.Jeff Brown2010-10-121-8/+6
| | | | | | | | | | | | | | Fixed some issues with Monkeys turning off their own screens. Ook ook! Added some more comments to explain what's going on. Change-Id: Id2bc0466161a642a73ef7ef97725d1c81e984b12
* | am b05632aa: am a28d5aff: Merge "Fix a bug synthesizing cancelation events ↵Jeff Brown2010-10-131-1/+1
|\ \ | |/ | | | | | | | | | | | | | | for motions." into gingerbread Merge commit 'b05632aae37ea3a3573aabf10e6868733546de96' * commit 'b05632aae37ea3a3573aabf10e6868733546de96': Fix a bug synthesizing cancelation events for motions.
| * Fix a bug synthesizing cancelation events for motions.Jeff Brown2010-10-111-1/+1
| | | | | | | | Change-Id: I881c0fa16c1d22c4b1b6cca24deb0105405ff5b0
| * Fix an event injection bug when the policy is bypassed.Jeff Brown2010-10-111-33/+30
| | | | | | | | | | | | | | | | | | | | 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. Change-Id: I4d56fdcdd31aaa675d452088af39a70c4e039970
* | Track input state when transferring touch focus.Jeff Brown2010-10-111-0/+30
| | | | | | | | | | | | | | Copies the input state to the destination window and sends synthesic cancelation events to the source window. Change-Id: Ia75820b0d756ed5d6cd22dce7830251ac85141ed
* | Fix an event injection bug when the policy is bypassed.Jeff Brown2010-10-111-33/+30
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | am 41aabeb5: am 1e6a3a53: Merge "Added more robust tracking and cancelation ↵Jeff Brown2010-10-111-242/+379
|\ \ | |/ | | | | | | | | | | | | | | of events." into gingerbread Merge commit '41aabeb51305d19747687f246080f44fc2a74435' * commit '41aabeb51305d19747687f246080f44fc2a74435': Added more robust tracking and cancelation of events.
| * Added more robust tracking and cancelation of events.Jeff Brown2010-10-101-242/+379
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change fixes several issues where events would be dropped in the input dispatch pipeline in such a way that the dispatcher could not accurately track the state of the input device. Given more robust tracking, we can now also provide robust cancelation of input events in cases where an application might otherwise become out of sync with the event stream due to ANR, app switch, policy decisions, or forced focus transitions. Pruned some of the input dispatcher log output. Moved the responsibility for calling intercept*BeforeQueueing into the input dispatcher instead of the input reader and added support for early interception of injected events for events coming from trusted sources. This enables behaviors like injection of media keys while the screen is off, haptic feedback of injected virtual keys, so injected events become more "first class" in a way. Change-Id: Iec6ff1dd21e5f3c7feb80ea4feb5382bd090dbd9
* | am 56364bcd: am 78d15acf: Merge "Make secure views tolerate IME overlays." ↵Jeff Brown2010-10-071-27/+30
|\ \ | |/ | | | | | | | | | | | | | | into gingerbread Merge commit '56364bcd0d1a1b064db3e83fdb64f948ce5c2ad7' * commit '56364bcd0d1a1b064db3e83fdb64f948ce5c2ad7': Make secure views tolerate IME overlays.
| * Make secure views tolerate IME overlays.Jeff Brown2010-10-051-27/+30
| | | | | | | | Change-Id: I3cf09b9d91045f4d9c558b4aace482a7b0bbd3d8
* | am e11b76d3: am f6295b35: Merge "Minor logging changes to input dispatcher ↵Jeff Brown2010-10-011-51/+77
|\ \ | |/ | | | | | | | | | | | | | | to help with debugging." into gingerbread Merge commit 'e11b76d3efb056edea301d53a354d0730adf3520' * commit 'e11b76d3efb056edea301d53a354d0730adf3520': Minor logging changes to input dispatcher to help with debugging.
| * Minor logging changes to input dispatcher to help with debugging.Jeff Brown2010-10-011-51/+77
| | | | | | | | | | | | | | | | Added dumpsys reporting to EventHub. Made the formatting a bit clearer. Added 'Locked' suffix to some internal methods of EventHub. Change-Id: Ic449560bcce378f6361895d27c66854e9724abb0
| * Fix bug in split touches.Jeff Brown2010-09-281-1/+2
| | | | | | | | Change-Id: I808c2201a06938f82817058059f4ddcc9b1a9ae2
* | Fix bug in split touches.Jeff Brown2010-09-281-1/+2
| | | | | | | | | | | | Cherry-picked down to master. Change-Id: I786761bd6aecc021ae22d8c9a022324f3a9980d1
* | am 26d5786f: am 9c37447e: Merge "Fix pointer index when splitting secondary ↵Jeff Brown2010-09-281-0/+8
|\ \ | |/ | | | | | | | | | | | | | | pointers." into gingerbread Merge commit '26d5786fb1a43d82b40fa908e1220a018b748c93' * commit '26d5786fb1a43d82b40fa908e1220a018b748c93': Fix pointer index when splitting secondary pointers.
| * Fix pointer index when splitting secondary pointers.Jeff Brown2010-09-271-0/+8
| | | | | | | | Change-Id: Ib01e810ea5b64501b1303000bbef0f0a1db2114e
* | Add support for transferring touch focus.Jeff Brown2010-09-271-0/+64
|/ | | | | | Prerequisite for drag and drop. Change-Id: Iedbe93ed0f3e1c4083130fe66b4ba06d416afce0
* Add suuport for splitting touch events across windows.Jeff Brown2010-09-261-320/+562
| | | | | | | | | | This feature is currently used to enable dragging the start and end selection handles of a TextView at the same time. Could be used for other things later. Deleted some dead code in ArrowKeyMovementMethod and CursorControllers. Change-Id: I930accd97ca1ca1917aab8a807db2c950fc7b409
* Fix app switch latency optimization.Jeff Brown2010-09-161-48/+75
| | | | | | This optimization was broken due to recent changes in how ANRs are handled. Change-Id: Ic99248a12755fadac8d4893e7d305b773e038d3d
* Fix input dispatcher regression on launcher drag&drop.Jeff Brown2010-09-161-49/+30
| | | | Change-Id: I40e937bd712cd2ed6cceac95dfd1b8c8e070724f
* Fix NPE when handling certain kinds of ANRs.Jeff Brown2010-09-161-4/+6
| | | | Change-Id: Iccef1852e52c84f6f49d30c491431460a10b33d3
* Make input dispatcher only ANR for foreground windows.Jeff Brown2010-09-151-393/+269
| | | | | | | | | | | | | | Redesigned the input dispatcher's ANR timeout mechanism so it is much closer to Froyo's policy. ANR is only ever signalled if the dispatcher is waiting on a window to finish processing its previous event(s) and there is new pending input. In the old code, we tracked the dispatch timeout separately for each input channel. This was somewhat complicated and also resulted in the situation where applications could ANR long after the user had pushed them into the background. Change-Id: I666ecada0952d4b95f1d67b9f733842b745c7f4b
* Replace epoll() with poll() and rename PollLoop to Looper.Jeff Brown2010-09-141-21/+21
| | | | | | | | | | | | | | | As part of this change, consolidated and cleaned up the Looper API so that there are fewer distinctions between the NDK and non-NDK declarations (no need for two callback types, etc.). Removed the dependence on specific constants from sys/poll.h such as POLLIN. Instead looper.h defines events like LOOPER_EVENT_INPUT for the events that it supports. That should help make any future under-the-hood implementation changes easier. Fixed a couple of compiler warnings along the way. Change-Id: I449a7ec780bf061bdd325452f823673e2b39b6ae
* Input dispatcher ANR handling enhancements.Jeff Brown2010-09-121-424/+1738
| | | | | | | | | | | | | | | | | | | | | | | This change is essentially a rewrite of the main input dispatcher loop with the target identification folded in. Since the input dispatcher now has all of the window state, it can make better decisions about when to ANR. Added a .5 second deadline for processing app switch keys. This behavior predates Gingerbread but had not previously been ported. Fixed some timing inaccuracies in the ANR accounting that could cause applications to ANR sooner than they should have. Added a mechanism for tracking key and motion events that have been dispatched to a window so that appropriate cancelation events can be synthesized when recovering from ANR. This change helps to keep applications in sync so they don't end up with stuck buttons upon recovery from ANRs. Added more comments to describe the tricky parts of PollLoop. Change-Id: I13dffca27acb436fc383980db536abc4d8b9e6f1
* Fix key repeat delay.Jeff Brown2010-09-081-4/+5
| | | | Change-Id: I6216e082324ee29bf50e37acc673350ca5417c4d