History log of /libcore/luni/src/main/native/sub.mk
Revision Date Author Comments
33fc9556dfda6298fcd7c119f68a7375e13cbed9 28-Dec-2015 Richard Uhler <ruhler@google.com> Introduce NativeAllocationRegistry API.

The NativeAllocationRegistry API provides a way to associate native
allocations with Java objects. The native allocations will
automatically be freed when the correspondong Java object becomes
unreachable.

Use NativeAllocationRegistry for BigInt.

Bug: 23130675
Change-Id: If89dc03f0668afdecf1086280d16d2803e07a62a
59cd43352e5fd4907303d06f9b92f01c943375f7 18-Dec-2015 Narayan Kamath <narayan@google.com> Remove unused collation and formatting code.

Change-Id: I154d59e4ccff1d899530aebf27cf444f15f674ab
583eb0e4738456f0547014a4857a14456be267ee 16-Dec-2015 Przemyslaw Szczepaniak <pszczepaniak@google.com> Move enso net code to use AsynchronousCloseMonitor

- Moved AsynchronousCloseMonitor to the libnativehelper,
it manages shared linked list of IO blocked threads shared
by both libopenjdk and libjavacore
- linux_close.c no longer allocates a table of RLIMIT_NOFILE
size.
- linux_close.c became linux_close.cpp so it can use
AsynchronousCloseMonitor for close signal detection.

Bug: 26127752
Change-Id: If8e71d3d3a04b0a723c7a8bd0398a36542ae7864
f640e11f2a796db071428f97a12ef84888e8ef4d 03-Nov-2015 Przemyslaw Szczepaniak <pszczepaniak@google.com> Move StrictJarFile to framework/core

Since StrictJarFile is derived from harmony code,
and not used in the libcore itself, we're moving
it to framework/base code.

Bug: 25337946
Change-Id: I477b7934fb3abfb0c7660e23dd46db216c504e73
(cherrypicked from 8996a40bc2d5caa031992765d642021252c4c810)
4fff8bb49a15d2b55e3aa8ffe98446f7f475285e 03-Aug-2015 Narayan Kamath <narayan@google.com> Use android's regex implementation.

Preserve ICU semantics.

Change-Id: Ic98b49c4f64f0b5525297bb96026154885eb111d
133892a64c416abdb5d19c77ec3194aeb789b34f 19-May-2015 Piotr Jastrzebski <haaawk@google.com> Use OpenJdk implenentation of Charset{Encoder,Decoder}.

Use libcore's NativeConverter directly and also hardcode
the default charset to UTF-8.

Change-Id: Iafe84d94e1169721de943638aedd43b3f0af65e6
46e3649f898305d185fc40bae2542e933a16b619 06-May-2015 Piotr Jastrzebski <haaawk@google.com> Use OpenJdk implementation of java.lang.* [part 1]

- Changes to String hashing.
- Change StringCoding.isTrusted.
- For boxed primitive types, change how TYPE is derived (use the
array equivalents component type).
- System: the security manager is now always null. Also, port over
changes to make system properties read only.
- StrictMath : Use our existing fdlibm and remove references to
jdflibm.h.

Change-Id: I221692836b9320cade9074b122fbc25c8e72cf99
8d05e88f57c1ea5543d4012687c70cd64efcada0 06-May-2015 Piotr Jastrzebski <haaawk@google.com> Use OpenJdk implementations for java.io.* [part 2]

Covers most of the serialization classes.

- ObjectInputStream / ObjectStream{Class,Field} : Use VMStack methods
wherever appropriate.
- RandomAccessFile : Reimplement in terms of IoBridge.

Change-Id: I4a57e14ec7fe30f42f6060daf37eb16329636117
3d43823e17818b3c5f45831f830884917b181454 05-May-2015 Piotr Jastrzebski <haaawk@google.com> Use OpenJdk implementation of java.nio.channels.{spi}.*

- Unsafe : Add supporting methods (addressSize, pageSize,
allocateMemory, freeMemory, setMemory and various getters
equivalent to the existing libcore Memory classes).
- NioUtils : Rewrite nioutils methods in terms of OpenJdk classes.
- DeleteOnExitHook : Access java.lang.Shutdown directly.
- FileDescriptor : Add getInt$, setInt$ and setSocket.
- NativeBuffers : Copy byte-by-byte instead of using Unsafe.copyMemory.
- FileInputStream : Add a custom implementation of available() instead
of using IO_Available.

