Commit Graph

1315 Commits

Author SHA1 Message Date
Jamie Gennis
5c0c93a8c4 SurfaceTexture: disallow unsupported uses.
This change makes the ANativeWindow_lock NDK function error out if it is
passed an ANativeWindow with a concrete type that is not Surface.  It
also makes eglCreateWindowSurface fail if it is passed a
SurfaceTextureClient as its 'window' argument.

Bug: 4087277
Change-Id: Ie68c50c52d88f72d8a387f6c094908044c83a88c
2011-03-15 10:37:37 -07:00
Jamie Gennis
96e0873907 am adf565f0: am 1a0452b7: am 122dd099: Merge "SurfaceTexture: fix transform matrix computation." into honeycomb-mr1
* commit 'adf565f02676a8f41b572d23123695e732ffd321':
  SurfaceTexture: fix transform matrix computation.
2011-03-14 17:51:48 -07:00
Jamie Gennis
bae774eb20 SurfaceTextureClient: Add ISurfaceTexture getter.
This change adds a getter method to SurfaceTextureClient to get the
ISurfaceTexture object with which the SurfaceTextureClient is
communicating.

Bug: 4086509
Change-Id: Ifec621e0fe5392a5be56b2348fdc54067cbebcdd
2011-03-14 17:47:11 -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
Jamie Gennis
827ebdbbff Merge "SurfaceTexture: fix transform matrix computation." into honeycomb-mr1 2011-03-14 17:42:48 -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
Jamie Gennis
d99c088f35 SurfaceTexture: fix transform matrix computation.
This change fixes the transform matrix computation in SurfaceTexture
when a crop rectangle is specified by the image producer.  It also adds
a test for this case as well as a basic test for the uncropped case.

Bug: 4070775
Change-Id: I1481c9ce9d08fe7f2bff86d3afdeab7d4002b157
2011-03-14 11:30:16 -07:00
Jamie Gennis
c2cc1b3f97 Merge "SurfaceFlinger: Respect the PROTECTED gralloc bit." into honeycomb-mr1 2011-03-10 18:06:32 -08:00
Jamie Gennis
7a4d0dfd43 SurfaceFlinger: Respect the PROTECTED gralloc bit.
This change makes SurfaceFlinger treat layers for which the active
buffer has the GRALLOC_USAGE_PROTECTED bit set as if they have the
'secure' flag set.

Change-Id: Ic60b6513a63e4bb92ec6ce9fd12fd39b4ba5f674
Bug: 4081304
2011-03-10 16:25:48 -08: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
Mathias Agopian
18570db84e am 33029221: Merge "revert the surface purgatory list and dependent changes." into gingerbread
* commit '33029221619f14577bd0d0e7c2f815abc8f1b8ea':
  revert the surface purgatory list and dependent changes.
2011-03-09 17:11:10 -08:00
Mathias Agopian
f7662afb76 revert the surface purgatory list and dependent changes.
6d0f6cb Revert "Fix [3513017] in lockscreen but showing empty launcher (live wallpaper) only"
6154412 Revert "partially fix [3306150] HTML5 video with H/W acceleration blackout (DO NOT MERGE)"
37c2a37 fix [3408713] Dialog window invisible sometimes

It looks like there is a surface leak, it's unclear where it is.
Without those reverts, this would cause a leak of the associated buffers
which is far more problematic. this change might hide the surface leak.

Bug: 4078032
Change-Id: Iedcda3ffcdd2f69d41047b5c3134c1e867ff90d7
2011-03-09 17:00:41 -08:00
Jamie Gennis
ec8a5ef78d Merge "ANativeWindow: add queues-to-window-composer check." into honeycomb-mr1 2011-03-09 14:47:56 -08:00
Jamie Gennis
134f042286 ANativeWindow: add queues-to-window-composer check.
This change adds a new 'method' to the ANativeWindow interface to check
whether buffers queued to the window will be sent directly to the system
window compositor.

