aboutsummaryrefslogtreecommitdiffstats
path: root/sample-android-qt/src/main/cpp/jni_onload.cpp
blob: 60557aff9df73bd20436ddf43ae5510ba503c1ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
* <pre>
* Author: landerlyoung@gmail.com
* Date:   2019-09-26
* Time:   15:32
* Life with Passion, Code with Creativity.
* </pre>
*/

#include <jni.h>
#include <cassert>
#include <android/log.h>
#include "ComputeIntensiveClass.h"
#include "NestedNativeClass.h"
#include "NativeDrawable.h"
#include "proxy/GenericProxy.h"
#include "proxy/jnihelper.h"
#include "proxy/jenny_fusion_proxies.h"

#include "proxy/java_okhttp_BuilderProxy.h"
#include "proxy/java_okhttp_OkHttpClientProxy.h"
#include "proxy/java_okhttp_RequestProxy.h"
#include "proxy/java_okhttp_CallProxy.h"
#include "proxy/java_okhttp_ResponseProxy.h"
#include "proxy/java_okhttp_ResponseBodyProxy.h"
#include "glue/header/NativeDrawable.h"
#include "glue/header/ComputeIntensiveClass.h"


JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved) {
    JNIEnv* env;
    if (vm->GetEnv(reinterpret_cast<void**>(&env),
                   JNI_VERSION_1_6) != JNI_OK) {
        return -1;
    }
    ::jenny::Env::attachJvm(vm);

    auto ok = ComputeIntensiveClass::registerNativeFunctions(env) &&
        NativeDrawable::registerNativeFunctions(env) &&
        // test generic init success
        jenny::initAllProxies(env);

    assert(ok);

    return JNI_VERSION_1_6;
}

void jennySampleErrorLog(JNIEnv *env, const char *error) {
    __android_log_write(ANDROID_LOG_ERROR, "jenny", error);
    env->ExceptionDescribe();
}