From 90f97a665a6329de97dde7e0e5fd1b56a58b5d45 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 21 Oct 2011 14:20:44 +0200 Subject: [PATCH] Fix 1.5 --- src/org/linphone/LinphoneActivity.java | 24 ++++++++++++++++++++---- src/org/linphone/LinphoneService.java | 19 ------------------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java index be968e857..70b5832f9 100644 --- a/src/org/linphone/LinphoneActivity.java +++ b/src/org/linphone/LinphoneActivity.java @@ -516,12 +516,28 @@ public class LinphoneActivity extends TabActivity implements SensorEventListener stopOrientationSensor(); finishActivity(INCOMING_CALL_ACTIVITY); } - + if (state == LinphoneCall.State.StreamsRunning && Version.isVideoCapable()) { + boolean videoEnabled = call.getCurrentParamsCopy().getVideoEnabled(); + boolean videoActivityLaunched = VideoCallActivity.launched; + if (videoEnabled && !videoActivityLaunched + && getResources().getBoolean(R.bool.autostart_video_activity) + && getResources().getBoolean(R.bool.use_video_activity)) { + // Do not call if video activity already launched as it would cause a pause() of the launched one + // and a race condition with capture surfaceview leading to a crash + startVideoActivity(); + } else if (!videoEnabled) { + finishVideoActivity(); + } + } + + if (state == LinphoneCall.State.CallUpdatedByRemote && Version.isVideoCapable()) { + if (VideoCallActivity.launched && !call.getCurrentParamsCopy().getVideoEnabled()) { + finishVideoActivity(); + } + } } } - - interface ContactPicked { void setAddressAndGoToDialer(String number, String name, Uri photo); -} +} \ No newline at end of file diff --git a/src/org/linphone/LinphoneService.java b/src/org/linphone/LinphoneService.java index c6742d037..9fe0f3943 100644 --- a/src/org/linphone/LinphoneService.java +++ b/src/org/linphone/LinphoneService.java @@ -341,25 +341,6 @@ public final class LinphoneService extends Service implements LinphoneServiceLis startActivity(new Intent() .setClass(this, LinphoneActivity.class) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); - } else if (state == LinphoneCall.State.StreamsRunning) { - if (Version.isVideoCapable() - && getResources().getBoolean(R.bool.autostart_video_activity) - && getResources().getBoolean(R.bool.use_video_activity) - && !VideoCallActivity.launched && LinphoneActivity.isInstanciated() - && call.getCurrentParamsCopy().getVideoEnabled()) { - // Do not call if video activity already launched as it would cause a pause() of the launched one - // and a race condition with capture surfaceview leading to a crash - LinphoneActivity.instance().startVideoActivity(); - } - else if (VideoCallActivity.launched && LinphoneActivity.isInstanciated() - && !call.getCurrentParamsCopy().getVideoEnabled()) { - LinphoneActivity.instance().finishVideoActivity(); - } - } else if (state == LinphoneCall.State.CallUpdatedByRemote) { - if (VideoCallActivity.launched && LinphoneActivity.isInstanciated() - && !call.getCurrentParamsCopy().getVideoEnabled()) { - LinphoneActivity.instance().finishVideoActivity(); - } } mHandler.post(new Runnable() {