blob: f8d41e4bef5412b1affb08dc8c3a2b795c9ea5de [file] [log] [blame]
Dimitry Ivanovea902812016-02-23 14:25:50 -08001/*
2 * Copyright (C) 2016 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#include <string>
18
19#include "nativeloader/native_loader.h"
20
21#include "core_jni_helpers.h"
22
23
24static jstring createClassloaderNamespace_native(JNIEnv* env,
25 jobject clazz,
26 jobject classLoader,
27 jint targetSdkVersion,
28 jstring librarySearchPath,
29 jstring libraryPermittedPath,
Jiyong Parkfcad6962017-08-22 10:24:28 +090030 jboolean isShared,
Kiyoung Kimcfc8da12019-02-20 18:07:41 +090031 jstring dexPath) {
Dimitry Ivanovea902812016-02-23 14:25:50 -080032 return android::CreateClassLoaderNamespace(env, targetSdkVersion,
33 classLoader, isShared == JNI_TRUE,
Kiyoung Kimcfc8da12019-02-20 18:07:41 +090034 dexPath,
Dimitry Ivanovea902812016-02-23 14:25:50 -080035 librarySearchPath, libraryPermittedPath);
36}
37
38static const JNINativeMethod g_methods[] = {
39 { "createClassloaderNamespace",
Kiyoung Kimcfc8da12019-02-20 18:07:41 +090040 "(Ljava/lang/ClassLoader;ILjava/lang/String;Ljava/lang/String;ZLjava/lang/String;)Ljava/lang/String;",
Dimitry Ivanovea902812016-02-23 14:25:50 -080041 reinterpret_cast<void*>(createClassloaderNamespace_native) },
42};
43
Narayan Kamathf9419f02017-06-15 11:35:38 +010044static const char* const kClassLoaderFactoryPathName = "com/android/internal/os/ClassLoaderFactory";
Dimitry Ivanovea902812016-02-23 14:25:50 -080045
46namespace android
47{
48
Narayan Kamathf9419f02017-06-15 11:35:38 +010049int register_com_android_internal_os_ClassLoaderFactory(JNIEnv* env) {
50 return RegisterMethodsOrDie(env, kClassLoaderFactoryPathName, g_methods, NELEM(g_methods));
Dimitry Ivanovea902812016-02-23 14:25:50 -080051}
52
53} // namespace android