Avoid infinite loop when deleting an account when registration is not enabled
This commit is contained in:
parent
7051daa9cb
commit
5e55fcd36f
1 changed files with 139 additions and 136 deletions
|
@ -42,61 +42,61 @@ public class LinphonePreferences {
|
||||||
private static final int LINPHONE_CORE_RANDOM_PORT = -1;
|
private static final int LINPHONE_CORE_RANDOM_PORT = -1;
|
||||||
private static LinphonePreferences instance;
|
private static LinphonePreferences instance;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
|
||||||
public static final synchronized LinphonePreferences instance() {
|
public static final synchronized LinphonePreferences instance() {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
instance = new LinphonePreferences();
|
instance = new LinphonePreferences();
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private LinphonePreferences() {
|
private LinphonePreferences() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContext(Context c) {
|
public void setContext(Context c) {
|
||||||
mContext = c;
|
mContext = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getString(int key) {
|
private String getString(int key) {
|
||||||
if (mContext == null && LinphoneManager.isInstanciated()) {
|
if (mContext == null && LinphoneManager.isInstanciated()) {
|
||||||
mContext = LinphoneManager.getInstance().getContext();
|
mContext = LinphoneManager.getInstance().getContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
return mContext.getString(key);
|
return mContext.getString(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
private LinphoneCore getLc() {
|
private LinphoneCore getLc() {
|
||||||
if (!LinphoneManager.isInstanciated())
|
if (!LinphoneManager.isInstanciated())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
return LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
public LpConfig getConfig() {
|
public LpConfig getConfig() {
|
||||||
LinphoneCore lc = getLc();
|
LinphoneCore lc = getLc();
|
||||||
if (lc != null) {
|
if (lc != null) {
|
||||||
return lc.getConfig();
|
return lc.getConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LinphoneManager.isInstanciated()) {
|
if (!LinphoneManager.isInstanciated()) {
|
||||||
Log.w("LinphoneManager not instanciated yet...");
|
Log.w("LinphoneManager not instanciated yet...");
|
||||||
return LinphoneCoreFactory.instance().createLpConfig(mContext.getFilesDir().getAbsolutePath() + "/.linphonerc");
|
return LinphoneCoreFactory.instance().createLpConfig(mContext.getFilesDir().getAbsolutePath() + "/.linphonerc");
|
||||||
}
|
}
|
||||||
|
|
||||||
return LinphoneCoreFactory.instance().createLpConfig(LinphoneManager.getInstance().mLinphoneConfigFile);
|
return LinphoneCoreFactory.instance().createLpConfig(LinphoneManager.getInstance().mLinphoneConfigFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removePreviousVersionAuthInfoRemoval() {
|
public void removePreviousVersionAuthInfoRemoval() {
|
||||||
getConfig().setBool("sip", "store_auth_info", true);
|
getConfig().setBool("sip", "store_auth_info", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// App settings
|
// App settings
|
||||||
public boolean isFirstLaunch() {
|
public boolean isFirstLaunch() {
|
||||||
return getConfig().getBool("app", "first_launch", true);
|
return getConfig().getBool("app", "first_launch", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void firstLaunchSuccessful() {
|
public void firstLaunchSuccessful() {
|
||||||
getConfig().setBool("app", "first_launch", false);
|
getConfig().setBool("app", "first_launch", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,17 +106,17 @@ public class LinphonePreferences {
|
||||||
ringtone = defaultRingtone;
|
ringtone = defaultRingtone;
|
||||||
return ringtone;
|
return ringtone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRingtone(String ringtonePath) {
|
public void setRingtone(String ringtonePath) {
|
||||||
getConfig().setString("app", "ringtone", ringtonePath);
|
getConfig().setString("app", "ringtone", ringtonePath);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean shouldAutomaticallyAcceptFriendsRequests() {
|
public boolean shouldAutomaticallyAcceptFriendsRequests() {
|
||||||
return false; //TODO
|
return false; //TODO
|
||||||
}
|
}
|
||||||
// End of app settings
|
// End of app settings
|
||||||
|
|
||||||
// Accounts settings
|
// Accounts settings
|
||||||
private LinphoneProxyConfig getProxyConfig(int n) {
|
private LinphoneProxyConfig getProxyConfig(int n) {
|
||||||
LinphoneProxyConfig[] prxCfgs = getLc().getProxyConfigList();
|
LinphoneProxyConfig[] prxCfgs = getLc().getProxyConfigList();
|
||||||
|
@ -124,7 +124,7 @@ public class LinphonePreferences {
|
||||||
return null;
|
return null;
|
||||||
return prxCfgs[n];
|
return prxCfgs[n];
|
||||||
}
|
}
|
||||||
|
|
||||||
private LinphoneAuthInfo getAuthInfo(int n) {
|
private LinphoneAuthInfo getAuthInfo(int n) {
|
||||||
LinphoneProxyConfig prxCfg = getProxyConfig(n);
|
LinphoneProxyConfig prxCfg = getProxyConfig(n);
|
||||||
try {
|
try {
|
||||||
|
@ -134,10 +134,10 @@ public class LinphonePreferences {
|
||||||
} catch (LinphoneCoreException e) {
|
} catch (LinphoneCoreException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a authInfo from the core and returns a copy of it.
|
* Removes a authInfo from the core and returns a copy of it.
|
||||||
* Useful to edit a authInfo (you should call saveAuthInfo after the modifications to save them).
|
* Useful to edit a authInfo (you should call saveAuthInfo after the modifications to save them).
|
||||||
|
@ -146,12 +146,12 @@ public class LinphonePreferences {
|
||||||
LinphoneAuthInfo authInfo = getAuthInfo(n);
|
LinphoneAuthInfo authInfo = getAuthInfo(n);
|
||||||
if (authInfo == null)
|
if (authInfo == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
LinphoneAuthInfo cloneAuthInfo = authInfo.clone();
|
LinphoneAuthInfo cloneAuthInfo = authInfo.clone();
|
||||||
getLc().removeAuthInfo(authInfo);
|
getLc().removeAuthInfo(authInfo);
|
||||||
return cloneAuthInfo;
|
return cloneAuthInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves a authInfo into the core.
|
* Saves a authInfo into the core.
|
||||||
* Useful to save the changes made to a cloned authInfo.
|
* Useful to save the changes made to a cloned authInfo.
|
||||||
|
@ -179,8 +179,8 @@ public class LinphonePreferences {
|
||||||
private int tempQualityReportingInterval = 0;
|
private int tempQualityReportingInterval = 0;
|
||||||
private boolean tempEnabled = true;
|
private boolean tempEnabled = true;
|
||||||
private boolean tempNoDefault = false;
|
private boolean tempNoDefault = false;
|
||||||
|
|
||||||
|
|
||||||
public AccountBuilder(LinphoneCore lc) {
|
public AccountBuilder(LinphoneCore lc) {
|
||||||
this.lc = lc;
|
this.lc = lc;
|
||||||
}
|
}
|
||||||
|
@ -189,12 +189,12 @@ public class LinphonePreferences {
|
||||||
tempTransport = transport;
|
tempTransport = transport;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AccountBuilder setUsername(String username) {
|
public AccountBuilder setUsername(String username) {
|
||||||
tempUsername = username;
|
tempUsername = username;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AccountBuilder setDisplayName(String displayName) {
|
public AccountBuilder setDisplayName(String displayName) {
|
||||||
tempDisplayName = displayName;
|
tempDisplayName = displayName;
|
||||||
return this;
|
return this;
|
||||||
|
@ -214,7 +214,7 @@ public class LinphonePreferences {
|
||||||
tempProxy = proxy;
|
tempProxy = proxy;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AccountBuilder setOutboundProxyEnabled(boolean enabled) {
|
public AccountBuilder setOutboundProxyEnabled(boolean enabled) {
|
||||||
tempOutboundProxy = enabled;
|
tempOutboundProxy = enabled;
|
||||||
return this;
|
return this;
|
||||||
|
@ -224,7 +224,7 @@ public class LinphonePreferences {
|
||||||
tempContactsParams = contactParams;
|
tempContactsParams = contactParams;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AccountBuilder setExpires(String expire) {
|
public AccountBuilder setExpires(String expire) {
|
||||||
tempExpire = expire;
|
tempExpire = expire;
|
||||||
return this;
|
return this;
|
||||||
|
@ -249,17 +249,17 @@ public class LinphonePreferences {
|
||||||
tempQualityReportingCollector = collector;
|
tempQualityReportingCollector = collector;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AccountBuilder setQualityReportingEnabled(boolean enable) {
|
public AccountBuilder setQualityReportingEnabled(boolean enable) {
|
||||||
tempQualityReportingEnabled = enable;
|
tempQualityReportingEnabled = enable;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AccountBuilder setQualityReportingInterval(int interval) {
|
public AccountBuilder setQualityReportingInterval(int interval) {
|
||||||
tempQualityReportingInterval = interval;
|
tempQualityReportingInterval = interval;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AccountBuilder setEnabled(boolean enable) {
|
public AccountBuilder setEnabled(boolean enable) {
|
||||||
tempEnabled = enable;
|
tempEnabled = enable;
|
||||||
return this;
|
return this;
|
||||||
|
@ -272,7 +272,7 @@ public class LinphonePreferences {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new account
|
* Creates a new account
|
||||||
* @throws LinphoneCoreException
|
* @throws LinphoneCoreException
|
||||||
*/
|
*/
|
||||||
public void saveNewAccount() throws LinphoneCoreException {
|
public void saveNewAccount() throws LinphoneCoreException {
|
||||||
String identity = "sip:" + tempUsername + "@" + tempDomain;
|
String identity = "sip:" + tempUsername + "@" + tempDomain;
|
||||||
|
@ -289,17 +289,17 @@ public class LinphonePreferences {
|
||||||
}
|
}
|
||||||
LinphoneAddress proxyAddr = LinphoneCoreFactory.instance().createLinphoneAddress(proxy);
|
LinphoneAddress proxyAddr = LinphoneCoreFactory.instance().createLinphoneAddress(proxy);
|
||||||
LinphoneAddress identityAddr = LinphoneCoreFactory.instance().createLinphoneAddress(identity);
|
LinphoneAddress identityAddr = LinphoneCoreFactory.instance().createLinphoneAddress(identity);
|
||||||
|
|
||||||
if (tempDisplayName != null) {
|
if (tempDisplayName != null) {
|
||||||
identityAddr.setDisplayName(tempDisplayName);
|
identityAddr.setDisplayName(tempDisplayName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tempTransport != null) {
|
if (tempTransport != null) {
|
||||||
proxyAddr.setTransport(tempTransport);
|
proxyAddr.setTransport(tempTransport);
|
||||||
}
|
}
|
||||||
|
|
||||||
String route = tempOutboundProxy ? proxyAddr.asStringUriOnly() : null;
|
String route = tempOutboundProxy ? proxyAddr.asStringUriOnly() : null;
|
||||||
|
|
||||||
LinphoneProxyConfig prxCfg = LinphoneCoreFactory.instance().createProxyConfig(identityAddr.asString(), proxyAddr.asStringUriOnly(), route, tempEnabled);
|
LinphoneProxyConfig prxCfg = LinphoneCoreFactory.instance().createProxyConfig(identityAddr.asString(), proxyAddr.asStringUriOnly(), route, tempEnabled);
|
||||||
|
|
||||||
if (tempContactsParams != null)
|
if (tempContactsParams != null)
|
||||||
|
@ -309,36 +309,36 @@ public class LinphonePreferences {
|
||||||
prxCfg.setExpires(Integer.parseInt(tempExpire));
|
prxCfg.setExpires(Integer.parseInt(tempExpire));
|
||||||
} catch (NumberFormatException nfe) { }
|
} catch (NumberFormatException nfe) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
prxCfg.enableAvpf(tempAvpfEnabled);
|
prxCfg.enableAvpf(tempAvpfEnabled);
|
||||||
prxCfg.setAvpfRRInterval(tempAvpfRRInterval);
|
prxCfg.setAvpfRRInterval(tempAvpfRRInterval);
|
||||||
prxCfg.enableQualityReporting(tempQualityReportingEnabled);
|
prxCfg.enableQualityReporting(tempQualityReportingEnabled);
|
||||||
prxCfg.setQualityReportingCollector(tempQualityReportingCollector);
|
prxCfg.setQualityReportingCollector(tempQualityReportingCollector);
|
||||||
prxCfg.setQualityReportingInterval(tempQualityReportingInterval);
|
prxCfg.setQualityReportingInterval(tempQualityReportingInterval);
|
||||||
|
|
||||||
LinphoneAuthInfo authInfo = LinphoneCoreFactory.instance().createAuthInfo(tempUsername, tempUserId, tempPassword, null, null, tempDomain);
|
LinphoneAuthInfo authInfo = LinphoneCoreFactory.instance().createAuthInfo(tempUsername, tempUserId, tempPassword, null, null, tempDomain);
|
||||||
|
|
||||||
lc.addProxyConfig(prxCfg);
|
lc.addProxyConfig(prxCfg);
|
||||||
lc.addAuthInfo(authInfo);
|
lc.addAuthInfo(authInfo);
|
||||||
|
|
||||||
if (!tempNoDefault && LinphonePreferences.instance().getAccountCount() == 1)
|
if (!tempNoDefault && LinphonePreferences.instance().getAccountCount() == 1)
|
||||||
lc.setDefaultProxyConfig(prxCfg);
|
lc.setDefaultProxyConfig(prxCfg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAccountDeleted(int n){
|
public boolean isAccountDeleted(int n){
|
||||||
LinphoneProxyConfig proxyConfig = getProxyConfig(n);
|
LinphoneProxyConfig proxyConfig = getProxyConfig(n);
|
||||||
return proxyConfig.getIsDeleted();
|
return proxyConfig.getIsDeleted();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccountTransport(int n, String transport) {
|
public void setAccountTransport(int n, String transport) {
|
||||||
LinphoneProxyConfig proxyConfig = getProxyConfig(n);
|
LinphoneProxyConfig proxyConfig = getProxyConfig(n);
|
||||||
|
|
||||||
if (proxyConfig != null && transport != null) {
|
if (proxyConfig != null && transport != null) {
|
||||||
LinphoneAddress proxyAddr;
|
LinphoneAddress proxyAddr;
|
||||||
try {
|
try {
|
||||||
proxyAddr = LinphoneCoreFactory.instance().createLinphoneAddress(proxyConfig.getProxy());
|
proxyAddr = LinphoneCoreFactory.instance().createLinphoneAddress(proxyConfig.getProxy());
|
||||||
|
|
||||||
if (transport.equals(getString(R.string.pref_transport_udp_key))) {
|
if (transport.equals(getString(R.string.pref_transport_udp_key))) {
|
||||||
proxyAddr.setTransport(TransportType.LinphoneTransportUdp);
|
proxyAddr.setTransport(TransportType.LinphoneTransportUdp);
|
||||||
} else if (transport.equals(getString(R.string.pref_transport_tcp_key))) {
|
} else if (transport.equals(getString(R.string.pref_transport_tcp_key))) {
|
||||||
|
@ -346,12 +346,12 @@ public class LinphonePreferences {
|
||||||
} else if (transport.equals(getString(R.string.pref_transport_tls_key))) {
|
} else if (transport.equals(getString(R.string.pref_transport_tls_key))) {
|
||||||
proxyAddr.setTransport(TransportType.LinphoneTransportTls);
|
proxyAddr.setTransport(TransportType.LinphoneTransportTls);
|
||||||
}
|
}
|
||||||
|
|
||||||
LinphoneProxyConfig prxCfg = getProxyConfig(n);
|
LinphoneProxyConfig prxCfg = getProxyConfig(n);
|
||||||
prxCfg.edit();
|
prxCfg.edit();
|
||||||
prxCfg.setProxy(proxyAddr.asStringUriOnly());
|
prxCfg.setProxy(proxyAddr.asStringUriOnly());
|
||||||
prxCfg.done();
|
prxCfg.done();
|
||||||
|
|
||||||
if (isAccountOutboundProxySet(n)) {
|
if (isAccountOutboundProxySet(n)) {
|
||||||
setAccountOutboundProxyEnabled(n, true);
|
setAccountOutboundProxyEnabled(n, true);
|
||||||
}
|
}
|
||||||
|
@ -360,11 +360,11 @@ public class LinphonePreferences {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public TransportType getAccountTransport(int n) {
|
public TransportType getAccountTransport(int n) {
|
||||||
TransportType transport = null;
|
TransportType transport = null;
|
||||||
LinphoneProxyConfig proxyConfig = getProxyConfig(n);
|
LinphoneProxyConfig proxyConfig = getProxyConfig(n);
|
||||||
|
|
||||||
if (proxyConfig != null) {
|
if (proxyConfig != null) {
|
||||||
LinphoneAddress proxyAddr;
|
LinphoneAddress proxyAddr;
|
||||||
try {
|
try {
|
||||||
|
@ -374,30 +374,30 @@ public class LinphonePreferences {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return transport;
|
return transport;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAccountTransportKey(int n) {
|
public String getAccountTransportKey(int n) {
|
||||||
TransportType transport = getAccountTransport(n);
|
TransportType transport = getAccountTransport(n);
|
||||||
String key = getString(R.string.pref_transport_udp_key);
|
String key = getString(R.string.pref_transport_udp_key);
|
||||||
|
|
||||||
if (transport != null && transport == TransportType.LinphoneTransportTcp)
|
if (transport != null && transport == TransportType.LinphoneTransportTcp)
|
||||||
key = getString(R.string.pref_transport_tcp_key);
|
key = getString(R.string.pref_transport_tcp_key);
|
||||||
else if (transport != null && transport == TransportType.LinphoneTransportTls)
|
else if (transport != null && transport == TransportType.LinphoneTransportTls)
|
||||||
key = getString(R.string.pref_transport_tls_key);
|
key = getString(R.string.pref_transport_tls_key);
|
||||||
|
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAccountTransportString(int n) {
|
public String getAccountTransportString(int n) {
|
||||||
TransportType transport = getAccountTransport(n);
|
TransportType transport = getAccountTransport(n);
|
||||||
|
|
||||||
if (transport != null && transport == TransportType.LinphoneTransportTcp)
|
if (transport != null && transport == TransportType.LinphoneTransportTcp)
|
||||||
return getString(R.string.pref_transport_tcp);
|
return getString(R.string.pref_transport_tcp);
|
||||||
else if (transport != null && transport == TransportType.LinphoneTransportTls)
|
else if (transport != null && transport == TransportType.LinphoneTransportTls)
|
||||||
return getString(R.string.pref_transport_tls);
|
return getString(R.string.pref_transport_tls);
|
||||||
|
|
||||||
return getString(R.string.pref_transport_udp);
|
return getString(R.string.pref_transport_udp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,7 +409,7 @@ public class LinphonePreferences {
|
||||||
prxCfg.edit();
|
prxCfg.edit();
|
||||||
prxCfg.setIdentity(identity);
|
prxCfg.setIdentity(identity);
|
||||||
prxCfg.done();
|
prxCfg.done();
|
||||||
|
|
||||||
info.setUsername(username);
|
info.setUsername(username);
|
||||||
saveAuthInfo(info);
|
saveAuthInfo(info);
|
||||||
} catch (LinphoneCoreException e) {
|
} catch (LinphoneCoreException e) {
|
||||||
|
@ -421,7 +421,7 @@ public class LinphonePreferences {
|
||||||
LinphoneAuthInfo authInfo = getAuthInfo(n);
|
LinphoneAuthInfo authInfo = getAuthInfo(n);
|
||||||
return authInfo == null ? null : authInfo.getUsername();
|
return authInfo == null ? null : authInfo.getUsername();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccountDisplayName(int n, String displayName) {
|
public void setAccountDisplayName(int n, String displayName) {
|
||||||
try {
|
try {
|
||||||
LinphoneProxyConfig prxCfg = getProxyConfig(n);
|
LinphoneProxyConfig prxCfg = getProxyConfig(n);
|
||||||
|
@ -434,7 +434,7 @@ public class LinphonePreferences {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAccountDisplayName(int n) {
|
public String getAccountDisplayName(int n) {
|
||||||
try {
|
try {
|
||||||
LinphoneAddress addr = LinphoneCoreFactory.instance().createLinphoneAddress(getProxyConfig(n).getIdentity());
|
LinphoneAddress addr = LinphoneCoreFactory.instance().createLinphoneAddress(getProxyConfig(n).getIdentity());
|
||||||
|
@ -442,7 +442,7 @@ public class LinphonePreferences {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,12 +470,12 @@ public class LinphonePreferences {
|
||||||
|
|
||||||
public void setAccountDomain(int n, String domain) {
|
public void setAccountDomain(int n, String domain) {
|
||||||
String identity = "sip:" + getAccountUsername(n) + "@" + domain;
|
String identity = "sip:" + getAccountUsername(n) + "@" + domain;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
LinphoneAuthInfo authInfo = getClonedAuthInfo(n);
|
LinphoneAuthInfo authInfo = getClonedAuthInfo(n);
|
||||||
authInfo.setDomain(domain);
|
authInfo.setDomain(domain);
|
||||||
saveAuthInfo(authInfo);
|
saveAuthInfo(authInfo);
|
||||||
|
|
||||||
LinphoneProxyConfig prxCfg = getProxyConfig(n);
|
LinphoneProxyConfig prxCfg = getProxyConfig(n);
|
||||||
prxCfg.edit();
|
prxCfg.edit();
|
||||||
prxCfg.setIdentity(identity);
|
prxCfg.setIdentity(identity);
|
||||||
|
@ -493,22 +493,22 @@ public class LinphonePreferences {
|
||||||
if (proxy == null || proxy.length() <= 0) {
|
if (proxy == null || proxy.length() <= 0) {
|
||||||
proxy = getAccountDomain(n);
|
proxy = getAccountDomain(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!proxy.contains("sip:")) {
|
if (!proxy.contains("sip:")) {
|
||||||
proxy = "sip:" + proxy;
|
proxy = "sip:" + proxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
LinphoneAddress proxyAddr = LinphoneCoreFactory.instance().createLinphoneAddress(proxy);
|
LinphoneAddress proxyAddr = LinphoneCoreFactory.instance().createLinphoneAddress(proxy);
|
||||||
if (!proxy.contains("transport=")) {
|
if (!proxy.contains("transport=")) {
|
||||||
proxyAddr.setTransport(getAccountTransport(n));
|
proxyAddr.setTransport(getAccountTransport(n));
|
||||||
}
|
}
|
||||||
|
|
||||||
LinphoneProxyConfig prxCfg = getProxyConfig(n);
|
LinphoneProxyConfig prxCfg = getProxyConfig(n);
|
||||||
prxCfg.edit();
|
prxCfg.edit();
|
||||||
prxCfg.setProxy(proxyAddr.asStringUriOnly());
|
prxCfg.setProxy(proxyAddr.asStringUriOnly());
|
||||||
prxCfg.done();
|
prxCfg.done();
|
||||||
|
|
||||||
if (isAccountOutboundProxySet(n)) {
|
if (isAccountOutboundProxySet(n)) {
|
||||||
setAccountOutboundProxyEnabled(n, true);
|
setAccountOutboundProxyEnabled(n, true);
|
||||||
}
|
}
|
||||||
|
@ -542,18 +542,18 @@ public class LinphonePreferences {
|
||||||
public boolean isAccountOutboundProxySet(int n) {
|
public boolean isAccountOutboundProxySet(int n) {
|
||||||
return getProxyConfig(n).getRoute() != null;
|
return getProxyConfig(n).getRoute() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccountContactParameters(int n, String contactParams) {
|
public void setAccountContactParameters(int n, String contactParams) {
|
||||||
LinphoneProxyConfig prxCfg = getProxyConfig(n);
|
LinphoneProxyConfig prxCfg = getProxyConfig(n);
|
||||||
prxCfg.edit();
|
prxCfg.edit();
|
||||||
prxCfg.setContactUriParameters(contactParams);
|
prxCfg.setContactUriParameters(contactParams);
|
||||||
prxCfg.done();
|
prxCfg.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExpires(int n) {
|
public String getExpires(int n) {
|
||||||
return String.valueOf(getProxyConfig(n).getExpires());
|
return String.valueOf(getProxyConfig(n).getExpires());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExpires(int n, String expire) {
|
public void setExpires(int n, String expire) {
|
||||||
try {
|
try {
|
||||||
LinphoneProxyConfig prxCfg = getProxyConfig(n);
|
LinphoneProxyConfig prxCfg = getProxyConfig(n);
|
||||||
|
@ -562,11 +562,11 @@ public class LinphonePreferences {
|
||||||
prxCfg.done();
|
prxCfg.done();
|
||||||
} catch (NumberFormatException nfe) { }
|
} catch (NumberFormatException nfe) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPrefix(int n) {
|
public String getPrefix(int n) {
|
||||||
return getProxyConfig(n).getDialPrefix();
|
return getProxyConfig(n).getDialPrefix();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPrefix(int n, String prefix) {
|
public void setPrefix(int n, String prefix) {
|
||||||
LinphoneProxyConfig prxCfg = getProxyConfig(n);
|
LinphoneProxyConfig prxCfg = getProxyConfig(n);
|
||||||
prxCfg.edit();
|
prxCfg.edit();
|
||||||
|
@ -601,14 +601,14 @@ public class LinphonePreferences {
|
||||||
public boolean getReplacePlusByZeroZero(int n) {
|
public boolean getReplacePlusByZeroZero(int n) {
|
||||||
return getProxyConfig(n).getDialEscapePlus();
|
return getProxyConfig(n).getDialEscapePlus();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setReplacePlusByZeroZero(int n, boolean replace) {
|
public void setReplacePlusByZeroZero(int n, boolean replace) {
|
||||||
LinphoneProxyConfig prxCfg = getProxyConfig(n);
|
LinphoneProxyConfig prxCfg = getProxyConfig(n);
|
||||||
prxCfg.edit();
|
prxCfg.edit();
|
||||||
prxCfg.setDialEscapePlus(replace);
|
prxCfg.setDialEscapePlus(replace);
|
||||||
prxCfg.done();
|
prxCfg.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefaultAccount(int accountIndex) {
|
public void setDefaultAccount(int accountIndex) {
|
||||||
LinphoneProxyConfig[] prxCfgs = getLc().getProxyConfigList();
|
LinphoneProxyConfig[] prxCfgs = getLc().getProxyConfigList();
|
||||||
if (accountIndex >= 0 && accountIndex < prxCfgs.length)
|
if (accountIndex >= 0 && accountIndex < prxCfgs.length)
|
||||||
|
@ -619,7 +619,7 @@ public class LinphonePreferences {
|
||||||
LinphoneProxyConfig defaultPrxCfg = getLc().getDefaultProxyConfig();
|
LinphoneProxyConfig defaultPrxCfg = getLc().getDefaultProxyConfig();
|
||||||
if (defaultPrxCfg == null)
|
if (defaultPrxCfg == null)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
LinphoneProxyConfig[] prxCfgs = getLc().getProxyConfigList();
|
LinphoneProxyConfig[] prxCfgs = getLc().getProxyConfigList();
|
||||||
for (int i = 0; i < prxCfgs.length; i++) {
|
for (int i = 0; i < prxCfgs.length; i++) {
|
||||||
if (defaultPrxCfg.getIdentity().equals(prxCfgs[i].getIdentity())) {
|
if (defaultPrxCfg.getIdentity().equals(prxCfgs[i].getIdentity())) {
|
||||||
|
@ -632,7 +632,7 @@ public class LinphonePreferences {
|
||||||
public int getAccountCount() {
|
public int getAccountCount() {
|
||||||
if (getLc() == null || getLc().getProxyConfigList() == null)
|
if (getLc() == null || getLc().getProxyConfigList() == null)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return getLc().getProxyConfigList().length;
|
return getLc().getProxyConfigList().length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -641,7 +641,7 @@ public class LinphonePreferences {
|
||||||
prxCfg.edit();
|
prxCfg.edit();
|
||||||
prxCfg.enableRegister(enabled);
|
prxCfg.enableRegister(enabled);
|
||||||
prxCfg.done();
|
prxCfg.done();
|
||||||
|
|
||||||
// If default proxy config is disabled, try to set another one as default proxy
|
// If default proxy config is disabled, try to set another one as default proxy
|
||||||
if (!enabled && getLc().getDefaultProxyConfig().getIdentity().equals(prxCfg.getIdentity())) {
|
if (!enabled && getLc().getDefaultProxyConfig().getIdentity().equals(prxCfg.getIdentity())) {
|
||||||
int count = getLc().getProxyConfigList().length;
|
int count = getLc().getProxyConfigList().length;
|
||||||
|
@ -655,11 +655,11 @@ public class LinphonePreferences {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAccountEnabled(int n) {
|
public boolean isAccountEnabled(int n) {
|
||||||
return getProxyConfig(n).registerEnabled();
|
return getProxyConfig(n).registerEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetDefaultProxyConfig(){
|
public void resetDefaultProxyConfig(){
|
||||||
int count = getLc().getProxyConfigList().length;
|
int count = getLc().getProxyConfigList().length;
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
|
@ -681,13 +681,16 @@ public class LinphonePreferences {
|
||||||
proxyCfg.edit();
|
proxyCfg.edit();
|
||||||
proxyCfg.enableRegister(false);
|
proxyCfg.enableRegister(false);
|
||||||
proxyCfg.done();
|
proxyCfg.done();
|
||||||
|
|
||||||
proxyCfg.setIsDeleted(true);
|
proxyCfg.setIsDeleted(true);
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
while(proxyCfg.getState() != RegistrationState.RegistrationCleared && proxyCfg.getState() != RegistrationState.RegistrationFailed){}
|
while(proxyCfg.getState() != RegistrationState.RegistrationCleared
|
||||||
|
&& proxyCfg.getState() != RegistrationState.RegistrationFailed
|
||||||
|
&& proxyCfg.getState() != RegistrationState.RegistrationNone){
|
||||||
|
}
|
||||||
if (authInfo != null)
|
if (authInfo != null)
|
||||||
getLc().removeAuthInfo(authInfo);
|
getLc().removeAuthInfo(authInfo);
|
||||||
if (proxyCfg != null)
|
if (proxyCfg != null)
|
||||||
|
@ -703,42 +706,42 @@ public class LinphonePreferences {
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
// End of accounts settings
|
// End of accounts settings
|
||||||
|
|
||||||
// Audio settings
|
// Audio settings
|
||||||
public void setEchoCancellation(boolean enable) {
|
public void setEchoCancellation(boolean enable) {
|
||||||
getLc().enableEchoCancellation(enable);
|
getLc().enableEchoCancellation(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEchoCancellationEnabled() {
|
public boolean isEchoCancellationEnabled() {
|
||||||
return getLc().isEchoCancellationEnabled();
|
return getLc().isEchoCancellationEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getEchoCalibration() {
|
public int getEchoCalibration() {
|
||||||
return getConfig().getInt("sound", "ec_delay", -1);
|
return getConfig().getInt("sound", "ec_delay", -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEchoConfigurationUpdated() {
|
public boolean isEchoConfigurationUpdated() {
|
||||||
return getConfig().getBool("app", "ec_updated", false);
|
return getConfig().getBool("app", "ec_updated", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void echoConfigurationUpdated() {
|
public void echoConfigurationUpdated() {
|
||||||
getConfig().setBool("app", "ec_updated", true);
|
getConfig().setBool("app", "ec_updated", true);
|
||||||
}
|
}
|
||||||
// End of audio settings
|
// End of audio settings
|
||||||
|
|
||||||
// Video settings
|
// Video settings
|
||||||
public boolean useFrontCam() {
|
public boolean useFrontCam() {
|
||||||
return getConfig().getBool("app", "front_camera_default", true);
|
return getConfig().getBool("app", "front_camera_default", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFrontCamAsDefault(boolean frontcam) {
|
public void setFrontCamAsDefault(boolean frontcam) {
|
||||||
getConfig().setBool("app", "front_camera_default", frontcam);
|
getConfig().setBool("app", "front_camera_default", frontcam);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVideoEnabled() {
|
public boolean isVideoEnabled() {
|
||||||
return getLc().isVideoSupported() && getLc().isVideoEnabled();
|
return getLc().isVideoSupported() && getLc().isVideoEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enableVideo(boolean enable) {
|
public void enableVideo(boolean enable) {
|
||||||
getLc().enableVideo(enable, enable);
|
getLc().enableVideo(enable, enable);
|
||||||
}
|
}
|
||||||
|
@ -746,7 +749,7 @@ public class LinphonePreferences {
|
||||||
public boolean shouldInitiateVideoCall() {
|
public boolean shouldInitiateVideoCall() {
|
||||||
return getLc().getVideoAutoInitiatePolicy();
|
return getLc().getVideoAutoInitiatePolicy();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInitiateVideoCall(boolean initiate) {
|
public void setInitiateVideoCall(boolean initiate) {
|
||||||
getLc().setVideoPolicy(initiate, shouldAutomaticallyAcceptVideoRequests());
|
getLc().setVideoPolicy(initiate, shouldAutomaticallyAcceptVideoRequests());
|
||||||
}
|
}
|
||||||
|
@ -754,16 +757,16 @@ public class LinphonePreferences {
|
||||||
public boolean shouldAutomaticallyAcceptVideoRequests() {
|
public boolean shouldAutomaticallyAcceptVideoRequests() {
|
||||||
return getLc().getVideoAutoAcceptPolicy();
|
return getLc().getVideoAutoAcceptPolicy();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAutomaticallyAcceptVideoRequests(boolean accept) {
|
public void setAutomaticallyAcceptVideoRequests(boolean accept) {
|
||||||
getLc().setVideoPolicy(shouldInitiateVideoCall(), accept);
|
getLc().setVideoPolicy(shouldInitiateVideoCall(), accept);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPreferredVideoSize() {
|
public String getPreferredVideoSize() {
|
||||||
//LinphoneCore can only return video size (width and height), not the name
|
//LinphoneCore can only return video size (width and height), not the name
|
||||||
return getConfig().getString("video", "size", "qvga");
|
return getConfig().getString("video", "size", "qvga");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPreferredVideoSize(String preferredVideoSize) {
|
public void setPreferredVideoSize(String preferredVideoSize) {
|
||||||
int bandwidth = 512;
|
int bandwidth = 512;
|
||||||
if (preferredVideoSize.equals("720p")) {
|
if (preferredVideoSize.equals("720p")) {
|
||||||
|
@ -779,25 +782,25 @@ public class LinphonePreferences {
|
||||||
getLc().setDownloadBandwidth(bandwidth);
|
getLc().setDownloadBandwidth(bandwidth);
|
||||||
}
|
}
|
||||||
// End of video settings
|
// End of video settings
|
||||||
|
|
||||||
// Call settings
|
// Call settings
|
||||||
public boolean useRfc2833Dtmfs() {
|
public boolean useRfc2833Dtmfs() {
|
||||||
return getLc().getUseRfc2833ForDtmfs();
|
return getLc().getUseRfc2833ForDtmfs();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendDtmfsAsRfc2833(boolean use) {
|
public void sendDtmfsAsRfc2833(boolean use) {
|
||||||
getLc().setUseRfc2833ForDtmfs(use);
|
getLc().setUseRfc2833ForDtmfs(use);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean useSipInfoDtmfs() {
|
public boolean useSipInfoDtmfs() {
|
||||||
return getLc().getUseSipInfoForDtmfs();
|
return getLc().getUseSipInfoForDtmfs();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendDTMFsAsSipInfo(boolean use) {
|
public void sendDTMFsAsSipInfo(boolean use) {
|
||||||
getLc().setUseSipInfoForDtmfs(use);
|
getLc().setUseSipInfoForDtmfs(use);
|
||||||
}
|
}
|
||||||
// End of call settings
|
// End of call settings
|
||||||
|
|
||||||
// Network settings
|
// Network settings
|
||||||
public void setWifiOnlyEnabled(Boolean enable) {
|
public void setWifiOnlyEnabled(Boolean enable) {
|
||||||
getConfig().setBool("app", "wifi_only", enable);
|
getConfig().setBool("app", "wifi_only", enable);
|
||||||
|
@ -806,15 +809,15 @@ public class LinphonePreferences {
|
||||||
public boolean isWifiOnlyEnabled() {
|
public boolean isWifiOnlyEnabled() {
|
||||||
return getConfig().getBool("app", "wifi_only", false);
|
return getConfig().getBool("app", "wifi_only", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStunServer() {
|
public String getStunServer() {
|
||||||
return getLc().getStunServer();
|
return getLc().getStunServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStunServer(String stun) {
|
public void setStunServer(String stun) {
|
||||||
getLc().setStunServer(stun);
|
getLc().setStunServer(stun);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIceEnabled(boolean enabled) {
|
public void setIceEnabled(boolean enabled) {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
getLc().setFirewallPolicy(FirewallPolicy.UseIce);
|
getLc().setFirewallPolicy(FirewallPolicy.UseIce);
|
||||||
|
@ -827,7 +830,7 @@ public class LinphonePreferences {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUpnpEnabled(boolean enabled) {
|
public void setUpnpEnabled(boolean enabled) {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
if (isIceEnabled()) {
|
if (isIceEnabled()) {
|
||||||
|
@ -845,11 +848,11 @@ public class LinphonePreferences {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void useRandomPort(boolean enabled) {
|
public void useRandomPort(boolean enabled) {
|
||||||
useRandomPort(enabled, true);
|
useRandomPort(enabled, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void useRandomPort(boolean enabled, boolean apply) {
|
public void useRandomPort(boolean enabled, boolean apply) {
|
||||||
getConfig().setBool("app", "random_port", enabled);
|
getConfig().setBool("app", "random_port", enabled);
|
||||||
if (apply) {
|
if (apply) {
|
||||||
|
@ -882,29 +885,29 @@ public class LinphonePreferences {
|
||||||
transports.tls = LINPHONE_CORE_RANDOM_PORT;
|
transports.tls = LINPHONE_CORE_RANDOM_PORT;
|
||||||
getLc().setSignalingTransportPorts(transports);
|
getLc().setSignalingTransportPorts(transports);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUpnpEnabled() {
|
public boolean isUpnpEnabled() {
|
||||||
return getLc().upnpAvailable() && getLc().getFirewallPolicy() == FirewallPolicy.UseUpnp;
|
return getLc().upnpAvailable() && getLc().getFirewallPolicy() == FirewallPolicy.UseUpnp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isIceEnabled() {
|
public boolean isIceEnabled() {
|
||||||
return getLc().getFirewallPolicy() == FirewallPolicy.UseIce;
|
return getLc().getFirewallPolicy() == FirewallPolicy.UseIce;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MediaEncryption getMediaEncryption() {
|
public MediaEncryption getMediaEncryption() {
|
||||||
return getLc().getMediaEncryption();
|
return getLc().getMediaEncryption();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMediaEncryption(MediaEncryption menc) {
|
public void setMediaEncryption(MediaEncryption menc) {
|
||||||
if (menc == null)
|
if (menc == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
getLc().setMediaEncryption(menc);
|
getLc().setMediaEncryption(menc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPushNotificationEnabled(boolean enable) {
|
public void setPushNotificationEnabled(boolean enable) {
|
||||||
getConfig().setBool("app", "push_notification", enable);
|
getConfig().setBool("app", "push_notification", enable);
|
||||||
|
|
||||||
if (enable) {
|
if (enable) {
|
||||||
// Add push infos to exisiting proxy configs
|
// Add push infos to exisiting proxy configs
|
||||||
String regId = getPushNotificationRegistrationID();
|
String regId = getPushNotificationRegistrationID();
|
||||||
|
@ -931,7 +934,7 @@ public class LinphonePreferences {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPushNotificationEnabled() {
|
public boolean isPushNotificationEnabled() {
|
||||||
return getConfig().getBool("app", "push_notification", false);
|
return getConfig().getBool("app", "push_notification", false);
|
||||||
}
|
}
|
||||||
|
@ -943,16 +946,16 @@ public class LinphonePreferences {
|
||||||
public String getPushNotificationRegistrationID() {
|
public String getPushNotificationRegistrationID() {
|
||||||
return getConfig().getString("app", "push_notification_regid", null);
|
return getConfig().getString("app", "push_notification_regid", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void useIpv6(Boolean enable) {
|
public void useIpv6(Boolean enable) {
|
||||||
getLc().enableIpv6(enable);
|
getLc().enableIpv6(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUsingIpv6() {
|
public boolean isUsingIpv6() {
|
||||||
return getLc().isIpv6Enabled();
|
return getLc().isIpv6Enabled();
|
||||||
}
|
}
|
||||||
// End of network settings
|
// End of network settings
|
||||||
|
|
||||||
// Advanced settings
|
// Advanced settings
|
||||||
public void setDebugEnabled(boolean enabled) {
|
public void setDebugEnabled(boolean enabled) {
|
||||||
getConfig().setBool("app", "debug", enabled);
|
getConfig().setBool("app", "debug", enabled);
|
||||||
|
@ -962,11 +965,11 @@ public class LinphonePreferences {
|
||||||
public boolean isDebugEnabled() {
|
public boolean isDebugEnabled() {
|
||||||
return getConfig().getBool("app", "debug", false);
|
return getConfig().getBool("app", "debug", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBackgroundModeEnabled(boolean enabled) {
|
public void setBackgroundModeEnabled(boolean enabled) {
|
||||||
getConfig().setBool("app", "background_mode", enabled);
|
getConfig().setBool("app", "background_mode", enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBackgroundModeEnabled() {
|
public boolean isBackgroundModeEnabled() {
|
||||||
return getConfig().getBool("app", "background_mode", true);
|
return getConfig().getBool("app", "background_mode", true);
|
||||||
}
|
}
|
||||||
|
@ -974,23 +977,23 @@ public class LinphonePreferences {
|
||||||
public void setAnimationsEnabled(boolean enabled) {
|
public void setAnimationsEnabled(boolean enabled) {
|
||||||
getConfig().setBool("app", "animations", enabled);
|
getConfig().setBool("app", "animations", enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean areAnimationsEnabled() {
|
public boolean areAnimationsEnabled() {
|
||||||
return getConfig().getBool("app", "animations", false);
|
return getConfig().getBool("app", "animations", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAutoStartEnabled() {
|
public boolean isAutoStartEnabled() {
|
||||||
return getConfig().getBool("app", "auto_start", false);
|
return getConfig().getBool("app", "auto_start", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAutoStart(boolean autoStartEnabled) {
|
public void setAutoStart(boolean autoStartEnabled) {
|
||||||
getConfig().setBool("app", "auto_start", autoStartEnabled);
|
getConfig().setBool("app", "auto_start", autoStartEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSharingPictureServerUrl() {
|
public String getSharingPictureServerUrl() {
|
||||||
return getConfig().getString("app", "sharing_server", null);
|
return getConfig().getString("app", "sharing_server", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSharingPictureServerUrl(String url) {
|
public void setSharingPictureServerUrl(String url) {
|
||||||
getConfig().setString("app", "sharing_server", url);
|
getConfig().setString("app", "sharing_server", url);
|
||||||
}
|
}
|
||||||
|
@ -999,12 +1002,12 @@ public class LinphonePreferences {
|
||||||
if (url != null && url.length() == 0) {
|
if (url != null && url.length() == 0) {
|
||||||
url = null;
|
url = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
LpConfig config = getConfig();
|
LpConfig config = getConfig();
|
||||||
config.setString("misc", "config-uri", url);
|
config.setString("misc", "config-uri", url);
|
||||||
config.sync();
|
config.sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRemoteProvisioningUrl() {
|
public String getRemoteProvisioningUrl() {
|
||||||
return getConfig().getString("misc", "config-uri", null);
|
return getConfig().getString("misc", "config-uri", null);
|
||||||
}
|
}
|
||||||
|
@ -1012,43 +1015,43 @@ public class LinphonePreferences {
|
||||||
public void setDefaultDisplayName(String displayName) {
|
public void setDefaultDisplayName(String displayName) {
|
||||||
getLc().setPrimaryContact(displayName, getDefaultUsername());
|
getLc().setPrimaryContact(displayName, getDefaultUsername());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDefaultDisplayName() {
|
public String getDefaultDisplayName() {
|
||||||
return getLc().getPrimaryContactDisplayName();
|
return getLc().getPrimaryContactDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefaultUsername(String username) {
|
public void setDefaultUsername(String username) {
|
||||||
getLc().setPrimaryContact(getDefaultDisplayName(), username);
|
getLc().setPrimaryContact(getDefaultDisplayName(), username);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDefaultUsername() {
|
public String getDefaultUsername() {
|
||||||
return getLc().getPrimaryContactUsername();
|
return getLc().getPrimaryContactUsername();
|
||||||
}
|
}
|
||||||
// End of advanced settings
|
// End of advanced settings
|
||||||
|
|
||||||
// Tunnel settings
|
// Tunnel settings
|
||||||
public String getTunnelMode() {
|
public String getTunnelMode() {
|
||||||
return getConfig().getString("app", "tunnel", null);
|
return getConfig().getString("app", "tunnel", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTunnelHost() {
|
public String getTunnelHost() {
|
||||||
return getConfig().getString("tunnel", "host", null);
|
return getConfig().getString("tunnel", "host", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTunnelHost(String host) {
|
public void setTunnelHost(String host) {
|
||||||
getConfig().setString("tunnel", "host", host);
|
getConfig().setString("tunnel", "host", host);
|
||||||
LinphoneManager.getInstance().initTunnelFromConf();
|
LinphoneManager.getInstance().initTunnelFromConf();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTunnelPort() {
|
public int getTunnelPort() {
|
||||||
return getConfig().getInt("tunnel", "port", 443);
|
return getConfig().getInt("tunnel", "port", 443);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTunnelPort(int port) {
|
public void setTunnelPort(int port) {
|
||||||
getConfig().setInt("tunnel", "port", port);
|
getConfig().setInt("tunnel", "port", port);
|
||||||
LinphoneManager.getInstance().initTunnelFromConf();
|
LinphoneManager.getInstance().initTunnelFromConf();
|
||||||
|
@ -1058,7 +1061,7 @@ public class LinphonePreferences {
|
||||||
public boolean isProvisioningLoginViewEnabled() {
|
public boolean isProvisioningLoginViewEnabled() {
|
||||||
return getConfig().getBool("app", "show_login_view", false);
|
return getConfig().getBool("app", "show_login_view", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disableProvisioningLoginView() {
|
public void disableProvisioningLoginView() {
|
||||||
if (isProvisioningLoginViewEnabled()) { // Only do it if it was previously enabled
|
if (isProvisioningLoginViewEnabled()) { // Only do it if it was previously enabled
|
||||||
getConfig().setBool("app", "show_login_view", false);
|
getConfig().setBool("app", "show_login_view", false);
|
||||||
|
@ -1070,7 +1073,7 @@ public class LinphonePreferences {
|
||||||
public void firstRemoteProvisioningSuccessful() {
|
public void firstRemoteProvisioningSuccessful() {
|
||||||
getConfig().setBool("app", "first_remote_provisioning", false);
|
getConfig().setBool("app", "first_remote_provisioning", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFirstRemoteProvisioning() {
|
public boolean isFirstRemoteProvisioning() {
|
||||||
return getConfig().getBool("app", "first_remote_provisioning", true);
|
return getConfig().getBool("app", "first_remote_provisioning", true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue