[Switch submodule branch] Uncommented tunnel related code
This commit is contained in:
parent
0dc98268c5
commit
7137609898
5 changed files with 28 additions and 25 deletions
|
@ -64,7 +64,6 @@ import android.os.Handler;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.PowerManager.WakeLock;
|
import android.os.PowerManager.WakeLock;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
import android.preference.CheckBoxPreference;
|
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.provider.Settings.SettingNotFoundException;
|
import android.provider.Settings.SettingNotFoundException;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
|
@ -100,7 +99,6 @@ import org.linphone.core.Core.LogCollectionUploadState;
|
||||||
import org.linphone.core.RegistrationState;
|
import org.linphone.core.RegistrationState;
|
||||||
import org.linphone.core.ConfiguringState;
|
import org.linphone.core.ConfiguringState;
|
||||||
import org.linphone.core.CoreException;
|
import org.linphone.core.CoreException;
|
||||||
import org.linphone.core.ErrorInfo;
|
|
||||||
import org.linphone.core.Factory;
|
import org.linphone.core.Factory;
|
||||||
import org.linphone.core.CoreListener;
|
import org.linphone.core.CoreListener;
|
||||||
import org.linphone.core.Event;
|
import org.linphone.core.Event;
|
||||||
|
@ -110,13 +108,13 @@ import org.linphone.core.InfoMessage;
|
||||||
import org.linphone.core.PresenceActivity;
|
import org.linphone.core.PresenceActivity;
|
||||||
import org.linphone.core.ProxyConfig;
|
import org.linphone.core.ProxyConfig;
|
||||||
import org.linphone.core.PublishState;
|
import org.linphone.core.PublishState;
|
||||||
|
import org.linphone.core.Tunnel;
|
||||||
import org.linphone.core.tools.OpenH264DownloadHelperListener;
|
import org.linphone.core.tools.OpenH264DownloadHelperListener;
|
||||||
import org.linphone.core.PayloadType;
|
|
||||||
import org.linphone.core.PresenceBasicStatus;
|
import org.linphone.core.PresenceBasicStatus;
|
||||||
import org.linphone.core.PresenceModel;
|
import org.linphone.core.PresenceModel;
|
||||||
import org.linphone.core.Reason;
|
import org.linphone.core.Reason;
|
||||||
import org.linphone.core.SubscriptionState;
|
import org.linphone.core.SubscriptionState;
|
||||||
//import org.linphone.core.TunnelConfig;
|
import org.linphone.core.TunnelConfig;
|
||||||
import org.linphone.core.VersionUpdateCheckResult;
|
import org.linphone.core.VersionUpdateCheckResult;
|
||||||
import org.linphone.mediastream.Log;
|
import org.linphone.mediastream.Log;
|
||||||
import org.linphone.mediastream.Version;
|
import org.linphone.mediastream.Version;
|
||||||
|
@ -530,17 +528,18 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
if (!mLc.tunnelAvailable())
|
if (!mLc.tunnelAvailable())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*NetworkInfo info = mConnectivityManager.getActiveNetworkInfo();
|
NetworkInfo info = mConnectivityManager.getActiveNetworkInfo();
|
||||||
mLc.tunnelCleanServers();
|
Tunnel tunnel = mLc.getTunnel();
|
||||||
|
tunnel.cleanServers();
|
||||||
TunnelConfig config = mPrefs.getTunnelConfig();
|
TunnelConfig config = mPrefs.getTunnelConfig();
|
||||||
if (config.getHost() != null) {
|
if (config.getHost() != null) {
|
||||||
mLc.tunnelAddServer(config);
|
tunnel.addServer(config);
|
||||||
manageTunnelServer(info);
|
manageTunnelServer(info);
|
||||||
}*/ // TODO FIXME
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isTunnelNeeded(NetworkInfo info) {
|
private boolean isTunnelNeeded(NetworkInfo info) {
|
||||||
/*if (info == null) {
|
if (info == null) {
|
||||||
Log.i("No connectivity: tunnel should be disabled");
|
Log.i("No connectivity: tunnel should be disabled");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -555,7 +554,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
&& getString(R.string.tunnel_mode_entry_value_3G_only).equals(pref)) {
|
&& getString(R.string.tunnel_mode_entry_value_3G_only).equals(pref)) {
|
||||||
Log.i("need tunnel: 'no wifi' connection");
|
Log.i("need tunnel: 'no wifi' connection");
|
||||||
return true;
|
return true;
|
||||||
}*/ // TODO FIXME
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -563,19 +562,20 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
private void manageTunnelServer(NetworkInfo info) {
|
private void manageTunnelServer(NetworkInfo info) {
|
||||||
if (mLc == null) return;
|
if (mLc == null) return;
|
||||||
if (!mLc.tunnelAvailable()) return;
|
if (!mLc.tunnelAvailable()) return;
|
||||||
|
Tunnel tunnel = mLc.getTunnel();
|
||||||
|
|
||||||
/*Log.i("Managing tunnel");
|
Log.i("Managing tunnel");
|
||||||
if (isTunnelNeeded(info)) {
|
if (isTunnelNeeded(info)) {
|
||||||
Log.i("Tunnel need to be activated");
|
Log.i("Tunnel need to be activated");
|
||||||
mLc.tunnelSetMode(Core.TunnelMode.enable);
|
tunnel.setMode(Tunnel.Mode.Enable);
|
||||||
} else {
|
} else {
|
||||||
Log.i("Tunnel should not be used");
|
Log.i("Tunnel should not be used");
|
||||||
String pref = mPrefs.getTunnelMode();
|
String pref = mPrefs.getTunnelMode();
|
||||||
mLc.tunnelSetMode(Core.TunnelMode.disable);
|
tunnel.setMode(Tunnel.Mode.Disable);
|
||||||
if (getString(R.string.tunnel_mode_entry_value_auto).equals(pref)) {
|
if (getString(R.string.tunnel_mode_entry_value_auto).equals(pref)) {
|
||||||
mLc.tunnelSetMode(Core.TunnelMode.auto);
|
tunnel.setMode(Tunnel.Mode.Auto);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}*/ // TODO FIXME
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized final void destroyCore() {
|
public synchronized final void destroyCore() {
|
||||||
|
|
|
@ -38,6 +38,8 @@ import org.linphone.core.NatPolicy;
|
||||||
import org.linphone.core.ProxyConfig;
|
import org.linphone.core.ProxyConfig;
|
||||||
import org.linphone.core.Config;
|
import org.linphone.core.Config;
|
||||||
//import org.linphone.core.TunnelConfig;
|
//import org.linphone.core.TunnelConfig;
|
||||||
|
import org.linphone.core.Tunnel;
|
||||||
|
import org.linphone.core.TunnelConfig;
|
||||||
import org.linphone.core.VideoActivationPolicy;
|
import org.linphone.core.VideoActivationPolicy;
|
||||||
import org.linphone.mediastream.Log;
|
import org.linphone.mediastream.Log;
|
||||||
import org.linphone.purchase.Purchasable;
|
import org.linphone.purchase.Purchasable;
|
||||||
|
@ -1290,12 +1292,13 @@ public class LinphonePreferences {
|
||||||
// End of advanced settings
|
// End of advanced settings
|
||||||
|
|
||||||
// Tunnel settings
|
// Tunnel settings
|
||||||
/*private TunnelConfig tunnelConfig = null;
|
private TunnelConfig tunnelConfig = null;
|
||||||
|
|
||||||
public TunnelConfig getTunnelConfig() {
|
public TunnelConfig getTunnelConfig() {
|
||||||
if(getLc().tunnelAvailable()) {
|
if(getLc().tunnelAvailable()) {
|
||||||
if(tunnelConfig == null) {
|
Tunnel tunnel = getLc().getTunnel();
|
||||||
TunnelConfig servers[] = getLc().tunnelGetServers();
|
if (tunnelConfig == null) {
|
||||||
|
TunnelConfig servers[] = tunnel.getServers();
|
||||||
if(servers.length > 0) {
|
if(servers.length > 0) {
|
||||||
tunnelConfig = servers[0];
|
tunnelConfig = servers[0];
|
||||||
} else {
|
} else {
|
||||||
|
@ -1349,7 +1352,7 @@ public class LinphonePreferences {
|
||||||
public void setTunnelMode(String mode) {
|
public void setTunnelMode(String mode) {
|
||||||
getConfig().setString("app", "tunnel", mode);
|
getConfig().setString("app", "tunnel", mode);
|
||||||
LinphoneManager.getInstance().initTunnelFromConf();
|
LinphoneManager.getInstance().initTunnelFromConf();
|
||||||
}*/
|
}
|
||||||
// End of tunnel settings
|
// End of tunnel settings
|
||||||
|
|
||||||
public boolean isProvisioningLoginViewEnabled() {
|
public boolean isProvisioningLoginViewEnabled() {
|
||||||
|
|
|
@ -290,16 +290,16 @@ public class SettingsFragment extends PreferencesListFragment {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*setPreferenceDefaultValueAndSummary(R.string.pref_tunnel_host_key, mPrefs.getTunnelHost());
|
setPreferenceDefaultValueAndSummary(R.string.pref_tunnel_host_key, mPrefs.getTunnelHost());
|
||||||
setPreferenceDefaultValueAndSummary(R.string.pref_tunnel_port_key, String.valueOf(mPrefs.getTunnelPort()));
|
setPreferenceDefaultValueAndSummary(R.string.pref_tunnel_port_key, String.valueOf(mPrefs.getTunnelPort()));
|
||||||
ListPreference tunnelModePref = (ListPreference) findPreference(getString(R.string.pref_tunnel_mode_key));
|
ListPreference tunnelModePref = (ListPreference) findPreference(getString(R.string.pref_tunnel_mode_key));
|
||||||
String tunnelMode = mPrefs.getTunnelMode();
|
String tunnelMode = mPrefs.getTunnelMode();
|
||||||
tunnelModePref.setSummary(tunnelMode);
|
tunnelModePref.setSummary(tunnelMode);
|
||||||
tunnelModePref.setValue(tunnelMode);*/
|
tunnelModePref.setValue(tunnelMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setTunnelPreferencesListener() {
|
private void setTunnelPreferencesListener() {
|
||||||
/*findPreference(getString(R.string.pref_tunnel_host_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
findPreference(getString(R.string.pref_tunnel_host_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
String host = newValue.toString();
|
String host = newValue.toString();
|
||||||
|
@ -329,7 +329,7 @@ public class SettingsFragment extends PreferencesListFragment {
|
||||||
preference.setSummary(mode);
|
preference.setSummary(mode);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});*/
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initAccounts() {
|
private void initAccounts() {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit c65f14509eeec3192cd1170646b700e9428ac292
|
Subproject commit 8e841b047641b1812a83880a90e89d702747ca5b
|
|
@ -1 +1 @@
|
||||||
Subproject commit 716ceeb474a415d685ca0f8377c3bf20819f9866
|
Subproject commit 36aa0bfd0e18a2ff7316ea0013ea7313b5f09b6c
|
Loading…
Reference in a new issue