Change-Id: I4d4b199e328c110b68b250029aea650f03c8724d
Bug: 3495535
2011-03-08 16:49:51 -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
e572319eaf am e23c235c: Merge "Only set KeyEvent long press flag when repeat count equals 1." into gingerbread
* commit 'e23c235c662c3028cfb080c6ed60d7defcdd0b69':
  Only set KeyEvent long press flag when repeat count equals 1.
2011-03-03 15:03:26 -08:00
Jeff Brown
ec7fb80775 Only set KeyEvent long press flag when repeat count equals 1.
This fixes a Gingerbread regression.

Bug: 3507021
Change-Id: Ia6030665b6a406332adc0ee0d8ee3cb735338c8e
2011-03-02 20:49:06 -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
Jamie Gennis
ea72db3737 Merge "Add the MIN_UNDEQUEUED_BUFFERS query to ANW." 2011-03-01 14:38:20 -08:00
Mathias Agopian
26f429d60e Merge "surfaceflinger_client: Don't dereference NULL ptrs." 2011-02-28 12:50:25 -08:00
Jamie Gennis
9d4d6c101d Add the MIN_UNDEQUEUED_BUFFERS query to ANW.
This change adds a new query to ANativeWindow for getting the minimum
number of buffers that must be left un-dequeued during the steady-state
operation of the ANativeWindow.

Change-Id: Ie8c461fc26b02ecde02ddb4f95bf763662cf1551
Related-Bug: 3356050
2011-02-28 12:24:40 -08:00
Jamie Gennis
bd9cbc3b55 surfaceflinger_client: Don't dereference NULL ptrs.
This change adds a null pointer check before dereferencing buffers in
a Surface list of known GraphicBuffer objects.  If not all the buffers
have been dequeued before this list can legitimately contain NULL
entries.

Change-Id: I0e105b53a3f6f9a5404716b7bf150c793ff648a6
2011-02-27 18:43:17 -08:00
Mathias Agopian
32bebb0a58 Fix sp<> conversion operator / constructor
some of the conversion operators were not using the proper
pointer type when calling incStrong/decStrong, usually it
has no bad consequences, but for some implementation
of the ref-counted object it could lead to recording the wrong
owner id.

Change-Id: If574b9069b8a4cf6e0911a992c8f095aba799995
2011-02-25 16:20:52 -08:00
Mathias Agopian
da26c6662d Merge "Fix some issues with RefBase debugging." 2011-02-24 16:23:51 -08:00
Glenn Kasten
3477a8cff2 Merge "Bug 3362814 Fix SMP race in access to mRequestExit" 2011-02-24 10:01:31 -08:00
Mathias Agopian
f14a1046e7 Fix some issues with RefBase debugging.
First slipt sp<> out of RefBase into StrongPointer.h so it can be reused
more easily and to make it clear that it doesn't require RefBase.

Note: the rest of the change only affects the system when DEBUG_REFS is enabled.

The main problem we fix here is that the owner id associated with each
reference could get out of date when a sp<> or wp<> was moved, for
instance when they're used in a Vector< >.

We fix this issue by calling into RefBase::moveReferences from
a template specialization for sp<TYPE> and wp<TYPE> of the
type helpers. RefBase::moveReferences() has then a chance to
update the owner ids.

There is a little bit of trickery to implement this generically in
RefBase, where we need to use a templatized functor that can turn
a sp<TYPE>* casted to a void* into a RefBase*.

Introduced a new debug option DEBUG_REFS_FATAL_SANITY_CHECKS
currently set to 0 by default as there seem to be an issue
with sp<ANativeWindow> which trips the sanity checks.

Change-Id: I4825b21c8ec47d4a0ef35d760760ae0c9cdfbd7f
2011-02-23 22:21:41 -08:00
Glenn Kasten
7e453a51a5 Bug 3362814 Fix SMP race in access to mRequestExit
Also fix an unlikely SMP race in access to mHoldSelf on entry to _threadLoop.

