Commit 8ae44ea7 authored by Adrien Béraud's avatar Adrien Béraud

remove unneeded file

Change-Id: I0c3f35056e43047fa23ca97ef34b6a4db7a4a079
parent cd37f099
#include "logger.h"
JavaVM *gJavaVM;
const char *kringservicePath = "cx/ring/daemon/RingserviceJNI";
void deinitClassHelper(JNIEnv *env, jobject obj) {
RING_INFO("deinitClassHelper");
/* delete cached object instances */
env->DeleteGlobalRef(obj);
RING_INFO("deinitClassHelper: object %x deleted", obj);
}
JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved) {
JNIEnv *env;
jclass clazz;
jint r;
RING_INFO("JNI_OnLoad");
//Assume it is c++
r = vm->GetEnv ((void **) &env, JNI_VERSION_1_6);
if (r != JNI_OK) {
RING_ERR("JNI_OnLoad: failed to get the environment using GetEnv()");
return -1;
}
RING_INFO("JNI_Onload: GetEnv %p", env);
clazz = env->FindClass (kringservicePath);
if (!clazz) {
RING_ERR("JNI_Onload: whoops, %s class not found!", kringservicePath);
}
gJavaVM = vm;
RING_INFO("JNI_Onload: JavaVM %p", gJavaVM);
/* put instances of class object we need into cache */
//initClassHelper(env, kManagerPath, &gManagerObject);
JNINativeMethod methods[] = {
$defs
};
r = env->RegisterNatives (clazz, methods, (int) (sizeof(methods) / sizeof(methods[0])));
return JNI_VERSION_1_6;
}
void JNI_OnUnLoad(JavaVM* vm, void* reserved) {
JNIEnv* env;
jclass clazz;
RING_INFO("JNI_OnUnLoad");
/* get env */
if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) {
RING_ERR("JNI_OnUnLoad: failed to get the environment using GetEnv()");
return;
}
RING_INFO("JNI_OnUnLoad: GetEnv %p", env);
/* Get jclass with env->FindClass */
clazz = env->FindClass(kringservicePath);
if (!clazz) {
RING_ERR("JNI_OnUnLoad: whoops, %s class not found!", kringservicePath);
}
/* remove instances of class object we need into cache */
//deinitClassHelper(env, gManagerObject);
env->UnregisterNatives(clazz);
RING_INFO("JNI_OnUnLoad: Native functions unregistered");
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment