Merge remote-tracking branch 'public/master' into bellesip

Conflicts:
	jni/Android.mk
	submodules/linphone
This commit is contained in:
Simon Morlat 2013-06-25 23:42:36 +02:00
commit 43dabf728a
7 changed files with 68 additions and 56 deletions

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.linphone" package="org.linphone"
android:versionCode="2003" android:installLocation="auto"> android:versionCode="2100" android:installLocation="auto">
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17"/> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17"/>
<!-- Permissions for Push Notification --> <!-- Permissions for Push Notification -->
@ -103,7 +103,9 @@
</intent-filter> </intent-filter>
</activity> </activity>
<service android:name="org.linphone.LinphoneService" android:stopWithTask="false"/> <service android:name="org.linphone.LinphoneService"
android:label="@string/service_name"
android:stopWithTask="false"/>
<receiver android:name="org.linphone.NetworkManager"> <receiver android:name="org.linphone.NetworkManager">
<intent-filter><action android:name="android.net.conn.CONNECTIVITY_CHANGE"></action></intent-filter> <intent-filter><action android:name="android.net.conn.CONNECTIVITY_CHANGE"></action></intent-filter>

View file

@ -45,18 +45,10 @@ endif
include $(linphone-root-dir)/submodules/externals/build/libxml2/Android.mk include $(linphone-root-dir)/submodules/externals/build/libxml2/Android.mk
# Speex # Speex
ifeq ($(wildcard $(linphone-root-dir)/submodules/externals/prebuilts/speex.mk),)
include $(linphone-root-dir)/submodules/externals/build/speex/Android.mk include $(linphone-root-dir)/submodules/externals/build/speex/Android.mk
else
include $(linphone-root-dir)/submodules/externals/prebuilts/speex.mk
endif
# Gsm # Gsm
ifeq ($(wildcard $(linphone-root-dir)/submodules/externals/prebuilts/gsm.mk),)
include $(linphone-root-dir)/submodules/externals/build/gsm/Android.mk include $(linphone-root-dir)/submodules/externals/build/gsm/Android.mk
else
include $(linphone-root-dir)/submodules/externals/prebuilts/gsm.mk
endif
include $(linphone-root-dir)/submodules/externals/build/polarssl/Android.mk include $(linphone-root-dir)/submodules/externals/build/polarssl/Android.mk
include $(linphone-root-dir)/submodules/externals/build/antlr3/Android.mk include $(linphone-root-dir)/submodules/externals/build/antlr3/Android.mk
@ -98,19 +90,11 @@ ifeq (,$(DUMP_VAR))
$(info Build X264 plugin for mediastreamer2) $(info Build X264 plugin for mediastreamer2)
endif endif
include $(linphone-root-dir)/submodules/msx264/Android.mk include $(linphone-root-dir)/submodules/msx264/Android.mk
ifeq ($(wildcard $(linphone-root-dir)/submodules/externals/prebuilts/x264.mk),)
include $(linphone-root-dir)/submodules/externals/build/x264/Android.mk include $(linphone-root-dir)/submodules/externals/build/x264/Android.mk
else
include $(linphone-root-dir)/submodules/externals/prebuilts/x264.mk
endif
endif endif
ifeq ($(wildcard $(linphone-root-dir)/submodules/externals/prebuilts/ffmpeg.mk),)
include $(linphone-root-dir)/submodules/externals/build/ffmpeg/Android.mk include $(linphone-root-dir)/submodules/externals/build/ffmpeg/Android.mk
include $(linphone-root-dir)/submodules/externals/build/ffmpeg-no-neon/Android.mk include $(linphone-root-dir)/submodules/externals/build/ffmpeg-no-neon/Android.mk
else
include $(linphone-root-dir)/submodules/externals/prebuilts/ffmpeg.mk
endif
include $(linphone-root-dir)/submodules/externals/build/libvpx/Android.mk include $(linphone-root-dir)/submodules/externals/build/libvpx/Android.mk
endif #armeabi-v7a endif #armeabi-v7a
@ -120,11 +104,7 @@ ifeq ($(BUILD_GPLV3_ZRTP), 1)
ifeq (,$(DUMP_VAR)) ifeq (,$(DUMP_VAR))
$(info Build ZRTP support - makes application GPLv3) $(info Build ZRTP support - makes application GPLv3)
endif endif
ifeq ($(wildcard $(linphone-root-dir)/submodules/externals/prebuilts/zrtpcpp.mk),)
include $(linphone-root-dir)/submodules/externals/build/libzrtpcpp/Android.mk include $(linphone-root-dir)/submodules/externals/build/libzrtpcpp/Android.mk
else
include $(linphone-root-dir)/submodules/externals/prebuilts/zrtpcpp.mk
endif
endif endif
ifeq ($(BUILD_SRTP), 1) ifeq ($(BUILD_SRTP), 1)

