diff --git a/res/values-FR/strings.xml b/res/values-FR/strings.xml
index 6f278218a..7913f8ac7 100644
--- a/res/values-FR/strings.xml
+++ b/res/values-FR/strings.xml
@@ -98,11 +98,11 @@
Paramètres vidéo
Partager ma vidéo
- Accepter vidéo entrante
+ Accepter appels vidéo
Envoyer ma vidéo automatiquement
- Accepter automatiquement la vidéo
+ Toujours accepter les demandes d\'appels vidéo
Initier les appels en vidéo
-
+ Toujours envoyer des demandes d\'appels vidéo
Activer la vidéo
Activer les animations
Remplacer + par 00
diff --git a/res/values/strings.xml b/res/values/strings.xml
index cddb2c5d7..e6182d504 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -130,11 +130,11 @@
Terminate call
Video settings
Share my camera
- Accept incoming camera
+ Accept incoming video requests
Automatically send my camera
- Automatically accept correspondent\'s camera
+ Always accept video requests
Initiate video calls
-
+ Always send video requests
Enable Video
Enable Animations
Replace + by 00
diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml
index 9cb3258e7..8ebc983bd 100644
--- a/res/xml/preferences.xml
+++ b/res/xml/preferences.xml
@@ -153,7 +153,8 @@
android:key="@string/pref_video_use_front_camera_key"
android:defaultValue="true"
android:title="@string/pref_video_use_front_camera_title"
- android:dependency="@string/pref_video_enable_key"/>
+ android:dependency="@string/pref_video_enable_key"
+ android:layout="@layout/hidden"/>
+ android:dependency="@string/pref_video_enable_key"
+ android:layout="@layout/hidden"/>
0) {
+ LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
+ if (lc == null) {
+ return;
+ }
+
+ if (lc.getCallsNb() > 0) {
if (isCallTransferOngoing) {
mCall.setImageResource(R.drawable.transfer_call);
mCall.setExternalClickListener(transferListener);
diff --git a/src/org/linphone/InCallActivity.java b/src/org/linphone/InCallActivity.java
index 25385289a..6cbb9bce7 100644
--- a/src/org/linphone/InCallActivity.java
+++ b/src/org/linphone/InCallActivity.java
@@ -26,6 +26,7 @@ import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneCall.State;
import org.linphone.core.LinphoneCallParams;
import org.linphone.core.LinphoneCore;
+import org.linphone.core.LinphoneCoreException;
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
import org.linphone.ui.Numpad;
@@ -34,6 +35,7 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Bundle;
+import android.os.CountDownTimer;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
@@ -60,6 +62,7 @@ public class InCallActivity extends FragmentActivity implements
LinphoneOnCallEncryptionChangedListener,
OnClickListener {
private final static int SECONDS_BEFORE_HIDING_CONTROLS = 3000;
+
private static InCallActivity instance;
private Handler mHandler = new Handler();
@@ -75,6 +78,7 @@ public class InCallActivity extends FragmentActivity implements
private Numpad numpad;
private int cameraNumber;
private Animation slideOutLeftToRight, slideInRightToLeft, slideInBottomToTop, slideInTopToBottom, slideOutBottomToTop, slideOutTopToBottom;
+ private CountDownTimer timer;
public static InCallActivity instance() {
return instance;
@@ -322,15 +326,14 @@ public class InCallActivity extends FragmentActivity implements
if (!displayVideo) {
LinphoneCallParams params = call.getCurrentParamsCopy();
params.setVideoEnabled(false);
+
LinphoneManager.getLc().updateCall(call, params);
replaceFragmentVideoByAudio();
video.setBackgroundResource(R.drawable.video_on);
setCallControlsVisibleAndRemoveCallbacks();
-
} else {
LinphoneManager.getInstance().addVideo();
-
isSpeakerEnabled = true;
LinphoneManager.getInstance().routeAudioToSpeaker();
speaker.setBackgroundResource(R.drawable.speaker_on);
@@ -808,6 +811,39 @@ public class InCallActivity extends FragmentActivity implements
setResult(Activity.RESULT_FIRST_USER, intent);
finish();
}
+
+ private void acceptCallUpdate(boolean accept) {
+ if (timer != null) {
+ timer.cancel();
+ }
+
+ LinphoneCall call = LinphoneManager.getLc().getCurrentCall();
+ if (call == null) {
+ return;
+ }
+
+ LinphoneCallParams params = call.getCurrentParamsCopy();
+ if (accept) {
+ params.setVideoEnabled(true);
+ LinphoneManager.getLc().enableVideo(true, true);
+ }
+
+ try {
+ LinphoneManager.getLc().acceptCallUpdate(call, params);
+ } catch (LinphoneCoreException e) {
+ e.printStackTrace();
+ }
+
+ if (accept) {
+ isSpeakerEnabled = true;
+ LinphoneManager.getInstance().routeAudioToSpeaker();
+ speaker.setBackgroundResource(R.drawable.speaker_on);
+
+ replaceFragmentAudioByVideo();
+ video.setBackgroundResource(R.drawable.video_off);
+ displayVideoCallControlsIfHidden();
+ }
+ }
@Override
public void onCallStateChanged(final LinphoneCall call, State state, String message) {
@@ -816,7 +852,7 @@ public class InCallActivity extends FragmentActivity implements
return;
}
- if (state == State.StreamsRunning) {
+ if (state == State.StreamsRunning) {
boolean isVideoEnabledInCall = call.getCurrentParamsCopy().getVideoEnabled();
if (isVideoEnabledInCall != isVideoEnabled) {
isVideoEnabled = isVideoEnabledInCall;
@@ -846,6 +882,35 @@ public class InCallActivity extends FragmentActivity implements
});
}
+ if (state == State.CallUpdatedByRemote) {
+ // If the correspondent proposes video while audio call
+ boolean remoteVideo = call.getRemoteParams().getVideoEnabled();
+ boolean localVideo = call.getCurrentParamsCopy().getVideoEnabled();
+ boolean autoAcceptCameraPolicy = LinphoneManager.getInstance().isAutoAcceptCamera();
+ if (remoteVideo && !localVideo && !autoAcceptCameraPolicy && !LinphoneManager.getLc().isInConference()) {
+ mHandler.post(new Runnable() {
+ public void run() {
+ //TODO: ask the user it's choice
+
+ // We let 30 secs for the user to decide
+ timer = new CountDownTimer(30000, 1000) {
+ public void onTick(long millisUntilFinished) { }
+ public void onFinish() {
+ acceptCallUpdate(false);
+ }
+ }.start();
+ }
+ });
+ } else if (remoteVideo && !LinphoneManager.getLc().isInConference() && autoAcceptCameraPolicy) {
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ acceptCallUpdate(true);
+ }
+ });
+ }
+ }
+
transfer.setEnabled(LinphoneManager.getLc().getCurrentCall() != null);
}
diff --git a/src/org/linphone/IncomingCallActivity.java b/src/org/linphone/IncomingCallActivity.java
index a1b69066d..c685e4685 100644
--- a/src/org/linphone/IncomingCallActivity.java
+++ b/src/org/linphone/IncomingCallActivity.java
@@ -24,6 +24,7 @@ import org.linphone.LinphoneSimpleListener.LinphoneOnCallStateChangedListener;
import org.linphone.core.LinphoneAddress;
import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneCall.State;
+import org.linphone.core.LinphoneCallParams;
import org.linphone.core.Log;
import org.linphone.ui.AvatarWithShadow;
import org.linphone.ui.LinphoneSliders;
@@ -128,7 +129,12 @@ public class IncomingCallActivity extends Activity implements LinphoneOnCallStat
LinphoneManager.getLc().terminateCall(mCall);
}
private void answer() {
- if (!LinphoneManager.getInstance().acceptCall(mCall)) {
+ LinphoneCallParams params = mCall.getCurrentParamsCopy();
+ if (mCall.getRemoteParams().getVideoEnabled() && LinphoneManager.getInstance().isAutoAcceptCamera()) {
+ params.setVideoEnabled(true);
+ }
+
+ if (!LinphoneManager.getInstance().acceptCallWithParams(mCall, params)) {
// the above method takes care of Samsung Galaxy S
Toast.makeText(this, R.string.couldnt_accept_call, Toast.LENGTH_LONG).show();
} else {
@@ -136,7 +142,7 @@ public class IncomingCallActivity extends Activity implements LinphoneOnCallStat
return;
}
- if (mCall.getCurrentParamsCopy().getVideoEnabled()) {
+ if (mCall.getRemoteParams().getVideoEnabled() && LinphoneManager.getInstance().isAutoAcceptCamera()) {
LinphoneActivity.instance().startVideoActivity(mCall);
}
else {
diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java
index d3d358599..a7172c3e1 100644
--- a/src/org/linphone/LinphoneManager.java
+++ b/src/org/linphone/LinphoneManager.java
@@ -54,6 +54,7 @@ import org.linphone.core.LinphoneAddress;
import org.linphone.core.LinphoneAuthInfo;
import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneCall.State;
+import org.linphone.core.LinphoneCallParams;
import org.linphone.core.LinphoneChatMessage;
import org.linphone.core.LinphoneChatRoom;
import org.linphone.core.LinphoneCore;
@@ -482,7 +483,6 @@ public final class LinphoneManager implements LinphoneCoreListener {
mLc.setRing(null);
mLc.setRootCA(mLinphoneRootCaFile);
mLc.setPlayFile(mPauseSoundFile);
- mLc.setVideoPolicy(isAutoInitiateVideoCalls(), isAutoAcceptCamera());
int availableCores = Runtime.getRuntime().availableProcessors();
Log.w("MediaStreamer : " + availableCores + " cores detected and configured");
@@ -655,6 +655,8 @@ public final class LinphoneManager implements LinphoneCoreListener {
setSignalingTransportsFromConfiguration(initialTransports);
initMediaEncryption();
+
+ mLc.setVideoPolicy(isAutoInitiateVideoCalls(), isAutoAcceptCamera());
try {
// Configure audio codecs
@@ -1109,10 +1111,6 @@ public final class LinphoneManager implements LinphoneCoreListener {
return getPrefBoolean(R.string.pref_video_enable_key, false);
}
- public boolean shareMyCamera() {
- return isVideoEnabled() && getPrefBoolean(R.string.pref_video_automatically_share_my_video_key, false);
- }
-
public boolean isAutoAcceptCamera() {
return isVideoEnabled() && getPrefBoolean(R.string.pref_video_automatically_accept_video_key, false);
}
@@ -1184,12 +1182,12 @@ public final class LinphoneManager implements LinphoneCoreListener {
return false;
}
- public boolean acceptCall(LinphoneCall call) {
+ public boolean acceptCallWithParams(LinphoneCall call, LinphoneCallParams params) {
if (Hacks.needGalaxySAudioHack() || sLPref.useGalaxySHack())
setAudioModeIncallForGalaxyS();
try {
- mLc.acceptCall(call);
+ mLc.acceptCallWithParams(call, params);
return true;
} catch (LinphoneCoreException e) {
Log.i(e, "Accept call failed");