rebranding: rename sflphone to ring
Refs #69972
Refs #70084
Change-Id: I152468471b02ff3b118c083cd285786e9e286fcc
diff --git a/ring-android/jni/ringservice.c.template b/ring-android/jni/ringservice.c.template
new file mode 100644
index 0000000..847a035
--- /dev/null
+++ b/ring-android/jni/ringservice.c.template
@@ -0,0 +1,73 @@
+#include "logger.h"
+
+JavaVM *gJavaVM;
+const char *ksflphoneservicePath = "cx/ring/service/RingserviceJNI";
+
+void deinitClassHelper(JNIEnv *env, jobject obj) {
+ SFL_INFO("deinitClassHelper");
+
+ /* delete cached object instances */
+ env->DeleteGlobalRef(obj);
+ SFL_INFO("deinitClassHelper: object %x deleted", obj);
+}
+
+JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved) {
+ JNIEnv *env;
+ jclass clazz;
+ jint r;
+
+ SFL_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;
+ }
+ SFL_INFO("JNI_Onload: GetEnv %p", env);
+
+ clazz = env->FindClass (ksflphoneservicePath);
+ if (!clazz) {
+ RING_ERR("JNI_Onload: whoops, %s class not found!", ksflphoneservicePath);
+ }
+ gJavaVM = vm;
+ SFL_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;
+
+ SFL_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;
+ }
+ SFL_INFO("JNI_OnUnLoad: GetEnv %p", env);
+
+ /* Get jclass with env->FindClass */
+ clazz = env->FindClass(ksflphoneservicePath);
+ if (!clazz) {
+ RING_ERR("JNI_OnUnLoad: whoops, %s class not found!", ksflphoneservicePath);
+ }
+
+ /* remove instances of class object we need into cache */
+ //deinitClassHelper(env, gManagerObject);
+
+ env->UnregisterNatives(clazz);
+ SFL_INFO("JNI_OnUnLoad: Native functions unregistered");
+}