Commit Graph

239 Commits

Author SHA1 Message Date
Jamie Gennis 8ba32fade1 Add the SurfaceTexture C++ implementation.
This change adds the C++ implementation of SurfaceTexture and related
classes. The goal of this is for a SurfaceTexture to be passed to
camera service or Stagefright in place of a Surface to allow camera
preview or decoded video frames to be streamed to an OpenGL ES texture
that an application can use.

Change-Id: I55c83a7017f1ecb81c9c9e3252cbd118b914296c
2011-01-06 13:20:47 -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
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
Jeff Brown 53c16642e2 Ensure the ShortcutManager uses the correct key character map.
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
2010-11-30 18:50:17 -08:00
Jeff Brown 6688837ff6 Support non-orientation aware keyboards and other devices.
Fixed a bug with dpad keys on external keyboards being rotated
according to the display orientation by adding a new input device
configuration property called "keyboard.orientationAware".

Added a mechanism for overriding the key layout and key character
map in the input device configuration file using the new
"keyboard.layout" and "keyboard.characterMap" properties.

Also added "trackball.orientationAware", "touch.orientationAware" and
"touch.deviceType" configuration properties.

Rewrote the configuration property reading code in native code
so that it can be used by EventHub and other components.

Added basic support for installable idc, kl, and kcm files
in /data/system/devices.  However, there is no provision for
copying files there yet.

Disabled long-press character pickers on full keyboards so that
key repeating works as expected.

Change-Id: I1bd9f0c3d344421db444e7d271eb09bc8bab4791
2010-11-30 17:15:49 -08:00
Joe Onorato ad1894d8df Allow status bar panels to be on top of the status bar.
Change-Id: I3c74ece5f7042e6302717f4263746d59d5447ec9
2010-11-24 10:26:50 -08:00
Jeff Brown a3477c862a Added support for full PC-style keyboards.
BREAKING CHANGE: Redesigned the key character map format to
accomodate full keyboards with more comprehensive suite of modifiers.
Old key character maps will not work anymore and must be updated.
The new format is plain text only and it not compiled to a binary
file (so the "kcm" tool will be removed in a subsequent check-in).

Added FULL keyboard type to support full PC-style keyboards.

Added SPECIAL_FUNCTION keyboard type to support special function
keypads that do not have any printable keys suitable for typing
and only have keys like HOME and POWER

Added a special VIRTUAL_KEYBOARD device id convention that maps
to a virtual keyboard with a fixed known layout.  This is designed
to work around issues injecting input events on devices whose
built-in keyboard does not have a useful key character map (ie.
when the built-in keyboard is a special function keyboard only.)

Modified several places where events were being synthesized
to use the virtual keyboard.

Removed support for the "qwerty" default layout.
The new default layout is "Generic".  For the most part "qwerty"
was being used as a backstop in case the built-in keyboard did
not have a key character map (probably because it was a special
function keypad) and the framework needed to be able to inject
key events anyways.  The latter issue is resolved by using the
special VIRTUAL_KEYBOARD device instead of BUILT_IN_KEYBOARD.

Added the concept of a key modifier behavior so that
MetaKeyKeyListener can distinguish between keyboards that use
chorded vs. toggled modifiers.

Wrote more robust key layout and key character map parsers
to enable support for new keyboard features and user installable
key maps.

Fixed a bug in InputReader generating key ups when keys
are released out of sequence.

Updated tons of documentation.

Currently QwertyKeyListener is being used for full keyboards
with autotext and capitalization disabled.  This mostly works
but causes some problems with character pickers, etc.
These issues will be resolved in subsequent changes.

Change-Id: Ica48f6097a551141c215bc0d2c6f7b3fb634d354
2010-11-18 09:49:03 -08:00
Jean-Baptiste Queru 3f02b88af6 am 5e069074: am a15e4886: Merge "Framebuffer: Support variable number of framebuffers in the UI"
* commit '5e0690745a45f99d12d940dd4aaae814b00a429e':
  Framebuffer: Support variable number of framebuffers in the UI
