Merge "Enable memory-mapped coverage after forking."
diff --git a/JavaLibrary.bp b/JavaLibrary.bp
index 57f27d7..503972f 100644
--- a/JavaLibrary.bp
+++ b/JavaLibrary.bp
@@ -269,6 +269,7 @@
name: "core-libart",
visibility: [
"//art/build/apex",
+ "//art/build/sdk",
"//external/robolectric-shadows",
"//external/wycheproof",
"//libcore/benchmarks",
@@ -497,6 +498,7 @@
java_test {
name: "jsr166-tests",
visibility: [
+ "//art/build/sdk",
"//cts/tests/libcore/jsr166",
],
srcs: ["jsr166-tests/src/test/java/**/*.java"],
@@ -527,6 +529,7 @@
java_test {
name: "core-tests",
visibility: [
+ "//art/build/sdk",
"//cts/tests/libcore/luni",
],
defaults: ["libcore_java_defaults"],
@@ -679,6 +682,7 @@
java_test {
name: "core-ojtests-public",
visibility: [
+ "//art/build/sdk",
"//cts/tests/libcore/ojluni",
],
defaults: ["libcore_java_defaults"],
@@ -815,6 +819,7 @@
java_sdk_library {
name: "art.module.public.api",
visibility: [
+ "//art/build/sdk",
"//frameworks/base",
],
srcs: [
diff --git a/NativeCode.bp b/NativeCode.bp
index 041a090..7cc154b 100644
--- a/NativeCode.bp
+++ b/NativeCode.bp
@@ -63,10 +63,10 @@
"dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp",
],
shared_libs: [
- "libandroidicu",
"libandroidio",
"libbase",
"libcrypto",
+ "libicu",
"libexpat",
"libnativehelper",
"libz",
@@ -130,6 +130,7 @@
shared_libs: [
"libandroidio",
"libcrypto",
+ "libicu",
"libnativehelper",
"libz",
],
@@ -146,15 +147,9 @@
},
android: {
shared_libs: [
- "libandroidicu",
"libdl_android",
],
},
- host: {
- shared_libs: [
- "libicuuc",
- ],
- },
},
notice: "ojluni/NOTICE",
diff --git a/benchmarks/src/benchmarks/regression/StringToBytesBenchmark.java b/benchmarks/src/benchmarks/regression/StringToBytesBenchmark.java
index 8b22224..f43b32e 100644
--- a/benchmarks/src/benchmarks/regression/StringToBytesBenchmark.java
+++ b/benchmarks/src/benchmarks/regression/StringToBytesBenchmark.java
@@ -26,7 +26,11 @@
L_16(makeString(16)),
L_64(makeString(64)),
L_256(makeString(256)),
- L_512(makeString(512));
+ L_512(makeString(512)),
+ A_16(makeAsciiString(16)),
+ A_64(makeAsciiString(64)),
+ A_256(makeAsciiString(256)),
+ A_512(makeAsciiString(512));
private final String value;
@@ -43,6 +47,14 @@
return new String(chars);
}
+ private static final String makeAsciiString(int length) {
+ char[] chars = new char[length];
+ for (int i = 0; i < length; ++i) {
+ chars[i] = ((i & 0x7f) != 0) ? (char) (i & 0x7f) : '?';
+ }
+ return new String(chars);
+ }
+
@Param StringLengths string;
public void timeGetBytesUtf8(int nreps) {
diff --git a/dalvik/src/main/java/dalvik/system/PathClassLoader.java b/dalvik/src/main/java/dalvik/system/PathClassLoader.java
index cbd494f..c2b34e6 100644
--- a/dalvik/src/main/java/dalvik/system/PathClassLoader.java
+++ b/dalvik/src/main/java/dalvik/system/PathClassLoader.java
@@ -65,6 +65,31 @@
}
/**
+ * Creates a {@code PathClassLoader} that operates on two given
+ * lists of files and directories. The entries of the first list
+ * should be one of the following:
+ *
+ * <ul>
+ * <li>JAR/ZIP/APK files, possibly containing a "classes.dex" file as
+ * well as arbitrary resources.
+ * <li>Raw ".dex" files (not inside a zip file).
+ * </ul>
+ *
+ * The entries of the second list should be directories containing
+ * native library files.
+ *
+ * @param dexPath the list of jar/apk files containing classes and
+ * resources, delimited by {@code File.pathSeparator}, which
+ * defaults to {@code ":"} on Android
+ * @param librarySearchPath the list of directories containing native
+ * libraries, delimited by {@code File.pathSeparator}; may be
+ * {@code null}
+ * @param parent the parent class loader
+ * @param sharedLibraryLoaders class loaders of Java shared libraries
+ * used by this new class loader. The shared library loaders are always
+ * checked before the {@code dexPath} when looking
+ * up classes and resources.
+ *
* @hide
*/
@libcore.api.CorePlatformApi
diff --git a/dalvik/src/main/java/dalvik/system/RuntimeHooks.java b/dalvik/src/main/java/dalvik/system/RuntimeHooks.java
index 6d54176..320ea28 100644
--- a/dalvik/src/main/java/dalvik/system/RuntimeHooks.java
+++ b/dalvik/src/main/java/dalvik/system/RuntimeHooks.java
@@ -16,15 +16,10 @@
package dalvik.system;
-import dalvik.system.ThreadPrioritySetter;
-
import java.util.Objects;
import java.util.TimeZone;
import java.util.function.Supplier;
-import libcore.util.NonNull;
-import libcore.util.Nullable;
-
/**
* Provides lifecycle methods and other hooks for an Android runtime "container" to call into the
* runtime and core libraries during initialization. For example, from
@@ -40,10 +35,6 @@
private static Supplier<String> zoneIdSupplier;
- // BEGIN Android-added: Customize behavior of Thread.setPriority(). http://b/139521784
- private static volatile ThreadPrioritySetter threadPrioritySetter;
- // END Android-added: Customize behavior of Thread.setPriority(). http://b/139521784
-
private RuntimeHooks() {
// No need to construct an instance. All methods are static.
}
@@ -86,26 +77,4 @@
Thread.UncaughtExceptionHandler uncaughtExceptionHandler) {
Thread.setUncaughtExceptionPreHandler(uncaughtExceptionHandler);
}
-
- // BEGIN Android-added: Customize behavior of Thread.setPriority(). http://b/139521784
- /**
- * Sets a {@link ThreadPrioritySetter} that will be invoked instead of
- * the default implementation during {@link Thread.setPriority(int)}.
- * @hide
- */
- @libcore.api.CorePlatformApi
- public static void setThreadPrioritySetter(@NonNull ThreadPrioritySetter threadPrioritySetter) {
- RuntimeHooks.threadPrioritySetter = Objects.requireNonNull(threadPrioritySetter);
- }
-
- /**
- * Returns the last {@code ThreadPrioritySetter} that has been
- * {@code #setThreadPrioritySetter(ThreadPrioritySetter) set}, or
- * null if the setter has not yet been called.
- * @hide
- */
- public static @Nullable ThreadPrioritySetter getThreadPrioritySetter() {
- return threadPrioritySetter;
- }
- // END Android-added: Customize behavior of Thread.setPriority(). http://b/139521784
}
diff --git a/dalvik/src/main/java/dalvik/system/ThreadPrioritySetter.java b/dalvik/src/main/java/dalvik/system/ThreadPrioritySetter.java
deleted file mode 100644
index 484784b..0000000
--- a/dalvik/src/main/java/dalvik/system/ThreadPrioritySetter.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package dalvik.system;
-
-/**
- * Interface for hooking to thread priority runtime setting
- * @hide
- */
-@libcore.api.CorePlatformApi
-@FunctionalInterface
-public interface ThreadPrioritySetter {
- @libcore.api.CorePlatformApi
- void setPriority(int nativeTid, int priority);
-}
diff --git a/dalvik/src/main/java/dalvik/system/VMDebug.java b/dalvik/src/main/java/dalvik/system/VMDebug.java
index fba5115..c97e529 100644
--- a/dalvik/src/main/java/dalvik/system/VMDebug.java
+++ b/dalvik/src/main/java/dalvik/system/VMDebug.java
@@ -77,14 +77,6 @@
@libcore.api.CorePlatformApi
public static final int KIND_GLOBAL_CLASS_INIT_TIME =
KIND_CLASS_INIT_TIME;
- public static final int KIND_GLOBAL_EXT_ALLOCATED_OBJECTS =
- KIND_EXT_ALLOCATED_OBJECTS;
- public static final int KIND_GLOBAL_EXT_ALLOCATED_BYTES =
- KIND_EXT_ALLOCATED_BYTES;
- public static final int KIND_GLOBAL_EXT_FREED_OBJECTS =
- KIND_EXT_FREED_OBJECTS;
- public static final int KIND_GLOBAL_EXT_FREED_BYTES =
- KIND_EXT_FREED_BYTES;
@libcore.api.CorePlatformApi
public static final int KIND_THREAD_ALLOCATED_OBJECTS =
@@ -92,25 +84,9 @@
@libcore.api.CorePlatformApi
public static final int KIND_THREAD_ALLOCATED_BYTES =
KIND_ALLOCATED_BYTES << 16;
- public static final int KIND_THREAD_FREED_OBJECTS =
- KIND_FREED_OBJECTS << 16;
- public static final int KIND_THREAD_FREED_BYTES =
- KIND_FREED_BYTES << 16;
@libcore.api.CorePlatformApi
public static final int KIND_THREAD_GC_INVOCATIONS =
KIND_GC_INVOCATIONS << 16;
- public static final int KIND_THREAD_CLASS_INIT_COUNT =
- KIND_CLASS_INIT_COUNT << 16;
- public static final int KIND_THREAD_CLASS_INIT_TIME =
- KIND_CLASS_INIT_TIME << 16;
- public static final int KIND_THREAD_EXT_ALLOCATED_OBJECTS =
- KIND_EXT_ALLOCATED_OBJECTS << 16;
- public static final int KIND_THREAD_EXT_ALLOCATED_BYTES =
- KIND_EXT_ALLOCATED_BYTES << 16;
- public static final int KIND_THREAD_EXT_FREED_OBJECTS =
- KIND_EXT_FREED_OBJECTS << 16;
- public static final int KIND_THREAD_EXT_FREED_BYTES =
- KIND_EXT_FREED_BYTES << 16;
@libcore.api.CorePlatformApi
public static final int KIND_ALL_COUNTS = 0xffffffff;
@@ -156,17 +132,6 @@
public static native String[] getVmFeatureList();
/**
- * Start method tracing with default name, size, and with <code>0</code>
- * flags.
- *
- * @deprecated Not used, not needed.
- */
- @Deprecated
- public static void startMethodTracing() {
- throw new UnsupportedOperationException();
- }
-
- /**
* Start method tracing, specifying a file name as well as a default
* buffer size. See <a
* href="{@docRoot}guide/developing/tools/traceview.html"> Running the
@@ -197,17 +162,6 @@
* Like startMethodTracing(String, int, int), but taking an already-opened
* FileDescriptor in which the trace is written. The file name is also
* supplied simply for logging. Makes a dup of the file descriptor.
- */
- public static void startMethodTracing(String traceFileName, FileDescriptor fd, int bufferSize,
- int flags, boolean samplingEnabled, int intervalUs) {
- startMethodTracing(traceFileName, fd, bufferSize, flags, samplingEnabled, intervalUs,
- false);
- }
-
- /**
- * Like startMethodTracing(String, int, int), but taking an already-opened
- * FileDescriptor in which the trace is written. The file name is also
- * supplied simply for logging. Makes a dup of the file descriptor.
* Streams tracing data to the file if streamingOutput is true.
*/
@libcore.api.CorePlatformApi
@@ -277,15 +231,31 @@
public static native long threadCpuTimeNanos();
/**
- * Count the number and aggregate size of memory allocations between
- * two points.
+ * Starts counting the number and aggregate size of memory allocations.
*/
@libcore.api.CorePlatformApi
public static native void startAllocCounting();
+
+ /**
+ * Stops counting the number and aggregate size of memory allocations.
+ */
@libcore.api.CorePlatformApi
public static native void stopAllocCounting();
+
+ /**
+ * Returns information on the number of objects allocated by the runtime between a
+ * {@link #startAllocCounting() start} and {@link #stopAllocCounting() stop}.
+ *
+ * @param kind either KIND_GLOBAL_* or KIND_THREAD_*.
+ */
@libcore.api.CorePlatformApi
public static native int getAllocCount(int kind);
+
+ /**
+ * Resets counting the number and aggregate size of memory allocations for the given kinds.
+ *
+ * @param kinds a union of KIND_GLOBAL_* and KIND_THREAD_*.
+ */
@libcore.api.CorePlatformApi
public static native void resetAllocCount(int kinds);
@@ -310,13 +280,20 @@
/**
* Count the number of instructions executed between two points.
*/
- public static native void startInstructionCounting();
- public static native void stopInstructionCounting();
- public static native void getInstructionCount(int[] counts);
- public static native void resetInstructionCount();
+ @Deprecated
+ public static void startInstructionCounting() {}
+ @Deprecated
+ public static void stopInstructionCounting() {}
+ @Deprecated
+ public static void getInstructionCount(int[] counts) {}
+ @Deprecated
+ public static void resetInstructionCount() {}
/**
* Dumps a list of loaded class to the log file.
+ *
+ * @param flags a union of {@link android.os.Debug.SHOW_FULL_DETAIL},
+ * {@link android.os.Debug.SHOW_CLASSLOADER}, and {@link android.os.Debug.SHOW_INITIALIZED}.
*/
@libcore.api.CorePlatformApi
@FastNative
@@ -384,33 +361,6 @@
public static native void dumpReferenceTables();
/**
- * Crashes the VM. Seriously. Dumps the interpreter stack trace for
- * the current thread and then aborts the VM so you can see the native
- * stack trace. Useful for figuring out how you got somewhere when
- * lots of native code is involved.
- */
- public static native void crash();
-
- /**
- * Together with gdb, provide a handy way to stop the VM at user-tagged
- * locations.
- */
- public static native void infopoint(int id);
-
- /*
- * Fake method, inserted into dmtrace output when the garbage collector
- * runs. Not actually called.
- */
- private static void startGC() {}
-
- /*
- * Fake method, inserted into dmtrace output during class preparation
- * (loading and linking, but not verification or initialization). Not
- * actually called.
- */
- private static void startClassPrep() {}
-
- /**
* Counts the instances of a class.
* It is the caller's responsibility to do GC if they don't want unreachable
* objects to get counted.
@@ -458,27 +408,6 @@
*/
public static native Object[][] getInstancesOfClasses(Class[] classes, boolean assignable);
- /**
- * Export the heap per-space stats for dumpsys meminfo.
- *
- * The content of the array is:
- *
- * <pre>
- * data[0] : the application heap space size
- * data[1] : the application heap space allocated bytes
- * data[2] : the application heap space free bytes
- * data[3] : the zygote heap space size
- * data[4] : the zygote heap space allocated size
- * data[5] : the zygote heap space free size
- * data[6] : the large object space size
- * data[7] : the large object space allocated bytes
- * data[8] : the large object space free bytes
- * </pre>
- *
- * @param data the array into which the stats are written.
- */
- public static native void getHeapSpaceStats(long[] data);
-
/* Map from the names of the runtime stats supported by getRuntimeStat() to their IDs */
private static final HashMap<String, Integer> runtimeStatsMap = new HashMap<>();
@@ -538,15 +467,6 @@
* Attaches an agent to the VM.
*
* @param agent The path to the agent .so file plus optional agent arguments.
- */
- public static void attachAgent(String agent) throws IOException {
- attachAgent(agent, null);
- }
-
- /**
- * Attaches an agent to the VM.
- *
- * @param agent The path to the agent .so file plus optional agent arguments.
* @param classLoader The classloader to use as a loading context.
*/
@libcore.api.CorePlatformApi
diff --git a/expectations/Android.bp b/expectations/Android.bp
index 76cf1ed..f1ce17e 100644
--- a/expectations/Android.bp
+++ b/expectations/Android.bp
@@ -13,6 +13,7 @@
// limitations under the License.
expectations_visibility = [
+ "//art/build/sdk",
"//cts/tests/libcore:__subpackages__",
]
diff --git a/libart/src/main/java/dalvik/system/VMRuntime.java b/libart/src/main/java/dalvik/system/VMRuntime.java
index 376fe94..90e22c7 100644
--- a/libart/src/main/java/dalvik/system/VMRuntime.java
+++ b/libart/src/main/java/dalvik/system/VMRuntime.java
@@ -420,20 +420,6 @@
}
/**
- * Tells the VM to enable the JIT compiler. If the VM does not have a JIT
- * implementation, calling this method should have no effect.
- */
- @libcore.api.CorePlatformApi
- public native void startJitCompilation();
-
- /**
- * Tells the VM to disable the JIT compiler. If the VM does not have a JIT
- * implementation, calling this method should have no effect.
- */
- @libcore.api.CorePlatformApi
- public native void disableJitCompilation();
-
- /**
* Sets the list of exemptions from hidden API access enforcement.
*
* @param signaturePrefixes
diff --git a/luni/src/main/java/libcore/math/NativeBN.java b/luni/src/main/java/libcore/math/NativeBN.java
index fb1cb78..8b2ea0f 100644
--- a/luni/src/main/java/libcore/math/NativeBN.java
+++ b/luni/src/main/java/libcore/math/NativeBN.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-// TODO: Prune out the methods we no longer need after replacing the BigInteger
-// code.
-
package libcore.math;
/**
@@ -36,13 +33,6 @@
// word at index 0.
public static native int[] bn2litEndInts(long a);
- public static native int sign(long a);
- // Returns -1, 0, 1 AND NOT boolean.
- // #define BN_is_negative(a) ((a)->neg != 0)
-
- public static native void BN_set_negative(long b, int n);
- // void BN_set_negative(BIGNUM *b, int n);
-
public static native void BN_mul(long r, long a, long b);
// int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
diff --git a/luni/src/main/native/ScopedIcuULoc.h b/luni/src/main/native/ScopedIcuULoc.h
index 5de5e36..5f7ca0a 100644
--- a/luni/src/main/native/ScopedIcuULoc.h
+++ b/luni/src/main/native/ScopedIcuULoc.h
@@ -19,7 +19,7 @@
#include <nativehelper/JNIHelp.h>
#include <nativehelper/ScopedUtfChars.h>
-#include "unicode/uloc.h"
+#include <unicode/uloc.h>
static void getLocale(const char* localeName, std::string& locale, UErrorCode* status) {
diff --git a/luni/src/main/native/libcore_math_NativeBN.cpp b/luni/src/main/native/libcore_math_NativeBN.cpp
index a123014..dc4b9473 100644
--- a/luni/src/main/native/libcore_math_NativeBN.cpp
+++ b/luni/src/main/native/libcore_math_NativeBN.cpp
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-// TODO: Check that we handle context allocation failures correctly.
-
#define LOG_TAG "NativeBN"
#include <stdio.h>
@@ -142,36 +140,26 @@
return result;
}
-static int NativeBN_sign(JNIEnv*, jclass, jlong a) {
- if (BN_is_zero(toBigNum(a))) {
- return 0;
- } else if (BN_is_negative(toBigNum(a))) {
- return -1;
- }
- return 1;
-}
-
-static void NativeBN_BN_set_negative(JNIEnv*, jclass, jlong b, int n) {
- BN_set_negative(toBigNum(b), n);
-}
-
static void NativeBN_BN_mul(JNIEnv* env, jclass, jlong r, jlong a, jlong b) {
Unique_BN_CTX ctx(BN_CTX_new());
- if (!BN_mul(toBigNum(r), toBigNum(a), toBigNum(b), ctx.get())) {
+ BN_CTX* ctxp = ctx.get();
+ if (!ctxp || !BN_mul(toBigNum(r), toBigNum(a), toBigNum(b), ctxp)) {
throwException(env);
}
}
static void NativeBN_BN_div(JNIEnv* env, jclass, jlong q, jlong rem, jlong num, jlong divisor) {
Unique_BN_CTX ctx(BN_CTX_new());
- if (!BN_div(toBigNum(q), toBigNum(rem), toBigNum(num), toBigNum(divisor), ctx.get())) {
+ BN_CTX* ctxp = ctx.get();
+ if (!ctxp || !BN_div(toBigNum(q), toBigNum(rem), toBigNum(num), toBigNum(divisor), ctxp)) {
throwException(env);
}
}
static void NativeBN_BN_mod_exp(JNIEnv* env, jclass, jlong r, jlong a, jlong p, jlong m) {
Unique_BN_CTX ctx(BN_CTX_new());
- if (!BN_mod_exp(toBigNum(r), toBigNum(a), toBigNum(p), toBigNum(m), ctx.get())) {
+ BN_CTX* ctxp = ctx.get();
+ if (!ctxp || !BN_mod_exp(toBigNum(r), toBigNum(a), toBigNum(p), toBigNum(m), ctxp)) {
throwException(env);
}
}
@@ -182,10 +170,8 @@
NATIVE_METHOD(NativeBN, BN_mod_exp, "(JJJJ)V"),
NATIVE_METHOD(NativeBN, BN_mul, "(JJJ)V"),
NATIVE_METHOD(NativeBN, BN_new, "()J"),
- NATIVE_METHOD(NativeBN, BN_set_negative, "(JI)V"),
NATIVE_METHOD(NativeBN, bn2litEndInts, "(J)[I"),
NATIVE_METHOD(NativeBN, litEndInts2bn, "([IIZJ)V"),
- NATIVE_METHOD(NativeBN, sign, "(J)I"),
};
void register_libcore_math_NativeBN(JNIEnv* env) {
jniRegisterNativeMethods(env, "libcore/math/NativeBN", gMethods, NELEM(gMethods));
diff --git a/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp b/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
index 6df5bdd..fdabcf7 100644
--- a/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
+++ b/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
@@ -31,10 +31,11 @@
#include <nativehelper/ScopedUtfChars.h>
#include <nativehelper/jni_macros.h>
+#include <unicode/char16ptr.h>
+#include <unicode/ustring.h>
+
#include "JniConstants.h"
#include "JniException.h"
-#include "unicode/char16ptr.h"
-#include "unicode/ustring.h"
#define BUCKET_COUNT 128
diff --git a/luni/src/test/java/tests/java/sql/StressTest.java b/luni/src/test/java/tests/java/sql/StressTest.java
index b981d5e..03c6b85 100644
--- a/luni/src/test/java/tests/java/sql/StressTest.java
+++ b/luni/src/test/java/tests/java/sql/StressTest.java
@@ -16,31 +16,40 @@
package tests.java.sql;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.sql.Connection;
import java.sql.DatabaseMetaData;
-import java.sql.Driver;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
-import java.util.Properties;
import java.util.Vector;
import java.util.logging.Logger;
import tests.support.DatabaseCreator;
import tests.support.Support_SQL;
import tests.support.ThreadPool;
-import junit.framework.TestCase;
-public class StressTest extends TestCase {
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public class StressTest {
Vector<Connection> vc = new Vector<Connection>();
private static Connection conn;
private static Statement statement;
+ @Before
public void setUp() throws Exception {
- super.setUp();
Support_SQL.loadDriver();
conn = Support_SQL.getConnection();
statement = conn.createStatement();
@@ -48,11 +57,11 @@
vc.clear();
}
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
closeConnections();
statement.close();
conn.close();
- super.tearDown();
}
private void createTestTables() {
@@ -105,6 +114,7 @@
* StressTest#testManyConnectionsUsingOneThread(). Create many
* connections to the DataBase using one thread.
*/
+ @Test
public void testManyConnectionsUsingOneThread() {
try {
int maxConnections = getConnectionNum();
@@ -120,6 +130,7 @@
* StressTest#testManyConnectionsUsingManyThreads(). Create many
* connections to the DataBase using some threads.
*/
+ @Test
public void testManyConnectionsUsingManyThreads() {
int numTasks = getConnectionNum();
@@ -149,6 +160,7 @@
* StressTest#testInsertOfManyRowsUsingOneThread(). Insert a lot of
* records to the Database using a maximum number of connections.
*/
+ @Test
public void testInsertOfManyRowsUsingOneThread() {
Logger.global
@@ -187,7 +199,10 @@
/**
* @tests
+ * TODO(b/169673091): Investigate why it could occasionally take 10min rather than 10s to
+ * finish.
*/
+ @Test
public void testInsertOfManyRowsUsingManyThreads() {
Logger.global.info("java.sql stress test: multiple threads and many operations.");
@@ -204,6 +219,7 @@
}
// close the pool and wait for all tasks to finish.
threadPool.join();
+ Logger.global.info("All threads joined");
assertEquals("Unable to create a connection", numConnections, vc.size());
try {
@@ -211,11 +227,12 @@
.executeQuery("SELECT COUNT(*) as counter FROM "
+ DatabaseCreator.TEST_TABLE2);
assertTrue("RecordSet is empty", rs.next());
-
+ Logger.global.info("Counting statement returned");
assertEquals("Incorrect number of records", tasksPerConnection
* numConnections, rs.getInt("counter"));
rs.close();
+ Logger.global.info("ResultSet closed");
} catch (SQLException sql) {
fail("Unexpected SQLException " + sql.toString());
diff --git a/mmodules/core_platform_api/api/legacy_platform/current.txt b/mmodules/core_platform_api/api/legacy_platform/current.txt
index 0f96f0d..289fe9e 100644
--- a/mmodules/core_platform_api/api/legacy_platform/current.txt
+++ b/mmodules/core_platform_api/api/legacy_platform/current.txt
@@ -596,7 +596,6 @@
}
public final class RuntimeHooks {
- method public static void setThreadPrioritySetter(@NonNull dalvik.system.ThreadPrioritySetter);
method public static void setTimeZoneIdSupplier(java.util.function.Supplier<java.lang.String>);
method public static void setUncaughtExceptionPreHandler(java.lang.Thread.UncaughtExceptionHandler);
}
@@ -613,10 +612,6 @@
method public final void untag(java.net.DatagramSocket) throws java.net.SocketException;
}
- @java.lang.FunctionalInterface public interface ThreadPrioritySetter {
- method public void setPriority(int, int);
- }
-
public final class VMDebug {
method public static void attachAgent(String, ClassLoader) throws java.io.IOException;
method public static long countInstancesOfClass(Class, boolean);
@@ -664,7 +659,6 @@
method public void clampGrowthLimit();
method public void clearGrowthLimit();
method public static boolean didPruneDalvikCache();
- method public void disableJitCompilation();
method public static String getCurrentInstructionSet();
method public static String getInstructionSet(String);
method public static dalvik.system.VMRuntime getRuntime();
@@ -696,7 +690,6 @@
method public static void setProcessDataDirectory(String);
method public static void setProcessPackageName(String);
method public void setTargetSdkVersion(int);
- method public void startJitCompilation();
method public void updateProcessState(int);
method public String vmInstructionSet();
method public String vmLibrary();
diff --git a/non_openjdk_java_files.bp b/non_openjdk_java_files.bp
index 51e099d..8f2e2cf 100644
--- a/non_openjdk_java_files.bp
+++ b/non_openjdk_java_files.bp
@@ -47,7 +47,6 @@
"dalvik/src/main/java/dalvik/system/RuntimeHooks.java",
"dalvik/src/main/java/dalvik/system/SocketTagger.java",
"dalvik/src/main/java/dalvik/system/TemporaryDirectory.java",
- "dalvik/src/main/java/dalvik/system/ThreadPrioritySetter.java",
"dalvik/src/main/java/dalvik/system/VMDebug.java",
"dalvik/src/main/java/dalvik/system/ZygoteHooks.java",
"dalvik/src/main/java/org/apache/harmony/dalvik/NativeTestTarget.java",
diff --git a/ojluni/src/main/java/java/lang/Runtime.java b/ojluni/src/main/java/java/lang/Runtime.java
index f5c52e7..b9baf65 100644
--- a/ojluni/src/main/java/java/lang/Runtime.java
+++ b/ojluni/src/main/java/java/lang/Runtime.java
@@ -78,11 +78,6 @@
*/
private boolean shuttingDown;
- /**
- * Reflects whether we are tracing method calls.
- */
- private boolean tracingMethods;
-
private static native void nativeExit(int code);
/**
@@ -845,13 +840,8 @@
* <code>false</code> to disable this feature.
*/
public void traceMethodCalls(boolean on) {
- if (on != tracingMethods) {
- if (on) {
- VMDebug.startMethodTracing();
- } else {
- VMDebug.stopMethodTracing();
- }
- tracingMethods = on;
+ if (on) {
+ throw new UnsupportedOperationException();
}
}
diff --git a/ojluni/src/main/java/java/lang/Thread.java b/ojluni/src/main/java/java/lang/Thread.java
index 0ff38a6..2b9e996 100644
--- a/ojluni/src/main/java/java/lang/Thread.java
+++ b/ojluni/src/main/java/java/lang/Thread.java
@@ -40,8 +40,6 @@
import java.util.concurrent.locks.LockSupport;
import sun.nio.ch.Interruptible;
import sun.reflect.CallerSensitive;
-import dalvik.system.RuntimeHooks;
-import dalvik.system.ThreadPrioritySetter;
import dalvik.system.VMStack;
import libcore.util.EmptyArray;
@@ -1245,18 +1243,7 @@
synchronized(this) {
this.priority = newPriority;
if (isAlive()) {
- // BEGIN Android-added: Customize behavior of Thread.setPriority().
- // http://b/139521784
- // setPriority0(newPriority);
- ThreadPrioritySetter threadPrioritySetter =
- RuntimeHooks.getThreadPrioritySetter();
- int nativeTid = this.getNativeTid();
- if (threadPrioritySetter != null && nativeTid != 0) {
- threadPrioritySetter.setPriority(nativeTid, newPriority);
- } else {
- setPriority0(newPriority);
- }
- // END Android-added: Customize behavior of Thread.setPriority().
+ setPriority0(newPriority);
}
}
}
@@ -2341,14 +2328,4 @@
// Android-added: Android specific nativeGetStatus() method.
private native int nativeGetStatus(boolean hasBeenStarted);
-
- // BEGIN Android-added: Customize behavior of Thread.setPriority(). http://b/139521784
- /**
- * Returns the thread ID of the underlying native thread -- which is different from
- * the {@link #getId() managed thread ID} -- or 0 if the native thread is not
- * started or has stopped.
- */
- @FastNative
- private native int getNativeTid();
- // END Android-added: Customize behavior of Thread.setPriority(). http://b/139521784
}
diff --git a/ojluni/src/main/java/java/math/BigInteger.java b/ojluni/src/main/java/java/math/BigInteger.java
index 47fb1ea..b20c5ec 100644
--- a/ojluni/src/main/java/java/math/BigInteger.java
+++ b/ojluni/src/main/java/java/math/BigInteger.java
@@ -2310,7 +2310,7 @@
// if (val.mag.length < BURNIKEL_ZIEGLER_THRESHOLD ||
// mag.length - val.mag.length < BURNIKEL_ZIEGLER_OFFSET) {
if (val.mag.length < BORINGSSL_DIV_THRESHOLD ||
- mag.length < BORINGSSL_DIV_THRESHOLD) {
+ mag.length - val.mag.length < BORINGSSL_DIV_THRESHOLD) {
return remainderKnuth(val);
} else {
return divideAndRemainder(val)[1];
diff --git a/ojluni/src/main/java/java/time/format/DateTimeFormatterBuilder.java b/ojluni/src/main/java/java/time/format/DateTimeFormatterBuilder.java
index 736a8fc..f881d93 100644
--- a/ojluni/src/main/java/java/time/format/DateTimeFormatterBuilder.java
+++ b/ojluni/src/main/java/java/time/format/DateTimeFormatterBuilder.java
@@ -61,7 +61,6 @@
*/
package java.time.format;
-import android.icu.impl.ZoneMeta;
import android.icu.text.LocaleDisplayNames;
import android.icu.text.TimeZoneFormat;
import android.icu.text.TimeZoneNames;
@@ -3698,7 +3697,7 @@
names = new String[TYPES.length + 1];
// Zeroth index used for id, other indexes based on NameType constant + 1.
names[0] = id;
- String canonicalId = ZoneMeta.getCanonicalCLDRID(id);
+ String canonicalId = ZoneName.getSystemCanonicalID(id);
timeZoneNames.getDisplayNames(canonicalId, TYPES, System.currentTimeMillis(),
/* dest */ names, /* destoffset */ 1);
if (names == null) {
diff --git a/ojluni/src/main/java/java/time/format/ZoneName.java b/ojluni/src/main/java/java/time/format/ZoneName.java
index fe4a95a..daecb6e 100644
--- a/ojluni/src/main/java/java/time/format/ZoneName.java
+++ b/ojluni/src/main/java/java/time/format/ZoneName.java
@@ -24,7 +24,6 @@
*/
package java.time.format;
-import android.icu.impl.ZoneMeta;
import android.icu.text.TimeZoneNames;
import android.icu.util.TimeZone;
import android.icu.util.ULocale;
@@ -57,14 +56,28 @@
}
public static String toZid(String zid) {
- // Android-changed: Use ICU ZoneMeta.
- String canonicalCldrId = ZoneMeta.getCanonicalCLDRID(zid);
+ // Android-changed: Use ICU TimeZone.getCanonicalID().
+ String canonicalCldrId = getSystemCanonicalID(zid);
if (canonicalCldrId != null) {
return canonicalCldrId;
}
return zid;
}
+ // BEGIN Android-added: Get non-custom system canonical time zone Id from ICU.
+ public static String getSystemCanonicalID(String zid) {
+ if (TimeZone.UNKNOWN_ZONE_ID.equals(zid)) {
+ return zid;
+ }
+ boolean[] isSystemID = { false };
+ String canonicalID = TimeZone.getCanonicalID(zid, isSystemID);
+ if (canonicalID == null || !isSystemID[0]) {
+ return null;
+ }
+ return canonicalID;
+ }
+ // END Android-added: Get non-custom system canonical time zone Id from ICU.
+
// Android-removed: zidMap and aliasMap containing zone id data.
// Android-removed: zidToMzone, mzoneToZid, mzoneToZidL, aliases and their initialization code.
}
diff --git a/ojluni/src/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java b/ojluni/src/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java
index bc0944f..619889b 100644
--- a/ojluni/src/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java
+++ b/ojluni/src/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java
@@ -46,7 +46,6 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
-import android.icu.impl.ZoneMeta;
/*
* @test
@@ -91,7 +90,7 @@
}
// Android-changed (http://b/33197219): TimeZone.getDisplayName() for
// non-canonical time zones are not correct.
- if (!zid.equals(ZoneMeta.getCanonicalCLDRID(zid))) {
+ if (!zid.equals(getSystemCanonicalID(zid))) {
continue;
}
zdt = zdt.withZoneSameLocal(ZoneId.of(zid));
@@ -110,6 +109,20 @@
}
}
+ // BEGIN Android-added: Get non-custom system canonical time zone Id from ICU.
+ private static String getSystemCanonicalID(String zid) {
+ if (android.icu.util.TimeZone.UNKNOWN_ZONE_ID.equals(zid)) {
+ return zid;
+ }
+ boolean[] isSystemID = { false };
+ String canonicalID = android.icu.util.TimeZone.getCanonicalID(zid, isSystemID);
+ if (canonicalID == null || !isSystemID[0]) {
+ return null;
+ }
+ return canonicalID;
+ }
+ // END Android-added: Get non-custom system canonical time zone Id from ICU.
+
private void printText(Locale locale, ZonedDateTime zdt, TextStyle style, TimeZone zone, String expected) {
String result = getFormatter(locale, style).format(zdt);
// Android-changed: TimeZone.getDisplayName() will never return "GMT".