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 | |
Elliott Hughes | a9f5c16 | 2010-06-16 16:32:18 -0700 | [diff] [blame] | 19 | #include "JniConstants.h" |
Elliott Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 20 | #include "ScopedLocalFrame.h" |
| 21 | |
Elliott Hughes | 972d9be | 2010-09-16 16:38:23 -0700 | [diff] [blame] | 22 | #include <stdlib.h> |
| 23 | |
Elliott Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 24 | extern int register_java_io_Console(JNIEnv* env); |
| 25 | extern int register_java_io_File(JNIEnv* env); |
Brian Carlstrom | ec2f593 | 2010-05-07 16:58:16 -0700 | [diff] [blame] | 26 | extern int register_java_io_ObjectStreamClass(JNIEnv* env); |
Elliott Hughes | dbbdffc | 2010-07-22 18:46:47 -0700 | [diff] [blame] | 27 | extern int register_java_lang_Character(JNIEnv* env); |
Brian Carlstrom | ec2f593 | 2010-05-07 16:58:16 -0700 | [diff] [blame] | 28 | extern int register_java_lang_Math(JNIEnv* env); |
Elliott Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 29 | extern int register_java_lang_ProcessManager(JNIEnv* env); |
Elliott Hughes | 910106e | 2010-08-26 17:20:46 -0700 | [diff] [blame] | 30 | extern int register_java_lang_RealToString(JNIEnv* env); |
Brian Carlstrom | ec2f593 | 2010-05-07 16:58:16 -0700 | [diff] [blame] | 31 | extern int register_java_lang_StrictMath(JNIEnv* env); |
Elliott Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 32 | extern int register_java_lang_System(JNIEnv* env); |
Brian Carlstrom | 12cd1f0 | 2010-06-22 23:43:20 -0700 | [diff] [blame] | 33 | extern int register_java_math_NativeBN(JNIEnv* env); |
Elliott Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 34 | extern int register_java_net_InetAddress(JNIEnv* env); |
| 35 | extern int register_java_net_NetworkInterface(JNIEnv* env); |
Elliott Hughes | 8510524 | 2010-08-16 16:10:53 -0700 | [diff] [blame] | 36 | extern int register_java_nio_ByteOrder(JNIEnv* env); |
Elliott Hughes | 5cd6df2 | 2010-06-30 16:35:27 -0700 | [diff] [blame] | 37 | extern int register_java_nio_charset_Charsets(JNIEnv* env); |
Elliott Hughes | bb1c041 | 2011-02-16 18:18:44 -0800 | [diff] [blame] | 38 | extern int register_java_text_Bidi(JNIEnv* env); |
Elliott Hughes | e377c5a | 2010-06-25 16:30:38 -0700 | [diff] [blame] | 39 | extern int register_java_util_regex_Matcher(JNIEnv* env); |
| 40 | extern int register_java_util_regex_Pattern(JNIEnv* env); |
Elliott Hughes | 74c05e2 | 2010-05-07 14:23:10 -0700 | [diff] [blame] | 41 | extern int register_java_util_zip_Adler32(JNIEnv* env); |
| 42 | extern int register_java_util_zip_CRC32(JNIEnv* env); |
| 43 | extern int register_java_util_zip_Deflater(JNIEnv* env); |
| 44 | extern int register_java_util_zip_Inflater(JNIEnv* env); |
Elliott Hughes | c27a366 | 2010-10-01 18:17:30 -0700 | [diff] [blame] | 45 | extern int register_libcore_icu_ICU(JNIEnv* env); |
| 46 | extern int register_libcore_icu_NativeBreakIterator(JNIEnv* env); |
Elliott Hughes | cfa6ffe | 2010-10-04 13:52:55 -0700 | [diff] [blame] | 47 | extern int register_libcore_icu_NativeCollation(JNIEnv* env); |
Elliott Hughes | c27a366 | 2010-10-01 18:17:30 -0700 | [diff] [blame] | 48 | extern int register_libcore_icu_NativeConverter(JNIEnv* env); |
| 49 | extern int register_libcore_icu_NativeDecimalFormat(JNIEnv* env); |
Elliott Hughes | 21557bb | 2010-06-23 14:59:03 -0700 | [diff] [blame] | 50 | extern int register_libcore_icu_NativeIDN(JNIEnv* env); |
| 51 | extern int register_libcore_icu_NativeNormalizer(JNIEnv* env); |
| 52 | extern int register_libcore_icu_NativePluralRules(JNIEnv* env); |
| 53 | extern int register_libcore_icu_TimeZones(JNIEnv* env); |
Elliott Hughes | 99a89dd | 2010-08-03 17:13:53 -0700 | [diff] [blame] | 54 | extern int register_libcore_io_IoUtils(JNIEnv* env); |
Elliott Hughes | f934c3d | 2011-03-14 18:24:10 -0700 | [diff] [blame] | 55 | extern int register_libcore_io_Memory(JNIEnv* env); |
Elliott Hughes | cdf7a1f | 2011-03-15 16:13:35 -0700 | [diff] [blame] | 56 | extern int register_libcore_io_OsConstants(JNIEnv* env); |
Elliott Hughes | ec617e2 | 2011-03-16 16:42:06 -0700 | [diff] [blame] | 57 | extern int register_libcore_io_Posix(JNIEnv* env); |
Stan Chesnutt | 975dc42 | 2010-12-09 16:52:41 -0800 | [diff] [blame] | 58 | extern int register_libcore_net_RawSocket(JNIEnv* env); |
Jesse Wilson | b8f9285 | 2010-12-22 12:04:40 -0800 | [diff] [blame] | 59 | extern int register_org_apache_harmony_dalvik_NativeTestTarget(JNIEnv* env); |
Elliott Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 60 | extern int register_org_apache_harmony_luni_platform_OSNetworkSystem(JNIEnv* env); |
Brian Carlstrom | ec2f593 | 2010-05-07 16:58:16 -0700 | [diff] [blame] | 61 | extern int register_org_apache_harmony_luni_util_fltparse(JNIEnv* env); |
Elliott Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 62 | extern int register_org_apache_harmony_xml_ExpatParser(JNIEnv* env); |
| 63 | extern int register_org_apache_harmony_xnet_provider_jsse_NativeCrypto(JNIEnv* env); |
Elliott Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 64 | |
| 65 | // DalvikVM calls this on startup, so we can statically register all our native methods. |
| 66 | extern "C" int registerCoreLibrariesJni(JNIEnv* env) { |
| 67 | ScopedLocalFrame localFrame(env); |
| 68 | |
Elliott Hughes | a9f5c16 | 2010-06-16 16:32:18 -0700 | [diff] [blame] | 69 | JniConstants::init(env); |
| 70 | |
Elliott Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 71 | bool result = |
Elliott Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 72 | register_java_io_Console(env) != -1 && |
| 73 | register_java_io_File(env) != -1 && |
Elliott Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 74 | register_java_io_ObjectStreamClass(env) != -1 && |
Elliott Hughes | dbbdffc | 2010-07-22 18:46:47 -0700 | [diff] [blame] | 75 | register_java_lang_Character(env) != -1 && |
Elliott Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 76 | register_java_lang_Math(env) != -1 && |
| 77 | register_java_lang_ProcessManager(env) != -1 && |
Elliott Hughes | 910106e | 2010-08-26 17:20:46 -0700 | [diff] [blame] | 78 | register_java_lang_RealToString(env) != -1 && |
Elliott Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 79 | register_java_lang_StrictMath(env) != -1 && |
| 80 | register_java_lang_System(env) != -1 && |
Brian Carlstrom | 12cd1f0 | 2010-06-22 23:43:20 -0700 | [diff] [blame] | 81 | register_java_math_NativeBN(env) != -1 && |
Elliott Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 82 | register_java_net_InetAddress(env) != -1 && |
| 83 | register_java_net_NetworkInterface(env) != -1 && |
Elliott Hughes | 8510524 | 2010-08-16 16:10:53 -0700 | [diff] [blame] | 84 | register_java_nio_ByteOrder(env) != -1 && |
Elliott Hughes | 5cd6df2 | 2010-06-30 16:35:27 -0700 | [diff] [blame] | 85 | register_java_nio_charset_Charsets(env) != -1 && |
Elliott Hughes | bb1c041 | 2011-02-16 18:18:44 -0800 | [diff] [blame] | 86 | register_java_text_Bidi(env) != -1 && |
Elliott Hughes | e377c5a | 2010-06-25 16:30:38 -0700 | [diff] [blame] | 87 | register_java_util_regex_Matcher(env) != -1 && |
| 88 | register_java_util_regex_Pattern(env) != -1 && |
Elliott Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 89 | register_java_util_zip_Adler32(env) != -1 && |
| 90 | register_java_util_zip_CRC32(env) != -1 && |
| 91 | register_java_util_zip_Deflater(env) != -1 && |
| 92 | register_java_util_zip_Inflater(env) != -1 && |
Elliott Hughes | c27a366 | 2010-10-01 18:17:30 -0700 | [diff] [blame] | 93 | register_libcore_icu_ICU(env) != -1 && |
| 94 | register_libcore_icu_NativeBreakIterator(env) != -1 && |
Elliott Hughes | cfa6ffe | 2010-10-04 13:52:55 -0700 | [diff] [blame] | 95 | register_libcore_icu_NativeCollation(env) != -1 && |
Elliott Hughes | c27a366 | 2010-10-01 18:17:30 -0700 | [diff] [blame] | 96 | register_libcore_icu_NativeConverter(env) != -1 && |
| 97 | register_libcore_icu_NativeDecimalFormat(env) != -1 && |
Elliott Hughes | 21557bb | 2010-06-23 14:59:03 -0700 | [diff] [blame] | 98 | register_libcore_icu_NativeIDN(env) != -1 && |
| 99 | register_libcore_icu_NativeNormalizer(env) != -1 && |
| 100 | register_libcore_icu_NativePluralRules(env) != -1 && |
| 101 | register_libcore_icu_TimeZones(env) != -1 && |
Elliott Hughes | 99a89dd | 2010-08-03 17:13:53 -0700 | [diff] [blame] | 102 | register_libcore_io_IoUtils(env) != -1 && |
Elliott Hughes | f934c3d | 2011-03-14 18:24:10 -0700 | [diff] [blame] | 103 | register_libcore_io_Memory(env) != -1 && |
Elliott Hughes | cdf7a1f | 2011-03-15 16:13:35 -0700 | [diff] [blame] | 104 | register_libcore_io_OsConstants(env) != -1 && |
Elliott Hughes | ec617e2 | 2011-03-16 16:42:06 -0700 | [diff] [blame] | 105 | register_libcore_io_Posix(env) != -1 && |
Stan Chesnutt | 975dc42 | 2010-12-09 16:52:41 -0800 | [diff] [blame] | 106 | register_libcore_net_RawSocket(env) != -1 && |
Elliott Hughes | 296b43d | 2011-02-10 15:54:17 -0800 | [diff] [blame] | 107 | register_org_apache_harmony_dalvik_NativeTestTarget(env) != -1 && |
Elliott Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 108 | register_org_apache_harmony_luni_platform_OSNetworkSystem(env) != -1 && |
Elliott Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 109 | register_org_apache_harmony_luni_util_fltparse(env) != -1 && |
Elliott Hughes | 296b43d | 2011-02-10 15:54:17 -0800 | [diff] [blame] | 110 | register_org_apache_harmony_xml_ExpatParser(env) != -1 && |
Elliott Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 111 | register_org_apache_harmony_xnet_provider_jsse_NativeCrypto(env) != -1 && |
Elliott Hughes | 296b43d | 2011-02-10 15:54:17 -0800 | [diff] [blame] | 112 | true; |
Elliott Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 113 | |
Elliott Hughes | 972d9be | 2010-09-16 16:38:23 -0700 | [diff] [blame] | 114 | if (!result) { |
| 115 | LOGE("Failed to initialize the core libraries; aborting..."); |
| 116 | abort(); |
| 117 | } |
| 118 | return 0; |
Elliott Hughes | c08f9fb | 2010-04-16 17:44:12 -0700 | [diff] [blame] | 119 | } |