Merge "Use the runtime's implementation for park/unpark"
diff --git a/libart/src/main/java/java/lang/DexCache.java b/libart/src/main/java/java/lang/DexCache.java
index 864196d..acd12db 100644
--- a/libart/src/main/java/java/lang/DexCache.java
+++ b/libart/src/main/java/java/lang/DexCache.java
@@ -45,6 +45,11 @@
private long dexFile;
/**
+ * References to pre resolved strings.
+ */
+ private long preResolvedStrings;
+
+ /**
* References to CallSite (C array pointer) as they become resolved following
* interpreter semantics.
*/
@@ -81,6 +86,11 @@
private long strings;
/**
+ * The number of elements in the native pre resolved strings array.
+ */
+ private int numPreResolvedStrings;
+
+ /**
* The number of elements in the native call sites array.
*/
private int numResolvedCallSites;
diff --git a/luni/src/main/java/libcore/io/ForwardingOs.java b/luni/src/main/java/libcore/io/ForwardingOs.java
index c14b84f..41d0ca4 100644
--- a/luni/src/main/java/libcore/io/ForwardingOs.java
+++ b/luni/src/main/java/libcore/io/ForwardingOs.java
@@ -65,6 +65,7 @@
}
public FileDescriptor accept(FileDescriptor fd, SocketAddress peerAddress) throws ErrnoException, SocketException { return os.accept(fd, peerAddress); }
+ @libcore.api.CorePlatformApi
public boolean access(String path, int mode) throws ErrnoException { return os.access(path, mode); }
public InetAddress[] android_getaddrinfo(String node, StructAddrinfo hints, int netId) throws GaiException { return os.android_getaddrinfo(node, hints, netId); }
public void bind(FileDescriptor fd, InetAddress address, int port) throws ErrnoException, SocketException { os.bind(fd, address, port); }
@@ -194,6 +195,7 @@
public FileDescriptor socket(int domain, int type, int protocol) throws ErrnoException { return os.socket(domain, type, protocol); }
public void socketpair(int domain, int type, int protocol, FileDescriptor fd1, FileDescriptor fd2) throws ErrnoException { os.socketpair(domain, type, protocol, fd1, fd2); }
public long splice(FileDescriptor fdIn, Int64Ref offIn, FileDescriptor fdOut, Int64Ref offOut, long len, int flags) throws ErrnoException { return os.splice(fdIn, offIn, fdOut, offOut, len, flags); }
+ @libcore.api.CorePlatformApi
public StructStat stat(String path) throws ErrnoException { return os.stat(path); }
public StructStatVfs statvfs(String path) throws ErrnoException { return os.statvfs(path); }
public String strerror(int errno) { return os.strerror(errno); }
diff --git a/luni/src/test/java/libcore/java/text/NumberFormatTest.java b/luni/src/test/java/libcore/java/text/NumberFormatTest.java
index 63892df..547653f 100644
--- a/luni/src/test/java/libcore/java/text/NumberFormatTest.java
+++ b/luni/src/test/java/libcore/java/text/NumberFormatTest.java
@@ -210,19 +210,18 @@
public void test_setCurrency() throws Exception {
NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.US);
- // The Armenian Dram is a special case where the fractional digits are 0.
- Currency amd = Currency.getInstance("AMD");
- assertEquals(0, amd.getDefaultFractionDigits());
+ // The Japanese Yen is a special case where the fractional digits are 0.
+ Currency jpy = Currency.getInstance("JPY");
+ assertEquals(0, jpy.getDefaultFractionDigits());
- // Armenian Dram ISO 4217 code.
- nf.setCurrency(amd);
+ nf.setCurrency(jpy);
assertEquals(2, nf.getMinimumFractionDigits()); // Check DecimalFormat has not taken the
assertEquals(2, nf.getMaximumFractionDigits()); // currency specific fractional digits.
- assertEquals("AMD50.00", nf.format(50.00));
+ assertEquals("¥50.00", nf.format(50.00));
// Try and explicitly request fractional digits for the specified currency.
- nf.setMaximumFractionDigits(amd.getDefaultFractionDigits());
- assertEquals("AMD50", nf.format(50.00));
+ nf.setMaximumFractionDigits(jpy.getDefaultFractionDigits());
+ assertEquals("¥50", nf.format(50.00));
nf = NumberFormat.getCurrencyInstance(Locale.US);
@@ -230,9 +229,9 @@
nf.setCurrency(Currency.getInstance("EUR"));
assertEquals("€50.00", nf.format(50.00));
- // Japanese Yen symbol.
- nf.setCurrency(Currency.getInstance("JPY"));
- assertEquals("¥50.00", nf.format(50.00));
+ // Armenian Dram symbol.
+ nf.setCurrency(Currency.getInstance("AMD"));
+ assertEquals("AMD50.00", nf.format(50.00));
// Swiss Franc ISO 4217 code.
nf.setCurrency(Currency.getInstance("CHF"));
@@ -245,9 +244,9 @@
NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.JAPAN);
assertEquals("¥50", nf.format(50.00));
- // Armenian Dram 0 fractional digits.
+ // Armenian Dram 2 fractional digits.
nf = NumberFormat.getCurrencyInstance(Locale.forLanguageTag("hy-AM"));
- assertEquals("50\u00a0֏", nf.format(50.00));
+ assertEquals("50,00\u00a0֏", nf.format(50.00));
// Swiss Francs 2 fractional digits.
nf = NumberFormat.getCurrencyInstance(Locale.forLanguageTag("de-CH"));
diff --git a/luni/src/test/java/libcore/java/text/OldDecimalFormatSymbolsTest.java b/luni/src/test/java/libcore/java/text/OldDecimalFormatSymbolsTest.java
index fa98bf9..444d91e 100644
--- a/luni/src/test/java/libcore/java/text/OldDecimalFormatSymbolsTest.java
+++ b/luni/src/test/java/libcore/java/text/OldDecimalFormatSymbolsTest.java
@@ -33,7 +33,6 @@
public void test_RIHarmony_compatible() throws Exception {
ObjectInputStream i = null;
try {
- DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.FRANCE);
i = new ObjectInputStream(
getClass()
.getClassLoader()
@@ -43,7 +42,17 @@
// RI's default NaN is U+FFFD, Harmony's is based on ICU
// This suggests an RI bug, assuming that non-UTF8 bytes are UTF8 and
// getting a conversion failure.
+ assertEquals("\ufffd", riSymbols.getNaN());
+ // Since CLDR 34, Android's group separator in French is changed from \u00a0 to \u202f.
+ // Both are no-break whitespace in Unicode.
+ assertEquals('\u00a0', riSymbols.getGroupingSeparator());
+
+ // Override the riSymbols fields known to differ on Android values so that we can check
+ // equality on all other fields with equals().
riSymbols.setNaN("NaN");
+ riSymbols.setGroupingSeparator('\u202f');
+ // Compare the Android defaults with the RI snapshot.
+ DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.FRANCE);
assertEquals(symbols, riSymbols);
} catch(NullPointerException e) {
assertNotNull("Failed to load /serialization/java/text/" +
@@ -144,7 +153,7 @@
assertEquals("\u20AC", dfs.getCurrencySymbol());
assertEquals(',', dfs.getDecimalSeparator());
assertEquals('#', dfs.getDigit());
- assertEquals('\u00a0', dfs.getGroupingSeparator());
+ assertEquals('\u202f', dfs.getGroupingSeparator());
assertEquals("\u221e", dfs.getInfinity());
assertEquals("EUR", dfs.getInternationalCurrencySymbol());
assertEquals('-', dfs.getMinusSign());
diff --git a/luni/src/test/java/libcore/libcore/icu/AlphabeticIndexTest.java b/luni/src/test/java/libcore/libcore/icu/AlphabeticIndexTest.java
index 24c7b33..c659f9d 100644
--- a/luni/src/test/java/libcore/libcore/icu/AlphabeticIndexTest.java
+++ b/luni/src/test/java/libcore/libcore/icu/AlphabeticIndexTest.java
@@ -23,6 +23,7 @@
import java.util.Locale;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNotNull;
/**
* Test for {@link android.icu.text.AlphabeticIndex}
@@ -36,16 +37,28 @@
// http://b/64953401
@Test
- public void test_amharic() {
- Locale amharic = Locale.forLanguageTag("am");
- UnicodeSet exemplarSet = LocaleData
- .getExemplarSet(ULocale.forLocale(amharic), 0, LocaleData.ES_INDEX);
- // If this assert fails it means that the am locale has gained an exemplar characters set
- // for index (see key ExemplarCharactersIndex in locale/am.txt). If that's the case, please
- // find another locale that's missing that key where the logic in
- // AlphabeticIndex.addIndexExemplars will generate buckets from alternate data.
- assertTrue(exemplarSet == null || exemplarSet.isEmpty());
- verifyIndex(amharic);
+ public void testBucketCount_withNoIndexCharacters() {
+ Locale localeWithNoIndexCharacters = null;
+ // Search in the available languages only instead of all possible locales
+ // in order to speed-up the test.
+ for (String language : Locale.getISOLanguages()) {
+ Locale locale = Locale.forLanguageTag(language);
+ UnicodeSet exemplarSet = LocaleData.getExemplarSet(
+ ULocale.forLocale(locale), 0, LocaleData.ES_INDEX);
+ if (exemplarSet == null || exemplarSet.isEmpty()) {
+ localeWithNoIndexCharacters = locale;
+ break;
+ }
+ }
+
+ assertNotNull("Can't find any language with no index characters",
+ localeWithNoIndexCharacters);
+
+ // If this assert fails it means that it can't find any language with no index character.
+ // If that's the case, please find expand the search space to find a locale that's missing
+ // that key where the logic in AlphabeticIndex.addIndexExemplars will generate buckets from
+ // alternate data.
+ verifyIndex(localeWithNoIndexCharacters);
}
private void verifyIndex(Locale locale) {
@@ -58,6 +71,7 @@
for (String s : exemplarSet) {
index.addRecord(s, s);
}
- assertTrue("Not enough buckets: " + index.getBucketLabels(), index.getBucketCount() > 1);
+ assertTrue("Locale(" + locale + ") does not have enough buckets: " + index.getBucketLabels(),
+ index.getBucketCount() > 1);
}
}
diff --git a/luni/src/test/java/libcore/libcore/icu/DateIntervalFormatTest.java b/luni/src/test/java/libcore/libcore/icu/DateIntervalFormatTest.java
index 6b33f13..d8a087c 100644
--- a/luni/src/test/java/libcore/libcore/icu/DateIntervalFormatTest.java
+++ b/luni/src/test/java/libcore/libcore/icu/DateIntervalFormatTest.java
@@ -83,8 +83,8 @@
assertEquals("1/19/2009 – 2/9/2012", formatDateRange(en_US, tz, fixedTime, fixedTime + 3 * YEAR, FORMAT_SHOW_YEAR | FORMAT_NUMERIC_DATE));
assertEquals("19.1.2009", formatDateRange(de_DE, tz, fixedTime, fixedTime + HOUR, FORMAT_SHOW_YEAR | FORMAT_NUMERIC_DATE));
- assertEquals("19.01.2009 – 22.01.2009", formatDateRange(de_DE, tz, fixedTime, fixedTime + 3 * DAY, FORMAT_SHOW_YEAR | FORMAT_NUMERIC_DATE));
- assertEquals("19.01.2009 – 22.04.2009", formatDateRange(de_DE, tz, fixedTime, fixedTime + 3 * MONTH, FORMAT_SHOW_YEAR | FORMAT_NUMERIC_DATE));
+ assertEquals("19.–22.01.2009", formatDateRange(de_DE, tz, fixedTime, fixedTime + 3 * DAY, FORMAT_SHOW_YEAR | FORMAT_NUMERIC_DATE));
+ assertEquals("19.01. – 22.04.2009", formatDateRange(de_DE, tz, fixedTime, fixedTime + 3 * MONTH, FORMAT_SHOW_YEAR | FORMAT_NUMERIC_DATE));
assertEquals("19.01.2009 – 09.02.2012", formatDateRange(de_DE, tz, fixedTime, fixedTime + 3 * YEAR, FORMAT_SHOW_YEAR | FORMAT_NUMERIC_DATE));
assertEquals("19/1/2009", formatDateRange(es_US, tz, fixedTime, fixedTime + HOUR, FORMAT_SHOW_YEAR | FORMAT_NUMERIC_DATE));
diff --git a/mmodules/core_platform_api/api/platform/current-api.txt b/mmodules/core_platform_api/api/platform/current-api.txt
index a647295..1851150 100644
--- a/mmodules/core_platform_api/api/platform/current-api.txt
+++ b/mmodules/core_platform_api/api/platform/current-api.txt
@@ -1031,7 +1031,9 @@
public class ForwardingOs implements libcore.io.Os {
ctor protected ForwardingOs(libcore.io.Os);
+ method public boolean access(java.lang.String, int) throws android.system.ErrnoException;
method public java.io.FileDescriptor open(java.lang.String, int, int) throws android.system.ErrnoException;
+ method public android.system.StructStat stat(java.lang.String) throws android.system.ErrnoException;
}
public final class IoBridge {
diff --git a/mmodules/core_platform_api/api/platform/last-api.txt b/mmodules/core_platform_api/api/platform/last-api.txt
index a647295..1851150 100644
--- a/mmodules/core_platform_api/api/platform/last-api.txt
+++ b/mmodules/core_platform_api/api/platform/last-api.txt
@@ -1031,7 +1031,9 @@
public class ForwardingOs implements libcore.io.Os {
ctor protected ForwardingOs(libcore.io.Os);
+ method public boolean access(java.lang.String, int) throws android.system.ErrnoException;
method public java.io.FileDescriptor open(java.lang.String, int, int) throws android.system.ErrnoException;
+ method public android.system.StructStat stat(java.lang.String) throws android.system.ErrnoException;
}
public final class IoBridge {