Commit Graph

913 Commits

Author SHA1 Message Date
Mathias Agopian
000e95e7eb fix the float Rect in OpenGLRenderer to handle NANs
- we want functions like isEmpty() to return true if NANs are
involved in the Rect

- also clean-up the intersect familly of calls

- minor cleanup in the int32_t Rect as well

These played a role in http://b/5331198.

Bug: 5331198

Change-Id: I5369725ab482e4b83da9f1bd4cee5256e5de75b2
2011-09-19 16:50:07 -07:00
Andreas Huber
1d60b9629c A new API "androidGetThreadPriority"
Change-Id: I6baeead8c70460863343fd557250635fb1e6a170
2011-09-16 09:33:22 -07:00
Jeff Brown
73aaf0d8d2 Velocity Tracker II: The Revenge of Velocity Tracker
Bug: 5265529

Rewrote the velocity tracker to fit a polynomial curve
to pointer movements using least squares linear regression.
The velocity is simply the first derivative of this polynomial.

Clients can also obtain an Estimator that describes the
complete terms of the estimating polynomial including
the coefficient of determination which provides a measure
of the quality of the fit (confidence).

Enhanced PointerLocation to display the movement curve predicted
by the estimator in addition to the velocity vector.

By default, the algorithm computes a 2nd degree (quadratic)
polynomial based on a 100ms recent history horizon.

Change-Id: Id377bef44117fce68fee2c41f90134ce3224d3a1
2011-09-14 19:16:37 -07:00
Jeff Brown
137c3c5495 Tweak VelocityTracker.
Bug: 5265529

Calculate the velocity using the most recent touch sample as the
point of reference instead of the oldest.  This change more heavily
weights recent touch samples and reduces the sample time window
used for calculation.  This significantly improves the accuracy
of fling gesture detection.

Change-Id: Ib1940933e786e5f6a731552a99bcd9400741d55f
2011-09-09 16:04:09 -07:00
Mathias Agopian
41b6aabf35 fix Surface positions are not floats
Added Surface.setPosition(float, float) which allows to set a surface's
position in float.

Bug: 5239859
Change-Id: I903aef4ad5b5999142202fb8ea30fe216d805711
2011-08-30 18:51:54 -07:00
Glenn Kasten
940673f92e Merge "Add C++ thread API androidGetThreadSchedulingGroup" 2011-08-29 14:38:52 -07:00
Jamie Gennis
3599bf2c07 SurfaceFlinger: use the HWC gralloc usage bit
This change makes SurfaceFlinger always use the
GRALLOC_USAGE_HW_COMPOSER usage bit when allocating buffers that may be
passed to the HWComposer.

Change-Id: I70362a8ede2b359fb2046853f85149d597465817
2011-08-22 14:56:29 -07:00
Jeff Brown
ecc7adef2e Input system bug fixes, particularly for stylus.
Bug: 5049148

Finished stylus support, including support for indirect stylus
and mouse tools.

Added TILT axis.  When stylus tilt X/Y is available, it is transformed
into an orientation and tilt inclination which is a more convenient
representation and a simpler extension to the exiting API.

Touch devices now only report touch data using a single input
source.  Previously touch devices in pointer mode would report
both absolute touch pad data and cooked pointer gestures.
Now we just pick one.  The touch device switches modes as needed
when the focused application enables/disables pointer gestures.
This change greatly simplifies the code and reduces the load
on the input dispatcher.

Fixed an incorrect assumption that the value of ABS_(MT_)DISTANCE
would be zero whenever the stylus was in direct contact.  It appears
that the correct way to determine whether the stylus is in direct
contact (rather than hovering) is by checking for a non-zero
reported pressure.

Added code to read the initial state of tool buttons and axis values
when the input devices are initialized or reset.  This fixes
problems where the input mapper state might have the wrong initial
state.

Moved responsibility for cancelling pending inputs (keys down,
touches, etc.) to the InputDispatcher by sending it a device reset
notification.  This frees the InputReader from having to synthesize
events during reset, which was cumbersome and somewhat brittle
to begin with.

Consolidated more of the common accumulator logic from
SingleTouchInputMapper and MultiTouchInputMapper into
TouchInputMapper.

Improved the PointerLocation output.

Change-Id: I595d3647f7fd7cb1e3eff8b3c76b85043b5fe2f0
2011-08-19 15:02:26 -07:00
Jamie Gennis
7f7e85898f Merge "SurfaceTexture: fix queues-to-composer" 2011-08-18 14:31:39 -07:00
Jamie Gennis
582270d69d SurfaceTexture: fix queues-to-composer
This change fixes the NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER query of
Surface and SurfaceTextureClient.  Surface now uses the inherited
SurfaceTextureClient implementation of this query.  SurfaceTextureClient
now queries SurfaceFlinger to determine whether buffers that are queued
to its ISurfaceTexture will be sent to SurfaceFlinger (as opposed to
some other process).

Change-Id: Iff187e72f30d454229f07f896b438198978270a8
2011-08-17 18:19:00 -07:00
Mathias Agopian
9a6e71d14f Merge "don't return the current buffer from dequeueBuffer" 2011-08-17 16:45:35 -07:00
Mathias Agopian
29b5762efc don't return the current buffer from dequeueBuffer
we were not reseting mCurrentTexture in some situations
which in turn caused dequeueBuffers() return a
"FREE" buffer that was also current.
Very often it was harmless, but it created a race with
updateTexImage() which could cause the following
queueBuffers() to fail.

Bug: 5156325
Change-Id: If15a31dc869117543d220d6e5562c57116cbabdb
2011-08-17 15:49:13 -07:00
Xavier Ducrohet
de16a5a62b am ddf155b8: am 5dcda1fd: am 88512f59: am a8313e71: Merge "Fix String16 operator+ to actually work"
* commit 'ddf155b8338eb894a97612e4cb21257c11d8434a':
  Fix String16 operator+ to actually work
2011-08-17 14:40:57 -07:00
Xavier Ducrohet
754b249bcd am 5dcda1fd: am 88512f59: am a8313e71: Merge "Fix String16 operator+ to actually work"
* commit '5dcda1fda53bdc6dfe80cf37e62cacdc216224b1':
  Fix String16 operator+ to actually work
2011-08-17 14:38:15 -07:00
Xavier Ducrohet
242915f3d0 am 88512f59: am a8313e71: Merge "Fix String16 operator+ to actually work"
* commit '88512f59bc051a42f4dd70acc8af5622f7e99db6':
  Fix String16 operator+ to actually work
2011-08-17 14:35:20 -07:00
Xavier Ducrohet
35302266fa am a8313e71: Merge "Fix String16 operator+ to actually work"
* commit 'a8313e71fe8b483448d14e22610101c5f3672744':
  Fix String16 operator+ to actually work
2011-08-17 14:31:08 -07:00
Josiah Gaskin
37bf88e547 Fix String16 operator+ to actually work
This change fixes the String16 utility's operator+ function.

Change-Id: Ibed7b07277b50bf178febc72b6ce497893e66f17
2011-08-16 15:16:04 -07:00
Mathias Agopian
cbe527884a fix a memory leak and memory corruption in RefBase
we would leak a weakref_impl if a RefBase was never incWeak()'ed.
there was also a dangling pointer that would cause memory corruption
and double-delete when a custom destroyer was used to delay the
execution of ~RefBase.

it turns out that the custom destroyer feature caused most of the
problems, so it's now gone. The only client was SurfaceFlinger
who now handles things on its own.

RefBase is essentially back its "gingerbread" state, but the
code was slightly cleaned-up.

Bug: 5151207, 5084978
Change-Id: Id6ef1d707f96d96366f75068f77b30e0ce2722a5
2011-08-11 22:33:02 -07:00
Jean-Baptiste Queru
37717b58dc am b654e6e5: am d144748d: Merge "Add missing include"
* commit 'b654e6e55a3e8d7e8c2e0b8b1ff4bb4f76c10e05':
  Add missing include
2011-08-11 15:22:42 -07:00
Jean-Baptiste Queru
e636a8ad44 am d144748d: Merge "Add missing include"
* commit 'd144748d4767b2ccfb13857e23f78bc944e9531d':
  Add missing include
2011-08-11 15:18:22 -07:00
Jean-Baptiste Queru
2327ffac7d Add missing include
Change-Id: I00181029e80a2ba75320550c14e950fadbab8a64
2011-08-11 13:36:04 -07:00
Jean-Baptiste Queru
65adf39c38 am 44874c23: am c962512c: Merge "added stub for getting buffer from surface texture"
* commit '44874c236de282b0d898f179fc9fdafa84aae40d':
  added stub for getting buffer from surface texture
2011-08-11 12:24:51 -07:00
Jean-Baptiste Queru
9f3a33a671 am c962512c: Merge "added stub for getting buffer from surface texture"
* commit 'c962512cac19e2bb1103c0c1a5f739d40d4d7740':
  added stub for getting buffer from surface texture
2011-08-11 12:19:44 -07:00
Chris Craik
f81c168a7a added stub for getting buffer from surface texture
Change-Id: If61153cacdd8027848f40f8d9035f7c4aead0a98
2011-08-11 11:56:59 -07:00
Mathias Agopian
f440f670a4 Merge changes I5174a6ec,I1f8538b6,Idb71fdcf
* changes:
  fix a crasher in SurfaceTexture::updateTexImage()
  rework dequeueBuffer()'s main loop.
  error out when SurfaceTexture APIs are called while not connected
2011-08-10 19:40:48 -07:00
Mathias Agopian
8e19c2e97e fix a crasher in SurfaceTexture::updateTexImage()
we now make sure to drain the buffer queue on disconnect.
this happens only when in synchrnous mode. in async mode
we clear all buffers except the head of the queue.

for extra safety we also catch the null pointer
in updateTexImage (which should  never happen) and return
an error.

Bug: 5111008

Change-Id: I5174a6ecbb0de641c6510ef56a611cbb4e9e1f59
2011-08-10 17:35:52 -07:00
Mathias Agopian
2560d14ce8 rework dequeueBuffer()'s main loop.
this simplifies the code a bit and also makes sure
we reevaluate mAbandoned and mConnectedApi each time
we come back from waiting on mDequeueCondition

Change-Id: I1f8538b62ad321b51ed79d953b700036daba796d
2011-08-10 17:35:26 -07:00
Mathias Agopian
ef51b99219 error out when SurfaceTexture APIs are called while not connected
- also log a warning when freeAllBuffers is called with a non empty buffer queue
- rename freeAllBuffers to freeAllBuffersLocked

Change-Id: Idb71fdcf233b9ccae62d5a2a7c3c4bad2501d877
2011-08-10 17:33:46 -07:00
Jeff Brown
9f213739b9 am ca97671e: am 6f5a837c: Merge "Fix getSwitchState according to device capabilities."
* commit 'ca97671e2b74ed31b5bef6fd0b39e489f1ec5f51':
  Fix getSwitchState according to device capabilities.
2011-08-10 13:59:44 -07:00
Jeff Brown
38b77d4373 am 6f5a837c: Merge "Fix getSwitchState according to device capabilities."
* commit '6f5a837c9c4a55c82111c6cd5af6055b63fcb5a9':
  Fix getSwitchState according to device capabilities.
2011-08-10 13:56:33 -07:00
Jeff Brown
c6d6863c9b Merge "Fix getSwitchState according to device capabilities." 2011-08-10 13:42:03 -07:00
Mathias Agopian
a11499a026 Fix typos and use new HAL_PRIORITY_URGENT_DISPLAY constant
Change-Id: I703f8a96dd0dfec427e74363ad95729bfefc95c7
2011-08-09 18:57:37 -07:00
Mathias Agopian
5bfc24515b return correct value from query after connecting a surface
the first time a surface was connected, the values returned
by query NATIVE_WINDOW_DEFAULT_{WIDTH|HEIGHT} and
NATIVE_WINDOW_TRANSFORM_HINT were wrong until a call
to queueBuffer was performed.

Bug: 5137366, 5121607
Change-Id: I7ac6b5b0daa876638f6bed7c20f286a6e6d984f6
2011-08-08 20:25:44 -07:00
Jean-Baptiste Queru
6b115451bf am 98c531dc: am 9b0c6bee: Merge "Fix a compiling error when trying to use setBufferCount"
* commit '98c531dca9e52af280ca002658bbe38775b3f6ae':
  Fix a compiling error when trying to use setBufferCount
2011-08-02 17:19:05 -07:00
Jean-Baptiste Queru
8fdbdf461a am 9b0c6bee: Merge "Fix a compiling error when trying to use setBufferCount"
* commit '9b0c6beed2cd5463655712ad80ed160c08611ff8':
  Fix a compiling error when trying to use setBufferCount
2011-08-02 17:15:24 -07:00
Teng-Hui Zhu
697bce061c Fix a compiling error when trying to use setBufferCount
Change-Id: I1aefaf7ec111340a584e0beeeea60b845e16bb1f
2011-08-02 16:57:20 -07:00
Jeff Brown
5873ce46ad Refactor input reader to add stylus support.
Bug: 5064702

Introduced the concept of an InputListener to further decouple
the InputReader from the InputDispatcher.  The InputListener
exposes just the minimum interface that the InputReader needs
to communicate with the outside world.  The InputReader
passes arguments to the InputListener by reference, which makes
it easy to queue them up.

Consolidated all of the InputReader locks into one simple global
Mutex.  The reason this wasn't done before was due to potential
re-entrance in outbound calls to the InputDispatcher.  To fix this,
the InputReader now queues up all of the events it wants to send
using a QueuedInputListener, then flushes them outside of the
critical section after all of the event processing is finished.
Removing all of the InputMapper locks greatly simplifies the
implementation.

Added tests for new stylus features such as buttons, tool types,
and hovering.

Added some helpers to BitSet32 to handle common code patterns
like finding the first marked bit and clearing it.

Fixed a bug in VelocityTracker where the wrong pointer trace
could get cleared when handling ACTION_POINTER_DOWN.  Oops.

Changed PointerCoords so it no longer stores useless zero
axis values.  Removed editAxisValue because it is not very
useful when all zero value axes are absent and therefore
cannot be edited in place.

Added dispatch of stylus hover events.

Added support for distance and tool types.

Change-Id: I4cf14d134fcb1db7d10be5f2af7b37deef8f8468
2011-07-31 15:38:09 -07:00
Derek Sollenberger
33e86c7a91 resolved conflicts for merge of b7f09f28 to honeycomb-plus-aosp
Change-Id: Iebde13c41a2adf4e693d87e808cb0659f913e4e6
2011-07-29 14:16:18 -04:00
Derek Sollenberger
bbfbd30383 am b7ed8471: am 01caec8c: Merge "Adding an optional param to the SurfaceTexture constructor."
* commit 'b7ed8471f1b96aff901149cf9ac29e4b32672f93':
  Adding an optional param to the SurfaceTexture constructor.
2011-07-29 09:53:09 -07:00
Derek Sollenberger
adbba1fda0 am 01caec8c: Merge "Adding an optional param to the SurfaceTexture constructor."
* commit '01caec8c4165a6cce2f276f8016b9eadab966944':
  Adding an optional param to the SurfaceTexture constructor.
2011-07-29 09:50:11 -07:00
Derek Sollenberger
77c988cf4e Adding an optional param to the SurfaceTexture constructor.
Change-Id: I0fdbccf483a16af8039b85c0562f19a34ebce536
2011-07-29 11:06:24 -04:00
Michaël Burtin
5aa3d79025 Fix getSwitchState according to device capabilities.
When querying switch state for a given device id, ensure that the device
exposes the given switch in its capabilities, report AKEY_STATE_UNKNOWN
otherwise.
This fix a bug in InputManager that reports an incorrect switch state
(down) when a device exposes at least one switch in its capabilites and
another switch is queried. For example, this can leads in always
reporting LID state open (SW_LID down) if only SW_HEADPHONE_INSERT is
exposed in capabilities.

Change-Id: I4e5265ec02af918c317673789e7948529842aa2d
Signed-off-by: Michaël Burtin <mburtin@gmail.com>
2011-07-29 15:28:02 +02:00
Kenny Root
b313559b21 Merge "Move extract native libraries to JNI code" 2011-07-27 15:54:51 -07:00
Mathias Agopian
aa599086f8 DO NOT MERGE. may fix build on some version of gcc
Change-Id: Id99d390862731fd3fbc009dbffdf1d2a59dbe348
2011-07-27 11:31:57 -07:00
Mathias Agopian
96e108271b Merge "remove dead code and member variables." 2011-07-26 12:08:07 -07:00
Kenny Root
49a65e5526 Move extract native libraries to JNI code
The built-in ZipFile class was quite a long time to find an unpack
libraries. Move everything to using the libutils ZipFileRO class that
goes quite a bit faster. Initial measurements are 6 times faster than
the Java code.

Also, read files off the disk and compare their CRC against the APK's
CRC to see if we need to write the new file to disk. This also cuts down
the bootup time by up to a second per APK that has native files.

Change-Id: Ic464a7969a17368fb6a6b81d026888c4136c7603
2011-07-26 10:14:58 -07:00
Mathias Agopian
3fbce7c560 remove dead code and member variables.
also fix some comments and improve debugging logs.

Change-Id: I83e55309f306332b59e1ec46104c4a7fffbf3c97
2011-07-25 20:03:43 -07:00
Jamie Gennis
fa1e002cec Merge "SurfaceTexture: enable RGB external textures" 2011-07-25 11:46:51 -07:00
Ted Bonkenburg
8d14330bd7 Merge "Add support for creating a Surface from a a SurfaceTexture." 2011-07-25 10:24:30 -07:00
Ted Bonkenburg
bd050ab2af Add support for creating a Surface from a a SurfaceTexture.
The Surface is already using SurfaceTexture internally and it is parcelable. This
is intended to replace and phase out ParcelSurfaceTexture in favor of creating a
new Surface.java object from an existing SurfaceTexture.

Change-Id: I8e2dd86614523da6abed6403e1d705a68fa19fdf
2011-07-22 16:36:44 -07:00