Change-Id: I6cbc0b94739c7dd5e77e8a5ba0da22cdc0b1a4db
2011-02-23 17:49:59 -08:00
Mathias Agopian
a08ef4932f Remove RefBase.h dependency on TextOutput.h
Change-Id: I72cd6b98ef82b4868fe1c8ec87862cf43fb4ee73
2011-02-22 18:08:58 -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
a1e5401add Merge "Add support for arbitrary axes in MotionEvents." 2011-02-16 20:00:21 -08:00
Kenny Root
af1cf07134 Clean up use of HAVE_ANDROID_OS
HAVE_ANDROID_OS was defined as "1" for targets, but never defined as "0"
for non-targets. Changing them to #ifdef should be safe and matches
all the other uses of HAVE_ANDROID_OS throughout the system.

Change-Id: I82257325a8ae5e4e4371ddfc4dbf51cea8ea0abb
2011-02-16 10:56:32 -08:00
Mathias Agopian
7266fb76c9 allow root to call into surfaceflinger
this is useful for running standalone tests
with standalone SurfaceFlinger.

Change-Id: I08d054f6214affa3a777a82765f4e0bd256ba26d
2011-02-15 19:27:47 -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
Jamie Gennis
e839fdad46 am c7839751: am c2efcd2c: Merge "Initialize the SurfaceTexture transform fields." into honeycomb
* commit 'c7839751aa1de52e0c3aab7dd1518b0fc8f2ee0a':
  Initialize the SurfaceTexture transform fields.
2011-02-07 13:47:02 -08:00
Jamie Gennis
6647e201e3 am c2efcd2c: Merge "Initialize the SurfaceTexture transform fields." into honeycomb
* commit 'c2efcd2ceadab33b42d938e3771c994816e9a4b0':
  Initialize the SurfaceTexture transform fields.
2011-02-04 15:05:28 -08:00
Jamie Gennis
f73935bb0d Initialize the SurfaceTexture transform fields.
Change-Id: I2c25f15949253a1dbe493fef440e5ef118c40e71
related-bug: 3426067
2011-02-04 13:46:38 -08:00
Jamie Gennis
08b4ea31a8 am 421d94c2: am ecb4b3f0: Merge "Pass the IGraphicBufferAlloc to SurfaceTextureClient." into honeycomb
* commit '421d94c20321e1de528416b279bf148baba47b39':
  Pass the IGraphicBufferAlloc to SurfaceTextureClient.
2011-02-02 16:21:24 -08:00
Jamie Gennis
d7a3ebe031 am ecb4b3f0: Merge "Pass the IGraphicBufferAlloc to SurfaceTextureClient." into honeycomb
* commit 'ecb4b3f02340e21eefabbea78559e85ec7ee0089':
  Pass the IGraphicBufferAlloc to SurfaceTextureClient.
2011-02-02 15:56:20 -08:00
Jamie Gennis
1b20cde313 Pass the IGraphicBufferAlloc to SurfaceTextureClient.
This change passes a reference to the IGraphicBufferAlloc binder object
to SurfaceTextureClient objects.  When STC objects are created they
query their associated ISurfaceTexture object for the
IGraphicBufferAlloc that the SurfaceTexture uses to allocate buffers.
Having the SurfaceTextureClient hold this reference prevents the
GraphicBufferAlloc in SurfaceFlinger from freeing the allocated buffers
before the SurfaceTextureClient is done with them.

Change-Id: Ib8e30e8b37fdd60438cbb4cb7e9174d0ba6d661c
related-bug: 3362519
2011-02-02 15:31:47 -08:00
Jamie Gennis
0eb8851e8c Clear GL errors before updating a SurfaceTexture.
Change-Id: Ibdac657ae9e9ccae53c63abed9caf1f1513915c2
2011-01-31 15:35:29 -08:00
Jean-Baptiste Queru
d45c61dfcf am 1314bdb2: am e88fa50b: Merge from open-source gingerbread
* commit '1314bdb2b22ae3613c3e08ae278dbc70f90b965c':
  fix failing thread object run