General : Switch JNI code to explicit registration rather than
implicit registration.

General : Track renaming of Unsafe methods (to add the $ suffix). This
might be unnecessary and will be reverted in a future change.

Change-Id: I7e63340d266dbd4b1c425b13710c05dce1086d4b
9a9f76d1e161f37b3d83d2db94ea63298d221bdf 28-Apr-2015 Piotr Jastrzebski <haaawk@google.com> Use OpenJdk Implementations of java.nio.charset.*

- PrehashedMap : Add a custom hash function instead of calling
hashCode().
- Add a few missing files in sun.nio.cs.
- Charset: Add an internal method that's equivalent to forName but
throws only UEEs.

Change-Id: Ica1f14d4784549c0a3642b61d325f1fb09526125
a8ed084745590c5e4a0e8559b5821809d60fe242 21-Apr-2015 Piotr Jastrzebski <haaawk@google.com> Use OpenJdk implementation of java.util.zip.*

- Move some of the internal implementation details of libcore's
zipfile into StrictJarFile.
- TODO: Adler32 continues to use old native code from libcore, this
must be switched over.
- InflaterInputStream: |closed| becomes protected.
- ZipFile : Always use mmap.
- ZipEntry : Add a long dataOffset.
- Switch all native code over to explicit registration.

Change-Id: Id5519b4548ea1eb22fd182edfbd2c804dc6f3bb5
865b9d2c38284a486fc8608d3193f5b846822595 15-Apr-2015 Piotr Jastrzebski <haaawk@google.com> Use OpenJdk implementation of java.util.regex.*

Change-Id: I046bb48e645a717c8404d9fad7657157f716d49a
9c853c5b9ebbb0ef60a013ae10ee411d70dfa832 18-Feb-2015 Piotr Jastrzebski <haaawk@google.com> Use OpenJdk implementations of java.text.*

- LocaleInternalsTest has been disabled since it depends on
internal implementation details.
- Collator: Use libcore's RuleBasedCollatorICU to fetch collator
rules instead of sun.misc.resources.LocaleData & friends.
- DateFormat: Add support for set24HourTimePref (not wired up
yet).
- DateFormatSymbols : Use libcore's LocaleData & TimeZoneNames
classes internally.
- NumberFormat: Use libcore's LocaleData.
- Drop support for SCIENTIFICSTYLE (we should re-enable this at
some point ?).
- SimpleDateFormat : Don't reject the format specifiers for
standalone weekday and friends. We'll need to switch over to
using ICU4J formatters at some point.
- Calendar : Use GregorianCalendar only.
- TimeZone : Use TimeZoneNames to access time zone names.

Change-Id: I4a2866904d4f2f39f0793154d9aad7f109da3b5a
3df3bfcbad6f4da20964424c4772985d1b1586a1 26-Aug-2015 Rayhaan Jaufeerally <rayhaan@google.com> Revert "Revert "Migrate Collator classes to use ICU4J.""

The SDK build is now fixed by adding icu4j as a dependency of docs.

This reverts commit 5fc822e7ef47448adccd73ca2ebbd28a068f5136.

Change-Id: Ibac9b40189a83323e5175e8ea26c973eb07bc34f
5fc822e7ef47448adccd73ca2ebbd28a068f5136 18-Aug-2015 Neil Fuller <nfuller@google.com> Revert "Migrate Collator classes to use ICU4J."

This reverts commit bf7bbff3a512b3350911d129aba5503dcfde9311.

Change-Id: I5e3d3481d1df11d31871d63fd1575cbf46698dee
bf7bbff3a512b3350911d129aba5503dcfde9311 23-Jul-2015 Rayhaan Jaufeerally <rayhaan@google.com> Migrate Collator classes to use ICU4J.

The following benchmarks have been run and show the performance
gains from calling ICU4J.

----- ICU4J -----
benchmark us linear runtime
CollatorIdentical 6.90 ==============================
CollatorPrimary 3.20 =============
CollatorSecondary 3.79 ================
CollatorTertiary 4.28 ==================
vm: app_process

