• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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)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     return android::CreateClassLoaderNamespace(env, targetSdkVersion,
32                                                classLoader, isShared == JNI_TRUE,
33                                                librarySearchPath, libraryPermittedPath);
34 }
35 
36 static const JNINativeMethod g_methods[] = {
37     { "createClassloaderNamespace",
38       "(Ljava/lang/ClassLoader;ILjava/lang/String;Ljava/lang/String;Z)Ljava/lang/String;",
39       reinterpret_cast<void*>(createClassloaderNamespace_native) },
40 };
41 
42 static const char* const kPathClassLoaderFactoryPathName = "com/android/internal/os/PathClassLoaderFactory";
43 
44 namespace android
45 {
46 
register_com_android_internal_os_PathClassLoaderFactory(JNIEnv * env)47 int register_com_android_internal_os_PathClassLoaderFactory(JNIEnv* env) {
48     return RegisterMethodsOrDie(env, kPathClassLoaderFactoryPathName, g_methods, NELEM(g_methods));
49 }
50 
51 } // namespace android
52