From 07391a4c4d78a925faa5a8f1f86fddd36d43c9ee Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 20 Jun 2013 10:07:22 +0200 Subject: [PATCH 1/5] Manifest version code set to 2110 --- AndroidManifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 351e23859..df49f08f8 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,7 +1,7 @@ + android:versionCode="2110" android:installLocation="auto"> From 29acd2cafd51c7f3fac63579d410cabf78328e7b Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 26 Jun 2013 07:31:32 +0200 Subject: [PATCH 2/5] Updated Russian translation thanks to Maxim Solodovnik --- res/values-RU/strings.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/res/values-RU/strings.xml b/res/values-RU/strings.xml index a25ef7733..0a501cfa1 100755 --- a/res/values-RU/strings.xml +++ b/res/values-RU/strings.xml @@ -355,6 +355,9 @@ Видео Микрофон Громкость + Маршрут + Получатель + Bluetooth Настройки Послать @@ -384,6 +387,7 @@ хочет поделиться своим статусом с Вами и получать обновления Вашего статуса. Идёт настройка шумоподавления Общий сервер + Удалённое резервирование Удалить контакт адрес SIP @@ -413,4 +417,7 @@ Входящий Фоновый режим + + Скачать + Ошибка скачивания. Проверьте ваше интернет соединение или попробуйте позже. From 05fbb9ef03d6f7550083722c7014e830dad908a9 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 26 Jun 2013 14:16:23 +0200 Subject: [PATCH 3/5] Simon's fixes for LinphoneManager + fix for bluetooth --- src/org/linphone/InCallActivity.java | 14 ++-- src/org/linphone/LinphoneManager.java | 104 +++++++++++++++----------- 2 files changed, 69 insertions(+), 49 deletions(-) diff --git a/src/org/linphone/InCallActivity.java b/src/org/linphone/InCallActivity.java index f5f7f8cf1..af06903fe 100644 --- a/src/org/linphone/InCallActivity.java +++ b/src/org/linphone/InCallActivity.java @@ -228,7 +228,7 @@ public class InCallActivity extends FragmentActivity implements routeBluetooth = (TextView) findViewById(R.id.routeBluetooth); routeBluetooth.setOnClickListener(this); } catch (NullPointerException npe) { - Log.e("Audio routes menu disabled on tablets for now"); + Log.e("Bluetooth: Audio routes menu disabled on tablets for now (1)"); } switchCamera = (ImageView) findViewById(R.id.switchCamera); @@ -251,16 +251,18 @@ public class InCallActivity extends FragmentActivity implements if (LinphoneManager.getInstance().isBluetoothScoConnected) { try { - routeLayout.setVisibility(View.VISIBLE); + if (routeLayout != null) + routeLayout.setVisibility(View.VISIBLE); audioRoute.setVisibility(View.VISIBLE); speaker.setVisibility(View.GONE); - } catch (NullPointerException npe) {} + } catch (NullPointerException npe) { Log.e("Bluetooth: Audio routes menu disabled on tablets for now (2)"); } } else { try { - routeLayout.setVisibility(View.GONE); + if (routeLayout != null) + routeLayout.setVisibility(View.GONE); audioRoute.setVisibility(View.GONE); speaker.setVisibility(View.VISIBLE); - } catch (NullPointerException npe) {} + } catch (NullPointerException npe) { Log.e("Bluetooth: Audio routes menu disabled on tablets for now (3)"); } } } @@ -299,7 +301,7 @@ public class InCallActivity extends FragmentActivity implements } } } catch (NullPointerException npe) { - Log.e("Audio routes menu disabled on tablets for now"); + Log.e("Bluetooth: Audio routes menu disabled on tablets for now (4)"); } if (isMicMuted) { diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java index f35da5dcf..d10d04bc0 100644 --- a/src/org/linphone/LinphoneManager.java +++ b/src/org/linphone/LinphoneManager.java @@ -148,6 +148,7 @@ public class LinphoneManager implements LinphoneCoreListener { private String basePath; private static boolean sExited; private String contactParams; + private boolean mAudioFocused; private WakeLock mIncallWakeLock; @@ -157,6 +158,7 @@ public class LinphoneManager implements LinphoneCoreListener { private BroadcastReceiver bluetoothReiceiver = new BluetoothManager(); public boolean isBluetoothScoConnected; public boolean isUsingBluetoothAudioRoute; + private boolean mBluetoothStarted; public ChatStorage chatStorage; @@ -211,10 +213,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) { @@ -259,6 +262,7 @@ public class LinphoneManager implements LinphoneCoreListener { public void onServiceConnected(int profile, BluetoothProfile proxy) { if (profile == BluetoothProfile.HEADSET) { mBluetoothHeadset = (BluetoothHeadset) proxy; + isBluetoothScoConnected = true; Log.d("Bluetooth headset connected"); } } @@ -266,8 +270,8 @@ public class LinphoneManager implements LinphoneCoreListener { public void onServiceDisconnected(int profile) { if (profile == BluetoothProfile.HEADSET) { mBluetoothHeadset = null; - Log.d("Bluetooth headset disconnected"); isBluetoothScoConnected = false; + Log.d("Bluetooth headset disconnected"); routeAudioToReceiver(); } } @@ -293,10 +297,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; @@ -311,7 +316,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); } @@ -324,16 +330,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); } @@ -484,12 +491,6 @@ public class LinphoneManager implements LinphoneCoreListener { getLc().playDtmf(dtmf, -1); } - - public void changeResolution() { - BandwidthManager manager = BandwidthManager.getInstance(); - manager.setUserRestriction(!manager.isUserRestriction()); - } - public void terminateCall() { if (mLc.isIncall()) { mLc.terminateCall(mLc.getCurrentCall()); @@ -579,14 +580,15 @@ public class LinphoneManager implements LinphoneCoreListener { } catch (LinphoneException e) { Log.w("no config ready yet"); } - + TimerTask lTask = new TimerTask() { @Override public void run() { mLc.iterate(); } }; - mTimer.scheduleAtFixedRate(lTask, 0, 20); + /*use schedule instead of scheduleAtFixedRate to avoid iterate from being call in burst after cpu wake up*/ + mTimer.schedule(lTask, 0, 20); IntentFilter lFilter = new IntentFilter(Intent.ACTION_SCREEN_ON); lFilter.addAction(Intent.ACTION_SCREEN_OFF); @@ -863,9 +865,11 @@ public class LinphoneManager implements LinphoneCoreListener { //stun server String lStun = getPrefString(R.string.pref_stun_server_key, getString(R.string.default_stun)); boolean useICE = getPrefBoolean(R.string.pref_ice_enable_key, mR.getBoolean(R.bool.pref_ice_enabled_default)); + //boolean useUpnp = getPrefBoolean(R.string.pref_upnp_enable_key, mR.getBoolean(R.bool.pref_upnp_enabled_default)); + mLc.setStunServer(lStun); if (lStun!=null && lStun.length()>0) { - mLc.setFirewallPolicy(useICE ? FirewallPolicy.UseIce : FirewallPolicy.UseStun); + mLc.setFirewallPolicy(useICE ? FirewallPolicy.UseIce : FirewallPolicy.UseStun); } else { mLc.setFirewallPolicy(FirewallPolicy.NoFirewall); } @@ -1215,13 +1219,6 @@ public class LinphoneManager implements LinphoneCoreListener { } } - if (state == LinphoneCall.State.Connected) { - if (mLc.getCallsNb() == 1) { - int res=mAudioManager.requestAudioFocus(null, AudioManager.STREAM_VOICE_CALL, AudioManager.AUDIOFOCUS_GAIN); - Log.d("Audio focus requested: " + (res == 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) { @@ -1233,27 +1230,37 @@ public class LinphoneManager implements LinphoneCoreListener { //previous state was ringing, so stop ringing stopRinging(); } - - if (state == CallEnd || state == Error || state == CallReleased) { - if (mLc.getCallsNb() == 0) { - int res=mAudioManager.abandonAudioFocus(null); - Log.d("Audio focus released: " + (res == 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()) { @@ -1274,7 +1281,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); } @@ -1319,6 +1325,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; @@ -1334,6 +1348,7 @@ public class LinphoneManager implements LinphoneCoreListener { mVibrator.vibrate(patern, 1); } if (mRingerPlayer == null) { + requestAudioFocus(); mRingerPlayer = new MediaPlayer(); mRingerPlayer.setAudioStreamType(STREAM_RING); mListenerDispatcher.onRingerPlayerCreated(mRingerPlayer); @@ -1358,7 +1373,10 @@ public class LinphoneManager implements LinphoneCoreListener { if (mVibrator!=null) { mVibrator.cancel(); } - + + if (Hacks.needGalaxySAudioHack()) + mAudioManager.setMode(AudioManager.MODE_NORMAL); + isRinging = false; // You may need to call galaxys audio hack after this method routeAudioToReceiver(); @@ -1620,7 +1638,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(); } From 95c2cab9a5488b827130f008999764383c16f772 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 26 Jun 2013 15:08:03 +0200 Subject: [PATCH 4/5] Manifest code set to 2120 --- AndroidManifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index df49f08f8..6990d4d42 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,7 +1,7 @@ + android:versionCode="2120" android:installLocation="auto"> From 23b7fc05a9826e12e2568efe4ddd8d4ecf7c4a2c Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 2 Jul 2013 17:07:20 +0200 Subject: [PATCH 5/5] Update linphone submodule. --- Makefile | 4 ++-- submodules/linphone | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 2784a9f26..941f263f5 100644 --- a/Makefile +++ b/Makefile @@ -84,8 +84,8 @@ prepare-srtp: $(TOPDIR)/submodules/externals/srtp/config.h prepare-mediastreamer2: @cd $(TOPDIR)/submodules/linphone/mediastreamer2/src/ && \ - eval `cat Makefile.am | grep xxd | grep yuv2rgb.vs | sed 's/$$$$builddir/./'` && \ - eval `cat Makefile.am | grep xxd | grep yuv2rgb.fs | sed 's/$$$$builddir/./'` && \ + eval `cat Makefile.am | grep xxd | grep yuv2rgb.vs | sed 's/\$$(abs_builddir)/./'` && \ + eval `cat Makefile.am | grep xxd | grep yuv2rgb.fs | sed 's/\$$(abs_builddir)/./'` && \ if ! [ -e yuv2rgb.vs.h ]; then echo "yuv2rgb.vs.h creation error (do you have 'xxd' application installed ?)"; exit 1; fi && \ if ! [ -e yuv2rgb.fs.h ]; then echo "yuv2rgb.fs.h creation error (do you have 'xxd' application installed ?)"; exit 1; fi diff --git a/submodules/linphone b/submodules/linphone index 3bff0cef8..5dbfc1d3e 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 3bff0cef821cf8f8c42fc78aa30917469d7bf0b2 +Subproject commit 5dbfc1d3e1426b6f805f890c850df73ed97381ad