|
@@ -30,7 +30,6 @@ static void SetParam(JNIEnv *env, jobject thiz, jstring key, jstring value) {
|
|
|
}
|
|
|
}
|
|
|
CommMap::GetInstance()->comm_params[key_] = value_;
|
|
|
- Logger::D(env, ToolKit::ToJsonString(CommMap::GetInstance()->comm_params));
|
|
|
}
|
|
|
|
|
|
static jstring GetParam(JNIEnv *env, jobject thiz, jstring key) {
|
|
@@ -46,75 +45,26 @@ static jstring InvokeJob(JNIEnv *env, jobject thiz, jobject context, jstring key
|
|
|
Json::Value root = ToolKit::ToJsonObject(data_);
|
|
|
root["common"] = CommMap::GetInstance()->comm_params;
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
char *p = AesUtils::Encrypt(ToolKit::ToJsonString(root).c_str(), reinterpret_cast<const uint8_t *>(key_));
|
|
|
jstring result = ToolKit::GetJString(env, p);
|
|
|
env->ReleaseStringUTFChars(key, key_);
|
|
|
env->ReleaseStringUTFChars(data, data_);
|
|
|
-
|
|
|
free(p);
|
|
|
return result;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
static jstring ParseJob(JNIEnv *env, jobject thiz, jobject context, jstring key, jstring data) {
|
|
|
const char *key_ = env->GetStringUTFChars(key, JNI_FALSE);
|
|
|
const char *data_ = env->GetStringUTFChars(data, JNI_FALSE);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
char *raw = AesUtils::Decrypt(data_, reinterpret_cast<const uint8_t *>(key_));
|
|
|
+ Logger::D(env, raw);
|
|
|
jstring result = ToolKit::GetJString(env, raw);
|
|
|
env->ReleaseStringUTFChars(key, key_);
|
|
|
env->ReleaseStringUTFChars(data, data_);
|
|
|
-
|
|
|
free(raw);
|
|
|
return result;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
-static jstring Test(JNIEnv *env, jobject thiz) {
|
|
|
- char *key = AesUtils::GetRawKey();
|
|
|
- jstring result = ToolKit::GetJString(env, key);
|
|
|
- free(key);
|
|
|
- return result;
|
|
|
-}
|
|
|
|
|
|
static JNINativeMethod gMethod[] = {
|
|
|
{"initSdkDrive", "(Landroid/content/Context;)V", (void *) InitSdkDrive},
|
|
@@ -122,7 +72,6 @@ static JNINativeMethod gMethod[] = {
|
|
|
{"getParam", "(Ljava/lang/String;)Ljava/lang/String;", (void *) GetParam},
|
|
|
{"invokeJob", "(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", (void *) InvokeJob},
|
|
|
{"parseJob", "(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", (void *) ParseJob},
|
|
|
- {"test", "()Ljava/lang/String;", (void *) Test},
|
|
|
};
|
|
|
|
|
|
extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
|