----- ICU4C -----
benchmark us linear runtime
CollatorIdentical 11.75 ==============================
CollatorPrimary 10.01 =========================
CollatorSecondary 9.88 =========================
CollatorTertiary 10.26 ==========================
vm: app_process

All tests relating to Collation pass after this change.

With respect to CJK character loading time, tests were done on a
Nexus 6 running this change, in the US locale and TRADITIONAL_CHINESE
locale.

In EN-US:
Time to load Traditional Chinese collator after boot: 76ms, 76ms
Time to load again: (39ms, 36ms, 36ms), (36ms, 36ms, 48ms)
In ZH-TW:
Time to load Traditional Chinese collator after boot: 37ms, 36ms
Time to load again: (36ms, 36ms, 36ms), (35ms, 37ms, 35ms)

This seems to indicate the system is creating a Collator on boot meaning
that ICU is caching it after the first creation. So if a device is in the
Traditional Chinese locale, the cost of creating Traditional Chinese
collators should have been absorbed at boot time.

Loading up the CJK ideographs uses up around ~500k of memory. From the
above findings, if the device is in a language requiring those characters
then they should be loaded up on boot in the Zygote, which may mean the
memory is shared across processes wishing to use the data.

Change-Id: I98a1c32c8f58e03d16d694b8a4fca4ced961af8e
660d0bea759fc97c34eb0cadfdd353f882820c62 14-Aug-2015 Rayhaan Jaufeerally <rayhaan@google.com> Change the Bidi class over to ICU4J.

The Harmony BidiTest passes before and after this change.

This change requires a corresponding change in libnativehelper
to remove the reference to java_text_bidi.cpp.

After this change (ICU4J):

benchmark us linear runtime
_complicatedOverrideBidi 18.64 =========================
_createBidiFromCharArray 14.28 ===================
_createBidiFromIter 11.54 ===============
_createBidiFromString 11.08 ===============
_hebrewBidi 21.92 ==============================
_reorderVisually 2.41 ===
_requiresBidi 1.37 =
vm: app_process
trial: 0

Before this change (ICU4C):
benchmark us linear runtime
_complicatedOverrideBidi 66.94 ======================
_createBidiFromCharArray 44.25 ==============
_createBidiFromIter 21.76 =======
_createBidiFromString 20.23 ======
_hebrewBidi 89.72 ==============================
_reorderVisually 7.10 ==
_requiresBidi 29.02 =========
vm: app_process
trial: 0

Change-Id: I733ac3f9983b8285883dee70958c5cf8054d334d
0517aff14a14236d4714634d9affe4f5b320984d 06-Aug-2015 Craig Cornelius <ccornelius@google.com> Remove libcore AlphabeticIndex and references. This has
been replaced by ICU4J's library.

Change-Id: I1365a18609b3d5bf45ae8341792a01f4e995f5bb
9dcac8229f1efd676f3e3b7e8a2f9a2c3eda04d2 30-Jul-2015 Rayhaan Jaufeerally <rayhaan@google.com> Migrate IDNA2003 implementation to ICU4J.

Although this migration uses the deprecated methods in ICU4J's
IDNA implementation, this has to be done to maintain complete
compatibility with the current implementation. This is because
the android API is explicitly documented as implementing the
IDNA2003 standard.

UTS46 is a new standard which aims to ease the transition to
IDNA2008 which is the latest specification for internationalized
domain names. Unfortunately this standard cannot be used in this
instance and will need to be introduced as part of another API.

The following benchmarks show the change in performance this
CL will cause. This seems acceptable for a string conversion.

--- Java ---
benchmark us linear runtime
ToAscii 804 ==============================
ToUnicode 323 ============
vm: app_process

--- Native ---
benchmark us linear runtime
ToAscii 134.0 ==============================
ToUnicode 89.5 ====================
vm: app_process

Change-Id: I96440d338ceeaea63eec490f49e9a35cfa5dc1f2
17552b6592aeaaa564725a07e10e8c4b1c8163cb 14-Jul-2015 Rayhaan Jaufeerally <rayhaan@google.com> Remove Transliterator wrapper class.

This change removes the wrapper class in Java which was used for
proxying requests to ICU4c. Now ICU4J is called directly at the
call sites. See: https://android-review.googlesource.com/#/c/162002/

This is done by replacing instantiations of the old Transliterator
class with calls to a static factory in ICU4J which returns a cached
transliterator if available, otherwise creates it on demand.

This change requires that the transliterator resource directories
and source files are added to our java libraries, which increases
the size of core-libart.jar from 2.289 MB to 2.332 MB. Maybe it's
possible to wait until dependencies on ICU4c have been removed to
see if we can save space there.

Change-Id: I2b2f84a051ba9815ba6d346dfe7fb764e39032c4
8d7307aed3c02fc9549c15f4bf14ad0a9587cd9d 24-Jul-2015 Narayan Kamath <narayan@google.com> Revert "Convert IDN to use ICU4j instead of ICU4c."

This reverts commit 9fe44362752f86af1d34eed6dca2b6a27ffa7ad8.

Change-Id: I22bd7819c20817be6444ccd11b903ae68f8e7745
9fe44362752f86af1d34eed6dca2b6a27ffa7ad8 16-Jul-2015 Rayhaan Jaufeerally <rayhaan@google.com> Convert IDN to use ICU4j instead of ICU4c.

Apache harmony tests still pass after this change, and
new tests have been added to verify that this meets the
specification defined in http://unicode.org/reports/tr46/.

The benchmarks below show the performance penalty from not doing
this natively.
benchmark us linear runtime
JavaToAscii 59.6 =========================
JavaToUnicode 68.9 ==============================
NativeToAscii 11.2 ====
NativeToUnicode 13.8 ======

Change-Id: Ie3fd1d439d9fc2651f5f1773676d12409c430c83
32563bc5c9df70a52cfb5c2a9d6ab865e8200092 14-Jul-2015 Rayhaan Jaufeerally <rayhaan@google.com> Remove NativePluralRules since we are using ICU4J directly.

The following benchmark shows the time taken for ICU4C to
run quantityForInt(5) on the US locale as _native, and _java
shows the time taken for the ICU4J PluralRules.select(5)
method to be run on the US locale.

benchmark us linear runtime
_java 2.27 ==============================
_native 1.89 =========================
vm: app_process

Change-Id: I2ca9a6636ea48bf922eceedce1cf3ef357cc4b99
37dd239f099f1d1b2aca030a2fe458669718cd78 14-Jul-2015 Rayhaan Jaufeerally <rayhaan@google.com> Transition the Normalizer class to call ICU4j.

The following benchmarks were obtained by running parts of NormalizerTest
through caliper.
benchmark us linear runtime
ICU4cIsNormalized 5.09 ======
ICU4jIsNormalized 5.22 ======
ICU4cNormalize 22.56 ==============================
ICU4jNormalize 21.97 =============================

NormalizerTest still passes after this change on Shamu. This change also
removes the JNI calls and their associated C++ wrappers.

Change-Id: I9081c899a76fdb3a341ca5ecd54c32cd6e6a0387
fc0a7474f3922e2ef087e1d225ce56f52edaf7aa 18-May-2015 Narayan Kamath <narayan@google.com> Remove support for big endian native orders.

We assume Android == LITTLE_ENDIAN in several places already.

bug: 20957523

Change-Id: Iff96c95c587c866285e0c35075dd014c8973bb92
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
8046f4dbe122ac5f362693550360b54cd6943a4b 23-Mar-2015 Narayan Kamath <narayan@google.com> Use compiler pragmas instead of flags.

This lets us turn off warnings for a small segment of the code
instead of the entire project.

bug: 19823499
Change-Id: I9309e9a33bddc33e8c100a49416e95b2a56e2385
1b9b1c8e53a4610438d597fc21d8a147092d05fd 18-Mar-2015 Fredrik Roubert <roubert@google.com> Set -Wno-deprecated-declarations to access deprecated IDNA2003 API.

In libcore_icu_NativeIDN.cpp there are calls to the deprecated IDNA2003
API which means that this code as of ICU55 no longer will compile
without specifying the -Wno-deprecated-declarations compiler flag.

bug: 19823499
Change-Id: Id5cd5da0d6c3ce62a5c642c99364d29eaebe7709
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
fc0498f0dd9af3c86b67d0536fceaf9ed04781fb 16-Dec-2014 Elliott Hughes <enh@google.com> Remove unnecessary include directives.

These are all picked up by virtue of the libraries that we use.

Change-Id: Ib5e86c65d53f3448d5f1d0c0d24f0f63ef5f1868
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
e390c9157503c045c7924474fb2f75405e5d6e65 10-Jul-2014 Elliott Hughes <enh@google.com> Switch libcore to the new icu.

