1 /*
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
createClassloaderNamespace_native(JNIEnv * env,jobject clazz,jobject classLoader,jint targetSdkVersion,jstring librarySearchPath,jstring libraryPermittedPath,jboolean isShared,jboolean isForVendor)24 static jstring createClassloaderNamespace_native(JNIEnv* env,
25 jobject clazz,
26 jobject classLoader,
27 jint targetSdkVersion,
28 jstring librarySearchPath,
29 jstring libraryPermittedPath,
30 jboolean isShared,
31 jboolean isForVendor) {
32 return android::CreateClassLoaderNamespace(env, targetSdkVersion,
33 classLoader, isShared == JNI_TRUE,
34 isForVendor == JNI_TRUE,
35 librarySearchPath, libraryPermittedPath);
36 }
37
38 static const JNINativeMethod g_methods[] = {
39 { "createClassloaderNamespace",
40 "(Ljava/lang/ClassLoader;ILjava/lang/String;Ljava/lang/String;ZZ)Ljava/lang/String;",
41 reinterpret_cast<void*>(createClassloaderNamespace_native) },
42 };
43
44 static const char* const kClassLoaderFactoryPathName = "com/android/internal/os/ClassLoaderFactory";
45
46 namespace android
47 {
48
register_com_android_internal_os_ClassLoaderFactory(JNIEnv * env)49 int register_com_android_internal_os_ClassLoaderFactory(JNIEnv* env) {
50 return RegisterMethodsOrDie(env, kClassLoaderFactoryPathName, g_methods, NELEM(g_methods));
51 }
52
53 } // namespace android
54