diff --git a/res/raw/linphonerc b/res/raw/linphonerc index 0df56c600..5f3bbe5f0 100644 --- a/res/raw/linphonerc +++ b/res/raw/linphonerc @@ -29,9 +29,9 @@ video_jitt_comp=60 nortp_timeout=30 [sound] -playback_dev_id=ANDROID SND: Android Sound card -ringer_dev_id=ANDROID SND: Android Sound card -capture_dev_id=ANDROID SND: Android Sound card +playback_dev_id= +ringer_dev_id= +capture_dev_id= remote_ring=/data/data/org.linphone/files/ringback.wav local_ring=/data/data/org.linphone/files/oldphone_mono.wav ec_tail_len=120 diff --git a/res/values/non_localizable_strings.xml b/res/values/non_localizable_strings.xml index 7b7a4dc64..c4354ccda 100644 --- a/res/values/non_localizable_strings.xml +++ b/res/values/non_localizable_strings.xml @@ -33,7 +33,6 @@ pref_transport_use_standard_ports_key pref_echo_canceller_calibration_key - pref_echo_limiter_key pref_prefix_key pref_proxy_key pref_domain_key diff --git a/res/values/strings.xml b/res/values/strings.xml index 3ee1e4190..9c35134d9 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -120,7 +120,6 @@ Delete this account Use as default Echo canceller calibration - Echo limiter Use front camera Video Preferences @@ -211,11 +210,11 @@ Cannot invite destination address [%s] started -Removes the echo heard by other end (not recommended) -Removes the echo heard by other end (brute force method) +Removes the echo heard by other end Stun server Calibrating... Calibrated [%s ms] +No echo failed Enter your username and password to connect to the service. Username diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index 3e7a9948e..e00f6bfef 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -56,13 +56,10 @@ - - - diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java index 755b9b0a9..db62aa321 100644 --- a/src/org/linphone/LinphoneActivity.java +++ b/src/org/linphone/LinphoneActivity.java @@ -21,14 +21,18 @@ package org.linphone; import static android.content.Intent.ACTION_MAIN; +import org.linphone.LinphoneManager.EcCalibrationListener; import org.linphone.LinphoneSimpleListener.LinphoneOnCallStateChangedListener; import org.linphone.compatibility.Compatibility; import org.linphone.core.LinphoneCall; import org.linphone.core.LinphoneCall.State; import org.linphone.core.LinphoneCore; +import org.linphone.core.LinphoneCore.EcCalibratorStatus; import org.linphone.core.LinphoneCore.RegistrationState; +import org.linphone.core.LinphoneCoreException; import org.linphone.core.Log; import org.linphone.mediastream.Version; +import org.linphone.mediastream.video.capture.hwconf.Hacks; import android.app.AlertDialog; import android.app.TabActivity; @@ -148,19 +152,25 @@ public class LinphoneActivity extends TabActivity implements ContactPicked switch (requestCode) { case FIRST_LOGIN_ACTIVITY: if (resultCode == RESULT_OK) { -// Toast.makeText(this, getString(R.string.ec_calibration_launch_message), Toast.LENGTH_LONG).show(); -// try { -// LinphoneManager.getInstance().startEcCalibration(new EcCalibrationListener() { -// public void onEcCalibrationStatus(EcCalibratorStatus status, int delayMs) { -// PreferenceManager.getDefaultSharedPreferences(LinphoneActivity.this) -// .edit().putBoolean( -// getString(R.string.pref_echo_canceller_calibration_key), -// status == EcCalibratorStatus.Done).commit(); -// } -// }); -// } catch (LinphoneCoreException e) { -// Log.e(e, "Unable to calibrate EC"); -// } + if (!Hacks.hasBuiltInEchoCanceller()) { + Toast.makeText(this, getString(R.string.ec_calibration_launch_message), Toast.LENGTH_LONG).show(); + try { + LinphoneManager.getInstance().startEcCalibration(new EcCalibrationListener() { + public void onEcCalibrationStatus(EcCalibratorStatus status, int delayMs) { + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(LinphoneActivity.this); + SharedPreferences.Editor editor = prefs.edit(); + if (status == EcCalibratorStatus.DoneNoEcho) { + editor.putBoolean(getString(R.string.pref_echo_cancellation_key), false); + } else if ((status == EcCalibratorStatus.Done) || (status == EcCalibratorStatus.Failed)) { + editor.putBoolean(getString(R.string.pref_echo_cancellation_key), true); + } + editor.commit(); + } + }); + } catch (LinphoneCoreException e) { + Log.e(e, "Unable to calibrate EC"); + } + } fillTabHost(); } else { finish(); diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java index 51fc3bd1b..7cf1643b3 100644 --- a/src/org/linphone/LinphoneManager.java +++ b/src/org/linphone/LinphoneManager.java @@ -605,9 +605,7 @@ public final class LinphoneManager implements LinphoneCoreListener { } boolean useEC = getPrefBoolean(R.string.pref_echo_cancellation_key, false); - boolean useEL = getPrefBoolean(R.string.pref_echo_limiter_key, false); mLc.enableEchoCancellation(useEC); - mLc.enableEchoLimiter(useEL); } catch (LinphoneCoreException e) { throw new LinphoneConfigException(getString(R.string.wrong_settings),e); } diff --git a/src/org/linphone/LinphonePreferencesActivity.java b/src/org/linphone/LinphonePreferencesActivity.java index f15b19ded..b633cfcfe 100644 --- a/src/org/linphone/LinphonePreferencesActivity.java +++ b/src/org/linphone/LinphonePreferencesActivity.java @@ -26,7 +26,6 @@ import static org.linphone.R.string.pref_codec_ilbc_key; import static org.linphone.R.string.pref_codec_speex16_key; import static org.linphone.R.string.pref_echo_cancellation_key; import static org.linphone.R.string.pref_echo_canceller_calibration_key; -import static org.linphone.R.string.pref_echo_limiter_key; import static org.linphone.R.string.pref_media_encryption_key; import static org.linphone.R.string.pref_video_enable_key; @@ -76,8 +75,7 @@ import de.timroes.axmlrpc.XMLRPCServerException; public class LinphonePreferencesActivity extends PreferenceActivity implements EcCalibrationListener { private Handler mHandler = new Handler(); - private CheckBoxPreference ecCalibratePref; - private CheckBoxPreference elPref; + private Preference ecCalibratePref; private CheckBoxPreference ecPref; private ListPreference mencPref; private int nbAccounts = 1; @@ -597,7 +595,7 @@ public class LinphonePreferencesActivity extends PreferenceActivity implements E addTransportChecboxesListener(); - ecCalibratePref = (CheckBoxPreference) findPreference(pref_echo_canceller_calibration_key); + ecCalibratePref = findPreference(pref_echo_canceller_calibration_key); ecCalibratePref.setOnPreferenceClickListener(new OnPreferenceClickListener() { public boolean onPreferenceClick(Preference preference) { startEcCalibration(); @@ -605,7 +603,6 @@ public class LinphonePreferencesActivity extends PreferenceActivity implements E } }); ecPref = (CheckBoxPreference) findPreference(pref_echo_cancellation_key); - elPref = (CheckBoxPreference) findPreference(pref_echo_limiter_key); mencPref = (ListPreference) findPreference(pref_media_encryption_key); boolean fastCpu = Version.isArmv7(); @@ -614,7 +611,6 @@ public class LinphonePreferencesActivity extends PreferenceActivity implements E findPreference(pref_codec_speex16_key).setEnabled(true); //findPreference(pref_codec_speex32_key)).setEnabled(enableIlbc); } - findPreference(pref_echo_limiter_key).setEnabled(true); initializeMediaEncryptionPreferences(); @@ -637,9 +633,8 @@ public class LinphonePreferencesActivity extends PreferenceActivity implements E doOnFirstLaunch(); } if (Hacks.hasBuiltInEchoCanceller()) { - uncheckDisableAndHideCheckbox(R.string.pref_echo_limiter_key); uncheckDisableAndHideCheckbox(R.string.pref_echo_cancellation_key); - uncheckDisableAndHideCheckbox(R.string.pref_echo_canceller_calibration_key); + findPreference(R.string.pref_echo_canceller_calibration_key).setLayoutResource(R.layout.hidden); } @@ -651,10 +646,6 @@ public class LinphonePreferencesActivity extends PreferenceActivity implements E findPreference(R.string.pref_video_codec_h264_key).setDefaultValue(false); } - addEchoPrefsListener(); - - if (Hacks.needSoftvolume()) checkAndDisableCheckbox(R.string.pref_audio_soft_volume_key); - if (!LinphoneManager.getLc().isTunnelAvailable()){ hidePreferenceCategory(R.string.pref_tunnel_key); } @@ -677,7 +668,6 @@ public class LinphonePreferencesActivity extends PreferenceActivity implements E } private void doOnFirstLaunch() { - manageCheckbox(R.string.pref_echo_limiter_key, !Hacks.hasBuiltInEchoCanceller(), true, false); prefs().edit().putBoolean(LinphoneActivity.PREF_FIRST_LAUNCH, false).commit(); } @@ -711,29 +701,6 @@ public class LinphonePreferencesActivity extends PreferenceActivity implements E } } - private void addEchoPrefsListener(){ - OnPreferenceChangeListener ec_listener=new OnPreferenceChangeListener(){ - public boolean onPreferenceChange(Preference arg0, Object newValue) { - Boolean val=(Boolean)newValue; - if (val){ - elPref.setChecked(!val); - } - return true; - } - }; - OnPreferenceChangeListener el_listener=new OnPreferenceChangeListener(){ - public boolean onPreferenceChange(Preference arg0, Object newValue) { - Boolean val=(Boolean)newValue; - if (val){ - ecPref.setChecked(!val); - } - return true; - } - }; - ecPref.setOnPreferenceChangeListener(ec_listener); - elPref.setOnPreferenceChangeListener(el_listener); - } - private void addTransportChecboxesListener() { final List checkboxes = Arrays.asList( @@ -801,15 +768,15 @@ public class LinphonePreferencesActivity extends PreferenceActivity implements E mHandler.post(new Runnable() { public void run() { - if (status == EcCalibratorStatus.Done) { + if (status == EcCalibratorStatus.DoneNoEcho) { + ecCalibratePref.setSummary(R.string.no_echo); + ecPref.setChecked(false); + } else if (status == EcCalibratorStatus.Done) { ecCalibratePref.setSummary(String.format(getString(R.string.ec_calibrated), delayMs)); - ecCalibratePref.setChecked(true); - + ecPref.setChecked(true); } else if (status == EcCalibratorStatus.Failed) { ecCalibratePref.setSummary(R.string.failed); - ecCalibratePref.setChecked(false); - elPref.setChecked(true); - ecPref.setChecked(false); + ecPref.setChecked(true); } } });