Change-Id: I58ec1fafdf5524538ac14c52d561bf93d5a6c946
1f3014901704f3ae81538773b8a0b382945adc8d 20-Jun-2014 Neil Fuller <nfuller@google.com> Unimplement Console.readPassword and remove test

ConsoleTest.test_readPassword* fails CTS tests.

Context: Under standard Android applications the
System.console() method will return null.

The Console.readPassword() method must turn off echo.

Under automated tests the ConsoleTest is exercising
a Console object with fake stdout / stdin streams to
get around the absence of a System.console().

setEcho() is hardcoded to use stdin / stdout in
the native code. Under the test runners stdin / stdout
are not connected to a TTY leading to a ENOTTY.

Under Android readPassword is unimportant. Rather than leaving
untested security-related code the password methods are being
unimplemented. It is unlikely this code has ever been used on
Android given the absence of a System Console instance.

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

Change-Id: I3951c1349842adf7dfbb7458c76c982646804ccb
f0d40d662d9dfdb04215c718961765837d2cf00c 11-Apr-2014 Neil Fuller <nfuller@google.com> libcore changes to support asynchronous close interruption

Previously AsynchronousSocketCloseMonitor was used to handle
socket interruption on close. To support the same for
FileChannel it has been renamed to AsynchronousCloseMonitor.
The Java class was already called this.

FileInputStream, FileOutputStream, RandomAccessFile will
now throw IOException if a connection is closed by another
thread during read. Thread.interrupt() continues to have no effect
on streams.

FileChannel will now throw AsynchronousCloseException during
reads and writes if the file is closed, per the documentation.

FileChannel will now throw ClosedByInterruptException during
reads and writes if the thread reading/writing is interrupted.

Note: FileChannel.lock() will probably still not not throw
AsynchronousCloseException, though it probably should.

This change also has impact on external/conscrypt and
frameworks/base.

Change-Id: I37de3e7d1a005a73821221e6156d10b95c595d7a
Bug: 13927110
081c0de9231d6fc2aa5e24bdcc21b5cde8a30f2b 31-Jan-2014 Elliott Hughes <enh@google.com> Rename our 'realpath' because it isn't the same as realpath(3).

Change-Id: I7b830d485c1ff769993233b7ea69e36b354f3259
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
011ed31c4d057d973931fa81a09d8c576a72d82a 22-Aug-2013 Kenny Root <kroot@google.com> Better error messages for zlib errors

Most of the zlib inflater errors had a really descriptive name like
"data error," but more descriptive errors are put into the "msg" field
of the z_stream structure. Use that for error messages instead so we get
the underlying cause of the data error.

Additionally split out the code for ZipUtilities from the header into a
separate source file so things using NativeZipStream don't have to
forward declare.

(cherry picked from commit 2e6a64542c52490d89476bfd1b10b1938a8a0e99)

Bug: 10424836
Change-Id: Ifc12645b37f7aabc700e6a0766dee55b4c3609a0
2e6a64542c52490d89476bfd1b10b1938a8a0e99 22-Aug-2013 Kenny Root <kroot@google.com> Better error messages for zlib errors

Most of the zlib inflater errors had a really descriptive name like
"data error," but more descriptive errors are put into the "msg" field
of the z_stream structure. Use that for error messages instead so we get
the underlying cause of the data error.

Additionally split out the code for ZipUtilities from the header into a
separate source file so things using NativeZipStream don't have to
forward declare.

Change-Id: Ifc12645b37f7aabc700e6a0766dee55b4c3609a0
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
ad9208affa02f92a6b85354a33123d51d80febe1 06-Feb-2013 Elliott Hughes <enh@google.com> resolved conflicts for merge of f78109f6 to dalvik-dev

(git cherry-pick -m 1 8a6e388c11d8ee72a0af23e6091239e2f58bc968)

Change-Id: Ie07e5901d5a127b6d6840b05da5dfd5c2b967048
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
44d737281c6a6c9be6ea1eb58cf678f43643650a 09-Sep-2012 Elliott Hughes <enh@google.com> Get expat header files from the approved location.

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

