Merge branch 'bellesip' of git.linphone.org:linphone-android-private into bellesip
This commit is contained in:
commit
7552cca7c8
7 changed files with 68 additions and 56 deletions
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.linphone"
|
||||
android:versionCode="2003" android:installLocation="auto">
|
||||
android:versionCode="2100" android:installLocation="auto">
|
||||
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17"/>
|
||||
|
||||
<!-- Permissions for Push Notification -->
|
||||
|
@ -103,7 +103,9 @@
|
|||
</intent-filter>
|
||||
</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">
|
||||
<intent-filter><action android:name="android.net.conn.CONNECTIVITY_CHANGE"></action></intent-filter>
|
||||
|
|
|
@ -45,18 +45,10 @@ endif
|
|||
include $(linphone-root-dir)/submodules/externals/build/libxml2/Android.mk
|
||||
|
||||
# Speex
|
||||
ifeq ($(wildcard $(linphone-root-dir)/submodules/externals/prebuilts/speex.mk),)
|
||||
include $(linphone-root-dir)/submodules/externals/build/speex/Android.mk
|
||||
else
|
||||
include $(linphone-root-dir)/submodules/externals/prebuilts/speex.mk
|
||||
endif
|
||||
|
||||
# Gsm
|
||||
ifeq ($(wildcard $(linphone-root-dir)/submodules/externals/prebuilts/gsm.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/antlr3/Android.mk
|
||||
|
@ -98,19 +90,11 @@ ifeq (,$(DUMP_VAR))
|
|||
$(info Build X264 plugin for mediastreamer2)
|
||||
endif
|
||||
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
|
||||
else
|
||||
include $(linphone-root-dir)/submodules/externals/prebuilts/x264.mk
|
||||
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-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
|
||||
endif #armeabi-v7a
|
||||
|
@ -120,11 +104,7 @@ ifeq ($(BUILD_GPLV3_ZRTP), 1)
|
|||
ifeq (,$(DUMP_VAR))
|
||||
$(info Build ZRTP support - makes application GPLv3)
|
||||
endif
|
||||
ifeq ($(wildcard $(linphone-root-dir)/submodules/externals/prebuilts/zrtpcpp.mk),)
|
||||
include $(linphone-root-dir)/submodules/externals/build/libzrtpcpp/Android.mk
|
||||
else
|
||||
include $(linphone-root-dir)/submodules/externals/prebuilts/zrtpcpp.mk
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_SRTP), 1)
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<string name="picture_name_format">linphone-mms-%s.jpg</string>
|
||||
|
||||
<string name="app_name">Linphone</string>
|
||||
<string name="service_name">Linphone Service</string>
|
||||
<string name="addressbook_label">Linphone</string>
|
||||
<string name="notification_title">Linphone</string>
|
||||
<string name="wait_dialog_text">Starting up</string>
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
<bool name="pref_codec_g722_default">false</bool>
|
||||
<bool name="pref_codec_silk24_default">false</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_pcma_default">true</bool>
|
||||
|
||||
|
|
|
@ -102,6 +102,11 @@
|
|||
android:defaultValue="@bool/pref_codec_g722_default"
|
||||
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
|
||||
android:key="@string/pref_codec_silk16_key"
|
||||
android:defaultValue="@bool/pref_codec_silk16_default"
|
||||
|
|
|
@ -252,15 +252,15 @@ public class InCallActivity extends FragmentActivity implements
|
|||
if (LinphoneManager.getInstance().isBluetoothScoConnected) {
|
||||
try {
|
||||
routeLayout.setVisibility(View.VISIBLE);
|
||||
audioRoute.setVisibility(View.VISIBLE);
|
||||
speaker.setVisibility(View.GONE);
|
||||
} catch (NullPointerException npe) {}
|
||||
audioRoute.setVisibility(View.VISIBLE);
|
||||
speaker.setVisibility(View.GONE);
|
||||
} else {
|
||||
try {
|
||||
routeLayout.setVisibility(View.GONE);
|
||||
audioRoute.setVisibility(View.GONE);
|
||||
speaker.setVisibility(View.VISIBLE);
|
||||
} catch (NullPointerException npe) {}
|
||||
audioRoute.setVisibility(View.GONE);
|
||||
speaker.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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.core.LinphoneCall.State.CallEnd;
|
||||
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 java.io.File;
|
||||
|
@ -151,6 +152,7 @@ public class LinphoneManager implements LinphoneCoreListener {
|
|||
private String basePath;
|
||||
private static boolean sExited;
|
||||
private String contactParams;
|
||||
private boolean mAudioFocused;
|
||||
|
||||
private WakeLock mIncallWakeLock;
|
||||
|
||||
|
@ -160,6 +162,7 @@ public class LinphoneManager implements LinphoneCoreListener {
|
|||
private BroadcastReceiver bluetoothReiceiver = new BluetoothManager();
|
||||
public boolean isBluetoothScoConnected;
|
||||
public boolean isUsingBluetoothAudioRoute;
|
||||
private boolean mBluetoothStarted;
|
||||
|
||||
public ChatStorage chatStorage;
|
||||
|
||||
|
@ -214,10 +217,11 @@ public class LinphoneManager implements LinphoneCoreListener {
|
|||
|
||||
private void routeAudioToSpeakerHelper(boolean speakerOn) {
|
||||
isUsingBluetoothAudioRoute = false;
|
||||
if (mAudioManager != null) {
|
||||
Compatibility.setAudioManagerInCallMode(mAudioManager);
|
||||
if (mAudioManager != null && mBluetoothStarted) {
|
||||
//Compatibility.setAudioManagerInCallMode(mAudioManager);
|
||||
mAudioManager.stopBluetoothSco();
|
||||
mAudioManager.setBluetoothScoOn(false);
|
||||
mBluetoothStarted=false;
|
||||
}
|
||||
|
||||
if (!speakerOn) {
|
||||
|
@ -296,10 +300,11 @@ public class LinphoneManager implements LinphoneCoreListener {
|
|||
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
public boolean routeAudioToBluetooth() {
|
||||
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
if (mBluetoothAdapter.isEnabled() && mAudioManager.isBluetoothScoAvailableOffCall()) {
|
||||
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
if (bluetoothAdapter.isEnabled() && mAudioManager.isBluetoothScoAvailableOffCall()) {
|
||||
mAudioManager.setBluetoothScoOn(true);
|
||||
mAudioManager.startBluetoothSco();
|
||||
mBluetoothStarted=true;
|
||||
|
||||
if (Version.sdkAboveOrEqual(Version.API11_HONEYCOMB_30)) {
|
||||
isUsingBluetoothAudioRoute = false;
|
||||
|
@ -314,7 +319,8 @@ public class LinphoneManager implements LinphoneCoreListener {
|
|||
Log.d("No bluetooth device available");
|
||||
scoDisconnected();
|
||||
} else {
|
||||
mAudioManager.setMode(AudioManager.MODE_IN_CALL);
|
||||
//Why is this for:
|
||||
//mAudioManager.setMode(AudioManager.MODE_IN_CALL);
|
||||
for (LinphoneOnAudioChangedListener listener : getSimpleListeners(LinphoneOnAudioChangedListener.class)) {
|
||||
listener.onAudioStateChanged(AudioState.SPEAKER);
|
||||
}
|
||||
|
@ -327,16 +333,17 @@ public class LinphoneManager implements LinphoneCoreListener {
|
|||
}
|
||||
|
||||
public void scoConnected() {
|
||||
Log.e("Bluetooth sco connected!");
|
||||
Log.i("Bluetooth sco connected!");
|
||||
isBluetoothScoConnected = true;
|
||||
}
|
||||
|
||||
public void scoDisconnected() {
|
||||
Log.e("Bluetooth sco disconnected!");
|
||||
Log.w("Bluetooth sco disconnected!");
|
||||
isUsingBluetoothAudioRoute = false;
|
||||
isBluetoothScoConnected = false;
|
||||
if (mAudioManager != null) {
|
||||
mAudioManager.setMode(AudioManager.MODE_NORMAL);
|
||||
//why is this for ?
|
||||
//mAudioManager.setMode(AudioManager.MODE_NORMAL);
|
||||
mAudioManager.stopBluetoothSco();
|
||||
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))) {
|
||||
// Brighten screen for at least 10 seconds
|
||||
if (mLc.getCallsNb() == 1) {
|
||||
|
@ -1243,25 +1244,36 @@ public class LinphoneManager implements LinphoneCoreListener {
|
|||
stopRinging();
|
||||
}
|
||||
|
||||
if (state == CallEnd || state == Error) {
|
||||
if (mLc.getCallsNb() == 0) {
|
||||
Log.d("Audio focus released: " + (mAudioManager.abandonAudioFocus(null) == AudioManager.AUDIOFOCUS_REQUEST_GRANTED ? "Granted" : "Denied"));
|
||||
mAudioManager.setMode(AudioManager.MODE_NORMAL);
|
||||
if (state == LinphoneCall.State.Connected) {
|
||||
if (mLc.getCallsNb() == 1) {
|
||||
requestAudioFocus();
|
||||
Compatibility.setAudioManagerInCallMode(mAudioManager);
|
||||
}
|
||||
Context activity = getContext();
|
||||
if (activity != null) {
|
||||
TelephonyManager tm = (TelephonyManager) activity.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
if (tm.getCallState() == TelephonyManager.CALL_STATE_IDLE) {
|
||||
mAudioManager.setMode(AudioManager.MODE_NORMAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (state == State.Connected) {
|
||||
|
||||
if (Hacks.needSoftvolume() || sLPref.useSoftvolume()) {
|
||||
adjustVolume(0); // Synchronize
|
||||
}
|
||||
}
|
||||
|
||||
if (state == CallEnd || state == Error) {
|
||||
if (mLc.getCallsNb() == 0) {
|
||||
if (mAudioFocused){
|
||||
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();
|
||||
if (activity != null) {
|
||||
TelephonyManager tm = (TelephonyManager) activity.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
if (tm.getCallState() == TelephonyManager.CALL_STATE_IDLE) {
|
||||
mAudioManager.setMode(AudioManager.MODE_NORMAL);
|
||||
Log.d("---AudioManager: back to MODE_NORMAL");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (state == CallEnd) {
|
||||
if (mLc.getCallsNb() == 0) {
|
||||
if (mIncallWakeLock != null && mIncallWakeLock.isHeld()) {
|
||||
|
@ -1282,7 +1294,6 @@ public class LinphoneManager implements LinphoneCoreListener {
|
|||
} else {
|
||||
Log.i("New call active while incall (CPU only) wake lock already active");
|
||||
}
|
||||
Compatibility.setAudioManagerInCallMode(mAudioManager);
|
||||
}
|
||||
mListenerDispatcher.onCallStateChanged(call, state, message);
|
||||
}
|
||||
|
@ -1327,6 +1338,14 @@ public class LinphoneManager implements LinphoneCoreListener {
|
|||
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() {
|
||||
if (disableRinging ) {
|
||||
return;
|
||||
|
@ -1342,6 +1361,7 @@ public class LinphoneManager implements LinphoneCoreListener {
|
|||
mVibrator.vibrate(patern, 1);
|
||||
}
|
||||
if (mRingerPlayer == null) {
|
||||
requestAudioFocus();
|
||||
mRingerPlayer = new MediaPlayer();
|
||||
mRingerPlayer.setAudioStreamType(STREAM_RING);
|
||||
mListenerDispatcher.onRingerPlayerCreated(mRingerPlayer);
|
||||
|
@ -1367,6 +1387,9 @@ public class LinphoneManager implements LinphoneCoreListener {
|
|||
mVibrator.cancel();
|
||||
}
|
||||
|
||||
if (Hacks.needGalaxySAudioHack())
|
||||
mAudioManager.setMode(AudioManager.MODE_NORMAL);
|
||||
|
||||
isRinging = false;
|
||||
// You may need to call galaxys audio hack after this method
|
||||
routeAudioToReceiver();
|
||||
|
@ -1628,7 +1651,7 @@ public class LinphoneManager implements LinphoneCoreListener {
|
|||
|
||||
Context activity = getContext();
|
||||
if (activity != null) {
|
||||
TelephonyManager tm = (TelephonyManager) activity.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
TelephonyManager tm = (TelephonyManager) activity.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
if (state == State.CallEnd && mLc.getCallsNb() == 0 && tm.getCallState() == TelephonyManager.CALL_STATE_IDLE) {
|
||||
routeAudioToReceiver();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue