summaryrefslogtreecommitdiffstats
path: root/luni/src/main/native
Commit message (Collapse)AuthorAgeFilesLines
* Fix Character.getDirectionality.Elliott Hughes2014-07-291-2/+2
| | | | | | | | | | Previously we'd throw ArrayIndexOutOfBoundsException for U+2066..U+2069. Now we'll return DIRECTIONALITY_UNDEFINED. I've exposed (via @hide) the underlying icu4c implementation so that frameworks code at least can work with the new explicit bidi formatting characters. Bug: 15492712 Change-Id: I96583c7e1c6be26d3f1a857615a1042d58e9feaf
* OsConstants: add PR_GET_DUMPABLE / PR_SET_DUMPABLENick Kralevich2014-07-241-0/+6
| | | | | | | | | | Expose PR_GET_DUMPABLE and PR_SET_DUMPABLE via java. This is a cherrypick of two commits from internal master: * 1fc6b04adc87e752aa35bedb7617b5145d835d7c * 514b1d21f66caff9f26fcf042882c5115b5431c4 Change-Id: Ibb60ed1d00c3a84fa77a34d0acc56cb995d14e1c
* Fix handling of invalid locales in Date/DecimalFormatSymbols.Narayan Kamath2014-07-231-11/+11
| | | | | | | | | | | | | | | | | For locales whose language code is "und" we use Locale.ROOT instead. This also fixes two other corner cases : - We were using the wrong locale to fetch timezone strings when the input locale was null. we now use the same locale throughout by making sure we don't perform any subsititutions in LocaleData.get. - Adds a clearer comment about the broken serialization behaviour. bug: 15849709 Change-Id: I95e7eb0ccb7458711038ce9b1c76b3279acda9d6
* Implement Locale.forLanguageTag in java.Narayan Kamath2014-07-221-51/+0
| | | | | | | | | | | | | | | | | This prevents us from having to parse ICU locale IDs or construct them in java. Note that the changes to LocaleTest bring us in line with the spec (some of the previous tests demonstrated wonky ICU4C behaviour we didn't want). This change includes a minor fix to unicode extension parsing, we now accept keywords with empty values which the spec allows. bug: 15661724 bug: 15849709 Change-Id: If9417ab4cb545fdb8b9a0a47a7eade6ebbe33ba8
* Switch libcore to the new icu.Elliott Hughes2014-07-091-2/+2
| | | | Change-Id: I58ec1fafdf5524538ac14c52d561bf93d5a6c946
* Don't return NULL as a jint.Ian Rogers2014-06-241-1/+1
| | | | | | Build fix. Change-Id: I49a566c3c34d2040e092689e52b0039c8195de03
* Build fix: Remove reference to deleted java_io_Console functionNeil Fuller2014-06-231-1/+0
| | | | | | | | The function was deleted by 1f3014901704f3ae81538773b8a0b382945adc8d Bug: 12491103 Change-Id: If75f1f05d6a72cac7b7a86b7616bae870615452e
* Unimplement Console.readPassword and remove testNeil Fuller2014-06-232-52/+0
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix getISO3Country and getISO3Language.Narayan Kamath2014-06-181-4/+4
| | | | | | | | | | | | | | | For backward compatibility, locales constructed with 3 letter countries and languages must return those languages and countries from these methods. With our strict language tag interpretation, these were being omitted or transformed to und. We fix this by passing only the language code (or the country code with a fixed language) down to ICU, which will then deal with it correctly. bug: 15638049 Change-Id: I517a82496a2a4c36b1ae9234f7d2d4eb89b34ffe
* Merge "Pass BCP-47 tags and not Locale.toString results to ICU."Narayan Kamath2014-06-108-103/+165
|\
| * Pass BCP-47 tags and not Locale.toString results to ICU.Elliott Hughes2014-06-168-103/+165
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ICU can't handle the new toString forms for scripts etc. and it's also guaranteed to deal with BCP-47 tags correctly. Most of the changes in this patch are required to keep backwards compatibility for getDisplayCountry string etc. in the face of the transformations toLanguageTag performs. A few tests were changed, but for the better. The tagalog -> filipino charlie foxtrot will be dealt with in a follow up change. Co-Authored-By: Narayan Kamath <narayan@google.com> Change-Id: Ia7f26d92a0e38c4bbb1d839c0fbd8ad16a473bf5
* | Fix bogus define checks and a typo.Narayan Kamath2014-06-131-10/+6
|/ | | | | | | | | | | | | | | RT_* constants are enum members in the UAPI so we can't use #define checks for them. Also fix a typo in the define check for an IFA_ constant. More generally, we should get rid of all these conditional checks for target builds because we know what version of the UAPI we have in bionic. We should move these conditional checks under #if HOST_BUILD or something similar. bug: 15602893 Change-Id: I3affc10773ade4dac68c176f79962ca8ad312579
* Remove unnecessary loop in uloc_forLanguageTag.Narayan Kamath2014-06-121-15/+15
| | | | | | | | | | When uloc_forLanguageTag fails with a U_STRING_NOT_TERMINATED_WARNING or with a U_BUFFER_OVERFLOW_EXCEPTION, we know precisely how many characters we need to allocate to make the call succeed. Change-Id: Ie761b9c7279d3c6f6d432285155a7087fab6d066
* Implement Locale.toLanguageTag without ICU support.Narayan Kamath2014-06-121-31/+0
| | | | | | | | | | | | This is the first part of an effort to avoid having to construct and parse ICU locale IDs and to instead use language tags as inputs to all ICU APIs. Only one minor unit test adjustment was required, and that change brings the test closer in line with the spec. Change-Id: I8abc0e3b868dd73e4fb9e36b6db19853eb99e6ac
* Fix Mac build.Ian Rogers2014-06-101-0/+3
| | | | Change-Id: I32fdb9dabbc87d49e0be82ea39c2eea6f452fd6f
* Build fix.Ian Rogers2014-06-091-0/+2
| | | | Change-Id: I52559cfcc806dfe0d8682be50a6078cb678e4169
* Remove deprecated WITH_HOST_DALVIK.Ian Rogers2014-06-093-5/+70
| | | | | | | | | | Bug: 13751317 Fix the Mac host build: - conditionally define constants using pre-existing pattern, - make Posix calls that the Mac doesn't support throw UnsupportedOperationException. Change-Id: Ib68887cbe36ab167d042eb96c7834bce0651b078
* Add interruptibility/wake on close to FileChannel.lock()Neil Fuller2014-06-031-2/+1
| | | | | | | | | | There is no obvious way of automated testing given the test would have to spawn a separate process to lock a file (and flock is not available on devices). It has been tested manually with multiple processes on host and a device. Bug: 13927110 Change-Id: Ie2e565d4965e7aa6392b0eb32e55cdf50d7f61c5
* Ensure NET_FAILURE_RETRY return -1 in case of an errorSerguei Katkov2014-05-201-0/+2
| | | | | | | | | | According to contract NET_FAILURE_RETRY / IO_FAILURE_RETRY should return -1 and set pending exception in case of an error. Not setting -1 was leading callers to assume a success. Change-Id: I995fa97f8ee8993a379f21582a14567818ea64bd Signed-off-by: Serguei Katkov <serguei.i.katkov@intel.com>
* Merge "Add android.system.Os.link for link(2)."Elliott Hughes2014-05-101-0/+13
|\
| * Add android.system.Os.link for link(2).Elliott Hughes2014-05-091-0/+13
| | | | | | | | | | Bug: 14683762 Change-Id: Ieeba1d2d0c5e9c05e85c6ffbaeb5a7febc69238c
* | Add missing 'const'.Elliott Hughes2014-05-081-1/+1
|/ | | | Change-Id: I20311836b80bc655a5ae389ef2f49b2a09f79744
* Ensure consistent (backwards-compatible) capitalization for ↵Elliott Hughes2014-05-071-27/+24
| | | | | | | yesterday/today/tomorrow. Bug: 14493853 Change-Id: I971ffc2d47534aef67df951725fcd16802ea6d54
* Fix BN to use correct size of arraySerguei Katkov2014-05-061-1/+1
| | | | | | | | | | | | | NativeBN_litEndInts2bn uses len as a size of the generated array while it should be wlen for 64-bit. This will fix the following BigIntegerTest cases: - BigIntegerTest#test_Constructor_ILjava_util_Random - BigIntegerTest#test_hashCode Change-Id: Ife98d11cf94cd5568e55163f98fc4fe3de9d3918 Signed-off-by: Serguei Katkov <serguei.i.katkov@intel.com> Reported-by: Marcus Oakland <marcus.oakland@arm.com>
* Merge "Use __SIGRTMIN so bionic can hide our signal from causal passers-by."Elliott Hughes2014-04-301-2/+3
|\
| * Use __SIGRTMIN so bionic can hide our signal from causal passers-by.Elliott Hughes2014-04-301-2/+3
| | | | | | | | Change-Id: Ib16b048bb8d849ee6f54251d0c8cc7f782121452
* | add prctl / PR_SET_NO_NEW_PRIVSNick Kralevich2014-04-292-0/+13
| | | | | | | | | | | | Add java wrappers for prctl and PR_SET_NO_NEW_PRIVS. Change-Id: I649a755ea9354b0290b25292bc65901b1528c1d5
* | libcore.io.OsConstants is dead; long live android.system.OsConstants!Elliott Hughes2014-04-293-4/+4
|/ | | | Change-Id: I3951c1349842adf7dfbb7458c76c982646804ccb
* Groundwork towards making the Libcore.os functionality public.Elliott Hughes2014-04-241-23/+23
| | | | Change-Id: Ie700aa16d91fba53fc5eb2555829cb74d84b12ad
* libcore changes to support asynchronous close interruptionNeil Fuller2014-04-225-58/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Merge "Change DecimalFormat.setRoundingMode() behavior to stay in spec"Neil Fuller2014-04-221-0/+2
|\
| * Change DecimalFormat.setRoundingMode() behavior to stay in specNeil Fuller2014-04-151-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The serialization tests revealed that some DecimalFormat instances could not be round-tripped. The reason is that the setRoundingMode() method was setting a non-zero rounding increment, which cannot be persisted, and also creates patterns that are outside of the DecimalFormat spec. Addressed the fact that ICU4C appears to support RoundingMode.UNNECESSARY now by deleting special-case code. Changed SerializationStressTest to use canonical DecimalFormat patterns: The ones chosen had a couple things that were not ideal: 1) Putting '-' in quotes causes ICU (for non-obvious reasons) treat the negative pattern prefix as not being default. Default in this case means "the positive prefix with a preceding '-'. Removing the quotes meant it would recognize the pattern as not needing everything after ;., so the pattern would be shrunk. 2) The positive pattern was also not one ICU could deal with fully. ICU changed "#.#" to "#0.#" at parse time (which can be corrected with a setMinimumIntegerDigits(0)). It's not clear why ICU cannot deal with parsing "#.#" when it can produce it, but there is a long comment in decimfmt.cc suggesting it is intentional and to avoid format producing empty strings. The pattern has been changed to one that ICU can handle and would choose when the various serialized fields are read back. This is necessary because NativeDecimalFormat compares the patterns and not just the serialized fields. Leaving the pattern check part of equals() means that two non-spec patterns will not be considered equal(), which is important while Android allows non-spec patterns. Restricting support in DecimalFormat to the documented subset of characters is not worth the effort and may cause problems elsewhere. Change-Id: I2de588458b86619733c0dc1692d526f179059910 Bug: 11668227
* | Remove include of private ICU include and set constant size for buffer inccornelius2014-04-161-2/+2
| | | | | | | | | | | | libcore_icu_NativeCollation.cpp Change-Id: I31ae75707b7036ab5b509c88915648fbaf7d76a5
* | Set ICU's default locale from Locale.getDefault.Narayan Kamath2014-04-111-0/+19
|/ | | | | bug: 2541757 Change-Id: I5de58be7e8a701f2c40182ea54bceff85ec1aad2
* Finish moving away from LD_LIBRARY_PATH on Android.Elliott Hughes2014-04-031-0/+16
| | | | | | | | We'll still use LD_LIBRARY_PATH if it's set, for testing or for the host, but we now ask the dynamic linker what to do. Bug: 12585421 Change-Id: I1457a63ead89fa8f8aeabc002c0b9038295b886e
* NativeBN: use bn_correct_top on negative BNKenny Root2014-03-181-0/+2
| | | | | | | | | | | | | | | | If you use BN_bin2bn, it will call bn_correct_top for you. However, since this code is poking into the structure of the BIGNUM itself without using API, we must call it ourselves. Before the test_negativeValues_superfluousZeroes would fail with this confusing error: libcore.java.math.BigIntegerTest#test_negativeValues_superfluousZeros junit.framework.AssertionFailedError: expected -1374707309 but was -1374707309 at junit.framework.Assert.assertEquals(Assert.java:99) at libcore.java.math.BigIntegerTest.test_negativeValues_superfluousZeros(BigIntegerTest.java:171) Bug: 12761797 Change-Id: I724c1313e4febca8ce2bda9d10f9b5ebde96a6b1
* Don't assume minusSign is a single char.Narayan Kamath2014-03-142-7/+8
| | | | | | | | | | | | | | | | | | | | | | | Locales like arabic have a multi char minusSign in their locale data. The only difficulty here is presented by DecimalFormatSymbols, which is a public API and expects the minus sign to be a single codepoint. The API has been changed to return the first character of the minusSign string for getMinusSign, which seems like the least bad option at this point. This change also removes a workaround for cases where ICU parsed (2445-) as (-2445) for RTL locales. ICU-52 doesn't do this anymore. The serialized form hasn't been modified either, since it's public API as well and it isn't easy to expand to a String without awkward semantics. bug: 13410257 Change-Id: I0e575b7eea0fd811ccb9fb5dc04e20d2e0fa13bf
* Fix ICU glue for uloc_toLanguageTag.Narayan Kamath2014-03-131-16/+18
| | | | | | | | | | | | | | | | There were several issues : - ICU does not set the output param UErrorCode* to U_ZERO_ERROR when an API call is successful, so we need to clear it before every API call. - ICU sets the error code to U_BUFFER_OVERFLOW_ERROR (and sets the output length to the required size) if the input buffer is too small. - ICU sets the error code to U_STRING_NOT_TERMINATED_WARNING when the input buffer is one character too short. bug: 13414549 bug: 13412659 Change-Id: I3e23ea507a540f37ab1c14a60afe801bca286554
* Merge "Add Currency.getNumericCode()"Neil Fuller2014-03-111-0/+10
|\
| * Add Currency.getNumericCode()Neil Fuller2014-03-111-0/+10
| | | | | | | | | | | | | | getNumericCode() was added in Java 1.7. It returns the ISO 4217 numeric code for a currency. Change-Id: I8404703e749b3324bbcb89ecf6d8d64b95a030a3
* | Implementation of MulticastChannel.Neil Fuller2014-02-283-1/+58
|/ | | | | | | | | | | | | | Note: ProtocolFamily / StandardProtocolFamily / DatagramChannel.open(ProtocolFamily) have not been implemented. There is a related change to libnativehelper that must be merged at the same time to avoid build breakage. See https://android-review.googlesource.com/#/c/81371/ Bug: 12464155 Change-Id: I07fc049b429a2d373e9bd7b07149632f5cd69f9d
* Update BN to work when sizeof(BN_ULONG) != 4.Colin Cross2014-02-211-51/+74
| | | | Change-Id: Ifc1cdf17c7198624c217afc82c43819b71660d53
* Fix NativeBreakIterator_cloneImpl return type.Elliott Hughes2014-02-211-1/+1
| | | | Change-Id: I44e36a0312973de83a2ee7d09483ad911e167604
* Fix JNI issues in NativeCollation.Narayan Kamath2014-02-071-15/+83
| | | | | | | | | We need to make sure the jchar array (and the corresponding input string) are valid throughout the iteration, not just during the JNI call that creates the iterator. bug: 12817544 Change-Id: I8dda0a7238a743da0d0e2b4c956ec0806ce3555b
* Only offer the CAP_* constants on bionic.Elliott Hughes2014-02-053-12/+11
| | | | | | It's too hard and insufficiently worthwhile to bother with glibc. Change-Id: Ic2d1c5242c20a197b713becbcdce09993abe0f5c
* Revert "Revert "ExpatParser LP64 fixes.""Elliott Hughes2014-02-051-2/+3
| | | | | | This reverts commit d88231f770f7459dc174aa970e305aa5f16f9f04. Change-Id: Iac6b50221aa1e4cfe8514ea693a4289d74e118de
* Revert "ExpatParser LP64 fixes."Elliott Hughes2014-02-051-1/+1
| | | | | | | | This reverts commit a8a1e201e415abfd6b5ae4fed98c8aa491e15af9. This causes YouTube to crash on launch. Reverting to give myself more time to investigate. Change-Id: I9ee107383a4f206ca83dd267baad77445eba3fce
* ExpatParser LP64 fixes.Elliott Hughes2014-02-031-1/+1
| | | | | | | Change-Id: I17ba32b6147b048f3cace0b2d7283b1c9d74f776 Signed-off-by: Stuart Monteith <Stuart.Monteith@arm.com> Signed-off-by: Marcus Oakland <marcus.oakland@arm.com> Signed-off-by: Matteo Franchin <matteo.franchin@arm.com>
* Add aarch64 to the architectures without alignment restrictions.Elliott Hughes2014-02-031-2/+2
| | | | Change-Id: I1ebc76b7ed08e177e97cd1e4d866347b7600057b
* NativeBreakIterator LP64 fixes.Elliott Hughes2014-02-031-4/+4
| | | | | | | Change-Id: I8886d73d9a83babca0f440177a9f3fd3eb70e38f Signed-off-by: Stuart Monteith <Stuart.Monteith@arm.com> Signed-off-by: Marcus Oakland <marcus.oakland@arm.com> Signed-off-by: Matteo Franchin <matteo.franchin@arm.com>