Commit Graph

233 Commits

Author SHA1 Message Date
Kenny Root
c412dcb3eb Split UTF functions from String8/16
Split out all the UTF-8/16/32 handling code from String8/16 to its own
file to allow better reuse of code.

Change-Id: If9ce63920edc75472c38da4adce0d13cda9ad2f7
2010-11-12 15:53:40 -08:00
Kenny Root
ec033c57b6 Fix default return code for getResource
Reorganization of getResource to allow for other densities accidentally
overrode the default return code for getResource from BAD_VALUE to
BAD_INDEX. This corrects the default return to BAD_VALUE which restores
other things to working.

Bug: 3155824
Change-Id: I13dafff85bc6978c5f5435fc09ab0474c7885c4d
2010-11-02 11:27:31 -07:00
Kenny Root
133cde5805 Add path to get different DPI drawables
Allow a caller to request a different density than their current display
allows. This can mean a device displaying mdpi can get a resource that's
in hdpi and have it pretend to be in mdpi resolution. If a drawable
that's returned is not in the requested density, it will set it at the
appropriate density to be scaled up later on.

The API for this is hidden currently.

Bug: 3134688
Change-Id: I6c3908cbdef4907b8d3f1576df9e3b0e7af1755a
2010-10-29 12:47:07 -07:00
Kenny Root
4b3d8bd9a4 am 7ba8c44e: am 8ad30b5b: Merge "Initialized check in ZipFileRO::findEntryByName" into gingerbread
Merge commit '7ba8c44ef7ba22d83a670e50314d69d0ddce1b9c'

* commit '7ba8c44ef7ba22d83a670e50314d69d0ddce1b9c':
  Initialized check in ZipFileRO::findEntryByName
2010-10-22 09:14:28 -07:00
Kenny Root
06dbe50a1a Initialized check in ZipFileRO::findEntryByName
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
2010-10-21 15:25:12 -07:00
Brad Fitzpatrick
c6a98bb73d resolved conflicts for merge of 368fdba4 to master
Change-Id: I42b7b433c86a71a5da5db67109f056a280077c9d
2010-10-21 07:39:10 -07:00
Joe Onorato
fc1a4df523 Reduce logging.
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
2010-10-19 15:08:05 -04:00
Jeff Brown
6a817e22e4 Add keycodes and meta-key modifiers to support external keyboards.
Added new key maps for external keyboards.  These maps are intended to
be shared across devices by inheriting the "keyboards.mk" product
makefile as part of the device's product definition.

One of the trickier changes here was to unwind some code in
MetaKeyKeyListener that assumed that only the low 8 bits of the meta key
state were actually used.  The new code abandons bitshifts in favor
of simple conditionals that are probably easier to read anyways.
The special meta key state constants used by MetaKeyKeyListener
are now (@hide) defined in KeyEvent now so as to make it clearer that they
share the same code space even if those codes are not valid for KeyEvents.

The EventHub now takes care of detecting the appropriate key layout
map and key character map when the device is added and sets system
properties accordingly.  This avoids having duplicate code in
KeyCharacterMap to probe for the appropriate key character map
although the current probing mechanism has been preserved for legacy
reasons just in case.

Added support for tracking caps lock, num lock and scroll lock and
turning their corresponding LEDs on and off as needed.

The key character map format will need to be updated to correctly support
PC style external keyboard semantics related to modifier keys.
That will come in a later change so caps lock doesn't actually do
anything right now except turn the shiny LEDs on and off...

Added a list of symbolic key names to KeyEvent and improved the toString()
output for debug diagnosis.  Having this list in a central place in the
framework also allows us to remove it from Monkey so there is one less
thing to maintain when we add new keycodes.

Bug: 2912307
Change-Id: If8c25e8d50a7c29bbf5d663c94284f5f86de5da4
2010-10-15 16:00:07 -07:00
Raphael Moll
cc13ed145c am 729503c2: am 848a2bc4: Merge "MinGW/Cygwin requires open() in O_BINARY mode." into gingerbread
Merge commit '729503c280e0d5b2621a8b7a6c93dd20fe1f5d0f'

* commit '729503c280e0d5b2621a8b7a6c93dd20fe1f5d0f':
  MinGW/Cygwin requires open() in O_BINARY mode.
2010-10-15 14:28:15 -07:00
Kenny Root
d72b033033 am 8fda1636: am bdf8034c: Merge "OBB: use PBKDF2 for key generation." into gingerbread
Merge commit '8fda1636e3e35f060b9046294efd3c062a1fdb84'

* commit '8fda1636e3e35f060b9046294efd3c062a1fdb84':
  OBB: use PBKDF2 for key generation.
2010-10-15 14:00:58 -07:00
Raphael Moll
2cf43c6988 MinGW/Cygwin requires open() in O_BINARY mode.
Alsso printf %zd is not supported on MinGW/Cygwin.

Change-Id: I03811dabb46e2b05dd1d8abcc0ff97b125c77d54
2010-10-13 21:55:15 -07:00
Kenny Root
95a6889312 OBB: use PBKDF2 for key generation.
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
2010-10-13 18:25:33 -07:00
Jeff Brown
2eb1995a5d am 22cb4ef8: am d577cfd7: Merge "Switch Looper back to using poll() instead of epoll()." into gingerbread
Merge commit '22cb4ef8ce9c4d5536ac5cee5c40b82bfa56ccc5'

* commit '22cb4ef8ce9c4d5536ac5cee5c40b82bfa56ccc5':
  Switch Looper back to using poll() instead of epoll().
2010-10-10 12:52:40 -07:00
Jeff Brown
54e1cdacd2 Switch Looper back to using poll() instead of epoll().
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
2010-10-07 13:26:39 -07:00
Kenny Root
8c4edc02d5 am bfa33b94: am f84a5918: Merge "Use pread() in ZipFileRO for Linux" into gingerbread
Merge commit 'bfa33b9484e2c0a019ab81f30261b9696df23a9b'

* commit 'bfa33b9484e2c0a019ab81f30261b9696df23a9b':
  Use pread() in ZipFileRO for Linux
2010-10-05 17:02:42 -07:00
Kenny Root
61ef747e0e Use pread() in ZipFileRO for Linux
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
2010-10-04 15:17:19 -07:00
Kenny Root
3d20bc9ff6 am ac754073: am b58b2714: Merge "ZipFileRO: moar logging and wrap close" into gingerbread
Merge commit 'ac7540733cafcca5bdb1842e1ebcb396ba064583'

* commit 'ac7540733cafcca5bdb1842e1ebcb396ba064583':
  ZipFileRO: moar logging and wrap close
2010-10-04 07:54:06 -07:00
Kenny Root
dbf6f272a2 ZipFileRO: moar logging and wrap close
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
2010-10-01 18:30:59 -07:00
Kenny Root
323b75e3c4 am c55f6da7: am 0b606263: Merge "Revert "Revert "Free created FileMap when uncompressing files""" into gingerbread
Merge commit 'c55f6da7281d34a4b875975cdf68f5062dfe4b34'

* commit 'c55f6da7281d34a4b875975cdf68f5062dfe4b34':
  Revert "Revert "Free created FileMap when uncompressing files""
2010-09-24 15:22:44 -07:00
Kenny Root
d6d93dbb86 am 3e07c000: am 74865ef6: Merge "Add locking around ZIP seeking" into gingerbread
Merge commit '3e07c0007b10fbda945516acaf6b2a8787a6ca06'

* commit '3e07c0007b10fbda945516acaf6b2a8787a6ca06':
  Add locking around ZIP seeking
2010-09-24 15:22:38 -07:00
Kenny Root
b47eafac1d Revert "Revert "Free created FileMap when uncompressing files""
This revert reverts commit a19ef306bd0a257c67b50f5e0e669e9fe52b0889.
2010-09-24 09:11:28 -07:00
Kenny Root
fa98920b71 Add locking around ZIP seeking
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
2010-09-24 08:05:51 -07:00
Jeff Brown
6bea174983 am 4ec134cd: am cce0cd13: Merge "Looper: use pthread_once for TLS key initialization." into gingerbread
Merge commit '4ec134cdba52b663506562c6406b07915820b007'

* commit '4ec134cdba52b663506562c6406b07915820b007':
  Looper: use pthread_once for TLS key initialization.
2010-09-21 15:57:13 -07:00
Jeff Brown
61a25b2490 Looper: use pthread_once for TLS key initialization.
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
2010-09-21 15:26:51 -07:00
Jeff Brown
62927a5539 am a8d95248: am 7d4739be: Merge "Reduce lock thrashing in native Looper." into gingerbread
Merge commit 'a8d95248bdbb8ea0933ecf86d2859964324978a7'

* commit 'a8d95248bdbb8ea0933ecf86d2859964324978a7':
  Reduce lock thrashing in native Looper.
2010-09-18 00:16:29 -07:00
Jeff Brown
ed242de3f5 Reduce lock thrashing in native Looper.
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
2010-09-17 17:01:23 -07:00
Jeff Brown
339f69889f am d3576ef8: am 1ac48eab: Merge "Ensure input dispatcher and native looper handles EINTR." into gingerbread
Merge commit 'd3576ef8906798d91da3ee88a103f4bedcab169e'

* commit 'd3576ef8906798d91da3ee88a103f4bedcab169e':
  Ensure input dispatcher and native looper handles EINTR.
2010-09-16 17:29:57 -07:00
Jeff Brown
f67f299036 Ensure input dispatcher and native looper handles EINTR.
Change-Id: I0a42db5f273b9bfe4ab174e4ee65d5d852f9f6bc
2010-09-16 17:04:52 -07:00
Jeff Brown
dc543aec70 am 14bc6b5d: am 09340a4b: Merge "Replace epoll() with poll() and rename PollLoop to Looper." into gingerbread
Merge commit '14bc6b5d0677e5c454a67775c852f90389bb4567'

* commit '14bc6b5d0677e5c454a67775c852f90389bb4567':
  Replace epoll() with poll() and rename PollLoop to Looper.
2010-09-15 12:32:29 -07:00
Jeff Brown
59abe7e090 Replace epoll() with poll() and rename PollLoop to Looper.
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
2010-09-14 01:59:45 -07:00
Jeff Brown
055a7926e6 am 0f0541e4: am b88102f5: Input dispatcher ANR handling enhancements.
Merge commit '0f0541e40cfef51eb5c3769e53c1aa853b53aaf6'

* commit '0f0541e40cfef51eb5c3769e53c1aa853b53aaf6':
  Input dispatcher ANR handling enhancements.
2010-09-12 17:15:19 -07:00
Jeff Brown
a665ca805c 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
2010-09-12 16:52:03 -07:00
Dianne Hackborn
4181bd66fc am 510951e9: am a8512a71: Always set the scheduling group when starting a new thread.
Merge commit '510951e98bdb861130f38c087956cd05e0b41dcd'

* commit '510951e98bdb861130f38c087956cd05e0b41dcd':
  Always set the scheduling group when starting a new thread.
2010-09-09 23:11:22 -07:00
Dianne Hackborn
9c82c48d52 Always set the scheduling group when starting a new thread.
Change-Id: Ia33acf13fc3752707f3819928c36315e223fa1bd
2010-09-09 22:12:25 -07:00
Kenny Root
16ead4738c am 2a08e2a9: am a19ef306: Revert "Free created FileMap when uncompressing files"
Merge commit '2a08e2a9f881d06a03e36367585137e05706f592'

* commit '2a08e2a9f881d06a03e36367585137e05706f592':
  Revert "Free created FileMap when uncompressing files"
2010-09-07 19:41:00 -07:00
Kenny Root
dc2d840ff7 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.
2010-09-07 19:30:22 -07:00
Dianne Hackborn
c946422d58 am a1205f07: am 2d3739d4: Merge "Modify native ALooper to take an explicit ident." into gingerbread
Merge commit 'a1205f07a6f0c745e8f42f16fe38c06af04143c7'

* commit 'a1205f07a6f0c745e8f42f16fe38c06af04143c7':
  Modify native ALooper to take an explicit ident.
2010-09-07 18:52:06 -07:00
Dianne Hackborn
45e0acb41a 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
2010-09-07 15:46:55 -07:00
Dianne Hackborn
1cce37b477 am 05dff838: am 11bbe200: Hopefully fix the build.
Merge commit '05dff838946abb01caa3c3172cf0f367964a0b6d'

* commit '05dff838946abb01caa3c3172cf0f367964a0b6d':
  Hopefully fix the build.
2010-09-07 14:48:28 -07:00
Dianne Hackborn
3d2bca9abd am b8bcfed5: am f703b77c: Merge "Add system property to turn off scheduling groups." into gingerbread
Merge commit 'b8bcfed5524a37ee51e3f1129f1df91bc4a59cb4'

* commit 'b8bcfed5524a37ee51e3f1129f1df91bc4a59cb4':
  Add system property to turn off scheduling groups.
2010-09-07 14:47:51 -07:00
Dianne Hackborn
bb39b9f17b Hopefully fix the build.
Change-Id: Id8cd92c0895c9939e1386ef488bd1309a3be3568
2010-09-07 12:32:19 -07:00
Dianne Hackborn
7b0d45c346 Add system property to turn off scheduling groups.
Do this:

adb shell setprop debug.sys.noschedgroups 1

Change-Id: I6e06a74205fd45ee1526ce71fe33944465d39984
2010-09-07 11:19:11 -07:00
Kenny Root
757a86752f am 8d5250c6: am 2e246549: Merge "Add better debug output for ResourceType errors" into gingerbread
Merge commit '8d5250c601504da7a7fde3a3fd7b1c51335becdf'

* commit '8d5250c601504da7a7fde3a3fd7b1c51335becdf':
  Add better debug output for ResourceType errors
2010-09-02 15:53:26 -07:00
Kenny Root
45162448b3 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
2010-09-02 14:58:47 -07:00
Kenny Root
b940c7e901 am 8e724905: am ad6731b0: Merge "Add debugging to ZipFileRO" into gingerbread
Merge commit '8e724905261bf4913bac75adc64fb08ed5ba8b7d'

* commit '8e724905261bf4913bac75adc64fb08ed5ba8b7d':
  Add debugging to ZipFileRO
2010-08-27 16:18:44 -07:00
Kenny Root
e0573a4ad6 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
2010-08-27 12:47:34 -07:00
Kenny Root
8d7fcccef6 am b90b9d54: am 6be23712: Merge "Free created FileMap when uncompressing files" into gingerbread
Merge commit 'b90b9d54eb6bbc3a4045ff0bf46d3366822e835e'

* commit 'b90b9d54eb6bbc3a4045ff0bf46d3366822e835e':
  Free created FileMap when uncompressing files
2010-08-24 09:02:28 -07:00
Kenny Root
24b2aee9ca am 821afa9a: am 54d41379: Merge "Add OBB flags to support overlays" into gingerbread
Merge commit '821afa9aec8d3a4ffd2e72ce797d8097eaf13973'

* commit '821afa9aec8d3a4ffd2e72ce797d8097eaf13973':
  Add OBB flags to support overlays
2010-08-21 09:41:12 -07:00
Kenny Root
cd9ce313dd Free created FileMap when uncompressing files
Change-Id: Ice22c4ecb7c129b74bf60cd66ae79e110b017a4a
2010-08-19 18:39:58 -07:00
Kenny Root
28e9b9f243 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
2010-08-18 09:34:58 -07:00