Commit Graph

360 Commits

Author SHA1 Message Date
Jeff Brown baa44b89ec Remove the simulator target from all makefiles.
Bug: 5010576

Change-Id: I04d722f258951a3078fe07899f5bbe8aac02a8e8
2011-07-11 22:12:16 -07:00
Mathias Agopian 6163091a2c Fix EGLUtils::selectConfigForPixelFormat()
- renderscript now calls EGL directly instead of relying on this function
- surfaceflinger also does its own EGLConfig selection
- selectConfigForPixelFormat stays for legacy reason (many tests use it) but
it now only tries to match the alpha channel of the format rather than the
format itself.

this will allow implementations who don't support the exact formats
defined in the HAL to work properly.

Bug: 4998223

Change-Id: Ic664dfc14d5072a514b6f77a115d1521bfc1578f
2011-07-08 14:37:05 -07:00
Jeff Brown 771e5828e8 Merge "Improve input event consistency invariants." 2011-06-28 20:17:59 -07:00
Jeff Brown 7832080b5a Improve input event consistency invariants.
Fixed some issues where inconsistent streams of events could
be generated by the dispatcher, particularly when switching from
hovering with one device to hovering with another.

Fixed a bug where the touch pad would fail to generate a new
HOVER_MOVE following a tap event.  As a result, the hover event
stream would not resume until the user touched the touch pad
again.

Change-Id: I444dce84641fb12e56a0af84c931520771d6c493
2011-06-28 20:10:40 -07:00
Andy McFadden bae6579eb2 Remove native EventRecurrence parser
Switch over to the new parser.

Bug 4575374

Change-Id: If78d8042fb266182900398f7fc464a048c779966
2011-06-28 07:43:27 -07:00
Jeff Brown 5d99f17e82 am 61220e88: am bbbab26e: am 2c180499: Merge "Revert velocity damping. Bug: 4364920" into honeycomb-mr2
* commit '61220e880ac4d9d76b7fd50744439e68e929c697':
  Revert velocity damping. Bug: 4364920
2011-06-07 17:52:30 -07:00
Jeff Brown 7ca7ba2064 Revert velocity damping.
Bug: 4364920

Velocity damping proved to be a bad idea because it would
cause a significant ramp in velocity at the beginning of
a gesture, instead of the desired smooth behavior.  Oh well.

Change-Id: Ie631946f47ef2492bd71fbed1ab44bbb39a875a8
2011-06-06 20:23:54 -07:00
Jeff Brown 36f49c133e am 56503b8d: am 8186a5f0: am 10c3f367: Merge "Implement pointer acceleration." into honeycomb-mr2
* commit '56503b8ddfe5c82407da32e18061e725f668432d':
  Implement pointer acceleration.
2011-06-03 15:30:33 -07:00
Jeff Brown adab620383 Implement pointer acceleration.
Bug: 4124987
Change-Id: I1f31a28f1594c55302ccabe13fe3ca6d2ff71d50
2011-06-02 14:12:05 -07:00
Jeff Brown d3e6d3e763 Initial checkin of spot presentation for touchpad gestures. (DO NOT MERGE)
Added a new PointerIcon API (hidden for now) for loading
pointer icons.

Fixed a starvation problem in the native Looper's sendMessage
implementation which caused new messages to be posted ahead
of old messages sent with sendMessageDelayed.

Redesigned the touch pad gestures to be defined in terms of
more fluid finger / spot movements.  The objective is to reinforce
the natural mapping between fingers and spots which means there
must not be any discontinuities in spot motion relative to
the fingers.

Removed the SpotController stub and folded its responsibilities
into PointerController.

Change-Id: Ib647dbd7a57a7f30dd9c6e2c260df51d7bbdd18e
2011-05-25 14:37:17 -07:00
Jeff Brown fa785531f7 Coalesce input events that arrive faster than 333Hz. (DO NOT MERGE)
Some drivers report individual finger updates one at a time
instead of all at once.  When 10 fingers are down, this can
cause the framework to have to handle 10 times as many events
each with 10 times as much data.  Applications like
PointerLocation would get significantly bogged down by all
of the redundant samples.

