Fixed crash & improved logs when linphone is started from a contact

This commit is contained in:
Sylvain Berfini 2019-05-17 10:51:04 +02:00
parent 5aeebfeb72
commit 9e0a441896
3 changed files with 24 additions and 22 deletions

View file

@ -87,19 +87,16 @@
android:name=".activities.DialerActivity" android:name=".activities.DialerActivity"
android:launchMode="singleTop"> android:launchMode="singleTop">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.DIAL" />
<action android:name="android.intent.action.CALL" /> <action android:name="android.intent.action.CALL" />
<action android:name="android.intent.action.CALL_PRIVILEGED" /> <action android:name="android.intent.action.CALL_PRIVILEGED" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<data android:scheme="tel" /> <data android:scheme="tel" />
<data android:scheme="sip" /> <data android:scheme="sip" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SENDTO" /> <action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<data android:scheme="sip" /> <data android:scheme="sip" />
<data android:scheme="imto" /> <data android:scheme="imto" />
</intent-filter> </intent-filter>

View file

@ -190,7 +190,6 @@ public final class LinphoneService extends Service {
return START_STICKY; return START_STICKY;
} }
mLinphoneManager = new LinphoneManager(this); mLinphoneManager = new LinphoneManager(this);
sInstance = this; // sInstance is ready once linphone manager has been created sInstance = this; // sInstance is ready once linphone manager has been created

View file

@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import android.Manifest; import android.Manifest;
import android.content.Intent; import android.content.Intent;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.TextureView; import android.view.TextureView;
@ -266,8 +267,11 @@ public class DialerActivity extends MainActivity implements AddressText.AddressC
String numberToCall = intent.getStringExtra("NumberToCall"); String numberToCall = intent.getStringExtra("NumberToCall");
Log.i("[Dialer] ACTION_CALL_LINPHONE with number: " + numberToCall); Log.i("[Dialer] ACTION_CALL_LINPHONE with number: " + numberToCall);
LinphoneManager.getCallManager().newOutgoingCall(numberToCall, null); LinphoneManager.getCallManager().newOutgoingCall(numberToCall, null);
} else if (Intent.ACTION_CALL.equals(action)) { } else {
if (intent.getData() != null) { Uri uri = intent.getData();
if (uri != null) {
Log.i("[Dialer] Intent data is: " + uri.toString());
if (Intent.ACTION_CALL.equals(action)) {
addressToCall = intent.getData().toString(); addressToCall = intent.getData().toString();
addressToCall = addressToCall.replace("%40", "@"); addressToCall = addressToCall.replace("%40", "@");
addressToCall = addressToCall.replace("%3A", ":"); addressToCall = addressToCall.replace("%3A", ":");
@ -277,13 +281,15 @@ public class DialerActivity extends MainActivity implements AddressText.AddressC
addressToCall = addressToCall.substring("tel:".length()); addressToCall = addressToCall.substring("tel:".length());
} }
Log.i("[Dialer] ACTION_CALL with number: " + addressToCall); Log.i("[Dialer] ACTION_CALL with number: " + addressToCall);
} } else {
} else if (Intent.ACTION_VIEW.equals(action)) {
addressToCall = addressToCall =
ContactsManager.getInstance() ContactsManager.getInstance()
.getAddressOrNumberForAndroidContact( .getAddressOrNumberForAndroidContact(getContentResolver(), uri);
getContentResolver(), intent.getData()); Log.i("[Dialer] " + action + " with number: " + addressToCall);
Log.i("[Dialer] ACTION_VIEW with number: " + addressToCall); }
} else {
Log.w("[Dialer] Intent data is null for action " + action);
}
} }
if (addressToCall != null) { if (addressToCall != null) {