2011-01-30 16:32:44 -08:00
Jean-Baptiste Queru
9bfc45e3c3 am e88fa50b: Merge from open-source gingerbread
* commit 'e88fa50be8d6709ef58b7aeb01c5efa059bcac2e':
  fix failing thread object run
2011-01-30 16:19:59 -08:00
Jean-Baptiste Queru
02bac86968 Merge from open-source gingerbread
Change-Id: I56f2ed37187796807fbf0de15274a85164f9432c
2011-01-30 15:30:03 -08:00
Jamie Gennis
c043fa28b9 am 62884505: Merge "Reset ANativeWindow crop on buffer geometry changes." into honeycomb
* commit '628845056282a0c5b1a212ce5aeeaac092b91ec8':
  Reset ANativeWindow crop on buffer geometry changes.
2011-01-30 15:03:03 -08:00
Jamie Gennis
da04384f18 Merge "Reset ANativeWindow crop on buffer geometry changes." into honeycomb 2011-01-30 15:00:44 -08:00
The Android Open Source Project
b36560f33e Mass merge from gingerbread - do not merge
Change-Id: I45dc3596bf4211d8f91c64f2d1d00588878df629
2011-01-30 12:40:38 -08:00
Dianne Hackborn
402960177f am a1f5e82f: am a30063d8: am 25eb0464: Merge "Normalize output from aapt d"
* commit 'a1f5e82f37c77af7b1d630b5bca715d1742f1234':
  Normalize output from aapt d
2011-01-29 23:07:48 -08:00
Dianne Hackborn
a8eea2f3d9 am a30063d8: am 25eb0464: Merge "Normalize output from aapt d"
* commit 'a30063d80c08434ac3c7316f338c6d54110449ab':
  Normalize output from aapt d
2011-01-29 23:04:50 -08:00
Dianne Hackborn
73431999ab Merge "Normalize output from aapt d" 2011-01-29 22:53:20 -08:00
Jamie Gennis
68f9127e88 Reset ANativeWindow crop on buffer geometry changes.
This changes the ANativeWindow API and the two implementations to reset
the window's crop rectangle to be uncropped when the window's buffer
geometry is changed.

Bug: 3359604
Change-Id: I64283dc8382ae687787ec0bebe6a5d5b4a0dcd6b
2011-01-28 18:21:54 -08:00
Jamie Gennis
e8c431b142 am 2a8f8d57: Merge "Quiet the SurfaceFlingerClient dequeueBuffer error." into honeycomb
* commit '2a8f8d57d23a171eaa367faa143f45fdd2f9cc1c':
  Quiet the SurfaceFlingerClient dequeueBuffer error.
2011-01-28 14:15:44 -08:00
Jamie Gennis
155c93ad47 Merge "Quiet the SurfaceFlingerClient dequeueBuffer error." into honeycomb 2011-01-28 14:12:57 -08:00
Jamie Gennis
749172269a Quiet the SurfaceFlingerClient dequeueBuffer error.
This is a temporary WAR for the case where dequeueBuffer is called when
all the buffers owned by a SurfaceTexture are not available - either
they're the current texture buffer or the next one.  Currently, an error
is returned in that case, and this change just prevents that error from
being logged.  In the future this will be fixed to not return an error
in that case.

Bug: 3356050
Change-Id: Ic6cc304881a63ce134cfd0bcb4265e3e3fa94b6a
2011-01-28 12:08:18 -08:00
Dianne Hackborn
311559851f am 256a09b2: Merge "Fix issue #3392073: At times soft keyboard comes up in..." into honeycomb
* commit '256a09b2fa5cc06775818428de771c7957403452':
  Fix issue #3392073: At times soft keyboard comes up in...
2011-01-27 22:50:56 -08:00
Dianne Hackborn
11e0746577 Fix issue #3392073: At times soft keyboard comes up in...
...gallery while attaching picture to gmail message

In various places we could block switching the IME target incorrectly.

Change-Id: I7e647fb35f4ea6f2e39eb7efd911420ea9ee64fa
2011-01-27 21:56:33 -08:00
Mathias Agopian
830423f797 am 72abf01a: Merge "Fix the ISurfaceComposer onTransact switch." into gingerbread
* commit '72abf01a8b6958ac1f86d36302a8462c4f51fd9d':
  Fix the ISurfaceComposer onTransact switch.
2011-01-27 11:24:33 -08:00
Ritu Srivastava
5ee1a0c5ee fix failing thread object run
A previously exited Thread object refuses to run again, if the
thread-id of the caller, conincides with the thread-id it previously
used in the worker thread. Hence reset the previously used worker
thread-id to -1 when it exits.

 Signed-off-by: Ritu Srivastava <rsrivast@sta.samsung.com>

Change-Id: I873925c312a43ec8a16392b98cc959042ff6bfd2

Signed-off-by: Madan Ankapura <mankapur@sta.samsung.com>
2011-01-25 21:48:54 -08:00
Mathias Agopian
275e627ef6 am 239fd805: Merge "fix [3361121] hang in glClear() - device unresponsive, OTA fails (DO NOT MERGE)" into gingerbread
* commit '239fd805ef7c0e4116b0a89e20caaf287e91f017':
  fix [3361121] hang in glClear() - device unresponsive, OTA fails (DO NOT MERGE)
2011-01-25 14:46:40 -08:00
Mathias Agopian
c92ba8851e am 1955a5c9: Merge "partially fix [3306150] HTML5 video with H/W acceleration blackout (DO NOT MERGE)" into gingerbread
* commit '1955a5c9da421dc89bb1a1dd3d3193159192cde9':
  partially fix [3306150] HTML5 video with H/W acceleration blackout (DO NOT MERGE)
2011-01-25 14:46:35 -08:00
Mathias Agopian
59f71e7feb am d3fcd0a1: Merge "minor clean-up. SurfaceFlinger doesn\'t need libpixelflinger.so. (DO NOT MERGE)" into gingerbread
* commit 'd3fcd0a1c923498921107bb44fbc8b24582a170a':
  minor clean-up. SurfaceFlinger doesn't need libpixelflinger.so. (DO NOT MERGE)
2011-01-25 14:46:22 -08:00
Mathias Agopian
d1a99ec6b2 fix [3361121] hang in glClear() - device unresponsive, OTA fails (DO NOT MERGE)
Generally we never want to lock a buffer for write access if it is at
the "head" on the surfaceflinger side. The only exception (1) is when
the buffer is not currently in use AND there is at least one queued
buffer -- in which case, SurfaceFlinger will never use said buffer
anymore, because on the next composition around, it will be able to
retire the first queued buffer.

The logic above relies on SurfaceFlinger always retiring
and locking a buffer before composition -- unfortunately this
didn't happen during a screenshot.

This could leave us in a situation where a buffer is locked by the
application for write, and used by SurfaceFlinger for texturing,
causing a hang.

Here, we fix this issue by never assuming the exception (1), it was
intended as an optimization allowing ANativeWindow::lockBuffer() to
return sooner and was justified when most of SF composition was
done in software. The actual buffer locking is now ensured by
gralloc. We could have handled screenshots in a similar way to
a regular composition, but it could have caused glitches on screen,
essentially, taking a screenshot could cause to skip a frame.

now that we removed the notion of a "inUse" buffer in surfaceflinger
a lot of code can be simplified / removed.

noteworthy, the whole concept of "unlockClient" wrt. "compositionComplete"
is also gone.
2011-01-25 14:19:13 -08:00
Mathias Agopian
53a67e1663 partially fix [3306150] HTML5 video with H/W acceleration blackout (DO NOT MERGE)
We used to guarantee that a layer in SurfaceFlinger would never be
destroyed before all references (to its ISurface) on the client
side would be released. At some point, this guarantee got
relaxed to allow to free gralloc resources sooner. This last
change was incorrect, because:
- in implementations with reference-counting the gralloc resources
wouldn't be released anyways, until all the mapping were gone
- in implementations without ref counting, the client side
would most likely crash or do something bad
- it also caused the SharedBufferStack slot to be reallocated
to another surface, which could be problematic if the client
continued to use the surface after the window manager destroyed it.