This change coalesces samples that are closely spaced in time,
before they are dispatched, as part of the motion event batching
protocol.

Increased the size of the InputChannel shared memory buffer so
that applications can catch up faster if they accumulate a
backlog of samples.

Change-Id: Ibc6abf8af027d9003011ac75caa12941080caba3
2011-05-25 14:37:16 -07:00
Jeff Brown c5982b7bee Improve VelocityTracker numerical stability. (DO NOT MERGE)
Replaced VelocityTracker with a faster and more accurate
native implementation.  This avoids the duplicate maintenance
overhead of having two implementations.

The new algorithm requires that the sample duration be at least
10ms in order to contribute to the velocity calculation.  This
ensures that the velocity is not severely overestimated when
samples arrive in bursts.

The new algorithm computes the exponentially weighted moving
average using weights based on the relative duration of successive
sample periods.

The new algorithm is also more careful about how it handles
individual pointers going down or up and their effects on the
collected movement traces.  The intent is to preserve the last
known velocity of pointers as they go up while also ensuring
that other motion samples do not count twice in that case.

Bug: 4086785
Change-Id: I95054102397c4b6a9076dc6a0fc841b4beec7920
2011-05-23 17:19:59 -07:00
Jeff Brown 247da72a5b Use touch pad gestures to manipulate the pointer. (DO NOT MERGE)
1. Single finger tap performs a click.
2. Single finger movement moves the pointer (hovers).
3. Button press plus movement performs click or drag.
   While dragging, the pointer follows the finger that is moving
   fastest.  This is important if there are additional fingers
   down on the touch pad for the purpose of applying force
   to an integrated button underneath.
4. Two fingers near each other moving in the same direction
   are coalesced as a swipe gesture under the pointer.
5. Two or more fingers moving in arbitrary directions are
   transformed into touches in the vicinity of the pointer.
   This makes scale/zoom and rotate gestures possible.

Added a native VelocityTracker implementation to enable intelligent
switching of the active pointer during drags.

Change-Id: I7b7ddacc724fb1306e1590dbaebb740d3130d7cd
2011-05-23 17:19:38 -07:00
Jeff Brown e959ed2533 Add initial API for stylus and mouse buttons.
Added the concept of pointer properties in a MotionEvent.
This is currently used to track the pointer tool type to enable
applications to distinguish finger touches from a stylus.

Button states are also reported to application as part of touch events.

There are no new actions for detecting changes in button states.
The application should instead query the button state from the
MotionEvent and take appropriate action as needed.

A good time to check the button state is on ACTION_DOWN.

As a side-effect, applications that do not support multiple buttons
will treat primary, secondary and tertiary buttons identically
for all touch events.

The back button on the mouse is mapped to KEYCODE_BACK
and the forward button is mapped to KEYCODE_FORWARD.

Added basic plumbing for the secondary mouse button to invoke
the context menu, particularly in lists.

Added clamp and split methods on MotionEvent to take care of
common filtering operations so we don't have them scattered
in multiple places across the framework.

Bug: 4260011
Change-Id: Ie992b4d4e00c8f2e76b961da0a902145b27f6d83
2011-05-13 12:11:17 -07:00
Dianne Hackborn db05e228a4 resolved conflicts for merge of 05be6d6f to master
Change-Id: Ic6a6c5bb300f6f1d43f9ed550b284282b4f16212
2011-05-09 19:00:59 -07:00
Dianne Hackborn 16fe3c2c1f Better compat mode part one: start scaling windows.
First step of improving app screen size compatibility mode.  When
running in compat mode, an application's windows are scaled up on
the screen rather than being small with 1:1 pixels.

