|
|
|
|
@ -2824,18 +2824,18 @@ JNIEXPORT void JNICALL Java_com_utun_chat_data_NativeLib_nativeCallContinue(
|
|
|
|
|
bridge_call_id_action((uint64_t)callId, "continue", call_continue_trampoline); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
struct phone_state_request { struct UTUN_INSTANCE* inst; int state; }; |
|
|
|
|
struct phone_state_request { struct UTUN_INSTANCE* inst; int state; unsigned policy; }; |
|
|
|
|
static void phone_state_execute(void* arg) { |
|
|
|
|
struct phone_state_request* req = arg; |
|
|
|
|
call_set_phone_state(req->inst, req->state); u_free(req); |
|
|
|
|
call_set_phone_state(req->inst, req->state, req->policy); u_free(req); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
JNIEXPORT void JNICALL Java_com_utun_chat_data_NativeLib_nativeSetPhoneState( |
|
|
|
|
JNIEnv* env, jobject thiz, jint state) { |
|
|
|
|
JNIEnv* env, jobject thiz, jint state, jint policy) { |
|
|
|
|
(void)env; (void)thiz; |
|
|
|
|
struct UTUN_INSTANCE* inst = instance_lite_get_instance(); |
|
|
|
|
struct UASYNC* ua = instance_lite_get_uasync(); |
|
|
|
|
if (!inst || !ua || !uasync_is_running(ua) || state < 0 || state > 2) { |
|
|
|
|
if (!inst || !ua || !uasync_is_running(ua) || state < 0 || state > 2 || policy < 0 || policy > 31) { |
|
|
|
|
DEBUG_WARN(DEBUG_CATEGORY_CALL, "phone state JNI unavailable state=%d", state); return; |
|
|
|
|
} |
|
|
|
|
struct phone_state_request* req = u_calloc(1, sizeof(*req)); |
|
|
|
|
@ -2843,7 +2843,7 @@ JNIEXPORT void JNICALL Java_com_utun_chat_data_NativeLib_nativeSetPhoneState(
|
|
|
|
|
if (!req || !task) { |
|
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_CALL, "phone state JNI allocation failed"); u_free(req); u_free(task); return; |
|
|
|
|
} |
|
|
|
|
req->inst = inst; req->state = state; |
|
|
|
|
req->inst = inst; req->state = state; req->policy = (unsigned)policy; |
|
|
|
|
task->callback = phone_state_execute; task->arg = req; uasync_post_reserved(ua, task); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|