fix inconsistency when a second call arrives

This commit is contained in:
Simon Morlat 2011-09-22 10:55:47 +02:00
parent 93e8705ed5
commit a1992d7c81
4 changed files with 20 additions and 19 deletions

View file

@ -82,6 +82,7 @@ public class DialerActivity extends SoftVolumeActivity implements LinphoneGuiLis
private PowerManager.WakeLock mWakeLock;
private SharedPreferences mPref;
private LinphoneCall mCurrentCall;
private boolean useIncallActivity;
private boolean useVideoActivity;
@ -394,11 +395,13 @@ public class DialerActivity extends SoftVolumeActivity implements LinphoneGuiLis
}
if (state==LinphoneCall.State.OutgoingInit){
mCurrentCall=call;
enterIncallMode(lc);
if (!LinphoneManager.getInstance().shareMyCamera())
call.enableCamera(false);
LinphoneActivity.instance().startOrientationSensor();
}else if (state==LinphoneCall.State.IncomingReceived){
mCurrentCall=call;
callPending(call);
if (!LinphoneManager.getInstance().shareMyCamera())
call.enableCamera(false);
@ -408,13 +411,19 @@ public class DialerActivity extends SoftVolumeActivity implements LinphoneGuiLis
enterIncallMode(lc);
}
}else if (state==LinphoneCall.State.Error){
if (mCurrentCall==call){
if (mWakeLock.isHeld()) mWakeLock.release();
showToast(R.string.call_error, message);
exitCallMode();
LinphoneActivity.instance().stopOrientationSensor();
mCurrentCall=null;
}
}else if (state==LinphoneCall.State.CallEnd){
if (mCurrentCall==call){
exitCallMode();
LinphoneActivity.instance().stopOrientationSensor();
mCurrentCall=null;
}
}
}

View file

@ -23,8 +23,7 @@ class LinphoneCallImpl implements LinphoneCall {
protected final long nativePtr;
boolean ownPtr = false;
native private void ref(long ownPtr);
native private void unref(long ownPtr);
native private void finalize(long nativePtr);
native private long getCallLog(long nativePtr);
private native boolean isIncoming(long nativePtr);
native private long getRemoteAddress(long nativePtr);
@ -46,10 +45,9 @@ class LinphoneCallImpl implements LinphoneCall {
protected LinphoneCallImpl(long aNativePtr) {
nativePtr = aNativePtr;
ref(nativePtr);
}
protected void finalize() throws Throwable {
unref(nativePtr);
finalize(nativePtr);
}
public LinphoneCallLog getCallLog() {
long lNativePtr = getCallLog(nativePtr);

View file

@ -65,7 +65,7 @@ class LinphoneCoreImpl implements LinphoneCore {
private native int enablePayloadType(long nativePtr, long payloadType, boolean enable);
private native void enableEchoCancellation(long nativePtr,boolean enable);
private native boolean isEchoCancellationEnabled(long nativePtr);
private native long getCurrentCall(long nativePtr) ;
private native Object getCurrentCall(long nativePtr) ;
private native void playDtmf(long nativePtr,char dtmf,int duration);
private native void stopDtmf(long nativePtr);
private native void setVideoWindowId(long nativePtr, Object wid);
@ -285,12 +285,7 @@ class LinphoneCoreImpl implements LinphoneCore {
public synchronized LinphoneCall getCurrentCall() {
isValid();
long lNativePtr = getCurrentCall(nativePtr);
if (lNativePtr!=0) {
return new LinphoneCallImpl(lNativePtr);
} else {
return null;
}
return (LinphoneCall)getCurrentCall(nativePtr);
}
public int getPlayLevel() {
@ -554,5 +549,4 @@ class LinphoneCoreImpl implements LinphoneCore {
// TODO Auto-generated method stub
}
}

@ -1 +1 @@
Subproject commit ef7dc050f57967cb63a0b2e6a8d294ca504816b8
Subproject commit 776d58673a12ceb309ad0e0dc50857b82e3a5d87