So, we essentially reinstate the guarantee that layers won't be
destroyed until after all references to their ISurface are
released.

NOTE: This doesn't entirely fix 3306150 because there is another
problem there where the Browser continues to use a surface after it
has been destroyed.

also improve SurfaceFlinger 'dumpsys' log

list the purgatory, which shows windows that have been closed,
but for which the client still has references.
2011-01-25 14:19:13 -08:00
Mathias Agopian
a0c6b76173 minor clean-up. SurfaceFlinger doesn't need libpixelflinger.so. (DO NOT MERGE)
Change-Id: I1ddbbbec4fa5b2521ef3787bc28efe1bc90d0060
2011-01-25 14:18:15 -08:00
Jeff Brown
d1de37fdab am 265cf2e7: Merge "Fix getSwitchState."
* commit '265cf2e76bef9ee369a7d43d567a22a0c39355ef':
  Fix getSwitchState.
2011-01-22 21:32:58 -08:00
Mathias Agopian
747104ad43 am 4707dc73: am 72abf01a: Merge "Fix the ISurfaceComposer onTransact switch." into gingerbread
* commit '4707dc73e236b7055644401b73cd30164b7ad157':
  Fix the ISurfaceComposer onTransact switch.
2011-01-21 10:15:34 -08:00
Mathias Agopian
78efe9773e Merge "clean-up unneeded code" into honeycomb 2011-01-20 12:25:26 -08:00
Mathias Agopian
2bd1d95efe clean-up unneeded code
now that we removed the notion of a "inUse" buffer in surfaceflinger
a lot of code can be simplified / removed.

noteworthy, the whole concept of "unlockClient" wrt. "compositionComplete"
is also gone.

Change-Id: I210413d4c8c0998dae05c8620ebfc895d3e6233d
2011-01-20 12:10:11 -08:00
Jeff Brown
cb203b228b Fix getSwitchState.
InputReader::getSwitchState always returns AKEY_STATE_UNKNOWN
because SwitchInputMapper::getSources() returns 0 which cannot
match any source mask including AINPUT_SOURCE_ANY.  As a result
initial lid switch detection is broken.

This change adds a new source constant AINPUT_SOURCE_SWITCH
that indicates that the source has switches.

Change-Id: I5321ecf0ce84f1c2b4535f6c163d3f4dcf9b7a9b
2011-01-19 20:35:47 -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
Mathias Agopian
226b2432b1 am a0bafb47: Merge "Use EGL_NATIVE_VISUAL_ID to select EGLConfig" into gingerbread
* commit 'a0bafb471385767f7c9c91efe7fd828b069b2e97':
  Use EGL_NATIVE_VISUAL_ID to select EGLConfig
2011-01-19 11:33:36 -08:00
Mathias Agopian
af6bba52c9 Merge "Use EGL_NATIVE_VISUAL_ID to select EGLConfig" into gingerbread 2011-01-19 11:31:07 -08:00
Mathias Agopian
ed8a50c9c5 fix [3361121] hang in glClear() - device unresponsive, OTA fails
Generally we never want to lock a buffer for write access if it is at
the "head" on the surfaceflinger side. The only exception (1) is when
the buffer is not currently in use AND there is at least one queued
buffer -- in which case, SurfaceFlinger will never use said buffer
anymore, because on the next composition around, it will be able to
retire the first queued buffer.

The logic above relies on SurfaceFlinger always retiring
and locking a buffer before composition -- unfortunately this
didn't happen during a screenshot.

This could leave us in a situation where a buffer is locked by the
application for write, and used by SurfaceFlinger for texturing,
causing a hang.

Here, we fix this issue by never assuming the exception (1), it was
intended as an optimization allowing ANativeWindow::lockBuffer() to
return sooner and was justified when most of SF composition was
done in software. The actual buffer locking is now ensured by
gralloc. We could have handled screenshots in a similar way to
a regular composition, but it could have caused glitches on screen,
essentially, taking a screenshot could cause to skip a frame.

Change-Id: I1f226b1ebdf6918439b687c2723955d55b842c55
2011-01-18 15:51:30 -08:00
Jeff Brown
98e88a7d7a am 41395459: Merge "Filter virtual keys after touches. (DO NOT MERGE)" into gingerbread
* commit '41395459e676cf9ab4059e08446656f145662c2d':
  Filter virtual keys after touches.  (DO NOT MERGE)
2011-01-18 14:38:27 -08:00
Jeff Brown
8fb7545953 Merge "Filter virtual keys after touches. (DO NOT MERGE)" into gingerbread 2011-01-18 14:31:31 -08:00
Mathias Agopian
7ad57ff34f am 72abf01a: Merge "Fix the ISurfaceComposer onTransact switch." into gingerbread
* commit '72abf01a8b6958ac1f86d36302a8462c4f51fd9d':
  Fix the ISurfaceComposer onTransact switch.
2011-01-18 11:26:51 -08:00
Mathias Agopian
788ce5d908 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: Ib85e0974160945d838956b50a3cac4de78618957
2011-01-16 17:57:20 -08:00
Jamie Gennis
238bec1ceb Fix the ISurfaceComposer onTransact switch.
Two of the cases in the ISurfaceComposer onTransact switch statement
were missing 'break' statements at the end, and would fall through to
the next case block. This change adds those break statements.

Change-Id: I6dcc84263d3ea03d94612c667103283846b3dee1
2011-01-16 17:34:07 -08:00
Jamie Gennis
c4d4aeab52 Implement SurfaceTexture frame-available callback.
This change implements the onFrameAvailable callback for the
SurfaceTexture java class.  It includes the C++ SurfaceTexture code as
well as the JNI and Java code to enable the callback.

Change-Id: Ifd8b8e7ad46ee70cba6da1c2e96dab8045d1ea30
2011-01-16 17:28:39 -08:00
Jamie Gennis
a214c64d7f Fix SurfaceTexture transform matrix.
Change-Id: I31520c547cafa5cc85cd0f73883ab3a9ff4648e2
2011-01-16 16:35:01 -08:00
Jamie Gennis
73e8b9e524 Compare GraphicBuffers using handles.
This change fixes a bug in SurfaceTextureClient where GraphicBuffers
were being compared using pointer comparison rather than handles.

Change-Id: Ib8989af94be32d4efd86e020a732f5143088a863
2011-01-15 17:00:06 -08:00
Mathias Agopian
b353fd9746 Merge "Fix error reporting in Surface::cancelBuffer()" into honeycomb 2011-01-14 19:27:32 -08:00
Jeff Brown
9346643577 Make getFallbackAction return false when there is none.
Change-Id: Id17c0f7269e4a228f4e5f11c54614fec508222a2
2011-01-14 17:54:38 -08:00
Mathias Agopian
a317f1ba7f Fix error reporting in Surface::cancelBuffer()
when we validate the surface there, most errors are in fact allowed
because it is legal to cancel a buffer after a surface has been
destroyed (for instance). in that case make sure to not log
error messages as they are very confusing.

Change-Id: Iecdfbaf6d9ee5da54d56cd7ea7a0d430c30934b0
2011-01-14 11:04:34 -08:00
Jamie Gennis
9a78c90cd4 Fix remote GraphicBuffer allocation in SurfaceFlinger.
This change fixes a horrible hack that I did to allow application
processes to create GraphicBuffer objects by making a binder call to
SurfaceFlinger.  This change introduces a new binder interface
specifically for doing this, and does it in such a way that
SurfaceFlinger will maintain a reference to the buffers until the app is
done with them.