Bug: 6369821
Change-Id: Ie038571a5dac1f301c0c3c6fb84df432e67b62c0
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
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
bef9ec33e1368f57c731fce63b6a8c61628c64b0 19-Apr-2011 Elliott Hughes <enh@google.com> Clean up ICU exception throwing.

Change-Id: Ifce086e1fb20b7cb99673f4d38c8c56144328295
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
57d0a10f4fa6cae6d5c63b4f799e048e83c5d11e 03-Mar-2011 Elliott Hughes <enh@google.com> Make all filenames match their classes.

Change-Id: I2c9f95a27ee3881fc609e3e4f1468205c701215d
ddafeb1d73cfe504720d10a2634b5858fc4cc413 19-Feb-2011 Elliott Hughes <enh@google.com> Rationalize our various native conversions to java.lang.String[].

We could probably get away with even fewer, but this seems an appropriate
amount of effort for now...

Change-Id: Ieef83250295324bab222fe529913d8f4e93817f4
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
3a9a00ad1f166a8e5ea810099b057522f9aecb48 08-Jan-2011 Elliott Hughes <enh@google.com> Fix getifaddrs(3).

Originally, we pulled out the IFA_ADDRESS messages and used them. That didn't
work with sholes' ppp interface, where we'd report the *destination* address
rather than the local address. We switched to the logical-sounding IFA_LOCAL
messages instead: for IPv4 you always get both IFA_ADDRESS and IFA_LOCAL, and
they're either the same, or you want IFA_LOCAL. It turns out that you don't
get IFA_LOCAL addresses for IPv6 unless they differ from the corresponding
IFA_ADDRESS. So what we have to do is use the IFA_ADDRESS but let IFA_LOCAL
override it, if it appears.

This code was getting way too large, so I've ripped the implementation out of
the header file and given it its own file. I've also switched to UniquePtr
now it exists, and removed a few unnecessary #includes of "LocalArray.h".

I've also added a unit test to help guard against breaking this again.

Bug: http://code.google.com/p/android/issues/detail?id=13784
Change-Id: I5a7d29b8e9bf652160eca043802363feb91421a2
c3d30bfb532fc1e609a67a324d6bfb9776f88778 08-Jan-2011 Elliott Hughes <enh@google.com> Tell editors that these are Makefiles (or fragments thereof).

Change-Id: I0c5e29ac750b9605b1e8f823d6998d31a933b7a4
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
95101d3d5a3417755c88fded1600e039fb363019 05-Nov-2010 Elliott Hughes <enh@google.com> Rewrite File.getCanonicalPath.

My original plan was to just rely on the fixed realpath(3), but it turns out
that Java's behavior is quite different from the C library's in cases where
path elements don't exist. I also wasn't particularly excited about introducing
a fixed-length buffer. To that end, I've added a native implementation of
getCanonicalPath.

I've also improved the getAbsolutePath and getCanonicalPath documentation.

This patch also makes File.absolutePath transient, a regression in gingerbread
which uselessly bloated File's serialized form.

Bug: 2281992
Change-Id: Iff94eee07fe574251c1188b2b2eb71f585c81c6a
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
539081f7286edf0576b02e9c5fb7ca4d617c46ff 14-Aug-2010 Elliott Hughes <enh@google.com> File names should match their contents.

Change-Id: I3440bb921c70834325dfe1b1177f81158186ec7b
6bdcc32b57431c0beca7656765eaadbdaedc6416 14-Aug-2010 Elliott Hughes <enh@google.com> Move the floating-point parsing into one file.

This removes a little duplication, potentially makes it a little easier for us
to replace this at some point, and removes the embarrassing spelling mistake
in two files' names that's been annoying me since I joined.

Change-Id: Ifb428f073ff7c742f2807146ed99fc5740edd159
9f2b1b1c3bf9de560f29f257c855c7c85b405c0f 07-Aug-2010 Elliott Hughes <enh@google.com> Make network I/O interruptible.

Every thread about to block on network I/O registers its thread id and
the fd it's going to block on. In close, we scan the list and signal
every thread that's blocked on the fd we're closing. They wake up with
EINTR, see that their java.io.FileDescriptor has been invalidated (by
the close code), and infer that this EINTR is not to be retried: this
EINTR implies that they should throw.

