summaryrefslogtreecommitdiffstats
path: root/libs/utils
Commit message (Collapse)AuthorAgeFilesLines
* Fix issue 3302649.Eric Laurent2011-01-041-0/+3
| | | | | | | | | | 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: I66e679665c384403cb3ba2c31746f5de72d5836d
* Initialized check in ZipFileRO::findEntryByNameKenny Root2010-10-211-1/+9
| | | | | | | | If a ZipFileRO object is uninitialized, the hash table will not have been initialized. This condition wasn't checked in findEntryByName. Bug: 3121109 Change-Id: Ib696e0e7e0cb4dd0fb2e456d6a847e5e8f4fe14e
* Reduce logging.Joe Onorato2010-10-191-1/+2
| | | | | | | | | | Remember, the system and main logs are - Shared resources - Primarily for recording problems - To be used only for large grained events during normal operation Bug: 3104855 Change-Id: I136fbd101917dcbc8ebc3f96f276426b48bde7b7
* MinGW/Cygwin requires open() in O_BINARY mode.Raphael Moll2010-10-131-20/+37
| | | | | | Alsso printf %zd is not supported on MinGW/Cygwin. Change-Id: I03811dabb46e2b05dd1d8abcc0ff97b125c77d54
* OBB: use PBKDF2 for key generation.Kenny Root2010-10-132-17/+45
| | | | | | | | | Switch to using PBKDF2 for the key generation for OBBs. Any previously generated OBBs will stop being read correctly. A small pbkdf2gen program is available to allow generation of appropriate keys with the salts. Bug: 3059950 Change-Id: If4305c989fd692fd1150eb270dbf751e09c37295
* Switch Looper back to using poll() instead of epoll().Jeff Brown2010-10-072-45/+254
| | | | | | | | | | | | Added a couple of micro-optimizations to avoid calling wake() unnecessarily and reduce JNI overhead slightly. Fixed a minor issue where we were not clearing the "next" field of Messages returned by the MessageQueue so the Message would hold on to its successor and potentially prevent the GC from collecting it if the message were leaked somehow. Change-Id: I488d29417ce0cdd7d0e447cda76ec978ef7f811c
* Use pread() in ZipFileRO for LinuxKenny Root2010-10-041-1/+32
| | | | | | | | | | | | | | | | | AssetManager instances are created by zygote and passed to all its children so that they don't have to individually open frameworks-res.apk. This creates a problem for determining the current file offset when using lseek() on those files, because you can't guarantee the cross-process locking of a mutex. Luckily, Linux implements pread() to get around this suckiness. The problem is that only Linux implements this, so we have to keep the old locking for use on host builds with aapt and friends. aapt doesn't have this same problem of sharing file descriptors across forked processes, so we can keep the local AutoMutex to protect accesses of those files. Change-Id: Ibe9f11499a53fe345f50fbaea438815ec0fd363e
* ZipFileRO: moar logging and wrap closeKenny Root2010-10-011-7/+19
| | | | | | | | | | | | There is apparently still a race upon reading the entry Local File Header that can't be tracked down, so move the LFH check inside the mutex-protected block so we can call lseek again to see where we are when we log an error. Also, close() can fail so use TEMP_FAILURE_RETRY on it so we don't unwittingly leak file descriptors when Mean Mr. EINTR comes a-knocking. Change-Id: I753abad0bd882fe28f7281c406fa76f64393ef4c
* Revert "Revert "Free created FileMap when uncompressing files""Kenny Root2010-09-241-5/+9
| | | | This revert reverts commit a19ef306bd0a257c67b50f5e0e669e9fe52b0889.
* Add locking around ZIP seekingKenny Root2010-09-241-10/+17
| | | | | | | | Since we switched to seeking to the LFH to verify its existence instead of a huge mmap of the file, we have to guarantee that another seek doesn't happen before we finish our read on the LFH. Change-Id: If8135d9cb6f2f5cc4db734eafa4f6b5f6269c62a
* Looper: use pthread_once for TLS key initialization.Jeff Brown2010-09-211-15/+14
| | | | | | | | Also fix a Valgrind complaint by zeroing out the entire epoll event struct since otherwise the data field union would be partly uninitialized (but not in a harmful way). Change-Id: I2091ce517e87fcad7c9caf90e2c5e4854a7ca465
* Reduce lock thrashing in native Looper.Jeff Brown2010-09-171-32/+38
| | | | | | | | In the common case, there is nothing interesting happening on the native Looper besides occasional wake ups. There is no point grabbing the semaphore then. Change-Id: Ib5c426d0e158dfa37891b7ff5537b6f833592fad
* Ensure input dispatcher and native looper handles EINTR.Jeff Brown2010-09-161-4/+10
| | | | Change-Id: I0a42db5f273b9bfe4ab174e4ee65d5d852f9f6bc
* Replace epoll() with poll() and rename PollLoop to Looper.Jeff Brown2010-09-146-749/+803
| | | | | | | | | | | | | | | As part of this change, consolidated and cleaned up the Looper API so that there are fewer distinctions between the NDK and non-NDK declarations (no need for two callback types, etc.). Removed the dependence on specific constants from sys/poll.h such as POLLIN. Instead looper.h defines events like LOOPER_EVENT_INPUT for the events that it supports. That should help make any future under-the-hood implementation changes easier. Fixed a couple of compiler warnings along the way. Change-Id: I449a7ec780bf061bdd325452f823673e2b39b6ae
* Input dispatcher ANR handling enhancements.Jeff Brown2010-09-121-1/+7
| | | | | | | | | | | | | | | | | | | | | | | 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
* Always set the scheduling group when starting a new thread.Dianne Hackborn2010-09-091-16/+23
| | | | Change-Id: Ia33acf13fc3752707f3819928c36315e223fa1bd
* Revert "Free created FileMap when uncompressing files"Kenny Root2010-09-071-9/+5
| | | | | | | | | 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.
* Modify native ALooper to take an explicit ident.Dianne Hackborn2010-09-071-6/+13
| | | | | | | | 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
* Hopefully fix the build.Dianne Hackborn2010-09-071-0/+2
| | | | Change-Id: Id8cd92c0895c9939e1386ef488bd1309a3be3568
* Add system property to turn off scheduling groups.Dianne Hackborn2010-09-071-8/+29
| | | | | | | | Do this: adb shell setprop debug.sys.noschedgroups 1 Change-Id: I6e06a74205fd45ee1526ce71fe33944465d39984
* Add better debug output for ResourceType errorsKenny Root2010-09-021-2/+2
| | | | | | | | 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
* Add debugging to ZipFileROKenny Root2010-08-271-2/+2
| | | | | | | 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
* Free created FileMap when uncompressing filesKenny Root2010-08-191-5/+9
| | | | Change-Id: Ice22c4ecb7c129b74bf60cd66ae79e110b017a4a
* Add OBB flags to support overlaysKenny Root2010-08-181-10/+22
| | | | | | | | | | | * 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
* Initial tool for OBB manipulationKenny Root2010-08-111-3/+39
| | | | | | | Add "obbtool" host command for adding, removing, and querying Opaque Binary Blob (OBB) information from a file. Change-Id: Id2ac41e687ad2a500c362616d6738a8ae7e8f5c3
* More native work.Dianne Hackborn2010-08-111-0/+6
| | | | | | | Implement save/restore of state, and add native APIs for configuration information. Change-Id: I2a3ddc2ba605db58d7c8b2b31b9215fb323f90b5
* Fix String8::operator+Kenny Root2010-08-062-2/+78
| | | | | | | | | | | The LHS was ignored when using: String8 + String8 String8 + (const char*) Add unit tests for above. Bug: 2898473 Change-Id: Ic8fe7be668b665c36aaaa3fc3c3ffdfff0fbba25
* Free scanBuf in ZipFileROKenny Root2010-08-041-6/+4
| | | | | | | | | 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
* Attempt to fix the SDK buildChristopher Tate2010-07-291-4/+4
| | | | | | | | 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
* Change unistd.h to stddef.h to be correctKenny Root2010-07-281-1/+1
| | | | | | size_t should be defined through inclusion of stddef.h instead of unistd.h Change-Id: Ieaadacfca1e1c44c2533ea95f73fc060c1519b52
* Add unistd.h for size_t typedef to fix sim-engKenny Root2010-07-281-0/+1
| | | | Change-Id: Ida4f1742547f39539b601f13182c722aa7cf863e
* Support streaming of compressed assets > 1 megabyteChristopher Tate2010-07-283-30/+271
| | | | | | | | | | | | 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
* Fix bug with phantom input windows.Jeff Brown2010-07-161-7/+29
| | | | | | | | | | | 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
* Don't build framework tests for simulator target.Jeff Brown2010-07-141-0/+5
| | | | Change-Id: I70f29c7eb307e4f3ec5702f4eb9d97b4342e2f36
* Add initial gamepad support.Jeff Brown2010-07-131-0/+10
| | | | Change-Id: I0439648f6eb5405f200e4223c915eb3a418b32b9
* Merge changes I2337051b,I19b426cb into gingerbreadKenny Root2010-07-122-17/+36
|\ | | | | | | | | | | * changes: Tweak ObbFile class Allow things that can install packages to set Obb paths
| * Tweak ObbFile classKenny Root2010-07-122-17/+36
| | | | | | | | | | | | | | | | | | | | | | * 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
* | Add new glue code for writing native apps.Dianne Hackborn2010-07-082-72/+99
|/ | | | | | | | | | | | | | | | | 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
* Add OBB file helper classKenny Root2010-07-074-0/+366
| | | | | | | ObbFile is a binary blob that will be used in packaging large files with smaller APKs. Change-Id: Ib1594346cfa2f49113de6565af77c24efbd89d63
* Add new native Looper API.Dianne Hackborn2010-07-021-4/+64
| | | | | | | | | | | 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
* Even more native input dispatch work in progress.Jeff Brown2010-06-174-41/+74
| | | | | | | | | | | | | | | | | 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
* Support for multiple testsJeff Brown2010-06-141-4/+9
| | | | | | | The build system enforces some invariants that were being ignored before. Change-Id: Ie7675042af7f961a507386c13b2a0b592b591af8
* Remove PollLoop from host build.Jeff Brown2010-06-131-4/+4
| | | | | | We can't build (and we don't need) PollLoop in the SDK on all platforms. Change-Id: I3b0f327bbb8bc58b9b8630b0161cf360403fea68
* Native input dispatch rewrite work in progress.Jeff Brown2010-06-138-12/+792
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix String8 to free its memory only after assignment operations based on ↵Andreas Huber2010-06-101-4/+8
| | | | | | pointers are finished in case that pointer referred to the string's original contents. Change-Id: I6961f3cf10ba3b728579ea63262db750a4cf8577
* ZipUtilsRO rewrite based on Dalvik Zip rewriteKenny Root2010-05-123-169/+299
| | | | | | | | | | | | | | | | | | | | | 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
* am ca48c88c: am 8a8658a5: Merge "Make static versions of libutils and ↵Dan Egnor2010-05-062-4/+15
|\ | | | | | | | | | | | | | | | | libbinder." into froyo Merge commit 'ca48c88c3d5733c4405a2fc4f7d9bb7fbba3d43f' into kraken * commit 'ca48c88c3d5733c4405a2fc4f7d9bb7fbba3d43f': Make static versions of libutils and libbinder.
| * Make static versions of libutils and libbinder.Dan Egnor2010-05-062-4/+15
| | | | | | | | | | | | | | | | | | | | 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
* | New xlarge screen size.Dianne Hackborn2010-04-281-0/+3
|/ | | | | | | | | | | | | 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
* Revert "fix [2542425] memory leak during video recording"Dianne Hackborn2010-03-301-2/+0
| | | | This reverts commit 544592e14f8d7643238e40ba9879727497900f35.