History log of /libcore/luni/src/main/native/Register.cpp
Revision Date Author Comments
83c7414449bc406b581f0cb81ae06e7bce91403c 15-Jan-2014 Jeff Hao <jeffhao@google.com> Removed offset and value from String and added StringFactory.

Change-Id: I55314ceb906d0bf7e78545dcd9bc3489a5baf03f
3f7c674bd1d220d1a8c149b5658145171c28094f 22-Apr-2015 Narayan Kamath <narayan@google.com> Move java.nio.Charsets to libcore.util.

This isn't public API, and isn't related to NIO. It's only ever
used by java.lang.String.

bug: 10898787
Change-Id: I4e194406746b88ba7268c2553e467e7e05400b40
f7d3d845d1db889060262cfb7a9f73a2c4fdb7f3 07-Apr-2015 Travis Keep <rocketman@google.com> Switch DateIntervalFormat/RelativeDateTimeFormatter to ICU4J

Information below from the existing benchmarks on a hammerhead. All
times given in microseconds. Note that the new version is slower,
but this is a small difference in absolute terms and means less
maintenance for libcore.

The ICU team is rewriting some of the underlying code in ICU4J
for a future ICU release which may alter performance.

ICU4C + JNI
DateIntervalFormat_formatDateRange_DATE 67.8
DateIntervalFormat_formatDateRange_DATE_TIME 76.0
DateIntervalFormat_formatDateRange_TIME 54.8
ICU4J
DateIntervalFormat_formatDateRange_DATE 179
DateIntervalFormat_formatDateRange_DATE_TIME 181
DateIntervalFormat_formatDateRange_TIME 167

ICU4C + JNI
RelativeDateTimeFormatter_getRelativeDateTimeString 151.6
RelativeDateTimeFormatter_getRelativeDateTimeString_ABBREV 169.0
RelativeDateTimeFormatter_getRelativeTimeSpanString 27.8
RelativeDateTimeFormatter_getRelativeTimeSpanString_ABBREV 27.7
ICU4J
RelativeDateTimeFormatter_getRelativeDateTimeString 366.5
RelativeDateTimeFormatter_getRelativeDateTimeString_ABBREV 377.6
RelativeDateTimeFormatter_getRelativeTimeSpanString 23.2
RelativeDateTimeFormatter_getRelativeTimeSpanString_ABBREV 22.9

Bug: 20127691
Change-Id: I1ebc08fd9c974743026ae1e6c848fb4de8aa0e48
d0ef6d8b070d2892caf59d1f7501ff05667be6cc 27-Mar-2015 Narayan Kamath <narayan@google.com> Implement BreakIterator in terms of icu4j.

Note that we need manual range checks in our wrapper because
the ICU4J implementation will clamp offsets to either end of
the input text.

benchmark results :

text benchmark us linear runtime
LIPSUM BreakIterator 326.02 =====
LIPSUM IcuBreakIterator 333.47 ======
LONGPARA BreakIterator 227.67 ====
LONGPARA IcuBreakIterator 228.68 ====
GERMAN BreakIterator 79.09 =
GERMAN IcuBreakIterator 81.30 =
THAI BreakIterator 1654.11 ==============================
THAI IcuBreakIterator 1646.75 =============================
THAI2 BreakIterator 44.28 =
THAI2 IcuBreakIterator 42.67 =
TABS BreakIterator 12.79 =
TABS IcuBreakIterator 12.53 =
ACCENT BreakIterator 16.26 =
ACCENT IcuBreakIterator 15.37 =
EMOJI BreakIterator 17.71 =
EMOJI IcuBreakIterator 18.34 =
SPACES BreakIterator 16.86 =
SPACES IcuBreakIterator 15.78 =
EMPTY BreakIterator 9.22 =
EMPTY IcuBreakIterator 9.96 =
NEWLINE BreakIterator 11.08 =
NEWLINE IcuBreakIterator 9.96 =
BIDI BreakIterator 19.54 =
BIDI IcuBreakIterator 18.96 =

Change-Id: I72023dd605da8e33974aa3181506f0d9c7bc180e
7bcff480531c1aa18de118c6f36dd397d5e1ad86 07-Feb-2015 Tao Bao <tbao@google.com> Use ICU for relative time formatting

Rewrite the DateUtils' relative time formatting APIs
(getRelativeTimeSpanString, getRelativeDateTimeString) to use ICU ones.
Two APIs that take withPreposition parameter are not changed. Because
(a) ICU doesn't provide functionality to format preposition; (b) They
are not really computing relative time but instead calling
formatDateRange() to get the absolute time/date string.

Benchmark results on aosp_hammerhead-userdebug:

before:
benchmark us linear runtime
DateUtils_getRelativeDateTimeString 127.1 ==========================
DateUtils_getRelativeDateTimeString_ABBREV 145.0 ==============================
DateUtils_getRelativeTimeSpanString 28.0 =====
DateUtils_getRelativeTimeSpanString_ABBREV 27.9 =====

now:
benchmark us linear runtime
RelativeDateTimeFormatter_getRelativeDateTimeString 119.2 ==========================
RelativeDateTimeFormatter_getRelativeDateTimeString_ABBREV 133.8 ==============================
RelativeDateTimeFormatter_getRelativeTimeSpanString 24.6 =====
RelativeDateTimeFormatter_getRelativeTimeSpanString_ABBREV 24.7 =====

Bug: 19146457
Bug: 5252772
Change-Id: Ief74608354964a17e42191d7b1a58964f3a9acfd
8f3b150cd86c2eb35229806fda6928501da27cac 26-Aug-2014 Elliott Hughes <enh@google.com> Keep qtaguid quiet by not trying to untag non-sockets.

(cherry-pick of f6cf9efb212e572dcd2e902ca461af6323793dbf.)

Bug: 17203955
Change-Id: I0999fc0ff295986b92e31568d96e321b9e7ffb2c
f6cf9efb212e572dcd2e902ca461af6323793dbf 26-Aug-2014 Elliott Hughes <enh@google.com> Keep qtaguid quiet by not trying to untag non-sockets.

Bug: 17203955
Change-Id: I0999fc0ff295986b92e31568d96e321b9e7ffb2c
55845eab3f391a30b50e1c186479935b14fa44da 23-Jun-2014 Neil Fuller <nfuller@google.com> Build fix: Remove reference to deleted java_io_Console function

The function was deleted by
1f3014901704f3ae81538773b8a0b382945adc8d

Bug: 12491103
Change-Id: If75f1f05d6a72cac7b7a86b7616bae870615452e
ad85992a32668bdd5230e884b424ee813178340a 29-Apr-2014 Elliott Hughes <enh@google.com> libcore.io.OsConstants is dead; long live android.system.OsConstants!

Change-Id: I3951c1349842adf7dfbb7458c76c982646804ccb
0c1869ed7f46baf764f9daf4e64c77cd7fbd3516 29-Nov-2013 Narayan Kamath <narayan@google.com> Add a JNI wrapper over libziparchive.

All functions delegate directly to the native code. We
do not perform any sort of central directory or local file
related lookups in the java layer.

For each entry, libziparchive gives us an offset to the start
of data for the entry and the compressed size. We use a
RandomAccessFile to seek to that offset and then construct an
InputStream that's bounded between [offset, offset + compressed_size).

We reuse existing code (JarVerifier / Manifest) for certificate
validation & collection.

bug: 10193060

Change-Id: I21eb4e6dc6aa8749e3f63830f9799e1f621d26e6
c3cfad989c612f749ea24ed641a64e619cc5bb9d 14-Jul-2011 Elliott Hughes <enh@google.com> Make libjavacore (libcore's JNI library) use JNI_OnLoad.

One other change here is that I've removed ExpatParser's dependency on
libcutils, switching the relevant code to use ICU instead.

(cherry picked from commit ab4b6905b5b100f251818bcfc68192ff736af7b7)

Change-Id: Id3758b31c3c76043ee1923223a243116188196c3
5b5e8e70b52dd4fca159fb39f9ee555d31699dec 12-Sep-2013 Elliott Hughes <enh@google.com> Remove RawSocket, which is no longer used.

Change-Id: Ia44a9ffd4d36da408c6b411c90d59ce7db30a36f
15c1945bb1810d061ea2d5b07a11e3ecc5ec8536 10-Sep-2013 Ruben Brunk <rubenbrunk@google.com> Remove dependency on JNIHelp header side effects.

(cherrypick of cc5305a004afc334842a4afadca9530c2ea0c8ff.)

Bug: 10680559
Change-Id: I49ad58dea61a0e558bebfbd76019e7e0730cab52
cc5305a004afc334842a4afadca9530c2ea0c8ff 10-Sep-2013 Ruben Brunk <rubenbrunk@google.com> Remove dependency on JNIHelp header side effects.

Bug: 10680559
Change-Id: Idfc643f1d220ace34de5b9e2cec123e545a44b95
61a124188040f84b5c237c338ec0ce7d3da75ed0 29-Aug-2013 Kenny Root <kroot@google.com> Move conscrypt out libjavacore and split tests

To make the situation with testing a little better and enable building
core libraries totally independent of conscrypt, move the native
registration to a JNI_OnLoad scheme. Also, since we want to separate the
testing, make conscrypt build its own tests library.

(cherry picked from commit ba07db54a902e6741cd085901264e4e45c9c844e)

Bug: 10092469
Change-Id: Ie0e9b73d05236a9bd02fbb66cb1a5da4ec34df45
ba07db54a902e6741cd085901264e4e45c9c844e 29-Aug-2013 Kenny Root <kroot@google.com> Move conscrypt out libjavacore and split tests

To make the situation with testing a little better and enable building
core libraries totally independent of conscrypt, move the native
registration to a JNI_OnLoad scheme. Also, since we want to separate the
testing, make conscrypt build its own tests library.

Change-Id: I9f2831839059c1c012ec7bdeab2f90b4e2f44bfd
480537d9d51add98bffe6d9a9ef3b1022b959336 03-May-2013 Elliott Hughes <enh@google.com> Add an icu4c-based DateIntervalFormat.

This will be used to replace DateUtils.formatDateRange's implementation.

Bug: 7289514
Change-Id: I5588c79a9d0a5cbed3b4600389c545e83fc26967
3443a5e4e7ea9fa3fdc3495a1f2c44bea97ac100 07-Jul-2011 Elliott Hughes <enh@google.com> Offer default implementations of various dalvik intrinsics in the library.

(cherry-picked from commit 2f95766aac3df74c6c641232eec4791b2330c9df)

Change-Id: I1005ee22ed8a017bb536bfd76df2173c7e8dcf64
7cad2d4e4e00bb152b726541b62840708d1cbcb1 20-Jul-2011 Elliott Hughes <enh@google.com> Some of our helpers have moved into libnativehelpers.

(cherry picked from commit 4b5012a6cd5f7f32f33a776c9e2c94ca3f3eb1d5)

Change-Id: I8a154f8b6e39b8ed0a633fab9ba31d557b545bb5
38375a4d0b3d34e2babbd2f6a013976c7c439696 24-Apr-2013 Kenny Root <kroot@google.com> Move JSSE to new package

To help with shipping the JSSE with apps that want to bundle it, move
it to a new package so that the tangles in other parts of the library
can be untangled.

Change-Id: I810b6861388635301e28aee5b9b47b8e6b35b430
09bcea1fd2a0bade07ab034352fde6c6ff6e01a6 01-Mar-2013 Elliott Hughes <enh@google.com> Add Unsafe.allocateInstance.

At the moment, mockers are writing dalvik-specific code that pokes
around with our internals and breaks when we change stuff. They're
also supporting Unsafe so they can run on the RI. Everyone's better
off if we just implement the missing Unsafe call.

Bug: 8297640
Change-Id: Ib647e27d920be548009f26ced3b74bad7400a590
f355854de80a0b69eb7763b8d1bacca18d2b88b8 28-Feb-2013 Geremy Condra <gcondra@google.com> Revert "Add basic seccomp filter for apps."

This reverts commit 296cb91e8c1b574f9fd76705b1b50c404f77e3dd

Change-Id: Ibf9dadee173080e9ad656bf81339fb419594fd38
7b047ca0757e5cef5641697c533637463045131d 28-Feb-2013 Geremy Condra <gcondra@google.com> Revert "Add basic seccomp filter for apps."

This reverts commit 296cb91e8c1b574f9fd76705b1b50c404f77e3dd

Change-Id: Ibf9dadee173080e9ad656bf81339fb419594fd38
ac7cf58962995825464af08ae6fa5e006c94f3fa 27-Feb-2013 Elliott Hughes <enh@google.com> Switch to using icu4c 50's TimeZoneNames API.

This takes us down from ~330ms/locale on prime to ~70ms/locale.

This also fixes a bug in DateFormatSymbols.getZoneStrings and adds a test
so we don't regress.

Change-Id: I13663a659666c0a7d87a299235b75fa4e9fef69d
296cb91e8c1b574f9fd76705b1b50c404f77e3dd 19-Feb-2013 Geremy Condra <gcondra@google.com> Add basic seccomp filter for apps.

Change-Id: I1b0f0433740cde80a720c9a5af131699f43fa921
860b3c5989a8dd9de73639d8057443aa12fe7b16 05-Feb-2013 Elliott Hughes <enh@google.com> Add libcore.icu.AlphabeticIndex.

Change-Id: I06a634199ff2c8dcf0a8b6e4774da4cdbfb0d774
3aac4ddc4d17c07fa8b4908069d23d5401a77993 05-Feb-2013 Elliott Hughes <enh@google.com> Add icu4c-backed transliteration.

Change-Id: I4194810646a2a0661331aaf941fb5f99ce7758b1
7cd6760f7045d771faae8080a8c6150bf678f679 04-May-2012 Elliott Hughes <enh@google.com> Make libjavacore independent of libnativehelper for the PDK.

Bug: 6369821
Change-Id: Ie038571a5dac1f301c0c3c6fb84df432e67b62c0
679cf68b607e9b4a3beb8bcdee06868ae583386f 08-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/#/c/157220

Bug: 5449033
Change-Id: I3deb0b1b71cf4ec6d82921a2e0015c3a7b397cbf
dc915c69ba2495dd2cf965d16058d0b13762142c 20-May-2011 Elliott Hughes <enh@google.com> Move the floating-point parsing code, and tidy up some documentation.

Change-Id: Ibdc1716847f4c6a85a7c24766feffc8768819cef
553d98af897f7202de5e5a776287de0b5ca8fe39 19-May-2011 Elliott Hughes <enh@google.com> Expose accept(2).

The implementation of PlainSocketImpl.accept is made ugly by the fact that the
SocketImpl we mutate may share its FileDescriptor with a SocketChannel, so we
need to mutate the FileDescriptor itself, and can't simply swap in a new one.
I've raised http://b/4452981 to see if we can integrate the nio and io socket
classes more closely, to avoid this kind of mess.

Bug: 3107501
Change-Id: I4964b64c25e936a44d1e4c22504ca29bba247ab6
e27d02044ec399884bfd4343d513bf270b9b9b11 16-May-2011 Elliott Hughes <enh@google.com> Remove OSNetworkSystem.close.

For now I'm keeping AsynchronousCloseMonitor as a special case in native code.
We can see about doing something more general-purpose in a later pass.

Bug: 3107501
Change-Id: Ib79b9fc0bebfafc2d14896d957bd8591ae8e6e97
1c039d71d3879f39e3a75b8788e656f7b4f88f08 05-May-2011 Elliott Hughes <enh@google.com> Add getaddrinfo(2).

This only supports the "node" side of getaddrinfo(2), not the "service" side.
There's also no support for AI_CANONNAME, so we currently return InetAddress[]
rather than anything equivalent to C's linked list of struct addrinfo.

Bug: 3107501
Change-Id: I8cf6baa3027a0fa05ac6e2f8fcc1dd8b576ff8c4
52467225e3b1ff2386ed5bf630e97e5345469260 23-Apr-2011 Elliott Hughes <enh@google.com> Move JNIHelp's implementation to C++.

Change-Id: I110615696e8348e0dc3cf4a53726a5e0595f5d7e
a37e971343883bb582a93ffbd9f0ba84f10e55ba 21-Apr-2011 Elliott Hughes <enh@google.com> Rewrite NetworkInterface.

This is part of the POSIX work, but also fixes a bug that asked for down
interfaces to be returned. Additionally, I found a few bugs while rewriting
this code. Most notably, we used to return a bogus broadcast address for
the loopback interface. The only difference I notice between us and the RI
when running on the host is that the RI claims that 127.0.0.1 has a prefix
length of 0 rather than 8. I believe that we are correct on this issue.

Bug: 4082343, 3107501
Change-Id: I677e0698e3a86676b4332b5d56fe514a99c3ddc0
462bdac45c10f43d88d8f07f6994e272a27c14a2 30-Mar-2011 Elliott Hughes <enh@google.com> Add close(2).

This is sufficient for non-socket fds, but may need to change to support the
asynchronous socket close monitor. (Hopefully not; I'd rather lift that into
Java.)

I've also changed the semantics of IoUtils.close to match those desired by
all callers: ignore null/invalid FileDescriptors.

Bug: 3107501
Change-Id: Iad5c31c8f0f34d2a5ab1ed4581509b46af28bd1f
8b15dcc5890963edad4dfcf558cc16027c7985e5 29-Mar-2011 Elliott Hughes <enh@google.com> Add sendfile(2).

This patch marks the end of OSFileSystem.

Having to support a Java "long*" for sendfile(2) gave me an opportunity to go
back and improve my ioctl(2) to use a corresponding "int*" equivalent, instead
of its previous special-case hack.

Bug: 3107501
Change-Id: I9fde4777700552263fab4fe9aeb556174163e3dc
52724d3ebd4ccaaa4b9f5576e329d4272cde8ea9 17-Mar-2011 Elliott Hughes <enh@google.com> Add fsync(2) and fdatasync(2).

Interesting parts to this change:
* first BlockGuard support (and general delegation support).
* first rethrowing of ErrnoException as IOException.
* switching FileChannelImpl from int to FileDescriptor.

The special case in FileDescriptor.sync has been removed. Testing with the RI
showed that it doesn't treat syncing a FileDescriptor that corresponds to a
socket as a special case --- it throws SyncFailedException just like normal.

Bug: 3107501
Change-Id: I99faf120bd802aec0397a79772ed38c5e1542fed
ec617e2cb4a374f0fd8fbda4a633214cf23a59a9 17-Mar-2011 Elliott Hughes <enh@google.com> Move the getenv(3) native code out of System as a demo.

This is a fairly trivial patch, just to show the general structure.

Bug: 3107501
Change-Id: I547df621ccb8b8874e5f74c4d0bcf84ccaef97c3
cdf7a1f942469221bcfd63d9cdf71851b011eaf0 16-Mar-2011 Elliott Hughes <enh@google.com> Expose POSIX constants.

And use them, too. This patch is a little confusing because we already had
constants in Java that were using the POSIX names but that didn't actually
correspond to the constants whose names they'd stolen. Ugh.

Bug: 3107501
Change-Id: Ib64a109c9340b0ecdf80bec91074206c001f455a
f934c3d2c8dd9e6bc5299cef41adace2a671637d 15-Mar-2011 Elliott Hughes <enh@google.com> Make OSMemory the semi-supported libcore.io.Memory.

Looks like we're not going to bother with a separate libcore.os package,
when libcore.io will do.

Change-Id: I2806c59349ed4b6410d768c4207c384ced973c54
bb1c04167bdff1939e9e71ed04c57337d4951008 17-Feb-2011 Elliott Hughes <enh@google.com> Tidy up the bidi code a little.

If we do ever use this, we should probably kill the run class completely; we
don't expose it to callers, and we could easily cope with a simple int[]
internally.

Change-Id: Ic03fbf7e56251a35b5db31509fbca15ab6d6f01a
08343a4ef77616fc420e51d1095c0d6a266041ba 16-Feb-2011 Elliott Hughes <enh@google.com> Remove our implementations of inline natives.

It turns out that our String.equals was getting used. Making dalvikvm's inline
natives be native methods ensures that doesn't happen.

I've also added a test to ensure we explicitly test both variants.

Change-Id: Ie2a4b5289092da5ffca4a4273692f1048ab3b841
296b43d6f6fc96b0b4cf16956bebed8347953a6f 11-Feb-2011 Elliott Hughes <enh@google.com> Remove the obsolete TouchDex code.

Apparently, this is how we did the first-boot dexing before we had a
package manager.

Change-Id: I6fce0fb30ab9dc2e7ebb0c4177540e92677c92b9
b8f9285f7e67812c435bc429e07683d6b9039b0a 22-Dec-2010 Jesse Wilson <jessewilson@google.com> Revert "Remove inline natives for an unused performance test." (libcore)

Change-Id: I7ea69f84c008c5bdbdf8af6134fb81d80f0a958e
2c549add8659c3f53a4b7306d3a01262434383e9 22-Dec-2010 Jesse Wilson <jessewilson@google.com> Remove native targets for unused performance tests.

Change-Id: Ia61172cd52de031290a811c3ec73edb929f40c10
1ad1fe9aa7fa705ce4441e90f46cf790ad0f758a 22-Dec-2010 Ben Cheng <bccheng@android.com> Revert "Remove native targets for unused performance tests."

This reverts commit 272a383283a974a4c32a94469b8a8b021d93a480.
272a383283a974a4c32a94469b8a8b021d93a480 21-Dec-2010 Jesse Wilson <jessewilson@google.com> Remove native targets for unused performance tests.

See also change I5a252e31.

Change-Id: I3880a81f1f7e90247ce12860b5a2f597037123a7
6523532145f06d8c208ed7a9374d3ab6d8132e66 14-Dec-2010 Elliott Hughes <enh@google.com> More serialization performance improvements.

Cache more work and don't use a Map of Integers for a range of
integers that's defined to be dense, just because they don't start at 0.

Bug: http://code.google.com/p/android/issues/detail?id=13138
Change-Id: Ie73d0bb946892f86165fca78da10bbcf64322570
975dc421bdf9f207ed88b3fbedbba558f0f62c3c 10-Dec-2010 Stan Chesnutt <chesnutt@google.com> Adds new RawSocket class (and underlying jni implementation). This is a
utility class for an experimental Java implementation of dhcp. The client
DHCP implementation needs to construct, send, receive, and parse raw L2
packets before the network interface is configured with an IP address. Current
Java networking classes do not work with unconfigured network interfaces.

Change-Id: I4dd0133868da5b84bd2a471c33173d4c056c34e8
7d0d108593ac30e19b8f2a5a157f697f3f46c041 13-Nov-2010 Elliott Hughes <enh@google.com> Switch ObjectOutputStream over to reflection.

Reduces the amount of (native) code, and improves performance. I've also
improved some of the detail messages from the reflection code (to help in
my own debugging).

I'll do ObjectInputStream next...

Bug: 3158451
Change-Id: Icf06a17507f9d011d120f2d704e084a103a400c7
cfa6ffebf3a63db7a125c4d9abe7e661fac5cc1f 04-Oct-2010 Elliott Hughes <enh@google.com> More package-jiggling for our ICU-related code.

Bug: 3045778
Change-Id: Ia9b29b28512deca6bd9dad806468238f8db2a8b9
c27a366a89e470690e99374b15270e7b9169ade1 02-Oct-2010 Elliott Hughes <enh@google.com> More icu4jni reshuffling.

Bug: 3045778
Change-Id: Iafb367f97d1fb169c6106adad0525cfcc0e10f25
972d9be2dbbf6d467728b8ad44625f6574068bf8 17-Sep-2010 Elliott Hughes <enh@google.com> Explode early when ICU's .dat file isn't available.

Also make it generally more obvious (and more obvious who's to blame) when
libcore's native code fails to initialize.

Bug: 3005342
Change-Id: I75496bb0c15391d7f32ba50b9c488ea0480e3e42
706de1164836051ab31cc69eb77a6bba1a723896 27-Aug-2010 Elliott Hughes <enh@google.com> Minor tidy-up of Float.toString and Double.toString.

This patch looks larger than it is. I've moved duplicated constants out of
Math and StrictMath and into Float and Double where they belong. I've also
moved a table out of BigDecimal so I can reuse it in NumberConverter, which
I've renamed to RealToString.

The main active ingredient here is that there's no longer StringBuilder usage
to prepend '-'. This actually brings us down from 74ns to 62ns for an easy
case like 123.45f.

[cherry-pick of 910106e29fe98f14b2c36312a7498287273ba826 from dalvik-dev to gingerbread; plus build fix]

Bug: 2934304
Change-Id: Id79a6fb0d739e673b7428d240fc48bdae9b8bb43
910106e29fe98f14b2c36312a7498287273ba826 27-Aug-2010 Elliott Hughes <enh@google.com> Minor tidy-up of Float.toString and Double.toString.

This patch looks larger than it is. I've moved duplicated constants out of
Math and StrictMath and into Float and Double where they belong. I've also
moved a table out of BigDecimal so I can reuse it in NumberConverter, which
I've renamed to RealToString.

The main active ingredient here is that there's no longer StringBuilder usage
to prepend '-'. This actually brings us down from 74ns to 62ns for an easy
case like 123.45f.

Bug: 2934304
Change-Id: I65461753247eeb9ff890ffe66b0bc79d66d2ec9c
8510524dab13e0acc1babf22cbc55002fb122777 17-Aug-2010 Elliott Hughes <enh@google.com> Some nio tidying.

Remove indirection on OSMemory, and use public ByteOrder and MapMode types
throughout the implementation, rather than adding our own duplication. Also
remove some unnecessary Java methods that just forwarded to identical native
methods, and an unnecessary factory class for MappedByteBuffer instances.
Also get rid of ICommonDataTypes, most of which was unused cruft.

Change-Id: I3240b02bcc19941b1b1cbba351ae7f7c1cdfc5b4
99a89dd6f0a0e1396aa9b3feebf15ea31f703d3a 04-Aug-2010 Elliott Hughes <enh@google.com> Rewrite the nio Pipe to use a Unix pipe behind the scenes.

We were using an AF_INET or AF_INET6 socket to implement the nio Pipe, which
was causing trouble for people on systems where IPv6 wasn't working yet.

This patch switches over to pipe(2). My first implementation used socketpair(2)
and retained the SocketChannelImpls, but it still seemed a bit off to be asking
for a full-duplex pipe to implement a unidirectional channel, and it required
hacks in the networking code to cope with the AF_LOCAL family, and in the
BlockGuard for the isLingeringSocket test.

This implementation uses pipe(2) and FileChannelImpl. It breaks a few tests, but
the tests are wrong, and it actually brings us closer to the RI's behavior of
throwing IOException "broken pipe" when writing to a broken pipe.

Rather than keep throwing junk into the FileSystem/NetworkSystem classes, and
resolving the question of which of those setNonBlocking belonged in (answer:
neither; this is a false Windows-style dichotomy that isn't helpful here), I've
added a new IoUtils with a few generally useful methods. The remainder of this
patch switches over existing code. We could probably make
FileDescriptor.descriptor private now I've exposed accessors, but this change
is large enough already...

Bug: 2735373
Bug: http://code.google.com/p/android/issues/detail?id=9431
Change-Id: I6b6d1e50bdddd435e71c31105a73c9d4fd135d7e
dbbdffce5ac97a0e93ef495adaacca3660b9ab21 23-Jul-2010 Elliott Hughes <enh@google.com> Remove UCharacter's unnecessary layer of indirection.

Also fix this sim-eng build failure:

libcore/luni/src/main/native/org_apache_harmony_luni_platform_OSMemory.cpp: In function ‘jint OSMemory_flushImpl(JNIEnv*, _jobject*, jint, jlong)’:
libcore/luni/src/main/native/org_apache_harmony_luni_platform_OSMemory.cpp:334: error: invalid conversion from ‘const void*’ to ‘void*’
libcore/luni/src/main/native/org_apache_harmony_luni_platform_OSMemory.cpp:334: error: initializing argument 1 of ‘int msync(void*, size_t, int)’

Change-Id: Ia23c9af79c690254179139072b84bd0a35f17fba
5cd6df2f627e06f9b7f714181d70d3148a3d6c60 01-Jul-2010 Elliott Hughes <enh@google.com> Part 2 of the "new String"/String.getBytes performance work.

I didn't plan on a part 2, but my benchmark was bogus. I'd failed to take into
account the fact that the ICU code (which I was comparing against) has a higher
intercept but lower slope than the Java I replaced it with. This new code
offers the best of both worlds: low intercept (start-up cost) and low slope
(per-byte/char cost).

The bad news is that this means I'm adding more native code. In addition to the
improved benchmark, I'll commit a benchmark that contains the pure Java
implementations so we can see when the JIT advances to the point that we can
retire this native code.

Change-Id: Ibac24c2e3deed216bd492acf2fac7554d3f96d85
12cd1f00c2fa1a7f37bf644cecdf7588bdc0b0a9 23-Jun-2010 Brian Carlstrom <bdc@google.com> Remove libcore's dependency on bouncycastle

external/bouncycastle
- Change to be the primary build for bouncycastle sources (as opposed to part of libcore)
- Moved OpenSSLMessageDigest from libcore to OpenSSLDigest
It uses NativeCrypto API from core, but implements a bouncycastle specific interface
- restored registration of bouncycastle MessageDigests for SHA-1, SHA-256, MD5
OpenSSLProvider versions take precedence, but explicit provider of "BC" allows choice
- enabled native versions of SHA-384 and SHA-512
- pruned MD4 implementation

frameworks/base
- frameworks and CoreTests modules now depend on bouncycastle
- update preloades classes for NativeBN package change
- moved CryptoTest to libcore

libcore
- core now builds without bouncycastle sources
- core-tests, core-tests-support, core-tests-supportlib now depend on bouncycastle
- removed libcore/openssl directory, moving NativeBN to java/math
- minor cleanup of Provider, Security, Services style while working on ProviderTest
- added new OpenSSLProvider registered as first provider to have
priority over the others to ensure our native implementations are used
- moved BouncyCastle to have priority as a provider over Harmony
- JarVerifier and JarUtils now implicitly use OpenSSLMessageDigest
- Cleanedup OpenSSLSignature, implementation needs to be finished to move to OpenSSLProvider
- To avoid using PEMWriter from BouncyCastle, NativeCrypto now takes binary encoded certs and keys
This is more efficient as well avoiding the base64 decode/encode of the binary data
- removed SHA-224 to match the RI

packages/apps/CertInstaller
- CertificateInstaller module now depends on bouncycastle
this is the only app to depend on bouncycastle

system/core
- updated BOOTCLASSPATH

Change-Id: I6205366b12baec4331b4a76e2c85d8324bf64b2c
e377c5a424823bacf28e8ffb2a2f02bfe46d4a2b 26-Jun-2010 Elliott Hughes <enh@google.com> Rewrite java.util.regex to use ICU's C++ API.

I've also removed a bunch of dead code and changed the interface to reduce the
number of JNI transitions. Error checking is more uniform, various special
cases have been removed, and we pass all the tests referenced by
libcore/luni/src/test/java/tests/regex/AllTests.java for the first time.

This should also be a stepping-stone to fixing http://b/2777924, removing the
need to copy the input string to the native heap.

Bug: 2587040
Change-Id: I62685a2384db441cd02df159e117187f3175e10d
21557bb6a8f35a2f9889adba449cac950c9d41b9 23-Jun-2010 Elliott Hughes <enh@google.com> Add TimeZones.forLocale, plus some tidying.

The new feature here is TimeZones.forLocale and the accompanying JNI. I've also
taken the liberty of pulling the time zone stuff out of ICU.java and ICU.cpp,
and I've moved some of the ICU-related code I've written recently (NativeIDN,
NativeNormalizer, and NativePluralRules) into a new libcore.icu package.

I've also renamed various things so the implementation details use the same
terminology as the thing they're implementing.

Bug: 2790386
Change-Id: Ie39a2f5f7023e8e29864de15790be8a660f5cba6
7775409378596fd980dbd576f9738d337bd8a76d 18-Jun-2010 Elliott Hughes <enh@google.com> Add support for ICU's PluralRules.

Note that this doesn't address the original submitter's complaint: ICU agrees
that zero isn't a special case in English. What this does is allow us to fix
getQuantityString to work with languages other than English and Czech (which
currently have hard-coded implementations in frameworks/base).

Bug: 2663392
Change-Id: I4cf80a61cd5183636381511d6b860d2059f788ee
f10b2437ae5ec073f8c4118f7235022ba83667c4 18-Jun-2010 Elliott Hughes <enh@google.com> Minor bidi tidying.

Fix the bidi code to consistently use finally blocks to ensure we can't
leak native UBidi objects. Rename BidiWrapper to NativeBidi since it isn't
a class with a finalizer that wraps a UBidi: it's just a namespace for static
native methods.

Also remove the useless public constructor from NativeCollation.

Bug: 2772065
Change-Id: I441ff4811bb66c37daf270d74d5403b9848cce90
74c50755c30b3afd4852e006aeedeb25232ca757 17-Jun-2010 Elliott Hughes <enh@google.com> Rewrite FileDescriptor and ProcessManager's JNI in terms of JNIHelp.h's API.

This lets us remove JniConstants::fileDescriptorClass and rely on the cached
jclass in JNIHelp.c.

Change-Id: Ie9b067113050e95413c28befe0143a8bbf2113de
a9f5c16a864ff63ba63f810410f8a27c086d5d52 17-Jun-2010 Elliott Hughes <enh@google.com> Remove dynamic calls to FindClass.

Initially, I was just fixing a threading bug in NativeDecimalFormat.cpp where
we were bypassing GCC's built-in static initializer thread safety. This led me
to the question of how expensive FindClass is, which led me to creating a new
canonical cache of jclasses.

Here's the motivating benchmark, showing the cost of calling an empty regular
(non-native) method, an empty native method, a native method that calls
FindClass, a native method that calls FindClass and GetFieldID, and a native
method that calls FindClass and GetMethodID:

benchmark ns logarithmic runtime
NoArgsRegular 74 ||||||||||||||
NoArgsNative 428 XX|||||||||||||||||||
FindClass 3064 XXXXXXXXXXXXXXXX|||||||||||
FindClassGetField 3654 XXXXXXXXXXXXXXXXXXX|||||||||
FindClassGetMethod 5634 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Change-Id: I41ab2b347895f043a7e21d8fa19e4541e198c3fc
ec2f5930802944b7e418bb97849071f538b2523c 08-May-2010 Brian Carlstrom <bdc@google.com> Moving most libcore .c files to .cpp

This change moves most of the libcore .c files to .cpp enough for them
to compile. This was largely motivated by the desire to avoid using
things like __attribute__ ((unused)) in .c files to supress warnings
in a recent change.

Change-Id: Ib967d9e16764ff805764e81362f945332080a06c
74c05e2a892f236c8648af7f4cfb2bcb483f267b 07-May-2010 Elliott Hughes <enh@google.com> Clean up the zlib-related native code.

All the dude wanted was to get rid of Get/Release*Critical... First, though I
needed to switch the C files over to C++, and getting them to compile with a
stricter compiler made me realize how much of this stuff is unnecessary junk.
Eventually, I managed to get rid of all the "hy" and "sieb" crap, and you can
actually see what's going on now.

As usual, this reduces duplication and fixes leaks. I've also fixed a bug where
we'd never update inCap, meaning that we'd always allocate a new buffer and
never reuse the existing one even if it was large enough.

Bug: 2663177
Change-Id: I71fcbf9ff958ebf71ef3063d50ea34c28c30dd26
6b811c5daec1b28e6f63b57f98a032236f2c3cf7 03-May-2010 Peter Hallam <peterhal@google.com> Merge awt-kernel, icu, luni-kernel, prefs, security-kernel, x-net into luni
Merge xml except xmlpull and kxml into luni