Commit graph

5965 commits

Author SHA1 Message Date
Jeff Brown
ac84a0a25d Input dispatcher ANR handling enhancements.
This change is essentially a rewrite of the main input dispatcher loop
with the target identification folded in.  Since the input dispatcher now
has all of the window state, it can make better decisions about
when to ANR.

Added a .5 second deadline for processing app switch keys.  This behavior
predates Gingerbread but had not previously been ported.

Fixed some timing inaccuracies in the ANR accounting that could cause
applications to ANR sooner than they should have.

Added a mechanism for tracking key and motion events that have been
dispatched to a window so that appropriate cancelation events can be
synthesized when recovering from ANR.  This change helps to keep
applications in sync so they don't end up with stuck buttons upon
recovery from ANRs.

Added more comments to describe the tricky parts of PollLoop.

Change-Id: I13dffca27acb436fc383980db536abc4d8b9e6f1
2013-07-30 13:56:54 -07:00
Dianne Hackborn
a78bab0359 Always set the scheduling group when starting a new thread.
Change-Id: Ia33acf13fc3752707f3819928c36315e223fa1bd
2013-07-30 13:56:54 -07:00
Romain Guy
4e30623bda Purge Skia objects from GL caches as needed.
Change-Id: I754c671cf790ad5ae8bf047ad328034217da4ecc
2013-07-30 13:56:54 -07:00
Kenny Root
b03e56d704 Revert "Free created FileMap when uncompressing files"
This reverts commit 52b8235238fb4d8cf141020cc1ae33880929dc3f.

munmap() on a region that overlaps something else (e.g, the ZIP Central
Directory in this case) unmaps those other regions as well making the
ZipFileRO class unhappy. Revert this for now until we can have FileMap
deal with this craziness.
2013-07-30 13:56:54 -07:00
Dianne Hackborn
aeaad5f5e9 Modify native ALooper to take an explicit ident.
The ALooper API now uses an explicit "identifier" for the integer
that is returned rather than implicitly using the fd.  This allows
the APIs that had the fd to be a little more sane.

Change-Id: I8507f535ad484c0bdc4a1bd016d87bb09acd7ff0
2013-07-30 13:56:54 -07:00
Dianne Hackborn
193c18ca8a Hopefully fix the build.
Change-Id: Id8cd92c0895c9939e1386ef488bd1309a3be3568
2013-07-30 13:56:54 -07:00
Dianne Hackborn
16d217efbb Add system property to turn off scheduling groups.
Do this:

adb shell setprop debug.sys.noschedgroups 1

Change-Id: I6e06a74205fd45ee1526ce71fe33944465d39984
2013-07-30 13:56:54 -07:00
Kenny Root
6bdd470cf1 Add better debug output for ResourceType errors
An error code is returned as -ESOMETHING, but the debug code was
printing out 0x%08x for these codes making -74 print out as 0xffffffb5
which is kind of silly.

Change-Id: I7d77fb3da2e146845949f121404f662b47288e61
2013-07-30 13:56:54 -07:00
Kenny Root
2349ee0996 Add debugging to ZipFileRO
Some assets are failing to read from ZIP files. This adds a bit more
debugging to figure out what's going on.

Change-Id: Id90e10546c54c85069a34478fbc28bc2523bda5d
2013-07-30 13:56:54 -07:00
Kenny Root
95f09be291 Free created FileMap when uncompressing files
Change-Id: Ice22c4ecb7c129b74bf60cd66ae79e110b017a4a
2013-07-30 13:56:54 -07:00
Kenny Root
6fab9b21ca Add OBB flags to support overlays
* Add flags field in OBB footer to support overlays.

* Remove unused 'crypto' and 'filesystem' fields in obbtool (could
  later be supported in the "flags" field of the OBB footer).

* Add notes to document OBB classes before shipping.

Change-Id: I386b43c32c5edef55210acb5d3322639c08010ba
2013-07-30 13:56:54 -07:00
Jeff Brown
38fb25b9d0 Add support for the PointerLocation overlay.
This change involves adding a new method to IWindowManager,
monitorInput() that returns an InputChannel to receive a copy of all
input that is dispatched to applications.  The caller must have
the READ_INPUT_STATE permission to make this request (similar to
other window manager methods such as getKeycodeState).

Change-Id: Icd14d810174a5b2928671ef16de73af88302aea0
2013-07-30 13:56:54 -07:00
Kenny Root
4e248ec5c6 Initial tool for OBB manipulation
Add "obbtool" host command for adding, removing, and querying Opaque
Binary Blob (OBB) information from a file.

Change-Id: Id2ac41e687ad2a500c362616d6738a8ae7e8f5c3
2013-07-30 13:56:54 -07:00
Dianne Hackborn
0537db078b More native work.
Implement save/restore of state, and add native APIs for
configuration information.

