Commit Graph

195 Commits

Author SHA1 Message Date
Dianne Hackborn
0e8852766d Implement native key pre-dispatching to IMEs.
This significantly re-works the native key dispatching code to
allow events to be pre-dispatched to the current IME before
being processed by native code.  It introduces one new public
API, which must be called after retrieving an event if the app
wishes for it to be pre-dispatched.

Currently the native code will only do pre-dispatching of
system keys, to avoid significant overhead for gaming input.
This should be improved to be smarted, filtering for only
keys that the IME is interested in.  Unfortunately IMEs don't
currently provide this information. :p

Change-Id: Ic1c7aeec8b348164957f2cd88119eb5bd85c2a9f
2010-07-15 22:05:33 -07:00
Jeff Brown
5c1ed84a2d Add support for new input sources.
Added several new coordinate values to MotionEvents to capture
touch major/minor area, tool major/minor area and orientation.

Renamed NDK input constants per convention.

Added InputDevice class in Java which will eventually provide
useful information about available input devices.

Added APIs for manufacturing new MotionEvent objects with multiple
pointers and all necessary coordinate data.

Fixed a bug in the input dispatcher where it could get stuck with
a pointer down forever.

Fixed a bug in the WindowManager where the input window list could
end up containing stale removed windows.

Fixed a bug in the WindowManager where the input channel was being
removed only after the final animation transition had taken place
which caused spurious WINDOW DIED log messages to be printed.

Change-Id: Ie55084da319b20aad29b28a0499b8dd98bb5da68
2010-07-15 18:32:33 -07:00
Jeff Brown
a50ee3ecb3 Don't build framework tests for simulator target.
Change-Id: I70f29c7eb307e4f3ec5702f4eb9d97b4342e2f36
2010-07-14 22:55:02 -07:00
Mathias Agopian
48c3476371 Remove the YV16 format for simplicity's sake.
Change-Id: Iee03d100933ba0c67b13d51e0435be3b4cd953cf
2010-07-14 15:12:05 -07:00
Dianne Hackborn
ce838a265d IME events are now dispatched to native applications.
And also:

- APIs to show and hide the IME, and control its interaction with the app.
- APIs to tell the app when its window resizes and needs to be redrawn.
- API to tell the app the content rectangle of its window (to layout
  around the IME or status bar).

There is still a problem with IME interaction -- we need a way for the
app to deliver events to the IME before it handles them, so that for
example the back key will close the IME instead of finishing the app.

Change-Id: I37b75fc2ec533750ef36ca3aedd2f0cc0b5813cd
2010-07-13 18:36:46 -07:00
Jeff Brown
8575a87b0d Add initial gamepad support.
Change-Id: I0439648f6eb5405f200e4223c915eb3a418b32b9
2010-07-13 17:04:57 -07:00
Dianne Hackborn
9147d11a5f Add ANativeWindow API for directly drawing to the surface bits.
Also other cleanup and fixes:

- We now properly set the default window format to 565.
- New APIs to set the window format and flags from native code.
- Tweaked glue for simpler handling of the "destroy" message.
- Um, other stuff.

Change-Id: Id7790a21a2fa9a19b91854d225324a7c1e7c6ade
2010-07-09 16:58:19 -07:00
Dianne Hackborn
3c5d125ed7 Add new glue code for writing native apps.
This factors out the boiler-plate code from the sample
app to a common glue code that can be used for everyone
writing this style of app: a dedicated app thread that
takes care of waiting for events and processing them.

As part of doing this, ALooper has a new facility to allow
registration of fds that cause ALooper_pollOnce() to return
the fd that has data, allowing the app to drive the loop
without callbacks.  Hopefully this makes some people feel better. :)

Also do some other cleanup of the ALooper API, plus some
actual documentation.

Change-Id: Ic53bd56bdf627e3ba28a3c093faa06a92be522b8
2010-07-08 11:06:59 -07:00
Jeff Brown
f16c26dec9 More native input dispatch work.
Removed old input dispatch code.
Refactored the policy callbacks.
Pushed a tiny bit of the power manager state down to native.
Fixed long press on MENU.
Made the virtual key detection and cancelation a bit more precise.

Change-Id: I5d8c1062f7ea0ab3b54c6fadb058c4d5f5a9e02e
2010-07-03 19:23:01 -07:00
Mathias Agopian
1764c73b55 remove unused YUV formats
Change-Id: Ie84616f842c7e0329d68e67e65a65d510558004b
2010-07-01 21:17:56 -07:00
Dianne Hackborn
e12e3d7692 Merge "Introduce official public NativeWindow type." into gingerbread 2010-06-30 16:05:30 -07:00
Mathias Agopian
05dedd17ec Merge "fix live wallpapers on Droid" into gingerbread 2010-06-30 15:59:02 -07:00
Mathias Agopian
a8f3e4e53c fix live wallpapers on Droid
On omap3 h/w we force opaque formats to RGB_565 instead of RGBX_8888
because the GL driver doesn't support it. RGBX_8888 is always remapped
to RGBA_8888.

Change-Id: I0bfabeb98c8d3a399079e6797cf2a0ee95915324
2010-06-30 15:43:47 -07:00
Dianne Hackborn
4b5e91e482 Introduce official public NativeWindow type.
Not yet hooked up to anything in the NDK, but requires renaming
the existing android_native_window_t type everywhere.

Change-Id: Iffee6ea39c93b8b34e20fb69e4d2c7c837e5ea2e
2010-06-30 15:32:04 -07:00
Jeff Brown
c393eb6cf5 Fix injection of specially intercepted keys like HOME.
This change mainly unwinds a premature optimization in the
dispatch pipeline.
To test HOME injection, run 'adb shell input keyevent 3'.

Change-Id: I1c4b7377c205da7c898014b8b07fc6dc1d46e4dd
2010-06-30 14:41:59 -07:00
Dianne Hackborn
189ed23c10 Implement default key handling for native code.
The native code now maintains a list of all keys that may use
default handling.  If the app finishes one of these keys
without handling it, the key will be passed back off to Java
for default treatment.

Change-Id: I6a842a0d728eeafa4de7142fae573f8c11099e18
2010-06-30 10:49:40 -07:00
Jeff Brown
4036f7f2b4 Fix native input dispatch in the emulator.
Set a default orientation of ROTATION_0.
Added some more careful checks based on whether we have valid
absolute axis information from the driver.
Reset key repeating during configuration changes since the keyboard
device may have been removed.

Change-Id: I685960828acffcb17595fc5683309e8064a76714
2010-06-29 16:52:21 -07:00
Dianne Hackborn
9c7f8186ae Update native activity & event APIs to follow correct conventions.
Change-Id: Ie64fb3a9c68bc9c117fa5621b75d1f609e304e0e
2010-06-29 10:43:54 -07:00
Jeff Brown
50de30a523 Native input event dispatching.
Target identification is now fully native.
Fixed a couple of minor issues related to input injection.
Native input enabled by default, can be disabled by setting
WindowManagerPolicy.ENABLE_NATIVE_INPUT_DISPATCH to false.

Change-Id: I7edf66ed3e987cc9306ad4743ac57a116af452ff
2010-06-28 19:10:54 -07:00
Christopher Tate
d974e00697 Remember to initialize timestamps in the dispatch allocator
Change-Id: I83a2d353c34ff84a7d130e602c6dedc6a5541944
2010-06-23 16:51:07 -07:00
Dianne Hackborn
4d96bb6ae3 First stab at attaching native event dispatching.
Provides the basic infrastructure for a
NativeActivity's native code to get an object representing
its event stream that can be used to read input events.

Still work to do, probably some API changes, and reasonable
default key handling (so that for example back will still
work).

Change-Id: I6db891bc35dc9683181d7708eaed552b955a077e
2010-06-22 11:21:50 -07:00
Mathias Agopian
3f3a74a53a remove unused YUV formats
Change-Id: Id0ae28b1700cf771cdbe0ca27b139d32cab90b2a
2010-06-21 18:22:09 -07:00
Mathias Agopian
b16fa651dd Merge "Added support for the GL_TEXTURE_EXTERNAL target" into gingerbread 2010-06-21 15:11:18 -07:00
Jeff Brown
51d45a710e More native input event dispatching.
Added ANRs handling.
Added event injection.
Fixed a NPE ActivityManagerServer writing ANRs to the drop box.
Fixed HOME key interception.
Fixed trackball reporting.
Fixed pointer rotation in landscape mode.

Change-Id: I50340f559f22899ab924e220a78119ffc79469b7
2010-06-21 13:59:34 -07:00
Jeff Brown
f4a4ec2063 Even more native input dispatch work in progress.
Added more tests.
Fixed a regression in Vector.
Fixed bugs in pointer tracking.
Fixed a starvation issue in PollLoop when setting or removing callbacks.
Fixed a couple of policy nits.

Modified the internal representation of MotionEvent to be more
efficient and more consistent.

Added code to skip/cancel virtual key processing when there are multiple
pointers down.  This helps to better disambiguate virtual key presses
from stray touches (such as cheek presses).

Change-Id: I2a7d2cce0195afb9125b23378baa94fd2fc6671c
2010-06-17 13:27:16 -07:00
Mathias Agopian
0a91775c4d Added support for the GL_TEXTURE_EXTERNAL target
This will allow us to support YUV surfaces.

Change-Id: I2d4da75f1006a5285bdc552695d4caeecccf2183
2010-06-15 17:31:17 -07:00
Jeff Brown
c10612c77a Merge "More work in progress on native events." into gingerbread 2010-06-15 16:44:23 -07:00
Jeff Brown
54bc281639 More work in progress on native events.
Refactored the code to eliminate potential deadlocks due to re-entrant
calls from the policy into the dispatcher.  Also added some plumbing
that will be used to notify the framework about ANRs.

Change-Id: Iba7a10de0cb3c56cd7520d6ce716db52fdcc94ff
2010-06-15 16:43:18 -07:00
Jeff Brown
f69280ef72 Support for multiple tests
The build system enforces some invariants that were being ignored
before.

Change-Id: Ie7675042af7f961a507386c13b2a0b592b591af8
2010-06-14 15:46:08 -07:00
Jeff Brown
66d9df50da Fix include paths.
Change-Id: Ifda45688f9f02710a74d5d7a7d902bacf1441e2e
2010-06-13 19:35:19 -07:00
Jeff Brown
e839a589bf Native input dispatch rewrite work in progress.
The old dispatch mechanism has been left in place and continues to
be used by default for now.  To enable native input dispatch,
edit the ENABLE_NATIVE_DISPATCH constant in WindowManagerPolicy.

Includes part of the new input event NDK API.  Some details TBD.

To wire up input dispatch, as the ViewRoot adds a window to the
window session it receives an InputChannel object as an output
argument.  The InputChannel encapsulates the file descriptors for a
shared memory region and two pipe end-points.  The ViewRoot then
provides the InputChannel to the InputQueue.  Behind the
scenes, InputQueue simply attaches handlers to the native PollLoop object
that underlies the MessageQueue.  This way MessageQueue doesn't need
to know anything about input dispatch per-se, it just exposes (in native
code) a PollLoop that other components can use to monitor file descriptor
state changes.

There can be zero or more targets for any given input event.  Each
input target is specified by its input channel and some parameters
including flags, an X/Y coordinate offset, and the dispatch timeout.
An input target can request either synchronous dispatch (for foreground apps)
or asynchronous dispatch (fire-and-forget for wallpapers and "outside"
targets).  Currently, finding the appropriate input targets for an event
requires a call back into the WindowManagerServer from native code.
In the future this will be refactored to avoid most of these callbacks
except as required to handle pending focus transitions.

End-to-end event dispatch mostly works!

To do: event injection, rate limiting, ANRs, testing, optimization, etc.

Change-Id: I8c36b2b9e0a2d27392040ecda0f51b636456de25
2010-06-13 17:42:16 -07:00
Mathias Agopian
579b3f88d0 allow re-targetting of surfaces
Surfaces can now be parcelized and sent to remote
processes. When a surface crosses a process
boundary, it looses its connection with the
current process and gets attached to the new one.

