Fix calls from native dialer.

This commit is contained in:
Guillaume Beraudo 2011-12-13 12:04:47 +01:00
parent f6afe8b15e
commit d198bef5a1
3 changed files with 23 additions and 17 deletions

View file

@ -16,19 +16,6 @@
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="org.linphone.LinphoneActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar"
android:launchMode="singleTask"
> <!-- android:alwaysRetainTaskState="true" clearTaskOnLaunch="false"-->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.CALL" />
@ -44,6 +31,20 @@
<data android:scheme="sip" /><!-- maybe one day -->
<data android:scheme="imto" />
</intent-filter>
</activity>
<activity android:name="org.linphone.LinphoneActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar"
android:launchMode="singleTask"
> <!-- android:alwaysRetainTaskState="true" clearTaskOnLaunch="false"-->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity android:name="org.linphone.IncomingCallActivity"

View file

@ -153,10 +153,14 @@ public class DialerActivity extends Activity implements LinphoneGuiListener {
public void newOutgoingCall(Intent intent) {
if (Intent.ACTION_CALL.equalsIgnoreCase(intent.getAction())) {
mAddress.setText(intent.getData().getSchemeSpecificPart());
} else if (Intent.ACTION_SENDTO.equals(intent.getAction())) {
String scheme = intent.getData().getScheme();
if (scheme.startsWith("imto")) {
mAddress.setText("sip:" + intent.getData().getLastPathSegment());
} else if (scheme.startsWith("call") || scheme.startsWith("sip")) {
mAddress.setText(intent.getData().getSchemeSpecificPart());
} else {
Log.e("Unknown scheme: ",scheme);
mAddress.setText(intent.getData().getSchemeSpecificPart());
}
mAddress.clearDisplayedName();

View file

@ -87,9 +87,10 @@ public class LinphoneActivity extends TabActivity implements ContactPicked
super.onCreate(savedInstanceState);
if (!LinphoneManager.isInstanciated()) {
Log.e("No service running: avoid crash by finishing ", this.getClass().getName());
Log.e("No service running: avoid crash by starting the launcher", this.getClass().getName());
// super.onCreate called earlier
finish();
startActivity(getIntent().setClass(this, LinphoneLauncherActivity.class));
return;
}
instance = this;