JNIEXPORT jint JNICALL Java_com_mediatek_tv_service_TVNative_updateSysStatus_1native (JNIEnv *env, jclass clazz, jstring Statustype) { INT32 i4_ret = 0; const CHAR* s_status_type = NULL; JNI_LOGD((" Enter [%s]@L[%d] \n", __func__, __LINE__)); if (Statustype != NULL) { s_status_type = JNI_GET_STRING_UTF_CHARS(env, Statustype); if (s_status_type != NULL){ i4_ret = a_comp_updateSysStatus(s_status_type); if(COMPR_OK == i4_ret) { JNI_LOGD((" Leave [%s]@L[%d] successfully \n", __func__, __LINE__)); } } JNI_RELEASE_STRING_UTF_CHARS(env,(jstring)Statustype, s_status_type); } JNI_LOGD((" Leave [%s]@L[%d] Fail\n", __func__, __LINE__)); return (jint)i4_ret; }
/* * Class: com_mediatek_tv_service_TVNative * Method: activateComponent_native * Signature: (Ljava/lang/String;)I */ JNIEXPORT jint JNICALL Java_com_mediatek_tv_service_TVNative_activateComponent_1native (JNIEnv *env, jclass clazz, jstring comp_name) { INT32 i4_ret = 0; const CHAR* s_comp_name = NULL; JNI_LOGD((" Enter [%s]@L[%d] \n", __func__, __LINE__)); if (comp_name != NULL) { s_comp_name = JNI_GET_STRING_UTF_CHARS(env, comp_name); if (s_comp_name != NULL){ i4_ret = a_comp_activatecomponent(s_comp_name); if(COMPR_OK == i4_ret) { JNI_LOGD((" Leave [%s]@L[%d] successfully \n", __func__, __LINE__)); } } JNI_RELEASE_STRING_UTF_CHARS(env,(jstring)comp_name, s_comp_name); } JNI_LOGD((" Leave [%s]@L[%d] Fail\n", __func__, __LINE__)); return (jint)i4_ret; }
EXTERN_C_START #ifdef TAG #undef TAG #endif #define TAG "[COMP-JNI] " static void _pf_jni_comp_nfy (const char *msg_type, VOID* pv_tag) { int ret; jstring jstr; jclass jclass_TVCallBack = NULL; jint withoutAttachDetach = 0; JNI_LOGD((" _pf_jni_comp_nfy -[%s]", msg_type)); JNI_LOGD(("g__env=%x g__JavaVM=%x\r\n",g__env,g__JavaVM )); /* * Check if we're already one with the VM. */ withoutAttachDetach = JNI_ALREADY_ONE_WITH_VM(g__env); if (!withoutAttachDetach) { ret = JNI_ATTACH_CURRENT_THREAD(g__env); if (ret < 0) { JNI_LOGD(("[ERROR][%d]{%s}\n", __LINE__, __func__)); } } else { JNI_LOGD(("[Warning][%d]{%s}We are already one with VM\n", __LINE__,__func__)); } jclass_TVCallBack = JNI_GET_CLASS_BY_NAME(g__env,"com/mediatek/tv/service/TVCallBack"); jstr = JNI_NEW_STRING_UTF(g__env, msg_type); if(jstr != NULL) { JNI_CALL_STATIC_METHODV(g__env,jclass_TVCallBack,Void,CMI(TVCallBack_def,TVCallBack_compServiceNotifyInfo),jstr); JNI_DEL_LOCAL_REF(g__env,jstr); } if (!withoutAttachDetach) { JNI_DETACH_CURRENT_THREAD(g__env); } JNI_LOGD((" _pf_jni_compt_nfy -[%s]- end", msg_type)); }
/* * Class: com_mediatek_tv_service_TVNative * Method: getStatus_native * Signature: (I)I */ JNIEXPORT jboolean JNICALL Java_com_mediatek_tv_service_TVNative_IsTTXAvail_1native (JNIEnv *env, jclass clazz) { JNI_LOGD((" Enter [%s]@L[%d] \n", __func__, __LINE__)); BOOL fgIsTTXAvail = FALSE; a_comp_IsTTXAvail(&fgIsTTXAvail); JNI_LOGD((" Leave [%s]@L[%d] Fail\n", __func__, __LINE__)); return (jboolean)fgIsTTXAvail; }
/* * Class: com_mediatek_tv_service_TVNative * Method: sendKeyEvent_native * Signature: (IIZ)I */ JNIEXPORT jint JNICALL Java_com_mediatek_tv_service_TVNative_sendkeyEventtoComp_1native (JNIEnv *env, jclass clazz,jint iKeycode, jint ikeyevent) { INT32 i4_ret = 0; JNI_LOGD((" Enter [%s]@L[%d] \n", __func__, __LINE__)); i4_ret = a_comp_sendkeyEvent(iKeycode,ikeyevent); if(COMPR_OK == i4_ret){ JNI_LOGD((" Enter [%s]@L[%d] Successfully\n", __func__, __LINE__)); } JNI_LOGD((" Enter [%s]@L[%d] Failed Ret = %d\n", __func__, __LINE__, i4_ret)); return (jint)i4_ret; }
/* * Class: com_alibaba_wireless_imservice_IMService * Method: native_IAccountModel_Create * Signature: ()I */ JNIEXPORT jint JNICALL Java_com_alibaba_wireless_imservice_IMService_native_1IAccountModel_1Create (JNIEnv *env, jclass cls) { int iResult = 0; JNI_LOGD("IMService","1IAccountModel_1IAccountModel_1Create"); iResult = (int)IAccountModel_Create(); return iResult; }
/* * Class: com_alibaba_wireless_imservice_IMService * Method: native_IAccountModel_Destroy * Signature: (I)V */ JNIEXPORT void JNICALL Java_com_alibaba_wireless_imservice_IMService_native_1IAccountModel_1Destroy (JNIEnv *env, jclass cls, jint handle) { IAccountModel *pAcntModel = (IAccountModel*)handle; if(0 == pAcntModel) return; JNI_LOGD("IMService","1IAccountModel_1Destroy"); IAccountModel_Destroy(pAcntModel); }
/* * Class: com_alibaba_wireless_imservice_IMService * Method: native_IAIM_Destroy * Signature: (I)V */ JNIEXPORT void JNICALL Java_com_alibaba_wireless_imservice_IMService_native_1IAIM_1Destroy (JNIEnv *env, jclass cls, jint iIM) { IAIM *pIM = (IAIM*)iIM; JNI_LOGD("IMService","1IAIM_1Destroy"); DPRINT("native_1IAIM_1Destroy.................About to Destroy 0x%x\n", pIM); IAIM_Destroy(pIM); DPRINT("native_1IAIM_1Destroy.................Destroy OK 0x%x\n", pIM); }
/* * Class: com_alibaba_wireless_imservice_IMService * Method: native_SetDatabasePath * Signature: ([B)I */ JNIEXPORT void JNICALL Java_com_alibaba_wireless_imservice_IMService_native_1SetDatabasePath (JNIEnv *env, jclass cls, jbyteArray path) { JNI_LOGD("IMService","1SetDatabasePath"); char *pPath = NULL; if(AMNULL == (pPath = GetTmpCszFromByteArray(env, path, 0))) return; IAIM_SetGlobalDatabasePath(pPath); ReleaseTmpCszFromByteArray(env, path, pPath, 0); }
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) { JNIEnv *env; #ifdef TARGET_VMKIT JNI_LOGD("IMService","JNI_OnLoad 1"); LEMUR_JAVA_VM_REGIST(imservice, jvm); #endif JNI_LOGD("IMService","JNI_OnLoad 2"); theVM = jvm; /* cache the JavaVM pointer */ if ((*jvm)->GetEnv(jvm, (void **)&env, JNI_VERSION_1_2)) { JNI_LOGD("IMService","JNI_OnLoad 3"); return JNI_ERR; /* JNI version not supported */ } JNI_LOGD("IMService","JNI_OnLoad 4"); return JNI_VERSION_1_2; }
/* * Class: com_alibaba_wireless_imservice_IMService * Method: native_IAIM_Create * Signature: ()I */ JNIEXPORT jint JNICALL Java_com_alibaba_wireless_imservice_IMService_native_1IAIM_1Create (JNIEnv *env, jclass cls) { IAIM *pIM = AMNULL; JNI_LOGD("IMService","1IAIM_1Create"); if(eAIM_RESULT_OK != IAIM_Create(&pIM)) { DPRINT("native_1IAIM_1Create..................Error!\n"); } DPRINT("native_1IAIM_1Create..........Create IAIM OK! 0x%x\n", pIM); return (jint)pIM; }
/* * Class: com_alibaba_wireless_imservice_IMService * Method: nGetAccountHandles * Signature: (I)[I */ JNIEXPORT jintArray JNICALL Java_com_alibaba_wireless_imservice_IMService_nGetAccountHandles (JNIEnv *env, jclass cls, jint iAcntModleHandle) { IAccountModel * pAcntModel = (IAccountModel*)iAcntModleHandle; jintArray iaryAcntHandles = 0; ListIter *pIter = 0; int *pElem = 0, idx = 0; JNI_LOGD("IMService","nGetAccountHandles"); DPRINT("nGetAccountHandles.......................Begin!"); if(0 == pAcntModel || 0 == pAcntModel->listAcnt.size) { return AMNULL; } DPRINT("nGetAccountHandles.................Acnt num: %d!", pAcntModel->listAcnt.size); if(AMNULL == (iaryAcntHandles = (*env)->NewIntArray(env, pAcntModel->listAcnt.size))) { return AMNULL; } if(AMNULL == (pElem = (*env)->GetPrimitiveArrayCritical(env, iaryAcntHandles, 0))) { return AMNULL; } pIter = create(ListIter, &pAcntModel->listAcnt); head(ListIter, pIter); idx = 0; do { pElem[idx++] = (int)retrieve(ListIter, pIter); DPRINT("nGetAccountHandles...............%s", ((AIMAccount*)pElem[idx-1])->szID?((AIMAccount*)pElem[idx-1])->szID:"0"); } while (!next(ListIter, pIter)); destroy(ListIter, pIter); (*env)->ReleasePrimitiveArrayCritical(env, iaryAcntHandles, pElem, 0); DPRINT("nGetAccountHandles.......................End!"); return iaryAcntHandles; }
void jni_comp_init(JNIEnv *env) { JNI_LOGD((" initComponentService begin\n")); a_comp_set_nfy(_pf_jni_comp_nfy, NULL); }