mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-24 14:48:07 +00:00
repair android build, serialize proxy configs.
This commit is contained in:
parent
39f9ec6a48
commit
643d39637b
5 changed files with 36 additions and 11 deletions
|
|
@ -224,6 +224,8 @@ public:
|
|||
|
||||
/*void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf, String url)*/
|
||||
newSubscriptionRequestId = env->GetMethodID(listenerClass,"newSubscriptionRequest","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneFriend;Ljava/lang/String;)V");
|
||||
|
||||
authInfoRequestedId = env->GetMethodID(listenerClass,"authInfoRequested","(Lorg/linphone/core/LinphoneCore;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
|
||||
|
||||
/*void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf);*/
|
||||
notifyPresenceReceivedId = env->GetMethodID(listenerClass,"notifyPresenceReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneFriend;)V");
|
||||
|
|
@ -245,7 +247,7 @@ public:
|
|||
|
||||
|
||||
proxyClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneProxyConfigImpl"));
|
||||
proxyCtrId = env->GetMethodID(proxyClass,"<init>", "(J)V");
|
||||
proxyCtrId = env->GetMethodID(proxyClass,"<init>", "(Lorg/linphone/core/LinphoneCoreImpl;J)V");
|
||||
|
||||
callClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCallImpl"));
|
||||
callCtrId = env->GetMethodID(callClass,"<init>", "(J)V");
|
||||
|
|
@ -325,6 +327,7 @@ public:
|
|||
jmethodID transferStateId;
|
||||
jmethodID infoReceivedId;
|
||||
jmethodID subscriptionStateId;
|
||||
jmethodID authInfoRequestedId;
|
||||
jmethodID publishStateId;
|
||||
jmethodID notifyRecvId;
|
||||
|
||||
|
|
@ -413,7 +416,19 @@ public:
|
|||
|
||||
}
|
||||
static void authInfoRequested(LinphoneCore *lc, const char *realm, const char *username, const char *domain) {
|
||||
|
||||
JNIEnv *env = 0;
|
||||
jint result = jvm->AttachCurrentThread(&env,NULL);
|
||||
if (result != 0) {
|
||||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
|
||||
env->CallVoidMethod(lcData->listener,
|
||||
lcData->authInfoRequestedId,
|
||||
lcData->core,
|
||||
realm ? env->NewStringUTF(realm):NULL,
|
||||
username ? env->NewStringUTF(username) : NULL,
|
||||
domain ? env->NewStringUTF(domain) : NULL);
|
||||
}
|
||||
static void globalStateChange(LinphoneCore *lc, LinphoneGlobalState gstate,const char* message) {
|
||||
JNIEnv *env = 0;
|
||||
|
|
@ -440,7 +455,7 @@ public:
|
|||
env->CallVoidMethod(lcData->listener
|
||||
,lcData->registrationStateId
|
||||
,lcData->core
|
||||
,env->NewObject(lcData->proxyClass,lcData->proxyCtrId,(jlong)proxy)
|
||||
,env->NewObject(lcData->proxyClass,lcData->proxyCtrId,lcData->core,(jlong)proxy)
|
||||
,env->CallStaticObjectMethod(lcData->registrationStateClass,lcData->registrationStateFromIntId,(jint)state),
|
||||
message ? env->NewStringUTF(message) : NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import org.linphone.core.LinphoneCore.RemoteProvisioningState;
|
|||
public interface LinphoneCoreListener {
|
||||
/**< Ask the application some authentication information
|
||||
* @return */
|
||||
void authInfoRequested(LinphoneCore lc,String realm,String username);
|
||||
void authInfoRequested(LinphoneCore lc, String realm, String username, String Domain);
|
||||
|
||||
/** General State notification
|
||||
* @param state LinphoneCore.State
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
isValid();
|
||||
long lNativePtr = getDefaultProxyConfig(nativePtr);
|
||||
if (lNativePtr!=0) {
|
||||
return new LinphoneProxyConfigImpl(lNativePtr);
|
||||
return new LinphoneProxyConfigImpl(this,lNativePtr);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -218,10 +218,12 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
if (addProxyConfig(proxyCfg,nativePtr,((LinphoneProxyConfigImpl)proxyCfg).nativePtr) !=0) {
|
||||
throw new LinphoneCoreException("bad proxy config");
|
||||
}
|
||||
((LinphoneProxyConfigImpl)proxyCfg).mCore=this;
|
||||
}
|
||||
public synchronized void removeProxyConfig(LinphoneProxyConfig proxyCfg) {
|
||||
isValid();
|
||||
removeProxyConfig(nativePtr, ((LinphoneProxyConfigImpl)proxyCfg).nativePtr);
|
||||
((LinphoneProxyConfigImpl)proxyCfg).mCore=null;
|
||||
}
|
||||
public synchronized void clearAuthInfos() {
|
||||
isValid();
|
||||
|
|
@ -517,7 +519,7 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
LinphoneProxyConfig[] proxies = new LinphoneProxyConfig[typesPtr.length];
|
||||
|
||||
for (int i=0; i < proxies.length; i++) {
|
||||
proxies[i] = new LinphoneProxyConfigImpl(typesPtr[i]);
|
||||
proxies[i] = new LinphoneProxyConfigImpl(this,typesPtr[i]);
|
||||
}
|
||||
|
||||
return proxies;
|
||||
|
|
@ -1137,7 +1139,7 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
}
|
||||
@Override
|
||||
public synchronized LinphoneProxyConfig createProxyConfig() {
|
||||
return new LinphoneProxyConfigImpl(createProxyConfig(nativePtr));
|
||||
return new LinphoneProxyConfigImpl(this,createProxyConfig(nativePtr));
|
||||
}
|
||||
@Override
|
||||
public synchronized void setCallErrorTone(Reason reason, String path) {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import org.linphone.core.LinphoneCore.RegistrationState;
|
|||
class LinphoneProxyConfigImpl implements LinphoneProxyConfig {
|
||||
|
||||
protected final long nativePtr;
|
||||
protected LinphoneCoreImpl mCore;
|
||||
|
||||
private native int getState(long nativePtr);
|
||||
private native void setExpires(long nativePtr, int delay);
|
||||
|
|
@ -41,9 +42,10 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig {
|
|||
enableRegister(enableRegister);
|
||||
ownPtr=true;
|
||||
}
|
||||
protected LinphoneProxyConfigImpl(long aNativePtr) {
|
||||
protected LinphoneProxyConfigImpl(LinphoneCoreImpl core, long aNativePtr) {
|
||||
nativePtr = aNativePtr;
|
||||
ownPtr=false;
|
||||
mCore=core;
|
||||
}
|
||||
protected void finalize() throws Throwable {
|
||||
//Log.e(LinphoneService.TAG,"fixme, should release underlying proxy config");
|
||||
|
|
@ -90,11 +92,17 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig {
|
|||
}
|
||||
|
||||
public void done() {
|
||||
done(nativePtr);
|
||||
Object mutex=mCore!=null ? mCore : this;
|
||||
synchronized(mutex){
|
||||
done(nativePtr);
|
||||
}
|
||||
}
|
||||
|
||||
public LinphoneProxyConfig edit() {
|
||||
edit(nativePtr);
|
||||
Object mutex=mCore!=null ? mCore : this;
|
||||
synchronized(mutex){
|
||||
edit(nativePtr);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 6aa6983512e5fa61ccdaaedc79f109993c5de04a
|
||||
Subproject commit b76e3dde111af0d24be4ac5f1d4f633361e654c1
|
||||
Loading…
Add table
Reference in a new issue