Register.cpp revision 61a124188040f84b5c237c338ec0ce7d3da75ed0
1/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
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
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
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
17#define LOG_TAG "libcore" // We'll be next to "dalvikvm" in the log; make the distinction clear.
18
19#include "JniConstants.h"
20#include "ScopedLocalFrame.h"
21
22#include <stdlib.h>
23
24// DalvikVM calls this on startup, so we can statically register all our native methods.
25int JNI_OnLoad(JavaVM* vm, void*) {
26    JNIEnv* env;
27    if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) {
28        ALOGE("JavaVM::GetEnv() failed");
29        abort();
30    }
31
32    ScopedLocalFrame localFrame(env);
33
34#define REGISTER(FN) extern void FN(JNIEnv*); FN(env)
35    REGISTER(register_java_io_Console);
36    REGISTER(register_java_io_File);
37    REGISTER(register_java_io_ObjectStreamClass);
38    REGISTER(register_java_lang_Character);
39    REGISTER(register_java_lang_Double);
40    REGISTER(register_java_lang_Float);
41    REGISTER(register_java_lang_Math);
42    REGISTER(register_java_lang_ProcessManager);
43    REGISTER(register_java_lang_RealToString);
44    REGISTER(register_java_lang_StrictMath);
45    REGISTER(register_java_lang_StringToReal);
46    REGISTER(register_java_lang_System);
47    REGISTER(register_java_math_NativeBN);
48    REGISTER(register_java_nio_ByteOrder);
49    REGISTER(register_java_nio_charset_Charsets);
50    REGISTER(register_java_text_Bidi);
51    REGISTER(register_java_util_regex_Matcher);
52    REGISTER(register_java_util_regex_Pattern);
53    REGISTER(register_java_util_zip_Adler32);
54    REGISTER(register_java_util_zip_CRC32);
55    REGISTER(register_java_util_zip_Deflater);
56    REGISTER(register_java_util_zip_Inflater);
57    REGISTER(register_libcore_icu_AlphabeticIndex);
58    REGISTER(register_libcore_icu_DateIntervalFormat);
59    REGISTER(register_libcore_icu_ICU);
60    REGISTER(register_libcore_icu_NativeBreakIterator);
61    REGISTER(register_libcore_icu_NativeCollation);
62    REGISTER(register_libcore_icu_NativeConverter);
63    REGISTER(register_libcore_icu_NativeDecimalFormat);
64    REGISTER(register_libcore_icu_NativeIDN);
65    REGISTER(register_libcore_icu_NativeNormalizer);
66    REGISTER(register_libcore_icu_NativePluralRules);
67    REGISTER(register_libcore_icu_TimeZoneNames);
68    REGISTER(register_libcore_icu_Transliterator);
69    REGISTER(register_libcore_io_AsynchronousCloseMonitor);
70    REGISTER(register_libcore_io_Memory);
71    REGISTER(register_libcore_io_OsConstants);
72    REGISTER(register_libcore_io_Posix);
73    REGISTER(register_libcore_net_RawSocket);
74    REGISTER(register_org_apache_harmony_dalvik_NativeTestTarget);
75    REGISTER(register_org_apache_harmony_xml_ExpatParser);
76    REGISTER(register_sun_misc_Unsafe);
77#undef REGISTER
78    return JNI_VERSION_1_6;
79}
80