Change-Id: I39c7b055bcd3ea1162ef2718d3d4b866bf7c81c0
2010-06-08 20:10:02 -07:00
Mathias Agopian
b7e930db17 split surface management from surface's buffers management
Change-Id: If3c5655d1231f8f0c49ba68f972b1b20c93b3f87
2010-06-04 18:57:41 -07:00
Mathias Agopian
49753266d2 fix a bug where fading in/out of opaque 32-bits windows wasn't working
opaque 32-bits windows are now allocated as RGBX_8888 buffers and
SurfaceFlinger always uses GL_MODULATE instead of trying to
optimize to GL_REPLACE when possible (makes no sense on
h/w accelerated GL).

we still have a small hack for devices that don't support
RGBX_8888 in their gralloc implementation where we revert to
RGBA_8888.
2010-06-01 15:57:44 -07:00
Mathias Agopian
5629eb1676 when a zero dimension buffer is allocated, turn the allocation into
a 1x1 buffer instead of Nx1 (or 1xN)

Change-Id: I27eeb15e83e13002dd9405f4e52b54f7dffc0fe7
2010-04-15 15:23:25 -07:00
Mathias Agopian
c8620b60d6 fix [2545826] calling into gralloc with external lock held
Change-Id: I2d0e017382404c684c768a0dd0423d574213f10a
2010-03-25 14:34:49 -07:00
Mathias Agopian
55fa25161a implement connect/disconnect in our native_window_t implementations
the framebuffer implementation doesn't do anything special with this
but the surfaceflinger implementation makes sure the surface is not used
by two APIs simultaneously.

Change-Id: Id4ca8ef7093d68846abc2ac814327cc40a64b66b
2010-03-11 15:06:54 -08:00
Christopher Tate
9855a0575e Calculate bitmask array sizes correctly in the EventHub
We've gotten lucky to date:  the previous calculation of bitmask array
sizes, (maxval+1)/8 only works properly when 'maxval' is one less than
a multiple of 8.  Fortunately, this has either been the case for us,
or there has been sufficient 'unused' space at the end of the defined
max value range that we haven't wound up overreading/overwriting the
allocated buffers.

Change-Id: I563a93a86644ab9f19489565e06c28e06bb53abc
2010-03-04 16:32:32 -08:00
Christopher Tate
2032f98f8c Fix #2489986 : The key bitmask needs to cover all possible keys
Change-Id: Ieebd2f879e6b6fbc0388655dd66f34be89e809a0
2010-03-04 16:00:29 -08:00
Dianne Hackborn
71c3eb2a38 Maybe fix issue #2482201: Paired bluetooth device looks like a qwerty keyboard
We now only consider a device to be a default keyboard if its name
has "-keypad".  A hack, but whatever.

Also add some debug logging for the input state to help identify such
issues in the future.
2010-03-02 17:37:45 -08:00
Mathias Agopian
98e71ddaed remove a dependency of GraphicBuffer (libui) on Parcel (libbinder).
Add a Flattenable interface to libutils which can be used to flatten
an object into bytestream + filedescriptor stream.
Parcel is modified to handle Flattenable. And GraphicBuffer implements
Flattenable.

Except for the overlay classes libui is now independent of libbinder.
2010-02-21 23:27:25 -08:00
Mathias Agopian
b6121422ef Remove a dependency of Region (libui) on Parcel (libbinder). 2010-02-17 20:26:47 -08:00
Mathias Agopian
3db2164051 fix a bug I introduced recently where YUV formats would crash the system 2010-02-16 20:43:39 -08:00
Mathias Agopian
54ed4f6282 get rid off the YUV formats at the libui layer 2010-02-16 17:33:37 -08:00
Mathias Agopian
9cce325fae split libsurfaceflinger_client and libcamera_client out of libui 2010-02-11 13:16:22 -08:00
Wu-cheng Li
1776e77c68 Merge "Remove some logs." 2010-02-10 00:07:36 -08:00
Wu-cheng Li
d5a4f1ff5b Remove some logs. 2010-02-10 13:02:17 +08:00
Wu-cheng Li
a05c822704 Add exposure compensation parameter.
bug:2375993
2010-02-09 18:28:50 +08:00
Wu-cheng Li
391f3f8b5e Add float support for set and get in CameraParameters.
bug:2375989
bug:2375987
2010-01-31 17:03:10 +08:00
Wu-cheng Li
077c40fee3 Add focal length and view angle API.
bug:2375989,2375987
2010-01-30 20:36:04 +08:00