Commit Graph

330 Commits

Author SHA1 Message Date
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
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
a0c30e9241 optimize Surface.readFromParcel()
this is called for each relayout() and used to create a full Surface (cpp)
which in turn did some heavy work (including an IPC with surfaceflinger),
most of the time to destroy it immediatelly when the returned surface
(the one in the parcel) was the same.

we now more intelligentely read from the parcel and construct the new
object only if needed.

Change-Id: Idfd40d9ac96ffc6d4ae5fd99bcc0773e131e2267
2010-06-04 18:57:41 -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
7e27f05739 more clean-up in preparation of bigger changes
the most important change here is the renaming of
ISurfaceFlingerClient to ISurfaceComposerClient

Change-Id: I94e18b0417f50e06f21377446639c61f65f959b3
2010-05-28 17:19:16 -07:00
Mathias Agopian
b8510b98b5 Fix a typo in Singleton<>
it could cause the sLock field to be emitted several times
in different compilation unit. it also prevented to
have 2 Singleton<> in the same file.
2010-05-28 15:13:30 -07:00
Mathias Agopian
d4784a3b90 more clean-up of Surfaceflinger's client management
SurfaceComposerClient now only exist on the WindowManager side,
the client side uses the new SurfaceClient class, which only
exposes what a client needs.

also instead of keeping mappings from IBinder to SurfaceComposerClients
we have a SurfaceClient per Surface (referring to the same IBinder), this
is made possible by the fact that SurfaceClient is very light.

Change-Id: I6a1f7015424f07871632a25ed6a502c55abfcfa6
2010-05-27 19:55:43 -07:00
Mathias Agopian
631f358d34 fix [2712278] The preview buffer left some black borders in left and bottom edges
we were incorrectly flagging push_buffer surfaces as invalid

Change-Id: I4dfd4ffbbe8a71f7e23e835db8d71966416c29bb
2010-05-25 17:51:34 -07:00
Mathias Agopian
a138f89c5e added the notion of fixed-size buffers
the new native_window_set_buffers_geometry allows
to specify a size and format for all buffers to be
dequeued. the buffer will be scalled to the window's
size.

Change-Id: I2c378b85c88d29cdd827a5f319d5c704d79ba381
2010-05-24 18:26:01 -07:00
Mathias Agopian
a0b3f1d2eb fix a bug when reallocating a window's buffers is needed
we need to mark the buffers that need to be reallocated,
NOT the buffer's indices.

Change-Id: I809e2e1b03b56c4d2ab983c25523dae99aa1da74
2010-05-24 13:47:24 -07:00
Mathias Agopian
f10d7fde03 added native_window_set_buffer_count()
this method can be used to change the number of buffers
associated to a native window. the default is two.

Change-Id: I608b959e6b29d77f95edb23c31dc9b099a758f2f
2010-05-21 14:34:32 -07:00
Mathias Agopian
bb641244d7 fix the threading issue for setBuffercount()
this change introduces R/W locks in the right places.
on the server-side, it guarantees that setBufferCount()
is synchronized with "retire" and "resize".
on the client-side, it guarantees that setBufferCount()
is synchronized with "dequeue", "lockbuffer" and "queue"
2010-05-20 18:00:42 -07:00
Mathias Agopian
dcf01e6644 added RWLock C++ wrapper
Change-Id: Ia736bf7f6e2c49915a9ab5669551cf89dafa7961
2010-05-19 15:12:59 -07:00
Mathias Agopian
d6297f7d09 fix some bugs in SharedBufferStack::resize
added buffers should now be labeled properly.

Change-Id: I28aa753fbe89ab89134e7753575319478934c7fa
2010-05-17 17:27:26 -07:00
Mathias Agopian
a1ac870fd1 Merge "SharedBufferStack now can grow up to 16 buffers." into kraken 2010-05-12 17:36:46 -07:00
Mathias Agopian
b5b7f260da SharedBufferStack now can grow up to 16 buffers.
there is a new resize() api, which currently only allows growing.

Change-Id: Ia37b81b73be466d2491ffed7f3a23cd8e113c6fe
2010-05-12 17:28:20 -07:00
Kenny Root
9b7640933e Merge "ZipUtilsRO rewrite based on Dalvik Zip rewrite" into kraken 2010-05-12 14:54:42 -07:00
Kenny Root
d4066a4ac5 ZipUtilsRO rewrite based on Dalvik Zip rewrite
Change the way zip archives are handled.  This is necessary to deal with
very large (~1GB) APK files, for which our current approach of mapping
the entire file falls over.

We now do the classic scavenger hunt for the End Of Central Directory
magic on a buffer of data read from the file, instead of a memory-mapped
section.  We use what we find to create a map that covers the Central
Directory only.

If the caller is interested in unpacking the file contents, we have to
do an additional file read to discover the size of the Local File Header
section so we can skip past it.

This is based on Change I745fb15abb in the dalvik tree. Both
implementations share a common ancestry, but the cost of unifying them
outweighs the benefits of wrapping C calls.

Change-Id: Iddacb50fe913917c2845708a530872d65fdbe620
2010-05-12 05:07:48 -07:00
Jamie Gennis
1853b7d790 Merge "Add incStrong and decStrong methods to android_native_{window,buffer}_t." into kraken 2010-05-11 12:25:31 -07:00
Jamie Gennis
5e67f87430 Add incStrong and decStrong methods to android_native_{window,buffer}_t.
This change adds the methods necessary to use sp<> to handle refcounting
android_native_window_t and android_native_buffer_t.  The new methods forward
the refcounting operations to the corresponding android_native_base_t
functions.

Change-Id: I7de8e262728e439bc1efdf69374a2a9f6f432ced
2010-05-10 17:33:32 -07:00
Dan Egnor
7dd2bb8412 am ca48c88c: am 8a8658a5: Merge "Make static versions of libutils and libbinder." into froyo
Merge commit 'ca48c88c3d5733c4405a2fc4f7d9bb7fbba3d43f' into kraken

* commit 'ca48c88c3d5733c4405a2fc4f7d9bb7fbba3d43f':
  Make static versions of libutils and libbinder.
2010-05-06 17:35:06 -07:00
Dan Egnor
e3c233d1a9 am 8a8658a5: Merge "Make static versions of libutils and libbinder." into froyo
Merge commit '8a8658a5de261c2da72d431940877bd054bc9837' into froyo-plus-aosp

* commit '8a8658a5de261c2da72d431940877bd054bc9837':
  Make static versions of libutils and libbinder.
2010-05-06 17:33:45 -07:00
Dan Egnor
386a332b4f Make static versions of libutils and libbinder.
Fix some small static-initialization-order issues (and a static-
initializers-missing issue) that result from doing so.  The static
libraries don't actually get used for anything real at the moment --
they're used for perf tests of bug 2660235.

Bug: 2660235
Change-Id: Iee2f38f79cc93b395e8d0a5a144ed92461f5ada0
2010-05-06 01:03:31 -07:00
The Android Open Source Project
ad3f4a4561 am f7896449: merge from open-source master
Merge commit 'f78964490d8098387d51444c87bf520ad3f674e2' into kraken

* commit 'f78964490d8098387d51444c87bf520ad3f674e2':
  Add new keycodes for the convenience of Japanese IMEs
  Call register_localized_collators() with the current locale.
  Fixed deserialization problem in DatePicker.
  Fix for bug 2467152 files with spaces fail to open.
  Set alpha value for newly created dim surface.
  telephony: Fix CID when CID is unknown
2010-05-05 16:00:01 -07:00
The Android Open Source Project
30f71ce597 merge from open-source master
Change-Id: Ia9e1f4e049f5870386ea29ddb6e3ef028ea918da
2010-05-05 15:57:42 -07:00
mogimo
ef1c5c314b Add new keycodes for the convenience of Japanese IMEs
Change-Id: Ibd308cef11261147856258595f6ca0137e03e05c
2010-05-05 13:37:21 -07:00
Mathias Agopian
30c4c182ec Merge "Add support for enqueuing buffers in arbitrary order" into kraken 2010-04-30 12:58:11 -07:00
Mathias Agopian
4fcad80654 Merge "cleanup. waitForCondition() now uses polymorphsim instead of templtes" into kraken 2010-04-29 14:17:12 -07:00
Mathias Agopian
a228cc5efa Merge "fix a race condition in undoDequeue(), where 'tail' could be computed incorrectly." into kraken 2010-04-29 14:16:14 -07:00
Dianne Hackborn
c93a781c24 New xlarge screen size.
Not complete, only for experimentation at this point.

This includes a reworking of how screen size configurations are matched,
so that if you are on a larger screen we can select configurations for
smaller screens if there aren't any exactly matching the current screen.

The screen size at which we switch to xlarge has been arbitrarily
chosen; the compatibility behavior has not yet been defined.

Change-Id: I1a33b3818eeb51a68fb72397568c39ab040a07f5
2010-04-28 16:51:52 -07:00
Mathias Agopian
c0a9164e9e Add support for enqueuing buffers in arbitrary order
Also added a very simple SharedBufferStack unit test.

Change-Id: I253dbbe98a53c966b78d22d4d6dd59f8aefc8c40
2010-04-28 16:12:54 -07:00
Mathias Agopian
b296533607 cleanup. waitForCondition() now uses polymorphsim instead of templtes
the reason for the above change is that waitForCondition() had become
large over time, mainly to handle error cases, using inlines to
evaluate the condition doesn't buys us much anymore while it increases
code size.

Change-Id: I2595d850832628954b900ab8bb1796c863447bc7
2010-04-28 16:12:54 -07:00
Mathias Agopian
0a8cd0689a fix a race condition in undoDequeue(), where 'tail' could be computed incorrectly.
in the undoDequeue() case, 'tail' was recalculated from 'available' and 'head'
however there was a race between this and retireAndLock(), which could cause
'tail' to be recalculated wrongly.

the interesting thing though is that retireAndLock() shouldn't have any impact
on the value of 'tail', which is client-side only attribute.
we fix the race by saving the value of 'tail' before dequeue() and restore it
in the case of undoDequeue(), since we know it doesn't depend on retireAndLock().

Change-Id: I4bcc4d16b6bc4dd93717ee739c603040b18295a0
2010-04-28 16:12:54 -07:00
Mathias Agopian
245e4d78c5 better fix for [2420565] Surface.lockCanvas() updates the dirty region too often
Change-Id: I83438b40effd21538f1c74396dc665254b9d5ab6
2010-04-21 22:25:35 -07:00
The Android Open Source Project
a327dcfd79 am f021d12f: merge from open-source master
Merge commit 'f021d12f6f7116e9275cd3553a349ce5cb8aab14' into kraken

* commit 'f021d12f6f7116e9275cd3553a349ce5cb8aab14':
  Allow META* macros outside of the framework
  Fix printing order of phone objects creation
2010-04-21 09:15:15 -07:00
The Android Open Source Project
fc821e5d26 merge from open-source master
Change-Id: I08f1feae65b1dfc3f740d78654c267f2e3ae5e85
2010-04-21 09:10:43 -07:00
Michael Richardson
a3a884d9e2 Allow META* macros outside of the framework
The META* macros are useful outside of the framework
for other systems implementing Binder interfaces, but
they depend upon the android namespace. This includes
the appropriate namespace operations, which should be
sane even in that android namespace.

Change-Id: If600156c65191f51f487d0ee301d9f9f532b263d
2010-04-20 14:14:30 -07:00
Mathias Agopian
cc08e688f5 added setCrop() to android_native_window_t
hooked up the new method up to Surface.cpp
the actual crop is not implemented in SF yet

Change-Id: Ic6e313c98fd880f127a051a0ccc71808bd689751
2010-04-20 13:36:29 -07:00
Mathias Agopian
1100c8b901 add support for up to 16 buffers per surface
also increase the dirtyregion size from 1 to 6 rectangles.
Overall we now need 27KiB process instead of 4KiB

Change-Id: Iebda5565015158f49d9ca8dbcf55e6ad04855be3
2010-04-20 13:36:29 -07:00
Mathias Agopian
0ec1f2fc6e am 26f61635: am 0a4ab1b9: Merge "fix [2599939] "cannot play video" after open/close a video player a dozen of times" into froyo
Merge commit '26f6163557980062dbb203388b3d0794ee0d06f7' into kraken

* commit '26f6163557980062dbb203388b3d0794ee0d06f7':
  fix [2599939] "cannot play video" after open/close a video player a dozen of times
2010-04-19 19:29:22 -07:00
Mathias Agopian
65d8840637 am 0a4ab1b9: Merge "fix [2599939] "cannot play video" after open/close a video player a dozen of times" into froyo
Merge commit '0a4ab1b9b4c7b891c1ecb67eed99e9c9b30c93aa' into froyo-plus-aosp

* commit '0a4ab1b9b4c7b891c1ecb67eed99e9c9b30c93aa':
  fix [2599939] "cannot play video" after open/close a video player a dozen of times
2010-04-19 19:26:31 -07:00
Mathias Agopian
3c772b706d fix [2599939] "cannot play video" after open/close a video player a dozen of times
get rid off the MAP_ONCE flag is MemoryHeapBase (as well as it's functionality),
this feature should not be used anymore.

the software renderer was incorrectly using the default ctor which set MAP_ONCE,
causing the leak. the software renderer itself is incorrectly used while coming
back from sleep.

Change-Id: I123621f8d140550b864f352bbcd8a5729db12b57
2010-04-19 19:09:03 -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
e4e8cf1f19 don't hardcode "mSurface" throughout our source code
this is used in a few places to get access to the android.view.Surface
native surface. use a macro instead. Also rename the field to mNativeSurface.

Change-Id: I1c6dea14abd6b8b1392c7f97b304115999355094
2010-04-12 16:29:36 -07:00
The Android Open Source Project
529973acc2 merge from open-source master
Change-Id: I975030d9572463bc69245bcffa25c47d7acb2b51
2010-04-08 11:27:55 -07:00
Chih-Wei Huang
e5f56fb1b4 Add keycodes PageUp and PageDown
This is useful for applications like web browser.

Change-Id: Ie9262d5b75de87ecd0971407a7c3ce9aa6e4998e
2010-04-02 14:39:20 -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
26d244281a libutils Condition are now PRIVATE by default
Condition must be initialized with SHARED for the old behavior, where
they can be used accross processes.

Updated the two places android that require SHARED conditions.

PRIVATE conditions (and mutexes) use more efficient syscalls.

Change-Id: I9a281a4b88206e92ac559c66554e886b9c62db3a
2010-03-19 16:16:43 -07:00