Currently we scale the application to fill the entire screen, so
don't use an even pixel scaling.  Though this may have some
negative impact on the appearance (it looks okay to me), it has a
big benefit of allowing us to now treat these apps as normal
full-screens apps and do the normal transition animations as you
move in and out and around in them.

This introduces fun stuff in the input system to take care of
modifying pointer coordinates to account for the app window
surface scaling.  The input dispatcher is told about the scale
that is being applied to each window and, when there is one,
adjusts pointer events appropriately as they are being sent
to the transport.

Also modified is CompatibilityInfo, which has been greatly
simplified to not be so insane and incomprehendible.  It is
now simple -- when constructed it determines if the given app
is compatible with the current screen size and density, and
that is that.

There are new APIs on ActivityManagerService to put applications
that we would traditionally consider compatible with larger screens
in compatibility mode.  This is the start of a facility to have
a UI affordance for a user to switch apps in and out of
compatibility.

To test switching of modes, there is a new variation of the "am"
command to do this: am screen-compat [on|off] [package]

This mode switching has the fundamentals of restarting activities
when it is changed, though the state still needs to be persisted
and the overall mode switch cleaned up.

For the few small apps I have tested, things mostly seem to be
working well.  I know of one problem with the text selection
handles being drawn at the wrong position because at some point
the window offset is being scaled incorrectly.  There are
probably other similar issues around the interaction between
two windows because the different window coordinate spaces are
done in a hacky way instead of being formally integrated into
the window manager layout process.

Change-Id: Ie038e3746b448135117bd860859d74e360938557
2011-05-09 17:03:24 -07:00
Iliyan Malchev 697526bc9e frameworks/base: android_native_buffer_t -> ANativeWindowBuffer
Change-Id: Idc2eabaa805bb6d308ebb315872623f28d428417
Signed-off-by: Iliyan Malchev <malchev@google.com>
2011-05-03 16:40:14 -07:00
Iliyan Malchev 41abd67302 frameworks/base: make the ANativeWindow query() method const
query() does not modify the object's data, so it needs to be a const method

Change-Id: I67c40a3c865461e6f1cc2193fd2d74286ff6ac8f
Signed-off-by: Iliyan Malchev <malchev@google.com>
2011-05-03 15:49:40 -07:00
Jeff Brown 4815f2a6ad Initial checkin of spot presentation for touchpad gestures.
Added a new PointerIcon API (hidden for now) for loading
pointer icons.

Fixed a starvation problem in the native Looper's sendMessage
implementation which caused new messages to be posted ahead
of old messages sent with sendMessageDelayed.

Redesigned the touch pad gestures to be defined in terms of
more fluid finger / spot movements.  The objective is to reinforce
the natural mapping between fingers and spots which means there
must not be any discontinuities in spot motion relative to
the fingers.

Removed the SpotController stub and folded its responsibilities
into PointerController.

Change-Id: I5126b1e69d95252fda7f2a684c9287e239a57163
2011-04-19 15:35:51 -07:00
Jeff Brown 4e394b18ba Coalesce input events that arrive faster than 333Hz.
Some drivers report individual finger updates one at a time
instead of all at once.  When 10 fingers are down, this can
cause the framework to have to handle 10 times as many events
each with 10 times as much data.  Applications like
PointerLocation would get significantly bogged down by all
of the redundant samples.

This change coalesces samples that are closely spaced in time,
before they are dispatched, as part of the motion event batching
protocol.

Increased the size of the InputChannel shared memory buffer so
that applications can catch up faster if they accumulate a
backlog of samples.

Added logging code to help measure input dispatch and drawing
latency issues in the view hierarchy.  See ViewDebug.DEBUG_LATENCY.

Change-Id: Ia5898f781f19901d2225c529a910c32bdf4f504f
2011-04-07 13:11:16 -07:00
Jeff Brown 23e0c8c1a1 Fix dispatcher crash when input monitoring enabled.
Also ensure that we actually log assertion failures.

Bug: 4203092
Change-Id: I5c14bc41b2255f876858121f5572e2de75cabcc3
2011-04-01 16:15:13 -07:00
Mathias Agopian 939fee8819 am e22aa623: am 25594e19: am f40e638e: fix [4093196] Device lock up - log spam with SharedBufferStack: waitForCondition(LockCondition) timed out
* commit 'e22aa62362a3007ee59ac62d4b5969e216987995':
  fix [4093196] Device lock up - log spam with SharedBufferStack: waitForCondition(LockCondition) timed out
2011-03-17 00:13:49 -07:00
Mathias Agopian d0b55c011a fix [4093196] Device lock up - log spam with SharedBufferStack: waitForCondition(LockCondition) timed out
a memory corruption happned when the buffer pool was resized
(like when playing a video or using camera) and there was
no current active buffer. In this case, the faulty code
would index into an array at position -1 which corrupted
24 bytes of data.

also improved region validation code (ifdef'ed out by default)

Bug: 4093196
Change-Id: I915c581d131148959d720e00e3892e9186ab733d
2011-03-17 00:04:42 -07:00
Jeff Brown e3d4a68f2d Merge "Improve VelocityTracker numerical stability." 2011-03-15 20:01:16 -07:00
Jeff Brown 1593354388 Improve VelocityTracker numerical stability.
Replaced VelocityTracker with a faster and more accurate
native implementation.  This avoids the duplicate maintenance
overhead of having two implementations.

The new algorithm requires that the sample duration be at least
10ms in order to contribute to the velocity calculation.  This
ensures that the velocity is not severely overestimated when
samples arrive in bursts.

The new algorithm computes the exponentially weighted moving
average using weights based on the relative duration of successive
sample periods.

The new algorithm is also more careful about how it handles
individual pointers going down or up and their effects on the
collected movement traces.  The intent is to preserve the last
known velocity of pointers as they go up while also ensuring
that other motion samples do not count twice in that case.

Bug: 4086785
Change-Id: I2632321232c64d6b8faacdb929e33f60e64dcdd3
2011-03-15 19:59:47 -07:00
Jamie Gennis cefc876234 am ceb7cb14: am 02805a40: Merge "ANativeWindow: add query for the concrete type." into honeycomb-mr1
* commit 'ceb7cb1460484eda1a3cb9cd271d7caf3a3dcbd1':
  ANativeWindow: add query for the concrete type.
2011-03-15 10:42:06 -07:00
Jamie Gennis 391bbe2246 ANativeWindow: add query for the concrete type.
This change adds a query to the ANativeWindow interface for getting the
concrete type of the ANativeWindow.

Bug: 4086509
Change-Id: I64aa86d72fbca3b52a98e1fc35608737781a3178
2011-03-14 17:47:11 -07:00
Jeff Brown fa773aa745 Use touch pad gestures to manipulate the pointer.
1. Single finger tap performs a click.
2. Single finger movement moves the pointer (hovers).
3. Button press plus movement performs click or drag.
   While dragging, the pointer follows the finger that is moving
   fastest.  This is important if there are additional fingers
   down on the touch pad for the purpose of applying force
   to an integrated button underneath.
4. Two fingers near each other moving in the same direction
   are coalesced as a swipe gesture under the pointer.
5. Two or more fingers moving in arbitrary directions are
   transformed into touches in the vicinity of the pointer.
   This makes scale/zoom and rotate gestures possible.

Added a native VelocityTracker implementation to enable intelligent
switching of the active pointer during drags.

Change-Id: I5ada57e7f2bdb9b0a791843eb354a8c706b365dc
2011-03-14 14:12:03 -07:00
Jeff Brown 46689da7ee Input improvements and bug fixes.
Associate each motion axis with the source from which it comes.
It is possible for multiple sources of the same device to define
the same axis.  This fixes new API that was introduced in MR1.
(Bug: 4066146)

Fixed a bug that might cause a segfault when using a trackball.

Only fade out the mouse pointer when touching the touch screen,
ignore other touch pads.

Changed the plural "sources" to "source" in several places in
the InputReader where we intend to refer to a particular source
rather than to a combination of sources.

Improved the batching code to support batching events from different
sources of the same device in parallel.  (Bug: 3391564)

Change-Id: I0189e18e464338f126f7bf94370b928e1b1695f2
2011-03-09 18:30:28 -08:00
Jeff Brown e89d1041dd Joystick tweaks. (DO NOT MERGE)
Ensure that the joystick can always reach -1.0, 0.0 and 1.0 positions
even when noise filtering is applied.  (Bug: 3514510)

Add support for a few more standard axes.

Add additional mapping modes for axes.
Some axes are inverted from standard interpretation
or are actually intended to be split into two distict axes
such as left/right trigger controls or accelerator/brake.

Add key layout file for a G25 racing wheel and XBox 360 controller
to tweak behavior.  They work fine without them but the axis mappings
are not ideal.

Change-Id: I0fddd90309af4dc14d35f34fe99ed6e521c0b7c7
2011-03-04 19:12:41 -08:00
Jeff Brown d5ed285606 Wake screen from external HID peripherals.
Added some plumbing to enable the policy to intercept motion
events when the screen is off to handle wakeup if needed.

Added a basic concept of an external device to limit the scope
of the wakeup policy to external devices only.  The wakeup policy
for internal devices should be based on explicit rules such as
policy flags in key layout files.

Moved isTouchEvent to native.

Ensure the dispatcher sends the right event type to userActivity
for non-touch pointer events like HOVER_MOVE and SCROLL.

Bug: 3193114
Change-Id: I15dbd48a16810dfaf226ff7ad117d46908ca4f86
2011-03-02 19:57:07 -08:00
Jeff Brown 80f3e7cc15 Fade out the mouse pointer after inactivity or other events.
Fades out the mouse pointer:
- after 15 seconds of inactivity normally
- after 3 seconds of inactivity in lights out mode
- after a non-modifier key down
- after a touch down

Extended the native Looper to support enqueuing time delayed
messages.  This is used by the PointerController to control
pointer fade timing.

Change-Id: I87792fea7dbe2d9376c78cf354fe3189a484d9da
2011-03-02 15:37:57 -08:00
Jeff Brown 25943a83f2 Add new hover move action and scroll wheel plumbing.
Added support for tracking the mouse position even when the mouse button
is not pressed.  To avoid confusing existing applications, mouse movements
are reported using the new ACTION_HOVER_MOVE action when the mouse button
is not pressed.

Added some more plumbing for the scroll wheel axes.  The values are
reported to Views but they are not yet handled by the framework.

Change-Id: I1706be850d25cf34e5adf880bbed5cc3265cf4b1
2011-02-19 06:14:21 -08:00
Jeff Brown 3ea4de826d Add new axes for joysticks and mouse wheels.
Added API on InputDevice to query the set of axes available.
Added API on KeyEvent and MotionEvent to convert keycodes and axes
to symbolic name strings for diagnostic purposes.
Added API on KeyEvent to query if a given key code is a gamepad button.
Added a new "axis" element to key layout files to specify the
mapping between raw absolute axis values and motion axis ids.
Expanded the axis bitfield to 64bits to allow for future growth.
Modified the Makefile for keyboard prebuilts to run the keymap
validation tool during the build.
Added layouts for two game controllers.
Added default actions for game pad button keys.
Added more tests.
Fixed a bunch of bugs.

Change-Id: I73f9166c3b3c5bcf4970845b58088ad467525525
2011-02-19 05:23:10 -08:00
Jeff Brown b2d4435dfa Fix a regression with MotionEvent parceling.
Also added some more unit tests.

Change-Id: I413654294d1a998eec056884e6df5eaa50f3daf4
2011-02-17 13:01:34 -08:00
Jeff Brown 3e3414636c Add support for arbitrary axes in MotionEvents.
This change makes it possible to extend the set of axes that
are reported in MotionEvents by defining new axis constants.

The MotionEvent object is now backed by its C++ counterpart
to avoid having to maintain multiple representations of the
same data.

Change-Id: Ibe93c90d4b390d43c176cce48d558d20869ee608
2011-02-15 19:14:37 -08:00
Mathias Agopian d5ea3db6a3 Use EGL_NATIVE_VISUAL_ID to select EGLConfig
EGLUtils::selectConfigForPixelFormat() now uses EGL_NATIVE_VISUAL_ID
to select a config with the proper format. this is more robust and
future proof.

Change-Id: I7245d904adab1e339f062b9b498ddd9324cfe7a4
2011-01-19 18:21:15 -08:00
Mathias Agopian 48b888aab9 improve SurfaceFlinger 'dumpsys' log
list the purgatory, which shows windows that have been closed,
but for which the client still has references.

Change-Id: I5168bb88cb328d5d77d71d0871deb9190f493126
2011-01-19 16:15:53 -08:00
Jeff Brown 9346643577 Make getFallbackAction return false when there is none.
Change-Id: Id17c0f7269e4a228f4e5f11c54614fec508222a2
2011-01-14 17:54:38 -08:00
Jeff Brown 4125036157 Mouse pointer integration.
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
2011-01-04 17:31:24 -08:00
Jeff Brown 4c501a4217 Add initial support for cursor-based pointing devices.
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
2010-12-29 13:19:53 -08:00
Jeff Brown 7999039b77 Fix race condition in fallback key processing.
Need to ensure that the channel is still valid before proceeding.

Bug: 3271482
Change-Id: Ia6863cbedd9b53cbc5c9c8815e9ea90bef3d2218
2010-12-09 18:14:23 -08:00
Mathias Agopian 0a757814f3 fix [3259708] Graphic Buffer Mapper does not support YV12
remove a bunch of a code that was there only to support broken gralloc implementations

Change-Id: I3c1a9172224cbcc283601abfbbd695a20815451f
2010-12-08 16:48:28 -08:00
Mathias Agopian a5529c8778 remove support for PUSH_BUFFER surfaces and overlays
the same functionality is now supported through
the h/w composer HAL, and YUV support in the GPU.

Change-Id: I8146605449954b8e8fd7f78810b7d873c2d8f5bf
2010-12-08 16:13:59 -08:00
Erik Gilling 1d21a9cafc surfaceflinger: add support for gralloc dump hooks
Change-Id: Ib6f539ed0132b70d040d653c03d52cc04249ac3c
2010-12-08 15:40:11 -08:00
Jeff Brown 02d85b5021 Add support for fallback keycodes.
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
2010-12-07 17:35:26 -08:00
Mathias Agopian b5a00fcb71 am 48f42f8c: am 4153bf3a: Merge "[3171580] don\'t automatically log GraphicBuffer allocation failures" into gingerbread
* commit '48f42f8c3fbd33b2f46c6290ff5963dd58938cf9':
  [3171580] don't automatically log GraphicBuffer allocation failures
2010-12-07 17:24:03 -08:00
Mathias Agopian 372c56e98b am 4153bf3a: Merge "[3171580] don\'t automatically log GraphicBuffer allocation failures" into gingerbread
* commit '4153bf3a259624a2f2dc497b77b225a1fb517abc':
  [3171580] don't automatically log GraphicBuffer allocation failures
2010-12-07 14:20:09 -08:00
Mathias Agopian 678bdd6349 [3171580] don't automatically log GraphicBuffer allocation failures
some of these failures are not fatal and even expected in some cases
so they should not emit a dump in the log in those cases.

Change-Id: Idcfa252e3bfa9d74e27fe4ad8f8623aa01aa9c5e
2010-12-03 17:33:09 -08:00
Jeff Brown db360642ed Improve support for external keyboards.
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
2010-12-02 16:01:32 -08:00