View file

@ -8,6 +8,7 @@
<string name="picture_name_format">linphone-mms-%s.jpg</string> <string name="picture_name_format">linphone-mms-%s.jpg</string>
<string name="app_name">Linphone</string> <string name="app_name">Linphone</string>
<string name="service_name">Linphone Service</string>
<string name="addressbook_label">Linphone</string> <string name="addressbook_label">Linphone</string>
<string name="notification_title">Linphone</string> <string name="notification_title">Linphone</string>
<string name="wait_dialog_text">Starting up</string> <string name="wait_dialog_text">Starting up</string>

View file

@ -17,6 +17,7 @@
<bool name="pref_codec_g722_default">false</bool> <bool name="pref_codec_g722_default">false</bool>
<bool name="pref_codec_silk24_default">false</bool> <bool name="pref_codec_silk24_default">false</bool>
<bool name="pref_codec_silk16_default">true</bool> <bool name="pref_codec_silk16_default">true</bool>
<bool name="pref_codec_silk8_default">false</bool>
<bool name="pref_codec_pcmu_default">true</bool> <bool name="pref_codec_pcmu_default">true</bool>
<bool name="pref_codec_pcma_default">true</bool> <bool name="pref_codec_pcma_default">true</bool>

View file

@ -102,6 +102,11 @@
android:defaultValue="@bool/pref_codec_g722_default" android:defaultValue="@bool/pref_codec_g722_default"
android:title="@string/pref_codec_g722"/> android:title="@string/pref_codec_g722"/>
<CheckBoxPreference
android:key="@string/pref_codec_silk8_key"
android:defaultValue="@bool/pref_codec_silk8_default"
android:title="@string/pref_codec_silk8"/>
<CheckBoxPreference <CheckBoxPreference
android:key="@string/pref_codec_silk16_key" android:key="@string/pref_codec_silk16_key"
android:defaultValue="@bool/pref_codec_silk16_default" android:defaultValue="@bool/pref_codec_silk16_default"

View file

@ -252,15 +252,15 @@ public class InCallActivity extends FragmentActivity implements
if (LinphoneManager.getInstance().isBluetoothScoConnected) { if (LinphoneManager.getInstance().isBluetoothScoConnected) {
try { try {
routeLayout.setVisibility(View.VISIBLE); routeLayout.setVisibility(View.VISIBLE);
} catch (NullPointerException npe) {}
audioRoute.setVisibility(View.VISIBLE); audioRoute.setVisibility(View.VISIBLE);
speaker.setVisibility(View.GONE); speaker.setVisibility(View.GONE);
} catch (NullPointerException npe) {}
} else { } else {
try { try {
routeLayout.setVisibility(View.GONE); routeLayout.setVisibility(View.GONE);
} catch (NullPointerException npe) {}
audioRoute.setVisibility(View.GONE); audioRoute.setVisibility(View.GONE);
speaker.setVisibility(View.VISIBLE); speaker.setVisibility(View.VISIBLE);
} catch (NullPointerException npe) {}
} }
} }

View file

@ -29,6 +29,7 @@ import static org.linphone.R.string.pref_codec_speex32_key;
import static org.linphone.R.string.pref_video_enable_key; import static org.linphone.R.string.pref_video_enable_key;
import static org.linphone.core.LinphoneCall.State.CallEnd; import static org.linphone.core.LinphoneCall.State.CallEnd;
import static org.linphone.core.LinphoneCall.State.Error; import static org.linphone.core.LinphoneCall.State.Error;
import static org.linphone.core.LinphoneCall.State.CallReleased;
import static org.linphone.core.LinphoneCall.State.IncomingReceived; import static org.linphone.core.LinphoneCall.State.IncomingReceived;
import java.io.File; import java.io.File;
@ -151,6 +152,7 @@ public class LinphoneManager implements LinphoneCoreListener {
private String basePath; private String basePath;
private static boolean sExited; private static boolean sExited;
private String contactParams; private String contactParams;
private boolean mAudioFocused;
private WakeLock mIncallWakeLock; private WakeLock mIncallWakeLock;
@ -160,6 +162,7 @@ public class LinphoneManager implements LinphoneCoreListener {
private BroadcastReceiver bluetoothReiceiver = new BluetoothManager(); private BroadcastReceiver bluetoothReiceiver = new BluetoothManager();
public boolean isBluetoothScoConnected; public boolean isBluetoothScoConnected;
public boolean isUsingBluetoothAudioRoute; public boolean isUsingBluetoothAudioRoute;
private boolean mBluetoothStarted;
public ChatStorage chatStorage; public ChatStorage chatStorage;
@ -214,10 +217,11 @@ public class LinphoneManager implements LinphoneCoreListener {
private void routeAudioToSpeakerHelper(boolean speakerOn) { private void routeAudioToSpeakerHelper(boolean speakerOn) {
isUsingBluetoothAudioRoute = false; isUsingBluetoothAudioRoute = false;
if (mAudioManager != null) { if (mAudioManager != null && mBluetoothStarted) {
Compatibility.setAudioManagerInCallMode(mAudioManager); //Compatibility.setAudioManagerInCallMode(mAudioManager);
mAudioManager.stopBluetoothSco(); mAudioManager.stopBluetoothSco();
mAudioManager.setBluetoothScoOn(false); mAudioManager.setBluetoothScoOn(false);
mBluetoothStarted=false;
} }
if (!speakerOn) { if (!speakerOn) {
@ -296,10 +300,11 @@ public class LinphoneManager implements LinphoneCoreListener {
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @TargetApi(Build.VERSION_CODES.HONEYCOMB)
public boolean routeAudioToBluetooth() { public boolean routeAudioToBluetooth() {
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (mBluetoothAdapter.isEnabled() && mAudioManager.isBluetoothScoAvailableOffCall()) { if (bluetoothAdapter.isEnabled() && mAudioManager.isBluetoothScoAvailableOffCall()) {
mAudioManager.setBluetoothScoOn(true); mAudioManager.setBluetoothScoOn(true);
mAudioManager.startBluetoothSco(); mAudioManager.startBluetoothSco();
mBluetoothStarted=true;
if (Version.sdkAboveOrEqual(Version.API11_HONEYCOMB_30)) { if (Version.sdkAboveOrEqual(Version.API11_HONEYCOMB_30)) {
isUsingBluetoothAudioRoute = false; isUsingBluetoothAudioRoute = false;
@ -314,7 +319,8 @@ public class LinphoneManager implements LinphoneCoreListener {
Log.d("No bluetooth device available"); Log.d("No bluetooth device available");
scoDisconnected(); scoDisconnected();
} else { } else {
mAudioManager.setMode(AudioManager.MODE_IN_CALL); //Why is this for:
//mAudioManager.setMode(AudioManager.MODE_IN_CALL);
for (LinphoneOnAudioChangedListener listener : getSimpleListeners(LinphoneOnAudioChangedListener.class)) { for (LinphoneOnAudioChangedListener listener : getSimpleListeners(LinphoneOnAudioChangedListener.class)) {
listener.onAudioStateChanged(AudioState.SPEAKER); listener.onAudioStateChanged(AudioState.SPEAKER);
} }
@ -327,16 +333,17 @@ public class LinphoneManager implements LinphoneCoreListener {
} }
public void scoConnected() { public void scoConnected() {
Log.e("Bluetooth sco connected!"); Log.i("Bluetooth sco connected!");
isBluetoothScoConnected = true; isBluetoothScoConnected = true;
} }
public void scoDisconnected() { public void scoDisconnected() {
Log.e("Bluetooth sco disconnected!"); Log.w("Bluetooth sco disconnected!");
isUsingBluetoothAudioRoute = false; isUsingBluetoothAudioRoute = false;
isBluetoothScoConnected = false; isBluetoothScoConnected = false;
if (mAudioManager != null) { if (mAudioManager != null) {
mAudioManager.setMode(AudioManager.MODE_NORMAL); //why is this for ?
//mAudioManager.setMode(AudioManager.MODE_NORMAL);
mAudioManager.stopBluetoothSco(); mAudioManager.stopBluetoothSco();
mAudioManager.setBluetoothScoOn(false); mAudioManager.setBluetoothScoOn(false);
} }
@ -1225,12 +1232,6 @@ public class LinphoneManager implements LinphoneCoreListener {
} }
} }
if (state == LinphoneCall.State.Connected) {
if (mLc.getCallsNb() == 1) {
Log.d("Audio focus requested: " + (mAudioManager.requestAudioFocus(null, AudioManager.STREAM_VOICE_CALL, AudioManager.AUDIOFOCUS_GAIN) == AudioManager.AUDIOFOCUS_REQUEST_GRANTED ? "Granted" : "Denied"));
}
}
if (state == IncomingReceived || (state == State.CallIncomingEarlyMedia && mR.getBoolean(R.bool.allow_ringing_while_early_media))) { if (state == IncomingReceived || (state == State.CallIncomingEarlyMedia && mR.getBoolean(R.bool.allow_ringing_while_early_media))) {
// Brighten screen for at least 10 seconds // Brighten screen for at least 10 seconds
if (mLc.getCallsNb() == 1) { if (mLc.getCallsNb() == 1) {
@ -1243,23 +1244,34 @@ public class LinphoneManager implements LinphoneCoreListener {
stopRinging(); stopRinging();
} }
if (state == LinphoneCall.State.Connected) {
if (mLc.getCallsNb() == 1) {
requestAudioFocus();
Compatibility.setAudioManagerInCallMode(mAudioManager);
}
if (Hacks.needSoftvolume() || sLPref.useSoftvolume()) {
adjustVolume(0); // Synchronize
}
}
if (state == CallEnd || state == Error) { if (state == CallEnd || state == Error) {
if (mLc.getCallsNb() == 0) { if (mLc.getCallsNb() == 0) {
Log.d("Audio focus released: " + (mAudioManager.abandonAudioFocus(null) == AudioManager.AUDIOFOCUS_REQUEST_GRANTED ? "Granted" : "Denied")); if (mAudioFocused){
mAudioManager.setMode(AudioManager.MODE_NORMAL); int res=mAudioManager.abandonAudioFocus(null);
Log.d("Audio focus released a bit later: " + (res == AudioManager.AUDIOFOCUS_REQUEST_GRANTED ? "Granted" : "Denied"));
mAudioFocused=false;
} }
Context activity = getContext(); Context activity = getContext();
if (activity != null) { if (activity != null) {
TelephonyManager tm = (TelephonyManager) activity.getSystemService(Context.TELEPHONY_SERVICE); TelephonyManager tm = (TelephonyManager) activity.getSystemService(Context.TELEPHONY_SERVICE);
if (tm.getCallState() == TelephonyManager.CALL_STATE_IDLE) { if (tm.getCallState() == TelephonyManager.CALL_STATE_IDLE) {
mAudioManager.setMode(AudioManager.MODE_NORMAL); mAudioManager.setMode(AudioManager.MODE_NORMAL);
Log.d("---AudioManager: back to MODE_NORMAL");
} }
} }
} }
if (state == State.Connected) {
if (Hacks.needSoftvolume() || sLPref.useSoftvolume()) {
adjustVolume(0); // Synchronize
}
} }
if (state == CallEnd) { if (state == CallEnd) {
@ -1282,7 +1294,6 @@ public class LinphoneManager implements LinphoneCoreListener {
} else { } else {
Log.i("New call active while incall (CPU only) wake lock already active"); Log.i("New call active while incall (CPU only) wake lock already active");
} }
Compatibility.setAudioManagerInCallMode(mAudioManager);
} }
mListenerDispatcher.onCallStateChanged(call, state, message); mListenerDispatcher.onCallStateChanged(call, state, message);
} }
@ -1327,6 +1338,14 @@ public class LinphoneManager implements LinphoneCoreListener {
disableRinging = true; disableRinging = true;
} }
private void requestAudioFocus(){
if (!mAudioFocused){
int res=mAudioManager.requestAudioFocus(null, AudioManager.STREAM_VOICE_CALL, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT );
Log.d("Audio focus requested: " + (res == AudioManager.AUDIOFOCUS_REQUEST_GRANTED ? "Granted" : "Denied"));
if (res==AudioManager.AUDIOFOCUS_REQUEST_GRANTED) mAudioFocused=true;
}
}
private synchronized void startRinging() { private synchronized void startRinging() {
if (disableRinging ) { if (disableRinging ) {
return; return;
@ -1342,6 +1361,7 @@ public class LinphoneManager implements LinphoneCoreListener {
mVibrator.vibrate(patern, 1); mVibrator.vibrate(patern, 1);
} }
if (mRingerPlayer == null) { if (mRingerPlayer == null) {
requestAudioFocus();
mRingerPlayer = new MediaPlayer(); mRingerPlayer = new MediaPlayer();
mRingerPlayer.setAudioStreamType(STREAM_RING); mRingerPlayer.setAudioStreamType(STREAM_RING);
mListenerDispatcher.onRingerPlayerCreated(mRingerPlayer); mListenerDispatcher.onRingerPlayerCreated(mRingerPlayer);
@ -1367,6 +1387,9 @@ public class LinphoneManager implements LinphoneCoreListener {
mVibrator.cancel(); mVibrator.cancel();
} }
if (Hacks.needGalaxySAudioHack())
mAudioManager.setMode(AudioManager.MODE_NORMAL);
isRinging = false; isRinging = false;
// You may need to call galaxys audio hack after this method // You may need to call galaxys audio hack after this method
routeAudioToReceiver(); routeAudioToReceiver();