50 Commits

Author SHA1 Message Date
Mathias Agopian
69a3ce1eb1 libutils cleanup
Change-Id: Ic069539338ba4097dba9399904f02bbd0296c20e
2012-08-05 12:38:51 -07:00
Nick Kralevich
4b447b91de Add mode when open(O_CREAT) is used.
When creating a new file using open(..., O_CREAT), it is an error
to fail to specify a creation mode. If a mode is not specified, a
random stack provided value is used as the "mode".

This will become a compile error in a future Android change.

Change-Id: I8635e8b69587ed107253870d991c3fcf563ca876
2012-06-26 15:03:38 -07:00
Jeff Brown
78f04a364f am 51df04b9: Port the legacy velocity tracker strategy.
* commit '51df04b93e8e362edd867abd7efaf1659b8b8b82':
  Port the legacy velocity tracker strategy.
2012-06-04 13:13:34 -07:00
Jeff Brown
ba58221769 am a5b06982: Implement a second order integrating VT strategy.
* commit 'a5b0698231459ac5b54cf8e8952ac5c2b2b2198b':
  Implement a second order integrating VT strategy.
2012-06-04 13:13:30 -07:00
Jeff Brown
2fd6baef59 am 18f329e9: Implement a weighted least squares VelocityTracker strategy.
* commit '18f329e9480fca75210bb7496e5b4bc987b4ad8f':
  Implement a weighted least squares VelocityTracker strategy.
2012-06-04 13:13:27 -07:00
Jeff Brown
51df04b93e Port the legacy velocity tracker strategy.
For comparison purposes, port the legacy velocity tracker
algorithm as it behaved prior to ICS.

Bug: 6413587
Change-Id: I7e8e56584dcdb1a3c660ca9d8f9c5bd5d868e449
2012-06-04 12:34:03 -07:00
Jeff Brown
a5b0698231 Implement a second order integrating VT strategy.
Bug: 6413587
Change-Id: I51bc7b8cbff22b10b728fc84ee15370e9984dd55
2012-06-04 12:34:03 -07:00
Jeff Brown
18f329e948 Implement a weighted least squares VelocityTracker strategy.
No change to the default strategy.

Bug: 6413587
Change-Id: I08eb6f9a511e65ad637359b55b5993c26ba93b40
2012-06-04 12:34:03 -07:00
Jeff Brown
767bc6d26c am 1fbbc071: Merge "Implement an integrating VelocityTracker strategy." into jb-dev
* commit '1fbbc0716f9b70c6dcee00c4550757077ef7f7b5':
  Implement an integrating VelocityTracker strategy.
2012-06-03 21:19:16 -07:00
Jeff Brown
7d3fa093bb am f47e76e2: Merge "Make velocity tracker strategy configurable." into jb-dev
* commit 'f47e76e2c78e78e26110786e99548d718d177c32':
  Make velocity tracker strategy configurable.
2012-06-03 21:19:13 -07:00
Jeff Brown
53dd12a668 Implement an integrating VelocityTracker strategy.
This algorithm better tolerates certain kinds of errors in the
touch input than the least squares strategy but it may underestimate
the velocity of accelerating movements.  This algorithm is
mainly of interest as a baseline for testing and comparison with the
least squares algorithm, which remains the default.

Bug: 6413587
Change-Id: I8ddb50084e44875e234717907e5b06d03f59788c
2012-06-03 19:23:58 -07:00
Jeff Brown
9eb7d86181 Make velocity tracker strategy configurable.
This change is very useful for testing purposes because it makes it
easy to compare different implementations to see how they behave.

There is no change to the current default strategy.

Bug: 6413587
Change-Id: I4d8567aa4160571ba9fa397ce419882cd9366749
2012-06-03 19:21:49 -07:00
Jeff Brown
aebfdc231a am e4db99cf: Merge "Detect when pointer has stopped moving." into jb-dev
* commit 'e4db99cf87c47730e80dc1431f07f4f1062c648e':
  Detect when pointer has stopped moving.
2012-05-15 11:31:47 -07:00
Jeff Brown
634ec69aa9 am 08b544c7: Merge "Fix pointer indexing issue in VelocityTracker." into jb-dev
* commit '08b544c7be67343b10a4130611318b8273d06433':
  Fix pointer indexing issue in VelocityTracker.
2012-05-15 11:31:45 -07:00
Jeff Brown
7469f8bb94 am 47a4a50d: Merge "Improve touch event resampling." into jb-dev
* commit '47a4a50df09b5ab76ee06cb8845fe5a02952ec32':
  Improve touch event resampling.
2012-05-15 11:31:32 -07:00
Jeff Brown
e2ec70bf92 am 00ff4748: Merge "More VelocityTracker refactoring." into jb-dev
* commit '00ff47484f8137aa3e59f680ff07d2662cfb4088':
  More VelocityTracker refactoring.
2012-05-15 11:31:08 -07:00
Jeff Brown
90729403d5 Detect when pointer has stopped moving.
Some input devices do not generate ACTION_MOVE events while all
pointers have stopped, thereby lulling the VelocityTracker into
a false sense of complacency.  Before handling the following sample,
reset the VelocityTracker state so as not to be influenced by
earlier samples before the pointer stopped.  The velocity after
stopping is assumed to be discontinuous.

Bug: 6413587
Change-Id: I6387bc036ff141d083d3d17a89e37eeaa3188349
2012-05-14 18:57:05 -07:00
Jeff Brown
dcab190bd2 Fix pointer indexing issue in VelocityTracker.
VelocityTracker was implicitly assuming that the pointer ids in
a MotionEvent were ordered.  That is not necessarily the case
so we need to be careful while copying the pointer coordinates out.

Bug: 6413587
Change-Id: I3b23a954f893eebdf786f2a94207149b092ef036
2012-05-14 18:44:17 -07:00
Jeff Brown
7174a491bc Improve touch event resampling.
Fixed a few bugs related to the id-to-index mapping for
pointer coordinates.

Tightened the bounds on the resampling time interval to
avoid predicting too far into the future.

Only lerp X and Y components of motion events.

Alter the future to satisfy past predictions.  (Rewrite touch
events to conceal obvious discontinuities.)

Added a system property to control whether resampling is enabled
for debugging purposes.

Bug: 6375101
Change-Id: I35972d63278bc4e78148053a4125ad9abeebfedb
2012-05-14 18:31:53 -07:00
Jeff Brown
85bd0d6283 More VelocityTracker refactoring.
Bug: 6413587
Change-Id: Ida1152e7a34d5fe5caab5e6b5e1bc79f6c7a25e6
2012-05-13 16:10:57 -07:00
Jeff Brown
47272c932a am b12b6b51: Merge "Minor refactoring before starting on velocity tracker changes." into jb-dev
* commit 'b12b6b5116e3d76474296b45f570693bb10d6c99':
  Minor refactoring before starting on velocity tracker changes.
2012-05-11 14:06:30 -07:00
Jeff Brown
8a90e6e317 Minor refactoring before starting on velocity tracker changes.
Bug: 6413587
Change-Id: I5eba2bb57193bff78cb3740de5f87aca0b31d154
2012-05-11 12:32:56 -07:00
Jeff Brown
c3cca66404 am 0632b35b: Merge "Improve handling of built-in keyboard." into jb-dev
* commit '0632b35b6828cd4324b3d218c2e38f895e819aad':
  Improve handling of built-in keyboard.
2012-05-01 18:41:00 -07:00
Jeff Brown
daa3753a04 Improve handling of built-in keyboard.
The window manager policy made some incorrect assumptions about the
meaning of the Configuration.keyboard field.  We need to be more
careful about distinguishing between built-in and external keyboards.

Most of this change is to move the determination of the parts of
the Configuration related to input devices into the WindowManagerService
leveraging new features of the InputManagerService to good effect.

Then we plumb through the flag that indicates whether a device
is internal or external so that we can be more particular about
how the lid switch effects changes to the Configuration.

Bug: 6424373
Change-Id: I36a1c22ade35e578955465a25940a33f227b9763
2012-05-01 16:34:20 -07:00
Jean-Baptiste Queru
3e2d59146d resolved conflicts for merge of 13c04786 to jb-dev-plus-aosp
Change-Id: Ib7aa5a768f4606beb2a4387811cfed7c00cbc111
2012-05-01 10:02:02 -07:00
Jean-Baptiste Queru
39b58ba2b2 resolved conflicts for merge of bc2fb7b9 to jb-dev-plus-aosp
Change-Id: I5386585e473201268c6ed8b05e0a16569d434ea2
2012-05-01 09:54:38 -07:00
Jeff Brown
771526c88f Resample touch events on frame boundaries.
Bug: 6375101
Change-Id: I8774e366306bb2b6b4e42b913525bf25b0380ec3
2012-04-27 15:58:42 -07:00
Jeff Brown
8bca94ad83 More work on international keyboards.
Changed the English US keymaps to implement a strict US key map
with no additional ALT functions.

Fixed a bug copying the alias in the InputDevice copy constructor.

Added support for end of line comments in KCM and KL files.

Added the German keyboard layout.

Sorted the keys in the keyboard layout files by physical arrangement
to make it easier to maintain them.

Bug: 6110399
Change-Id: If44d83de5b98f2bf0016cbb8e12264387b286aaa
2012-04-23 16:12:32 -07:00
Jeff Brown
5bbd4b4f5f Get alias for Bluetooth devices.
Bluetooth devices can be renamed by the user.  Make the
input system aware of the user-specified name and transparently
pass it down to applications.  This enables the keyboard
layout picker Settings UI to use device names that are
consistent with what the user set in the Bluetooth UI.

Bug: 6363157
Change-Id: I8eea26ce2c69c2a3f09c8de02e9e847610e0419c
2012-04-20 20:11:12 -07:00
Jeff Brown
9a2bbf680e Improve handling of certain keyboard layout properties.
Automatically choose a default value for the 'number' property
based on the characters that the key can generate.

Don't generate any character when ctrl, alt or meta is
pressed unless the behavior exactly matches the modifier keys
that are pressed.

Simplified the basic keyboard layouts taking into account the
new features.

Bug: 6110399
Change-Id: Ibc0f0b50c2dcf3f962a33ac77c24d2993b77637d
2012-04-18 15:01:57 -07:00
Jeff Brown
4a3862f6b0 Add Dvorak keyboard layout.
Added support for mapping both scan codes and HID usages to
KeyLayoutMap and KeyCharacterMap.  Keyboard overlays can
now influence how key events are mapped to key codes.

Bug: 6110399
Change-Id: I6619fd2d3e1337c55928f89869dbc45b535c7ccf
2012-04-17 18:50:05 -07:00
Jeff Brown
6ec6f79e1a Support loading keyboard layout overlays from resources.
Added the concept of a keyboard layout overlay, which is
a key character map file that has "type OVERLAY".

Added support for loading keyboard layout overlays from
resources dynamically.  The layouts are reloaded whenever they
are changed in the Settings application or an application
is installed.  This is somewhat more aggressive than necessary
so we might want to optimize it later.

Before system-ready, the input system uses just the generic
keyboard layouts that are included on the device system image.
After system-ready, it considers the user's selected keyboard
layout overlay and attempts to load it as necessary.  We need to
wait until system-ready before doing this because we need to
be in a state where it is safe to start applications or access
their resources.

Bug: 6110399
Change-Id: Iae0886d3356649b0d2440aa00910a888cedd8323
2012-04-17 17:56:32 -07:00
Jeff Brown
a47425a13c Add support for input devices that have vibrators.
Added a getVibrator() method to InputDevice which returns a Vibrator
associated with that input device.  Its uses the same API as the
system vibrator which makes it easy for applications to be modified
to use one or the other.

Bug: 6334179
Change-Id: Ifc7f13dbcb778670f3f1c07ccc562334e6109d2e
2012-04-13 17:01:15 -07:00
Jeff Brown
af9e8d3818 Notify applications when input devices change.
This change allows the InputManager to keep track of what input
devices are registered with the system and when they change.
It needs to do this so that it can properly clear its cache of
input device properties (especially the key map!) when changes
occur.

Added new API so that applications can register listeners for
input device changes.

Fixed a minor bug in EventHub where it didn't handle EPOLLHUP
properly so it would spam the log about unsupposed epoll events
until inotify noticed that the device was gone and removed it.

Change-Id: I937d8c601f7185d4299038bce6a2934fe4fdd2b3
2012-04-12 18:54:54 -07:00
Jeff Brown
cc11698319 HID usage should take precedence over scan code.
Change-Id: Ibd8988e3dcc0d64f4019ffe491d9789733f9d243
2012-04-12 10:05:41 -07:00
Jeff Brown
49ccac530b Refactor key code mapping.
Added handling for EV_MSC / MSC_SCAN which typically reports
the HID usage associated with a key.  This will enable key maps
to map keys with HID usages that Linux does not natively recognize.

Removed keyCode and flags fields from EventHub RawEvent since
they don't necessarily make sense in isolation now that we
pay attention to HID usage codes too.

