diff --git a/res/values/strings.xml b/res/values/strings.xml
index d98f80f9a..f923f6094 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -8,6 +8,7 @@
Error adding new call
Transfer started
+ Warning: service is not ready
conf
active
diff --git a/src/org/linphone/IncomingCallActivity.java b/src/org/linphone/IncomingCallActivity.java
index d60fc20df..5e3bccc3f 100644
--- a/src/org/linphone/IncomingCallActivity.java
+++ b/src/org/linphone/IncomingCallActivity.java
@@ -46,7 +46,7 @@ public class IncomingCallActivity extends Activity implements OnClickListener {
private void findIncomingCall(Intent intent) {
String stringUri = intent.getStringExtra("stringUri");
- mCall = LinphoneManager.getInstance().retrieveIncomingCall(stringUri);
+ mCall = LinphoneManager.getLc().findCallFromUri(stringUri);
if (mCall == null) {
Log.e("Couldn't find incoming call from ", stringUri);
Toast.makeText(this, "Error", Toast.LENGTH_SHORT);
diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java
index 38131d12a..7279897fb 100644
--- a/src/org/linphone/LinphoneManager.java
+++ b/src/org/linphone/LinphoneManager.java
@@ -959,7 +959,6 @@ public final class LinphoneManager implements LinphoneCoreListener {
private static class ListenerDispatcher implements LinphoneServiceListener {
private LinphoneServiceListener serviceListener;
- private List incomingCalls = new ArrayList();
List simpleListeners;
public ListenerDispatcher(List simpleListeners) {
this.simpleListeners = simpleListeners;
@@ -987,20 +986,8 @@ public final class LinphoneManager implements LinphoneCoreListener {
if (serviceListener != null) serviceListener.onCallEncryptionChanged(call, encrypted, authenticationToken);
}
- public LinphoneCall retrieveIncomingCall(String stringUri) {
- for (LinphoneCall call : incomingCalls) {
- if (stringUri.equals(call.getRemoteAddress().asStringUriOnly())) {
- return call;
- }
- }
- return null;
- }
-
public void onCallStateChanged(LinphoneCall call, State state,
String message) {
- if (State.IncomingReceived.equals(state)) {
- incomingCalls.add(call);
- }
if (serviceListener != null) serviceListener.onCallStateChanged(call, state, message);
for (LinphoneOnCallStateChangedListener l : getSimpleListeners(LinphoneOnCallStateChangedListener.class)) {
l.onCallStateChanged(call, state, message);
@@ -1041,7 +1028,4 @@ public final class LinphoneManager implements LinphoneCoreListener {
return instance != null;
}
- public LinphoneCall retrieveIncomingCall(String stringUri) {
- return listenerDispatcher.retrieveIncomingCall(stringUri);
- }
}
diff --git a/src/org/linphone/LinphoneService.java b/src/org/linphone/LinphoneService.java
index 19a189a77..43e48678d 100644
--- a/src/org/linphone/LinphoneService.java
+++ b/src/org/linphone/LinphoneService.java
@@ -68,7 +68,7 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
private Handler mHandler = new Handler();
private static LinphoneService instance;
- static boolean isReady() { return (instance!=null); }
+ public static boolean isReady() { return (instance!=null); }
/**
* @throws RuntimeException service not instantiated
diff --git a/src/org/linphone/core/LinphoneCoreImpl.java b/src/org/linphone/core/LinphoneCoreImpl.java
index a5b4b718c..8a40cdb9f 100644
--- a/src/org/linphone/core/LinphoneCoreImpl.java
+++ b/src/org/linphone/core/LinphoneCoreImpl.java
@@ -559,4 +559,11 @@ class LinphoneCoreImpl implements LinphoneCore {
public synchronized void transferCallToAnother(LinphoneCall call, LinphoneCall dest) {
transferCallToAnother(nativePtr, getCallPtr(call), getCallPtr(dest));
}
+
+ private native long findCallFromUri(long nativePtr, String uri);
+ @Override
+ public synchronized LinphoneCall findCallFromUri(String uri) {
+ long callPtr = findCallFromUri(nativePtr, uri);
+ return callPtr != 0 ? new LinphoneCallImpl(callPtr) : null;
+ }
}
diff --git a/src/org/linphone/ui/Digit.java b/src/org/linphone/ui/Digit.java
index 902657045..e3de49152 100644
--- a/src/org/linphone/ui/Digit.java
+++ b/src/org/linphone/ui/Digit.java
@@ -19,13 +19,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
package org.linphone.ui;
import org.linphone.LinphoneManager;
+import org.linphone.LinphoneService;
+import org.linphone.R;
import org.linphone.core.LinphoneCore;
+import org.linphone.core.Log;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
+import android.widget.Toast;
public class Digit extends Button implements AddressAware {
@@ -77,7 +81,16 @@ public class Digit extends Button implements AddressAware {
mKeyCode = Digit.this.getText().subSequence(0, 1);
}
+ private boolean linphoneServiceReady() {
+ if (!LinphoneService.isReady()) {
+ Log.w("Service is not ready while pressing digit");
+ Toast.makeText(getContext(), getContext().getString(R.string.skipable_error_service_not_ready), Toast.LENGTH_SHORT).show();
+ return false;
+ }
+ return true;
+ }
public void onClick(View v) {
+ if (!linphoneServiceReady()) return;
LinphoneCore lc = LinphoneManager.getLc();
lc.stopDtmf();
mIsDtmfStarted =false;
@@ -96,6 +109,7 @@ public class Digit extends Button implements AddressAware {
}
public boolean onTouch(View v, MotionEvent event) {
+ if (!linphoneServiceReady()) return true;
LinphoneCore lc = LinphoneManager.getLc();
if (event.getAction() == MotionEvent.ACTION_DOWN && mIsDtmfStarted ==false) {
LinphoneManager.getInstance().playDtmf(getContext().getContentResolver(), mKeyCode.charAt(0));
@@ -109,6 +123,7 @@ public class Digit extends Button implements AddressAware {
}
public boolean onLongClick(View v) {
+ if (!linphoneServiceReady()) return true;
// Called if "0+" dtmf
LinphoneCore lc = LinphoneManager.getLc();
lc.stopDtmf();
diff --git a/submodules/linphone b/submodules/linphone
index 9ea9dcadb..df65d1137 160000
--- a/submodules/linphone
+++ b/submodules/linphone
@@ -1 +1 @@
-Subproject commit 9ea9dcadbd06bdc90cffc1e0e95d4e5d1c48fd8e
+Subproject commit df65d113730693274f1b35a516b0a065aa7c755c
diff --git a/test/org/linphone/TestConferenceActivity.java b/test/org/linphone/TestConferenceActivity.java
index 9d9adfc16..3510de0be 100644
--- a/test/org/linphone/TestConferenceActivity.java
+++ b/test/org/linphone/TestConferenceActivity.java
@@ -94,10 +94,12 @@ public class TestConferenceActivity extends ConferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
+ LinphoneManagerWaitHelper.disabled=true;
super.onCreate(savedInstanceState);
-
//if (!serviceStarted) startService(new Intent(ACTION_MAIN).setClass(this, LinphoneService.class));
+ findViewById(R.id.toggleMuteMic).setOnClickListener(null);
+ findViewById(R.id.toggleSpeaker).setOnClickListener(null);
}
@@ -308,6 +310,15 @@ public class TestConferenceActivity extends ConferenceActivity {
public int getVideoDevice() {return 0;}
public void setDeviceRotation(int rotation) {}
public void setVideoDevice(int id) {}
+ @Override
+ public LinphoneCall findCallFromUri(String uri) {
+ for (LinphoneCall call : calls) {
+ if (call.getRemoteAddress().asStringUriOnly().equals(uri)) {
+ return call;
+ }
+ }
+ return null;
+ }
}
@@ -318,7 +329,7 @@ public class TestConferenceActivity extends ConferenceActivity {
this.displayName = niceName;
this.number = number;}
public String asString() {return displayName;}
- public String asStringUriOnly() {return null;}
+ public String asStringUriOnly() {return getUserName() + "@" + getDomain();}
public String getDisplayName() {return displayName;}
public String getDomain() {return "example.org";}
public String getPort() {return "5060";}