2010-11-17 17:36:11 -08:00
Jean-Baptiste Queru af10976583 am a15e4886: Merge "Framebuffer: Support variable number of framebuffers in the UI"
* commit 'a15e4886de8f75f3cb137f51743d330414c910e8':
  Framebuffer: Support variable number of framebuffers in the UI
2010-11-17 17:29:48 -08:00
Jeff Brown e33a9ecc25 Enable touch splitting for all windows by default.
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
2010-11-12 14:53:43 -08:00
Jason Bayer af34db4dcb Add new keycodes initially used for GoogleTV devices.
Change-Id: I1b901037d6d401931dd3ec6f7d5e1e6ad165d1c9
2010-11-11 18:36:11 -08:00
Joe Onorato d94206c41d The CHEEK_TOUCH stuff never worked. Remove it.
Bug: 3104906
Change-Id: Ia37236ba1775fc3ec8c111e2e0b85b105e0dea6a
2010-11-08 13:02:58 -08:00
Jeff Brown 8149991234 Tell system server whether the app handled input events.
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
2010-11-08 12:49:43 -08:00
Rodrigo Obregon 71484f2f76 Framebuffer: Support variable number of framebuffers in the UI
This change defines a macro NUM_FRAME_BUFFERS to set
the desired number of framebuffers to be used by the UI,
instead of hard-coding 2 framebuffers.

Aditional logic has been  added to handle the initialization
and destruction of NUM_FRAME_BUFFERS buffers.

Change-Id: I3a4bfec3e0f453432f2ffebf084c00f574d3be46
Signed-off-by: Rodrigo Obregon <robregon@ti.com>
2010-11-03 15:16:18 -05:00
Jeff Brown 7e5660f3e2 Add plumbing for volume mute key.
Full support for the volume mute key will be implemented in a
later change.

Bug: 2912307
Change-Id: I98c27d6360f159c8b7447e04b45f442eff87b38a
2010-11-02 17:31:39 -07:00
Jeff Brown 4c766ccea5 resolved conflicts for merge of df3cccf3 to master
Change-Id: I425496a9fc4e9cbc50ad6938e9dccb14827d9558
2010-10-27 22:18:43 -07:00
Jeff Brown fef5b04203 Drop all dispatcher state when dispatcher is disabled.
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
2010-10-27 18:43:51 -07:00
Jeff Brown bc9f053156 am 2ef36763: am 860c2df4: Merge "Add unit tests for native input and fix bugs identified." into gingerbread
Merge commit '2ef36763700eff5679d6012e7f078c57f1a4c465'

* commit '2ef36763700eff5679d6012e7f078c57f1a4c465':
  Add unit tests for native input and fix bugs identified.
2010-10-24 14:36:23 -07:00
Jeff Brown 3c3cc62e24 Add unit tests for native input and fix bugs identified.
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
2010-10-23 03:52:57 -07:00
Jeff Brown 2659f40403 am f2c40603: am 7689dd49: Merge "Fix bug where home presses were not poking user activity." into gingerbread
Merge commit 'f2c406030874b355ca9e4e67cc0e3aff6103c23e'

* commit 'f2c406030874b355ca9e4e67cc0e3aff6103c23e':
  Fix bug where home presses were not poking user activity.
2010-10-19 09:55:39 -07:00
Jeff Brown 60b5776c87 Add support for calibrating touch position.
Useful for tweaking touch screen alignment without having to modify the
kernel device driver x/y axis bounds.

Change-Id: I6ca43d3c138548f9dfb76aa33150a0c853698fb6
2010-10-18 17:24:49 -07:00
Jeff Brown ef3a823482 Fix bug where home presses were not poking user activity.
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
2010-10-18 14:50:13 -07:00
Jeff Brown 7d8733fc7a am 5f0cbfce: am c1e7b218: Merge "Improve input device calibration format." into gingerbread
Merge commit '5f0cbfcecc4db20f897507c826296b3aac70c592'