Removed the fallback code for mapping keys and axes.  In practice,
an input device should be self-sufficient.  We should not ever
need to look at the built-in keyboard's key map.  In fact, there
usually isn't a built-in keyboard anyhow.  This code was originally
working around a problem where we weren't loading the key map
for touch screens with virtual keys, which has long since been fixed.

Change-Id: I0a319bdec44be9514f795526347397e94d53a127
2012-04-11 20:28:09 -07:00
Jeff Brown
9f25b7fdf2 Request key maps from input manager service.
Instead of each application loading the KeyCharacterMap from
the file system, get them from the input manager service as
part of the InputDevice object.

Refactored InputManager to be a proper singleton instead of
having a bunch of static methods.

InputManager now maintains a cache of all InputDevice objects
that it has loaded.  Currently we never invalidate the cache
which can cause InputDevice to return stale motion ranges if
the device is reconfigured.  This will be fixed in a future change.

Added a fake InputDevice with ID -1 to represent the virtual keyboard.

Change-Id: If7a695839ad0972317a5aab89e9d1e42ace28eb7
2012-04-10 18:23:58 -07:00
Jeff Brown
e38fdfae91 Add a unique input device descriptor.
The purpose of the input device descriptor is to make it possible
to associate persistent settings for each input device, such as the
keyboard layout.

The descriptor is a hash of the information we have about the
device, such as its vendor id, product id, unique id, name,
or location.

Bug: 6110399
Change-Id: Idb80f946819b3f0dbf4e661bb0a753dbc2b60981
2012-04-06 14:57:19 -07:00
Colin Cross
a982dc05d7 frameworks/base: move Zip* from libandroidfw to libutils
ZipUtils is needed by build/tools, move it from libandroidfw
(frameworks/base) to libutils (frameworks/native).

Change-Id: I2b4b7adcdf68eb25ee7cba5dd3b69eadf0523af3
2012-03-22 18:43:07 -07:00
Jeff Brown
9dc348d756 Merge "Fix spurious ANRs in native activities." 2012-03-13 15:15:48 -07:00
Jeff Brown
2b6c32ca41 Fix spurious ANRs in native activities.
Some native activities experienced ANRs when the input consumer
deferred an input event due to client-side batching.  If the
input channel was fully emptied then the client had no way of
knowing that it should wake up to handle the deferred input event.

This patch also fixes some lock issues in the native activity
input queue implementation.  In at least one error case, it
was possible for a function to exit without releasing the lock.

Bug: 6051176
Change-Id: I4d9d843237e69b9834f8d8b360031b677fcab8c3
2012-03-13 15:00:09 -07:00
Dianne Hackborn
5c6dfeb1fb Fix issue #6054627: resource matching issue of size qualifiers
Resource matching would incorrectly identify two configs with the
same value as better than.

Change-Id: I7297dcf58fd5a43f1a5ff53bb093eeeb2cad090f
2012-03-09 13:17:17 -08:00
Mathias Agopian
08965ec67a fixup hardcoded include paths for new project
Change-Id: Id443ec5c99bb4d7653905f1be1f72a029e0cf087
2012-03-07 19:34:36 -08:00
Mathias Agopian
49d2b1864c move CursorWindow from libbinder to libandroidfw
Change-Id: I3b304e4f74e0d0ec8b20c57296c62449c9a0f792
2012-02-27 18:11:20 -08:00
Mathias Agopian
027692b640 attempt to fix sdk build
Change-Id: I94f32a9a7abccb52487bb9ff5e286faa4acfceff
2012-02-21 16:55:25 -08:00
Mathias Agopian
cbc69718cb another attempt at fixing the linux build
Change-Id: Iac20439fd6eea4682859112e72f051294bc87ef6
2012-02-21 14:34:47 -08:00
Mathias Agopian
30167542cb another attempt to fix the linux build
Change-Id: Ifd4714de7281ffc8a8c90fb25fb34719a19a9b6f
2012-02-21 14:06:21 -08:00
Jean-Baptiste Queru
cd0f3088ef Add stubs for improved compatibility
Change-Id: I77b348b4c592e0b694aabb069812c94b9cb79a00
2012-02-21 13:49:15 -08:00
Mathias Agopian
30c46ad519 attempt to fix linux builds
Change-Id: I46d6f914fdc32dc26cc71bed3399e202f00eeb2a
2012-02-21 13:27:59 -08:00
Mathias Agopian
83c64e6b62 frameworks/base refactoring
create the new libandroidfw from parts of libui and libutils

Change-Id: I1584995616fff5d527a2aba63921b682a6194d58
2012-02-20 22:38:43 -08:00