Change-Id: Icb240397c6c206d7f69124c1497a829f051cb49b
2011-01-13 12:19:04 -08:00
Jamie Gennis
e5366c567a Add logging to SurfaceTextureClient.
Change-Id: I984c3b9c88f8af613a50138188ff1b770e2de6b4
2011-01-13 12:19:03 -08:00
Jamie Gennis
0579d57502 Merge "Fix a bug in SurfaceTexture::dequeueBuffer." into honeycomb 2011-01-13 12:13:56 -08:00
Eric Laurent
15025254eb Fix issue 3302649.
The cause of the problem is that AudioTrack::start() can fail if it is called from a newly created
thread that has the same ID as the AudioTrack callback thread that has just been stopped and not yet exited.
This is possible as the thread ID used by the Thread class is not the TID.

The fix consists in clearing the thread ID before exiting the thread loop.

Change-Id: I8b5f6a63feeaeb9a01267380e85f6f1456e7aa01
2011-01-12 18:28:25 -08:00
Eric Laurent
2ad398bba5 am bec4abaa: Merge "Fix issue 3302649." into gingerbread
* commit 'bec4abaa12bf6759f354b54119c5524cf9339e7b':
  Fix issue 3302649.
2011-01-12 13:52:42 -08:00
Jamie Gennis
235c424c9a Fix a bug in SurfaceTexture::dequeueBuffer.
This change fixes a bug that allowed the most recently queued buffer to
be returned by dequeueBuffer.  At the next updateTexImage call, the
dequeued buffer would be set as the contents of the texture even though
the client could be writing to it.

Change-Id: I53dc14eed13262475627d5551337df57fd78fe00
2011-01-12 11:28:38 -08:00
Jamie Gennis
f238e28500 Implement crop & transform for SurfaceTexture.
This change adds support for the setCrop and setTransform methods of the
SurfaceTexture C++ class.  The crop and transform for the current
texture will be accessed by applications as a single texture coordinate
transform matrix.

Change-Id: I6482bf96f680e5c175364e848936db3908d6c8f8
2011-01-12 11:28:38 -08:00
Jeff Brown
7bfdb29e53 Filter virtual keys after touches. (DO NOT MERGE)
Adds a new virtualKeyQuietTimeMillis configuration resource that sets
the duration for which virtual keys will be dropped after recent touches
on screen.  The default value is 0; it is intended to be overridden
per device using a resource overlay.

This change is designed to help in two cases:

1. Swipes from touchscreen into virtual key area.
2. Accidental taps in virtual key area while using on-screen keyboard.

Bug: 3089163
Change-Id: Id6733c83c2e2bc8d9553aa0e5c1fd74b741bec6e
2011-01-11 20:56:04 -08:00
Jamie Gennis
67eedd74ab Fix a bug in SurfaceTexture::setBufferCount.
We need to reset mCurrentTexture and mLastQueued in setBufferCount
because it frees all of the buffers associated with the buffer slots.

Change-Id: Ie2f834ec1c07ce7a4ab9b2b5fc5fe8c294010c60
2011-01-09 16:40:06 -08:00
Jamie Gennis
e70d8b4393 Add method logging to the SurfaceTexture C++ class.
Change-Id: Ic05b05428d34c04634ce9fc3f924ff3322bb2da2
2011-01-09 16:40:06 -08:00
Jamie Gennis
3461e0fadf Initialize the SurfaceTexture buffer slots.
Change-Id: I81a562ad897173f33cd6a2127737718a7db610eb
2011-01-09 16:40:06 -08:00
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
Jamie Gennis
4956334065 Add the ISurfaceComposer::createGraphicBuffer IPC.
This change adds a new binder method to the ISurfaceComposer interface.
This IPC is intended to allow SurfaceFlinger clients to allocate gralloc
buffers using SurfaceFlinger as a proxy to gralloc.

Change-Id: Ide9fc283aec5da6268ba62cfed0c3319a50b640d
2011-01-06 13:12:35 -08:00