This patch also fixes a couple of bugs in accept. We were trying (and,
obviously, failing) to reset SO_RCVTIMEO on fd -1 if the accept failed,
and then throwing an exception relating to that rather than the failed
accept(2). We were also not treating timeouts as a special case of
failure and throwing the appropriate SocketTimeoutException. (One has
to suspect that there's an errno-to-Exception function that we could
write that would work for all this native code.)

This patch also cleans up connect a little more. I've inlined doConnect
into its single caller, I've removed the bogus use of 100ms polling,
and I've rewritten the checking for success/failure to be based on the
advice in Stevens' "Unix Network Programming".

Bug: 2823977
Change-Id: I4f0cbd95be9ba25368be166008855a80c5d30845
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
221d0ccb4cc23ee0bf0646e9abe471fb48b3a1a8 15-Jul-2010 Elliott Hughes <enh@google.com> Simplify the network send(2) interfaces.

Similar to the change for the recv(2) code.

Unrelatedly, I've pulled out our exception-throwing helpers for reuse. This
was meant to be in a separate change, but I accidentally mixed it in.

Bug: 2823977
Change-Id: I314a4337189277b6eff65f7ccf9e897b5d0b73f2
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
94782d07dd2d65b1a37fddca68eb9a9ac81ada4a 16-Jun-2010 Elliott Hughes <enh@google.com> Use Integer.valueOf rather than "new Integer" (et cetera) from JNI.

Also factor it out rather than keep duplicating it.

Change-Id: I6349668f4676f1e0a7dd6fdc101dd1784c5465fb
753dcd862b31e85766225590d90ba0b9f481176f 02-Jun-2010 Elliott Hughes <enh@google.com> Refactor some of the OSNetworkSystem stuff to more appropriate homes.

Also rewrite PlainDatagramSocketImpl.peek in terms of existing primitives
rather than requiring its own. I still don't see how it can get called, but
at least now it doesn't require its own native code.

Bug: 2686833

Change-Id: I0453add66dab4c7095ee2a3f51a49efbd1205598
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
cec4dd4b1d33f78997603d0f89c0d0e56e64dbcd 26-Apr-2010 Peter Hallam <peterhal@google.com> merge more modules into luni
f7fb59f46848901875d317fdaa1008b63fd74ad2 17-Mar-2010 Elliott Hughes <enh@google.com> Add Java 6's java.io.Console.

This is actually functional, if you're in the mood to "adb shell".

The implementation is based on harmony's, but with the initialization and
native code rewritten, with readPassword responsible for echoing a newline (so
we don't have to play silly tricks with the ECHONL flag), and a vastly
simplified ConsoleReader class. I've also rewritten the documentation.

Change-Id: I902b47fb27a8fdb2d6f067bb905ee02c6a10e454
381cd64da7ff16b9252d677197ed52a3e1bb6219 26-Nov-2009 Elliott Hughes <enh@google.com> DO NOT MERGE: backport the IPv6 NetworkInterface/multicast fixes.

This is a backport of the minimal changes from master (flan) to fix IPv6
multicasting. Specifically, it fixes NetworkInterface to report IPv6 addresses,
it fixes GenericIPMreq so we pass the interface indexes down to native code,
it replaces our old copy of harmony's MulticastSocketTest with the current
upstream version (to avoid bogus failures), and it brings back one small
"unrelated" fix to OSNetworkSystem.cpp that's necessary to prevent failures
in later parts of tests we used to fail too early to notice secondary
problems.

This passes all the (fixed) MulticastSocketTest tests, causes no regressions
in the whole net.AllTests suite, and fixes the user-submitted application
that started the investigation.

Bug: 1750581
5e1a00946a6d3119b3db272e747529528021a4af 21-Nov-2009 Elliott Hughes <enh@google.com> Switch java_io_File.c over to C++.
e73f40b484788e8c1f89a24307dc4be58da5edb2 02-Oct-2009 Elliott Hughes <enh@google.com> Switch java_net_NetworkInterface.c to C++.

(I have a bigger change to make to this file, but the web claims that it's
best to keep renames in minimally small patches so git doesn't get confused.)
adc854b798c1cfe3bfd4c27d68d5cee38ca617da 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
1c0fed63c71ddb230f3b304aac12caffbedf2f21 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
dd828f42a5c83b4270d4fbf6fce2da1878f1e84a 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
fdb2704414a9ed92394ada0d1395e4db86889465 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution