mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
Fixed issue with android platform helper and DNS servers + added logs into android platform helper
This commit is contained in:
parent
cb28cd4ccd
commit
2f97587d53
2 changed files with 17 additions and 5 deletions
|
|
@ -2176,7 +2176,7 @@ static void _linphone_core_init_account_creator_service(LinphoneCore *lc) {
|
|||
linphone_core_set_account_creator_service(lc, service);
|
||||
}
|
||||
|
||||
static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig *config, void * userdata){
|
||||
static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig *config, void * userdata, void *system_context){
|
||||
const char *remote_provisioning_uri = NULL;
|
||||
LinphoneFactory *lfactory = linphone_factory_get();
|
||||
LinphoneCoreCbs *internal_cbs = _linphone_core_cbs_new();
|
||||
|
|
@ -2192,7 +2192,13 @@ static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig
|
|||
lc->config=lp_config_ref(config);
|
||||
lc->data=userdata;
|
||||
lc->ringstream_autorelease=TRUE;
|
||||
lc->platform_helper = new LinphonePrivate::StubbedPlatformHelpers(lc);
|
||||
|
||||
#ifdef __ANDROID__
|
||||
if (system_context)
|
||||
lc->platform_helper = LinphonePrivate::createAndroidPlatformHelpers(lc, system_context);
|
||||
#endif
|
||||
if (lc->platform_helper == NULL)
|
||||
lc->platform_helper = new LinphonePrivate::StubbedPlatformHelpers(lc);
|
||||
|
||||
linphone_task_list_init(&lc->hooks);
|
||||
|
||||
|
|
@ -2287,8 +2293,7 @@ static void _linphone_core_set_system_context(LinphoneCore *lc, void *system_con
|
|||
|
||||
LinphoneCore *_linphone_core_new_with_config(LinphoneCoreCbs *cbs, struct _LpConfig *config, void *userdata, void *system_context) {
|
||||
LinphoneCore *core = belle_sip_object_new(LinphoneCore);
|
||||
linphone_core_init(core, cbs, config, userdata);
|
||||
_linphone_core_set_system_context(core, system_context);
|
||||
linphone_core_init(core, cbs, config, userdata, system_context);
|
||||
return core;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -116,10 +116,14 @@ AndroidPlatformHelpers::~AndroidPlatformHelpers () {
|
|||
env->DeleteGlobalRef(mJavaHelper);
|
||||
mJavaHelper = nullptr;
|
||||
}
|
||||
lInfo() << "AndroidPlatformHelpers has been destroyed.";
|
||||
}
|
||||
|
||||
void AndroidPlatformHelpers::setDnsServers () {
|
||||
if (!mJavaHelper) return;
|
||||
if (!mJavaHelper) {
|
||||
lError() << "AndroidPlatformHelpers' mJavaHelper is null.";
|
||||
return;
|
||||
}
|
||||
JNIEnv *env = ms_get_jni_env();
|
||||
if (env && mJavaHelper) {
|
||||
jobjectArray jservers = (jobjectArray)env->CallObjectMethod(mJavaHelper, mGetDnsServersId);
|
||||
|
|
@ -136,10 +140,13 @@ void AndroidPlatformHelpers::setDnsServers () {
|
|||
jstring jserver = (jstring)env->GetObjectArrayElement(jservers, i);
|
||||
const char *str = env->GetStringUTFChars(jserver, nullptr);
|
||||
if (str) {
|
||||
lInfo() << "AndroidPlatformHelpers found DNS server " << str;
|
||||
l = bctbx_list_append(l, ms_strdup(str));
|
||||
env->ReleaseStringUTFChars(jserver, str);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
lError() << "AndroidPlatformHelpers::setDnsServers() failed to get DNS servers list";
|
||||
}
|
||||
linphone_core_set_dns_servers(mCore, l);
|
||||
bctbx_list_free_with_data(l, ms_free);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue