Fix incoming activity not showing up issue
This commit is contained in:
parent
a7f77655d3
commit
176f98c9df
5 changed files with 30 additions and 9 deletions
|
@ -84,7 +84,7 @@
|
|||
<activity android:name="org.linphone.InCallActivity"
|
||||
android:theme="@style/FullScreen"
|
||||
android:noHistory="true"
|
||||
android:launchMode="singleInstance">
|
||||
android:launchMode="singleTask">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
</intent-filter>
|
||||
|
|
|
@ -1009,7 +1009,6 @@ public class InCallActivity extends FragmentActivity implements
|
|||
@Override
|
||||
protected void onResume() {
|
||||
instance = this;
|
||||
LinphoneManager.addListener(this);
|
||||
|
||||
if (isVideoEnabled) {
|
||||
displayVideoCallControlsIfHidden();
|
||||
|
@ -1019,6 +1018,8 @@ public class InCallActivity extends FragmentActivity implements
|
|||
}
|
||||
|
||||
super.onResume();
|
||||
|
||||
LinphoneManager.addListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,6 +23,7 @@ import static android.content.Intent.ACTION_MAIN;
|
|||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.linphone.LinphoneManager.AddressType;
|
||||
|
@ -1267,14 +1268,14 @@ public class LinphoneActivity extends FragmentActivity implements
|
|||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
LinphoneManager.removeListener(this);
|
||||
|
||||
super.onPause();
|
||||
refreshStatus(OnlineStatus.Away);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
LinphoneManager.removeListener(this);
|
||||
|
||||
if (chatStorage != null) {
|
||||
chatStorage.close();
|
||||
chatStorage = null;
|
||||
|
@ -1327,12 +1328,27 @@ public class LinphoneActivity extends FragmentActivity implements
|
|||
((DialerFragment) dialerFragment).newOutgoingCall(intent);
|
||||
}
|
||||
if (LinphoneManager.getLc().getCalls().length > 0) {
|
||||
LinphoneCall call = LinphoneManager.getLc().getCalls()[0];
|
||||
if (call != null && call.getState() != LinphoneCall.State.IncomingReceived) {
|
||||
if (call.getCurrentParamsCopy().getVideoEnabled()) {
|
||||
startVideoActivity(call);
|
||||
LinphoneCall calls[] = LinphoneManager.getLc().getCalls();
|
||||
if (calls.length > 0) {
|
||||
LinphoneCall call = calls[0];
|
||||
|
||||
if (call != null && call.getState() != LinphoneCall.State.IncomingReceived) {
|
||||
if (call.getCurrentParamsCopy().getVideoEnabled()) {
|
||||
startVideoActivity(call);
|
||||
} else {
|
||||
startIncallActivity(call);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If a call is ringing, start incomingcallactivity
|
||||
Collection<LinphoneCall.State> incoming = new ArrayList<LinphoneCall.State>();
|
||||
incoming.add(LinphoneCall.State.IncomingReceived);
|
||||
if (LinphoneUtils.getCallsInState(LinphoneManager.getLc(), incoming).size() > 0) {
|
||||
if (InCallActivity.isInstanciated()) {
|
||||
InCallActivity.instance().startIncomingCallActivity();
|
||||
} else {
|
||||
startIncallActivity(call);
|
||||
startActivity(new Intent(this, IncomingCallActivity.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,6 +78,7 @@ import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
|||
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration.AndroidCamera;
|
||||
import org.linphone.mediastream.video.capture.hwconf.Hacks;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ContentResolver;
|
||||
|
@ -1004,6 +1005,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressLint("Wakelock")
|
||||
public void callState(final LinphoneCore lc,final LinphoneCall call, final State state, final String message) {
|
||||
Log.i("new state [",state,"]");
|
||||
if (state == IncomingReceived && !call.equals(lc.getCurrentCall())) {
|
||||
|
|
|
@ -546,6 +546,7 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
|
|||
Log.i("Service not ready, discarding call state change to ",state.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
if (state == LinphoneCall.State.IncomingReceived) {
|
||||
onIncomingReceived();
|
||||
}
|
||||
|
@ -574,6 +575,7 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
|
|||
if ((state == State.CallEnd || state == State.Error) && LinphoneManager.getLc().getCallsNb() < 1) {
|
||||
mWifiLock.release();
|
||||
}
|
||||
|
||||
mHandler.post(new Runnable() {
|
||||
public void run() {
|
||||
if (guiListener() != null)
|
||||
|
|
Loading…
Reference in a new issue