Elliott Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 The Android Open Source Project |
Elliott Hughes | a9f5c16 | 2010-06-16 16:32:18 -0700 | [diff] [blame] | 3 | * |
Elliott Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 4 | * 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 Hughes | a9f5c16 | 2010-06-16 16:32:18 -0700 | [diff] [blame] | 7 | * |
Elliott Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
Elliott Hughes | a9f5c16 | 2010-06-16 16:32:18 -0700 | [diff] [blame] | 9 | * |
Elliott Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 10 | * 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 Hughes | 972d9be | 2010-09-16 16:38:23 -0700 | [diff] [blame] | 17 | #define LOG_TAG "libcore" // We'll be next to "dalvikvm" in the log; make the distinction clear. |
| 18 | |
Ruben Brunk | 15c1945 | 2013-09-09 17:01:23 -0700 | [diff] [blame] | 19 | #include "cutils/log.h" |
Elliott Hughes | a9f5c16 | 2010-06-16 16:32:18 -0700 | [diff] [blame] | 20 | #include "JniConstants.h" |
Elliott Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 21 | #include "ScopedLocalFrame.h" |
| 22 | |
Elliott Hughes | 972d9be | 2010-09-16 16:38:23 -0700 | [diff] [blame] | 23 | #include <stdlib.h> |
| 24 | |
Elliott Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 25 | // DalvikVM calls this on startup, so we can statically register all our native methods. |
Elliott Hughes | c3cfad9 | 2011-07-13 17:50:40 -0700 | [diff] [blame] | 26 | jint JNI_OnLoad(JavaVM* vm, void*) { |
Elliott Hughes | 7cd6760 | 2012-05-03 17:21:04 -0700 | [diff] [blame] | 27 | 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 Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 33 | ScopedLocalFrame localFrame(env); |
| 34 | |
Elliott Hughes | 7cd6760 | 2012-05-03 17:21:04 -0700 | [diff] [blame] | 35 | #define REGISTER(FN) extern void FN(JNIEnv*); FN(env) |
Elliott Hughes | ad85992 | 2014-04-29 10:39:00 -0700 | [diff] [blame] | 36 | REGISTER(register_android_system_OsConstants); |
Elliott Hughes | 7cd6760 | 2012-05-03 17:21:04 -0700 | [diff] [blame] | 37 | REGISTER(register_java_io_Console); |
| 38 | REGISTER(register_java_io_File); |
| 39 | REGISTER(register_java_io_ObjectStreamClass); |
| 40 | REGISTER(register_java_lang_Character); |
Elliott Hughes | 3443a5e | 2011-07-07 13:47:33 -0700 | [diff] [blame] | 41 | REGISTER(register_java_lang_Double); |
| 42 | REGISTER(register_java_lang_Float); |
Elliott Hughes | 7cd6760 | 2012-05-03 17:21:04 -0700 | [diff] [blame] | 43 | 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 Kamath | 0c1869e | 2013-11-29 17:59:15 +0000 | [diff] [blame] | 53 | REGISTER(register_java_util_jar_StrictJarFile); |
Elliott Hughes | 7cd6760 | 2012-05-03 17:21:04 -0700 | [diff] [blame] | 54 | 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 Hughes | 860b3c5 | 2013-02-04 19:35:22 -0800 | [diff] [blame] | 60 | REGISTER(register_libcore_icu_AlphabeticIndex); |
Elliott Hughes | 480537d | 2013-05-03 13:07:18 -0700 | [diff] [blame] | 61 | REGISTER(register_libcore_icu_DateIntervalFormat); |
Elliott Hughes | 7cd6760 | 2012-05-03 17:21:04 -0700 | [diff] [blame] | 62 | 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 Hughes | ac7cf58 | 2013-02-26 15:31:24 -0800 | [diff] [blame] | 70 | REGISTER(register_libcore_icu_TimeZoneNames); |
Elliott Hughes | 3aac4dd | 2013-02-04 15:37:52 -0800 | [diff] [blame] | 71 | REGISTER(register_libcore_icu_Transliterator); |
Elliott Hughes | 7cd6760 | 2012-05-03 17:21:04 -0700 | [diff] [blame] | 72 | REGISTER(register_libcore_io_AsynchronousCloseMonitor); |
| 73 | REGISTER(register_libcore_io_Memory); |
Elliott Hughes | 7cd6760 | 2012-05-03 17:21:04 -0700 | [diff] [blame] | 74 | REGISTER(register_libcore_io_Posix); |
Elliott Hughes | 7cd6760 | 2012-05-03 17:21:04 -0700 | [diff] [blame] | 75 | REGISTER(register_org_apache_harmony_dalvik_NativeTestTarget); |
| 76 | REGISTER(register_org_apache_harmony_xml_ExpatParser); |
Elliott Hughes | 09bcea1 | 2013-03-01 11:31:03 -0800 | [diff] [blame] | 77 | REGISTER(register_sun_misc_Unsafe); |
Elliott Hughes | 7cd6760 | 2012-05-03 17:21:04 -0700 | [diff] [blame] | 78 | #undef REGISTER |
Elliott Hughes | c3cfad9 | 2011-07-13 17:50:40 -0700 | [diff] [blame] | 79 | |
Elliott Hughes | 7cd6760 | 2012-05-03 17:21:04 -0700 | [diff] [blame] | 80 | return JNI_VERSION_1_6; |
Elliott Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 81 | } |