blob: 5db47b5f25078d8c65a0ccc07b1f6972da2f9726 [file] [log] [blame]
Elliott Hughesc08f9fb2010-04-16 17:44:12 -07001/*
2 * Copyright (C) 2010 The Android Open Source Project
Elliott Hughesa9f5c162010-06-16 16:32:18 -07003 *
Elliott Hughesc08f9fb2010-04-16 17:44:12 -07004 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
Elliott Hughesa9f5c162010-06-16 16:32:18 -07007 *
Elliott Hughesc08f9fb2010-04-16 17:44:12 -07008 * http://www.apache.org/licenses/LICENSE-2.0
Elliott Hughesa9f5c162010-06-16 16:32:18 -07009 *
Elliott Hughesc08f9fb2010-04-16 17:44:12 -070010 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Elliott Hughes972d9be2010-09-16 16:38:23 -070017#define LOG_TAG "libcore" // We'll be next to "dalvikvm" in the log; make the distinction clear.
18
Ruben Brunk15c19452013-09-09 17:01:23 -070019#include "cutils/log.h"
Elliott Hughesa9f5c162010-06-16 16:32:18 -070020#include "JniConstants.h"
Elliott Hughesc08f9fb2010-04-16 17:44:12 -070021#include "ScopedLocalFrame.h"
22
Elliott Hughes972d9be2010-09-16 16:38:23 -070023#include <stdlib.h>
24
Elliott Hughesc08f9fb2010-04-16 17:44:12 -070025// DalvikVM calls this on startup, so we can statically register all our native methods.
Elliott Hughesc3cfad92011-07-13 17:50:40 -070026jint JNI_OnLoad(JavaVM* vm, void*) {
Elliott Hughes7cd67602012-05-03 17:21:04 -070027 JNIEnv* env;
28 if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) {
29 ALOGE("JavaVM::GetEnv() failed");
30 abort();
31 }
32
Elliott Hughesc08f9fb2010-04-16 17:44:12 -070033 ScopedLocalFrame localFrame(env);
34
Elliott Hughes7cd67602012-05-03 17:21:04 -070035#define REGISTER(FN) extern void FN(JNIEnv*); FN(env)
Elliott Hughesad859922014-04-29 10:39:00 -070036 REGISTER(register_android_system_OsConstants);
Elliott Hughes7cd67602012-05-03 17:21:04 -070037 REGISTER(register_java_io_Console);
38 REGISTER(register_java_io_File);
39 REGISTER(register_java_io_ObjectStreamClass);
40 REGISTER(register_java_lang_Character);
Elliott Hughes3443a5e2011-07-07 13:47:33 -070041 REGISTER(register_java_lang_Double);
42 REGISTER(register_java_lang_Float);
Elliott Hughes7cd67602012-05-03 17:21:04 -070043 REGISTER(register_java_lang_Math);
44 REGISTER(register_java_lang_ProcessManager);
45 REGISTER(register_java_lang_RealToString);
46 REGISTER(register_java_lang_StrictMath);
47 REGISTER(register_java_lang_StringToReal);
48 REGISTER(register_java_lang_System);
49 REGISTER(register_java_math_NativeBN);
50 REGISTER(register_java_nio_ByteOrder);
51 REGISTER(register_java_nio_charset_Charsets);
52 REGISTER(register_java_text_Bidi);
Narayan Kamath0c1869e2013-11-29 17:59:15 +000053 REGISTER(register_java_util_jar_StrictJarFile);
Elliott Hughes7cd67602012-05-03 17:21:04 -070054 REGISTER(register_java_util_regex_Matcher);
55 REGISTER(register_java_util_regex_Pattern);
56 REGISTER(register_java_util_zip_Adler32);
57 REGISTER(register_java_util_zip_CRC32);
58 REGISTER(register_java_util_zip_Deflater);
59 REGISTER(register_java_util_zip_Inflater);
Elliott Hughes860b3c52013-02-04 19:35:22 -080060 REGISTER(register_libcore_icu_AlphabeticIndex);
Elliott Hughes480537d2013-05-03 13:07:18 -070061 REGISTER(register_libcore_icu_DateIntervalFormat);
Elliott Hughes7cd67602012-05-03 17:21:04 -070062 REGISTER(register_libcore_icu_ICU);
63 REGISTER(register_libcore_icu_NativeBreakIterator);
64 REGISTER(register_libcore_icu_NativeCollation);
65 REGISTER(register_libcore_icu_NativeConverter);
66 REGISTER(register_libcore_icu_NativeDecimalFormat);
67 REGISTER(register_libcore_icu_NativeIDN);
68 REGISTER(register_libcore_icu_NativeNormalizer);
69 REGISTER(register_libcore_icu_NativePluralRules);
Elliott Hughesac7cf582013-02-26 15:31:24 -080070 REGISTER(register_libcore_icu_TimeZoneNames);
Elliott Hughes3aac4dd2013-02-04 15:37:52 -080071 REGISTER(register_libcore_icu_Transliterator);
Elliott Hughes7cd67602012-05-03 17:21:04 -070072 REGISTER(register_libcore_io_AsynchronousCloseMonitor);
73 REGISTER(register_libcore_io_Memory);
Elliott Hughes7cd67602012-05-03 17:21:04 -070074 REGISTER(register_libcore_io_Posix);
Elliott Hughes7cd67602012-05-03 17:21:04 -070075 REGISTER(register_org_apache_harmony_dalvik_NativeTestTarget);
76 REGISTER(register_org_apache_harmony_xml_ExpatParser);
Elliott Hughes09bcea12013-03-01 11:31:03 -080077 REGISTER(register_sun_misc_Unsafe);
Elliott Hughes7cd67602012-05-03 17:21:04 -070078#undef REGISTER
Elliott Hughesc3cfad92011-07-13 17:50:40 -070079
Elliott Hughes7cd67602012-05-03 17:21:04 -070080 return JNI_VERSION_1_6;
Elliott Hughesc08f9fb2010-04-16 17:44:12 -070081}