* commit '5f0cbfcecc4db20f897507c826296b3aac70c592':
  Improve input device calibration format.
2010-10-16 09:13:13 -07:00
Jeff Brown e68d9e0be4 Add support for secure system overlays.
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
2010-10-15 17:10:55 -07:00
Jeff Brown d9dd44d867 Add support for secure system overlays. (DO NOT MERGE)
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
2010-10-15 16:03:35 -07:00
Jeff Brown 6a817e22e4 Add keycodes and meta-key modifiers to support external keyboards.
Added new key maps for external keyboards.  These maps are intended to
be shared across devices by inheriting the "keyboards.mk" product
makefile as part of the device's product definition.

One of the trickier changes here was to unwind some code in
MetaKeyKeyListener that assumed that only the low 8 bits of the meta key
state were actually used.  The new code abandons bitshifts in favor
of simple conditionals that are probably easier to read anyways.
The special meta key state constants used by MetaKeyKeyListener
are now (@hide) defined in KeyEvent now so as to make it clearer that they
share the same code space even if those codes are not valid for KeyEvents.

The EventHub now takes care of detecting the appropriate key layout
map and key character map when the device is added and sets system
properties accordingly.  This avoids having duplicate code in
KeyCharacterMap to probe for the appropriate key character map
although the current probing mechanism has been preserved for legacy
reasons just in case.

Added support for tracking caps lock, num lock and scroll lock and
turning their corresponding LEDs on and off as needed.

The key character map format will need to be updated to correctly support
PC style external keyboard semantics related to modifier keys.
That will come in a later change so caps lock doesn't actually do
anything right now except turn the shiny LEDs on and off...

Added a list of symbolic key names to KeyEvent and improved the toString()
output for debug diagnosis.  Having this list in a central place in the
framework also allows us to remove it from Monkey so there is one less
thing to maintain when we add new keycodes.

Bug: 2912307
Change-Id: If8c25e8d50a7c29bbf5d663c94284f5f86de5da4
2010-10-15 16:00:07 -07:00
Jeff Brown 6b337e74f0 Improve input device calibration format.
Added support for calibrating touch size for devices that report
size as an area measurement rather than as a width.
Fixed some bugs.

Bug: 3096045
Change-Id: I30a12e73752883516ed054f8af407204bca45814
2010-10-14 21:44:16 -07:00
Jeff Brown b6702e5972 Track input state when transferring touch focus.
Copies the input state to the destination window and sends synthesic
cancelation events to the source window.

Change-Id: Ia75820b0d756ed5d6cd22dce7830251ac85141ed
2010-10-11 18:32:20 -07:00
Jeff Brown 33d54ce97d 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
2010-10-11 17:54:12 -07:00
Jeff Brown d129348647 am 41aabeb5: am 1e6a3a53: Merge "Added more robust tracking and cancelation of events." into gingerbread
Merge commit '41aabeb51305d19747687f246080f44fc2a74435'

* commit '41aabeb51305d19747687f246080f44fc2a74435':
  Added more robust tracking and cancelation of events.
2010-10-11 17:42:30 -07:00
Jeff Brown 1fe6dec097 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.

Change-Id: I4d56fdcdd31aaa675d452088af39a70c4e039970
2010-10-11 16:26:13 -07:00
Jeff Brown 90f0cee685 Added more robust tracking and cancelation of events.
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
2010-10-10 14:45:51 -07:00
Jamie Gennis 309d3bb2f9 Move binder magic from the Surface class to GraphicBuffer.
- Register buffers with Gralloc when unflattening a GraphicBuffer (rather than
doing it in the Surface class).
- Add support for a GraphicBuffer that wraps an android_native_window_t*.