Change-Id: I2a3ddc2ba605db58d7c8b2b31b9215fb323f90b5
2013-07-30 13:56:54 -07:00
Kenny Root
23b4a0936f Fix String8::operator+
The LHS was ignored when using:
  String8 + String8
  String8 + (const char*)

Add unit tests for above.

Bug: 2898473
Change-Id: Ic8fe7be668b665c36aaaa3fc3c3ffdfff0fbba25
2013-07-30 13:56:54 -07:00
Kenny Root
3da482eec2 Free scanBuf in ZipFileRO
In the success case, the 65kB scanBuf was not freed!

Also, get rid of annoying complaints about ssize_t from printf in error
cases.

Change-Id: If154ac19bf47637f898b4ec8c8e27c9a073a7b81
2013-07-30 13:56:54 -07:00
Christopher Tate
0374b429af Attempt to fix the SDK build
On the assumption that the local min() function declaration is in
conflict with some 'min' #define floating around, rename the local
function to min_of().

Change-Id: I62aa27f213c6093cc78805de611cf4aa75f0eef2
2013-07-30 13:56:54 -07:00
Kenny Root
f2729494e8 Change unistd.h to stddef.h to be correct
size_t should be defined through inclusion of stddef.h instead of unistd.h

Change-Id: Ieaadacfca1e1c44c2533ea95f73fc060c1519b52
2013-07-30 13:56:54 -07:00
Kenny Root
b9590bde9a Add unistd.h for size_t typedef to fix sim-eng
Change-Id: Ida4f1742547f39539b601f13182c722aa7cf863e
2013-07-30 13:56:54 -07:00
Christopher Tate
c28f214f6c Support streaming of compressed assets > 1 megabyte
Compressed assets larger than one megabyte are now decompressed on demand
rather than being decompressed in their entirety and held in memory.  Reading
the data in order is relatively efficient, as is seeking forward in the stream.
Seeking backwards is supported, but requires reprocessing the compressed data
from the beginning, so is very inefficient.

In addition, the size limit on compressed assets has been eliminated.

Change-Id: I6e68247957e6c53e7e8ba70d12764695f1723bad
2013-07-30 13:56:54 -07:00
Jeff Brown
35a154e57f Fix bug with phantom input windows.
Add dumpsys integration for the native input dispatcher.
Add some InputDevice API stubs.
Add an appendFormat helper method to String8 for printf style
string formatting mainly for debugging purposes.
Use generic ArrayList<WindowState> everywhere in WindowManagerService
to eliminate unnecessary casts all over.

Change-Id: I9d1e3bd90eb7222d10620200477f11b7bfd25e44
2013-07-30 13:56:54 -07:00
Christopher Tate
9f43945b7c Add native C APIs for working with the Asset Manager
Change-Id: I493b142c4b35e5cc1a1e85283bb5dfb306a6d261
2013-07-30 13:56:54 -07:00
Jeff Brown
3f607c1c84 Don't build framework tests for simulator target.
Change-Id: I70f29c7eb307e4f3ec5702f4eb9d97b4342e2f36
2013-07-30 13:56:54 -07:00
Jeff Brown
7aba23129b Add initial gamepad support.
Change-Id: I0439648f6eb5405f200e4223c915eb3a418b32b9
2013-07-30 13:56:54 -07:00
Kenny Root
51e2fb7086 Tweak ObbFile class
* Move error messages around to clarify the errors.

* Add extra error check when reading a file.

* Seek to the end of a file when writing the signature so the users of
  the API don't have to remember to do it.

Change-Id: I2337051b9f9fa8147c5900237deec790dcd92436
2013-07-30 13:56:54 -07:00
Dianne Hackborn
245708a1be 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
2013-07-30 13:56:53 -07:00
Kenny Root
1d2aeb673f Add OBB file helper class
ObbFile is a binary blob that will be used in packaging large files
with smaller APKs.

Change-Id: Ib1594346cfa2f49113de6565af77c24efbd89d63
2013-07-30 13:56:53 -07:00
Dianne Hackborn
26fc52b1d4 Add new native Looper API.
This allows us to avoid exposing the file descriptor of
the event queue; instead, you attach an event queue to
a looper.  This will also should allow native apps to be
written without the need for a separate thread, by attaching
the event queue to the main thread's looper and scheduling
their own messages there.

Change-Id: I38489282635895ae2cbfacb88599c1b1cad9b239
2013-07-30 13:56:53 -07:00
Mathias Agopian
7b1516795e Fix a bug in sp<> and wp<> which could cause memory corruptions
when assigning a smart pointer to another one, we need to make
sure to read all the data we need from the right-hand-side
reference (the assignee) before we decRef the assigned.

This bug would cause linked-list of smart-pointers to fail
miserably.

Change-Id: Ibb554c15fddf909f7737c632b7c80322e80ea93f
2013-07-30 13:56:53 -07:00
Jeff Brown
9efaaa4359 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
2013-07-30 13:56:53 -07:00
Jeff Brown
80d9c1cfb0 Support for multiple tests
The build system enforces some invariants that were being ignored
before.

Change-Id: Ie7675042af7f961a507386c13b2a0b592b591af8
2013-07-30 13:56:53 -07:00
Jeff Brown
ea5c46b7c1 Remove PollLoop from host build.
We can't build (and we don't need) PollLoop in the SDK on all platforms.

Change-Id: I3b0f327bbb8bc58b9b8630b0161cf360403fea68
2013-07-30 13:56:53 -07:00
Jeff Brown
4d643d6fdb Fix include paths.
Change-Id: Ifda45688f9f02710a74d5d7a7d902bacf1441e2e
2013-07-30 13:56:53 -07:00
Jeff Brown
66db68948c 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
2013-07-30 13:56:53 -07:00
Andreas Huber
10e5da58e4 Fix String8 to free its memory only after assignment operations based on pointers are finished in case that pointer referred to the string's original contents.
Change-Id: I6961f3cf10ba3b728579ea63262db750a4cf8577
2013-07-30 13:56:53 -07:00
Kenny Root
ad4f2e59af Add invariant check for stylesString size
It was possible for stylesStrings to claim to start past the end of the
data area thereby making mStringPoolSize larger than the data area.

Change-Id: Ibc4d5b429e3a388516135801c8abc3681daae291
2013-07-30 13:56:53 -07:00
Kenny Root
65d3c95a4d Range checking for ResTable_map
Correct previous offset change and get ready for safe-iop.

Change-Id: Ib276c726f32b0711a72f47d3263eb21640e5a800
2013-07-30 13:56:53 -07:00
Kenny Root
076618172d Improve checking in aapt dump
The aapt dump reading had less error checking than the actual parsing,
so this change brings it more into parity so that bad APKs don't crash
"aapt dump"

Change-Id: Ib30e63e41be5c652645c4aa0de580a87b184529d
2013-07-30 13:56:53 -07:00
Konstantin Lopyrev
7517432a55 Fix 1684100: Making sure that empty package, type and resource ids are not accepted.
Change-Id: I4c94877e4312e9a5b4d22c8625069ca056c62e40
2013-07-30 13:56:53 -07:00
Daisuke Miyakawa
f16344acab Delete vCard code to platform/framework/opt/vcard.
Now all the code and related tests are in (top)/framework/opt/vcard.

See also 33mb46cb82 in platform/framework/opt/vcard.

Bug: 2735156
Change-Id: Ic3413110580874761e596b8fe9ad3c2e3c60795b
2013-07-30 13:56:53 -07:00
Daisuke Miyakawa
3073020282 Remove stale and inappropriate dependency.
Change-Id: I2e9412075c157a8649ac06e89a8987a36544d78b
2013-07-30 13:56:53 -07:00
Mathias Agopian
24ed9052bd 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.
2013-07-30 13:56:53 -07:00
Daisuke Miyakawa
fcf836d32f Small fix around intermideate charset (ISO-8859-1).
After a few investigation, it is found that ISO-8859-1 is confirmed to be the
best charset for that use.

Modify comment so that we explicitly mention it.

Change-Id: I16e487fab33964a1665a1dd6991f2e8598f8895e
2013-07-30 13:56:53 -07:00
Daisuke Miyakawa
e6cbafd07d Make vCard code a separated static library.
- Move the library to a separate directory in framewokr/base, and rename its package from
  android.pim.vcard to com.android.vcard.
- Move all tests for the library under the directory.
- Confirm all tests for vCard are successful.

It would be better for us to have this directory somewhere else (like external/).
But I'll submit this here now and move it to the right place as soon as possible.
From the view of build mechanism, we can do that immediately.

BUG: 2689523
Change-Id: I435e10571b7160bfcc029bed7c37aaac1c6fd69a
2013-07-30 13:56:53 -07:00
Mathias Agopian
9b0be73f2a added RWLock C++ wrapper
Change-Id: Ia736bf7f6e2c49915a9ab5669551cf89dafa7961
2013-07-30 13:56:53 -07:00
Kenny Root
c2b77d2fad 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
2013-07-30 13:56:53 -07:00
Dan Morrill
eb502abd56 Adding PacketVideo attribution in NOTICE.
Change-Id: Id2fe398d4deed6ebd8cba8516ffc6c0334a961b0
2013-07-30 13:56:53 -07:00
Dan Egnor
88753ae9d8 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
2013-07-30 13:56:53 -07:00
Dianne Hackborn
88e4960025 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
2013-07-30 13:56:53 -07:00
Dianne Hackborn
2937406b0d Revert "fix [2542425] memory leak during video recording"
This reverts commit 544592e14f8d7643238e40ba9879727497900f35.
2013-07-30 13:56:53 -07:00