Sha256: 7962ba3ec2474c435c84103bacea5ae92ab518f6cb02ecff269bd60457d7fbe8

Contents?: true

Size: 1.59 KB

Versions: 11

Compression:

Stored size: 1.59 KB

Contents

#include "rhodes.h"
#include "DeviceSecurity.h"

#include "logging/RhoLog.h"
#undef DEFAULT_LOGCATEGORY
#define DEFAULT_LOGCATEGORY "DeviceSecurity_impl"

#define DEVICESECURITY_FACTORY_CLASS "com.rho.devicesecurity.DeviceSecurityFactory"

extern "C" void Init_DeviceSecurity_API(void);

extern "C" void Init_DeviceSecurity(void)
{
    RAWTRACE(__FUNCTION__);

    JNIEnv *env = jnienv();
    if(env)
    {
        jclass cls = rho_find_class(env, DEVICESECURITY_FACTORY_CLASS);
        if(!cls)
        {
            RAWLOG_ERROR1("Failed to find java class: %s", DEVICESECURITY_FACTORY_CLASS);
            return;
        }
        jmethodID midFactory = env->GetMethodID(cls, "<init>", "()V");
        if(!midFactory)
        {
            RAWLOG_ERROR1("Failed to get constructor for java class %s", DEVICESECURITY_FACTORY_CLASS);
            return;
        }
        jobject jFactory = env->NewObject(cls, midFactory);
        if(env->IsSameObject(jFactory, NULL))
        {
            RAWLOG_ERROR1("Failed to create %s instance", DEVICESECURITY_FACTORY_CLASS);
            return;
        }
        
        RAWTRACE("Initializing Java factory");

        rho::CDeviceSecurityBase::setJavaFactory(env, jFactory);

        RAWTRACE("Deleting JNI reference");

        env->DeleteLocalRef(jFactory);

        RAWTRACE("Initializing API");

        Init_DeviceSecurity_API();

        RAWTRACE("Init_DeviceSecurity succeeded");
    }
    else
    {
        RAWLOG_ERROR("Failed to initialize DeviceSecurity API: jnienv() is failed");
    }

}

extern "C" void Init_DeviceSecurity_extension() {
    Init_DeviceSecurity();
}

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rhodes-7.6.0 lib/commonAPI/devicesecurity/ext/platform/android/jni/DeviceSecurity_impl.cpp
rhodes-7.5.1 lib/commonAPI/devicesecurity/ext/platform/android/jni/DeviceSecurity_impl.cpp
rhodes-7.4.1 lib/commonAPI/devicesecurity/ext/platform/android/jni/DeviceSecurity_impl.cpp
rhodes-7.1.17 lib/commonAPI/devicesecurity/ext/platform/android/jni/DeviceSecurity_impl.cpp
rhodes-6.2.0 lib/commonAPI/devicesecurity/ext/platform/android/jni/DeviceSecurity_impl.cpp
rhodes-6.0.11 lib/commonAPI/devicesecurity/ext/platform/android/jni/DeviceSecurity_impl.cpp
rhodes-5.5.18 lib/commonAPI/devicesecurity/ext/platform/android/jni/DeviceSecurity_impl.cpp
rhodes-5.5.17 lib/commonAPI/devicesecurity/ext/platform/android/jni/DeviceSecurity_impl.cpp
rhodes-5.5.15 lib/commonAPI/devicesecurity/ext/platform/android/jni/DeviceSecurity_impl.cpp
rhodes-5.5.0.22 lib/commonAPI/devicesecurity/ext/platform/android/jni/DeviceSecurity_impl.cpp
rhodes-5.5.2 lib/commonAPI/devicesecurity/ext/platform/android/jni/DeviceSecurity_impl.cpp