Change-Id: I029ac086111bbac800e5ca37eb505f558b718cd8
2010-10-10 13:09:46 -07:00
Jeff Brown 6d462b1221 am 56364bcd: am 78d15acf: Merge "Make secure views tolerate IME overlays." into gingerbread
Merge commit '56364bcd0d1a1b064db3e83fdb64f948ce5c2ad7'

* commit '56364bcd0d1a1b064db3e83fdb64f948ce5c2ad7':
  Make secure views tolerate IME overlays.
2010-10-07 12:20:45 -07:00
Mathias Agopian e1c290b97d am ff04e97f: am f4619308: Merge "fix [2835280] Add support for cancelling buffers to ANativeWindow" into gingerbread
Merge commit 'ff04e97faf75c435e453d4c1caf7eeac8b9c1ceb'

* commit 'ff04e97faf75c435e453d4c1caf7eeac8b9c1ceb':
  fix [2835280] Add support for cancelling buffers to ANativeWindow
2010-10-06 17:07:39 -07:00
Jeff Brown 35cf0e9854 Make secure views tolerate IME overlays.
Change-Id: I3cf09b9d91045f4d9c558b4aace482a7b0bbd3d8
2010-10-05 12:26:23 -07:00
Mathias Agopian 19957553cb fix [2835280] Add support for cancelling buffers to ANativeWindow
There is a new ANativeWindow::cancelBuffer() API that can be used to
cancel any dequeued buffer, BEFORE it's been enqueued. The buffer is
returned to the list of availlable buffers. dequeue and cancel are not
mutually thread safe, they must be called from the same thread or
external synchronization must be used.

Change-Id: I86cc7985bace8b6a93ad2c75d2bef5c3c2cb4d61
2010-10-04 20:10:11 -07:00
Jeff Brown c0242197ea am ea58d1ba: am e951ef07: Merge "Wait for initial device scan to finish before updating config." into gingerbread
Merge commit 'ea58d1bac2960c1794f048bfa5d1a60b1a3d23a1'

* commit 'ea58d1bac2960c1794f048bfa5d1a60b1a3d23a1':
  Wait for initial device scan to finish before updating config.
2010-10-01 21:49:39 -07:00
Jeff Brown 76025e44e4 am e11b76d3: am f6295b35: Merge "Minor logging changes to input dispatcher to help with debugging." into gingerbread
Merge commit 'e11b76d3efb056edea301d53a354d0730adf3520'

* commit 'e11b76d3efb056edea301d53a354d0730adf3520':
  Minor logging changes to input dispatcher to help with debugging.
2010-10-01 21:49:29 -07:00
Jeff Brown 1ad00e96fe Wait for initial device scan to finish before updating config.
This change narrows the opportunity for a race condition setting the
resource Configuration while devices are being updated.

Change-Id: I58efa563f4129ab0fce7108511d16a99dff7e451
2010-10-01 18:55:43 -07:00
Jeff Brown 2806e381cf Minor logging changes to input dispatcher to help with debugging.
Added dumpsys reporting to EventHub.
Made the formatting a bit clearer.
Added 'Locked' suffix to some internal methods of EventHub.

Change-Id: Ic449560bcce378f6361895d27c66854e9724abb0
2010-10-01 18:05:13 -07:00
Jeff Brown 4adce423e4 am 57fa3e8b: am 9e32a438: Merge "Support haptic feedback for virtual keys defined in key layout." into gingerbread
Merge commit '57fa3e8b4c94125ddb5be015dd7fbde4a458894f'

* commit '57fa3e8b4c94125ddb5be015dd7fbde4a458894f':
  Support haptic feedback for virtual keys defined in key layout.
2010-10-01 17:08:34 -07:00
Jeff Brown 956c0fb238 Support haptic feedback for virtual keys defined in key layout.
Change-Id: I83e4108a87332692e03791dc066206becbc7941f
2010-10-01 15:08:56 -07:00