Merge with Master

This commit is contained in:
Lucas Legrand 2018-07-30 15:41:26 +02:00
commit 30bda8f7c6
17 changed files with 141 additions and 55 deletions

View file

@ -33,7 +33,7 @@ apply plugin: 'com.android.library'
dependencies { dependencies {
compile 'org.apache.commons:commons-compress:1.16.1' implementation 'org.apache.commons:commons-compress:1.16.1'
javadocDeps 'org.apache.commons:commons-compress:1.16.1' javadocDeps 'org.apache.commons:commons-compress:1.16.1'
} }

View file

@ -13,7 +13,7 @@ buildscript {
google() google()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:2.3.3' classpath 'com.android.tools.build:gradle:3.1.0'
} }
} }

View file

@ -26,8 +26,8 @@ allprojects {
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
dependencies { dependencies {
compile group: 'org.apache.commons', name: 'commons-compress', version: '1.16.1' implementation group: 'org.apache.commons', name: 'commons-compress', version: '1.16.1'
compile 'com.android.support:support-v4:26.0.2' implementation 'com.android.support:support-v4:26.0.2'
} }

View file

@ -152,6 +152,7 @@ public class LinphonePreferences {
// Accounts settings // Accounts settings
private ProxyConfig getProxyConfig(int n) { private ProxyConfig getProxyConfig(int n) {
if (getLc() == null) return null;
ProxyConfig[] prxCfgs = getLc().getProxyConfigList(); ProxyConfig[] prxCfgs = getLc().getProxyConfigList();
if (n < 0 || n >= prxCfgs.length) if (n < 0 || n >= prxCfgs.length)
return null; return null;
@ -171,6 +172,7 @@ public class LinphonePreferences {
* 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).
*/ */
private AuthInfo getClonedAuthInfo(int n) { private AuthInfo getClonedAuthInfo(int n) {
if (getLc() == null) return null;
AuthInfo authInfo = getAuthInfo(n); AuthInfo authInfo = getAuthInfo(n);
if (authInfo == null) if (authInfo == null)
return null; return null;
@ -185,6 +187,7 @@ public class LinphonePreferences {
* Useful to save the changes made to a cloned authInfo. * Useful to save the changes made to a cloned authInfo.
*/ */
private void saveAuthInfo(AuthInfo authInfo) { private void saveAuthInfo(AuthInfo authInfo) {
if (getLc() == null) return;
getLc().addAuthInfo(authInfo); getLc().addAuthInfo(authInfo);
} }
@ -339,8 +342,12 @@ public class LinphonePreferences {
proxy = tempProxy; proxy = tempProxy;
} }
} }
Address proxyAddr = Factory.instance().createAddress(proxy); Address proxyAddr = Factory.instance().createAddress(proxy);
Address identityAddr = Factory.instance().createAddress(identity); Address identityAddr = Factory.instance().createAddress(identity);
if (proxyAddr == null || identityAddr == null) {
throw new CoreException("Proxy or Identity address is null !");
}
if (tempDisplayName != null) { if (tempDisplayName != null) {
identityAddr.setDisplayName(tempDisplayName); identityAddr.setDisplayName(tempDisplayName);
@ -539,6 +546,7 @@ public class LinphonePreferences {
} }
private void setAccountPassword(int n, String password, String ha1) { private void setAccountPassword(int n, String password, String ha1) {
if (getLc() == null) return;
String user = getAccountUsername(n); String user = getAccountUsername(n);
String domain = getAccountDomain(n); String domain = getAccountDomain(n);
String userid = null; String userid = null;
@ -632,6 +640,8 @@ public class LinphonePreferences {
} }
Address proxyAddr = Factory.instance().createAddress(proxy); Address proxyAddr = Factory.instance().createAddress(proxy);
if (proxyAddr == null) return;
if (!proxy.contains("transport=")) { if (!proxy.contains("transport=")) {
proxyAddr.setTransport(getAccountTransport(n)); proxyAddr.setTransport(getAccountTransport(n));
} }
@ -758,6 +768,7 @@ public class LinphonePreferences {
} }
public void setDefaultAccount(int accountIndex) { public void setDefaultAccount(int accountIndex) {
if (getLc() == null) return;
ProxyConfig[] prxCfgs = getLc().getProxyConfigList(); ProxyConfig[] prxCfgs = getLc().getProxyConfigList();
if (accountIndex >= 0 && accountIndex < prxCfgs.length) if (accountIndex >= 0 && accountIndex < prxCfgs.length)
getLc().setDefaultProxyConfig(prxCfgs[accountIndex]); getLc().setDefaultProxyConfig(prxCfgs[accountIndex]);
@ -787,6 +798,7 @@ public class LinphonePreferences {
} }
public void setAccountEnabled(int n, boolean enabled) { public void setAccountEnabled(int n, boolean enabled) {
if (getLc() == null) return;
ProxyConfig prxCfg = getProxyConfig(n); ProxyConfig prxCfg = getProxyConfig(n);
if (prxCfg == null) { if (prxCfg == null) {
LinphoneUtils.displayErrorAlert(getString(R.string.error), mContext); LinphoneUtils.displayErrorAlert(getString(R.string.error), mContext);
@ -815,6 +827,7 @@ public class LinphonePreferences {
} }
public void resetDefaultProxyConfig(){ public void resetDefaultProxyConfig(){
if (getLc() == null) return;
int count = getLc().getProxyConfigList().length; int count = getLc().getProxyConfigList().length;
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
if (isAccountEnabled(i)) { if (isAccountEnabled(i)) {
@ -829,6 +842,7 @@ public class LinphonePreferences {
} }
public void deleteAccount(int n) { public void deleteAccount(int n) {
if (getLc() == null) return;
ProxyConfig proxyCfg = getProxyConfig(n); ProxyConfig proxyCfg = getProxyConfig(n);
if (proxyCfg != null) if (proxyCfg != null)
getLc().removeProxyConfig(proxyCfg); getLc().removeProxyConfig(proxyCfg);
@ -849,10 +863,12 @@ public class LinphonePreferences {
// Audio settings // Audio settings
public void setEchoCancellation(boolean enable) { public void setEchoCancellation(boolean enable) {
if (getLc() == null) return;
getLc().enableEchoCancellation(enable); getLc().enableEchoCancellation(enable);
} }
public boolean echoCancellationEnabled() { public boolean echoCancellationEnabled() {
if (getLc() == null) return false;
return getLc().echoCancellationEnabled(); return getLc().echoCancellationEnabled();
} }
@ -879,42 +895,50 @@ public class LinphonePreferences {
} }
public boolean isVideoEnabled() { public boolean isVideoEnabled() {
if (getLc() == null) return false;
return getLc().videoSupported() && getLc().videoEnabled(); return getLc().videoSupported() && getLc().videoEnabled();
} }
public void enableVideo(boolean enable) { public void enableVideo(boolean enable) {
if (getLc() == null) return;
getLc().enableVideoCapture(enable); getLc().enableVideoCapture(enable);
getLc().enableVideoDisplay(enable); getLc().enableVideoDisplay(enable);
} }
public boolean shouldInitiateVideoCall() { public boolean shouldInitiateVideoCall() {
if (getLc() == null) return false;
return getLc().getVideoActivationPolicy().getAutomaticallyInitiate(); return getLc().getVideoActivationPolicy().getAutomaticallyInitiate();
} }
public void setInitiateVideoCall(boolean initiate) { public void setInitiateVideoCall(boolean initiate) {
if (getLc() == null) return;
VideoActivationPolicy vap = getLc().getVideoActivationPolicy(); VideoActivationPolicy vap = getLc().getVideoActivationPolicy();
vap.setAutomaticallyInitiate(initiate); vap.setAutomaticallyInitiate(initiate);
getLc().setVideoActivationPolicy(vap); getLc().setVideoActivationPolicy(vap);
} }
public boolean shouldAutomaticallyAcceptVideoRequests() { public boolean shouldAutomaticallyAcceptVideoRequests() {
if (getLc() == null) return false;
VideoActivationPolicy vap = getLc().getVideoActivationPolicy(); VideoActivationPolicy vap = getLc().getVideoActivationPolicy();
return vap.getAutomaticallyAccept(); return vap.getAutomaticallyAccept();
} }
public void setAutomaticallyAcceptVideoRequests(boolean accept) { public void setAutomaticallyAcceptVideoRequests(boolean accept) {
if (getLc() == null) return;
VideoActivationPolicy vap = getLc().getVideoActivationPolicy(); VideoActivationPolicy vap = getLc().getVideoActivationPolicy();
vap.setAutomaticallyAccept(accept); vap.setAutomaticallyAccept(accept);
getLc().setVideoActivationPolicy(vap); getLc().setVideoActivationPolicy(vap);
} }
public String getVideoPreset() { public String getVideoPreset() {
if (getLc() == null) return null;
String preset = getLc().getVideoPreset(); String preset = getLc().getVideoPreset();
if (preset == null) preset = "default"; if (preset == null) preset = "default";
return preset; return preset;
} }
public void setVideoPreset(String preset) { public void setVideoPreset(String preset) {
if (getLc() == null) return;
if (preset.equals("default")) preset = null; if (preset.equals("default")) preset = null;
getLc().setVideoPreset(preset); getLc().setVideoPreset(preset);
preset = getVideoPreset(); preset = getVideoPreset();
@ -930,22 +954,27 @@ public class LinphonePreferences {
} }
public void setPreferredVideoSize(String preferredVideoSize) { public void setPreferredVideoSize(String preferredVideoSize) {
if (getLc() == null) return;
getLc().setPreferredVideoSizeByName(preferredVideoSize); getLc().setPreferredVideoSizeByName(preferredVideoSize);
} }
public int getPreferredVideoFps() { public int getPreferredVideoFps() {
if (getLc() == null) return 0;
return (int)getLc().getPreferredFramerate(); return (int)getLc().getPreferredFramerate();
} }
public void setPreferredVideoFps(int fps) { public void setPreferredVideoFps(int fps) {
if (getLc() == null) return;
getLc().setPreferredFramerate(fps); getLc().setPreferredFramerate(fps);
} }
public int getBandwidthLimit() { public int getBandwidthLimit() {
if (getLc() == null) return 0;
return getLc().getDownloadBandwidth(); return getLc().getDownloadBandwidth();
} }
public void setBandwidthLimit(int bandwidth) { public void setBandwidthLimit(int bandwidth) {
if (getLc() == null) return;
getLc().setUploadBandwidth(bandwidth); getLc().setUploadBandwidth(bandwidth);
getLc().setDownloadBandwidth(bandwidth); getLc().setDownloadBandwidth(bandwidth);
} }
@ -953,34 +982,42 @@ public class LinphonePreferences {
// Call settings // Call settings
public boolean useRfc2833Dtmfs() { public boolean useRfc2833Dtmfs() {
if (getLc() == null) return false;
return getLc().getUseRfc2833ForDtmf(); return getLc().getUseRfc2833ForDtmf();
} }
public void sendDtmfsAsRfc2833(boolean use) { public void sendDtmfsAsRfc2833(boolean use) {
if (getLc() == null) return;
getLc().setUseRfc2833ForDtmf(use); getLc().setUseRfc2833ForDtmf(use);
} }
public boolean useSipInfoDtmfs() { public boolean useSipInfoDtmfs() {
if (getLc() == null) return false;
return getLc().getUseInfoForDtmf(); return getLc().getUseInfoForDtmf();
} }
public void sendDTMFsAsSipInfo(boolean use) { public void sendDTMFsAsSipInfo(boolean use) {
if (getLc() == null) return;
getLc().setUseInfoForDtmf(use); getLc().setUseInfoForDtmf(use);
} }
public int getIncTimeout() { public int getIncTimeout() {
if (getLc() == null) return 0;
return getLc().getIncTimeout(); return getLc().getIncTimeout();
} }
public void setIncTimeout(int timeout) { public void setIncTimeout(int timeout) {
if (getLc() == null) return;
getLc().setIncTimeout(timeout); getLc().setIncTimeout(timeout);
} }
public int getInCallTimeout() { public int getInCallTimeout() {
if (getLc() == null) return 0;
return getLc().getInCallTimeout(); return getLc().getInCallTimeout();
} }
public void setInCallTimeout(int timeout) { public void setInCallTimeout(int timeout) {
if (getLc() == null) return;
getLc().setInCallTimeout(timeout); getLc().setInCallTimeout(timeout);
} }
@ -1030,6 +1067,7 @@ public class LinphonePreferences {
} }
public String getSipPort() { public String getSipPort() {
if (getLc() == null) return null;
Transports transports = getLc().getTransports(); Transports transports = getLc().getTransports();
int port; int port;
if (transports.getUdpPort() > 0) if (transports.getUdpPort() > 0)
@ -1040,6 +1078,7 @@ public class LinphonePreferences {
} }
public void setSipPort(int port) { public void setSipPort(int port) {
if (getLc() == null) return;
Transports transports = getLc().getTransports(); Transports transports = getLc().getTransports();
transports.setUdpPort(port); transports.setUdpPort(port);
transports.setTcpPort(port); transports.setTcpPort(port);
@ -1048,6 +1087,7 @@ public class LinphonePreferences {
} }
private NatPolicy getOrCreateNatPolicy() { private NatPolicy getOrCreateNatPolicy() {
if (getLc() == null) return null;
NatPolicy nat = getLc().getNatPolicy(); NatPolicy nat = getLc().getNatPolicy();
if (nat == null) { if (nat == null) {
nat = getLc().createNatPolicy(); nat = getLc().createNatPolicy();
@ -1061,6 +1101,7 @@ public class LinphonePreferences {
} }
public void setStunServer(String stun) { public void setStunServer(String stun) {
if (getLc() == null) return;
NatPolicy nat = getOrCreateNatPolicy(); NatPolicy nat = getOrCreateNatPolicy();
nat.setStunServer(stun); nat.setStunServer(stun);
@ -1070,6 +1111,7 @@ public class LinphonePreferences {
} }
public void setIceEnabled(boolean enabled) { public void setIceEnabled(boolean enabled) {
if (getLc() == null) return;
NatPolicy nat = getOrCreateNatPolicy(); NatPolicy nat = getOrCreateNatPolicy();
nat.enableIce(enabled); nat.enableIce(enabled);
nat.enableStun(enabled); nat.enableStun(enabled);
@ -1077,12 +1119,14 @@ public class LinphonePreferences {
} }
public void setTurnEnabled(boolean enabled) { public void setTurnEnabled(boolean enabled) {
if (getLc() == null) return;
NatPolicy nat = getOrCreateNatPolicy(); NatPolicy nat = getOrCreateNatPolicy();
nat.enableTurn(enabled); nat.enableTurn(enabled);
getLc().setNatPolicy(nat); getLc().setNatPolicy(nat);
} }
public void setUpnpEnabled(boolean enabled) { public void setUpnpEnabled(boolean enabled) {
if (getLc() == null) return;
NatPolicy nat = getOrCreateNatPolicy(); NatPolicy nat = getOrCreateNatPolicy();
nat.enableUpnp(enabled); nat.enableUpnp(enabled);
getLc().setNatPolicy(nat); getLc().setNatPolicy(nat);
@ -1109,6 +1153,7 @@ public class LinphonePreferences {
} }
public void setTurnUsername(String username) { public void setTurnUsername(String username) {
if (getLc() == null) return;
NatPolicy nat = getOrCreateNatPolicy(); NatPolicy nat = getOrCreateNatPolicy();
AuthInfo authInfo = getLc().findAuthInfo(null, nat.getStunServerUsername(), null); AuthInfo authInfo = getLc().findAuthInfo(null, nat.getStunServerUsername(), null);
@ -1127,6 +1172,7 @@ public class LinphonePreferences {
} }
public void setTurnPassword(String password) { public void setTurnPassword(String password) {
if (getLc() == null) return;
NatPolicy nat = getOrCreateNatPolicy(); NatPolicy nat = getOrCreateNatPolicy();
AuthInfo authInfo = getLc().findAuthInfo(null, nat.getStunServerUsername(), null); AuthInfo authInfo = getLc().findAuthInfo(null, nat.getStunServerUsername(), null);
@ -1142,10 +1188,12 @@ public class LinphonePreferences {
} }
public MediaEncryption getMediaEncryption() { public MediaEncryption getMediaEncryption() {
if (getLc() == null) return null;
return getLc().getMediaEncryption(); return getLc().getMediaEncryption();
} }
public void setMediaEncryption(MediaEncryption menc) { public void setMediaEncryption(MediaEncryption menc) {
if (getLc() == null) return;
if (menc == null) if (menc == null)
return; return;
@ -1166,6 +1214,7 @@ public class LinphonePreferences {
String appId = getString(R.string.push_sender_id); String appId = getString(R.string.push_sender_id);
if (regId != null && lc.getProxyConfigList().length > 0) { if (regId != null && lc.getProxyConfigList().length > 0) {
for (ProxyConfig lpc : lc.getProxyConfigList()) { for (ProxyConfig lpc : lc.getProxyConfigList()) {
if (lpc == null) continue;
if (!lpc.isPushNotificationAllowed()) { if (!lpc.isPushNotificationAllowed()) {
lpc.edit(); lpc.edit();
lpc.setContactUriParameters(null); lpc.setContactUriParameters(null);
@ -1215,10 +1264,12 @@ public class LinphonePreferences {
} }
public void useIpv6(Boolean enable) { public void useIpv6(Boolean enable) {
if (getLc() == null) return;
getLc().enableIpv6(enable); getLc().enableIpv6(enable);
} }
public boolean isUsingIpv6() { public boolean isUsingIpv6() {
if (getLc() == null) return false;
return getLc().ipv6Enabled(); return getLc().ipv6Enabled();
} }
// End of network settings // End of network settings
@ -1259,14 +1310,17 @@ public class LinphonePreferences {
} }
public String getSharingPictureServerUrl() { public String getSharingPictureServerUrl() {
if (getLc() == null) return null;
return getLc().getFileTransferServer(); return getLc().getFileTransferServer();
} }
public void setSharingPictureServerUrl(String url) { public void setSharingPictureServerUrl(String url) {
if (getLc() == null) return;
getLc().setFileTransferServer(url); getLc().setFileTransferServer(url);
} }
public void setRemoteProvisioningUrl(String url) { public void setRemoteProvisioningUrl(String url) {
if (getLc() == null) return;
if (url != null && url.length() == 0) { if (url != null && url.length() == 0) {
url = null; url = null;
} }
@ -1274,26 +1328,31 @@ public class LinphonePreferences {
} }
public String getRemoteProvisioningUrl() { public String getRemoteProvisioningUrl() {
if (getLc() == null) return null;
return getLc().getProvisioningUri(); return getLc().getProvisioningUri();
} }
public void setDefaultDisplayName(String displayName) { public void setDefaultDisplayName(String displayName) {
if (getLc() == null) return;
Address primary = getLc().getPrimaryContactParsed(); Address primary = getLc().getPrimaryContactParsed();
primary.setDisplayName(displayName); primary.setDisplayName(displayName);
getLc().setPrimaryContact(primary.asString()); getLc().setPrimaryContact(primary.asString());
} }
public String getDefaultDisplayName() { public String getDefaultDisplayName() {
if (getLc() == null) return null;
return getLc().getPrimaryContactParsed().getDisplayName(); return getLc().getPrimaryContactParsed().getDisplayName();
} }
public void setDefaultUsername(String username) { public void setDefaultUsername(String username) {
if (getLc() == null) return;
Address primary = getLc().getPrimaryContactParsed(); Address primary = getLc().getPrimaryContactParsed();
primary.setUsername(username); primary.setUsername(username);
getLc().setPrimaryContact(primary.asString()); getLc().setPrimaryContact(primary.asString());
} }
public String getDefaultUsername() { public String getDefaultUsername() {
if (getLc() == null) return null;
return getLc().getPrimaryContactParsed().getUsername(); return getLc().getPrimaryContactParsed().getUsername();
} }
// End of advanced settings // End of advanced settings
@ -1302,6 +1361,7 @@ public class LinphonePreferences {
private TunnelConfig tunnelConfig = null; private TunnelConfig tunnelConfig = null;
public TunnelConfig getTunnelConfig() { public TunnelConfig getTunnelConfig() {
if (getLc() == null) return null;
if(getLc().tunnelAvailable()) { if(getLc().tunnelAvailable()) {
Tunnel tunnel = getLc().getTunnel(); Tunnel tunnel = getLc().getTunnel();
if (tunnelConfig == null) { if (tunnelConfig == null) {
@ -1384,10 +1444,12 @@ public class LinphonePreferences {
} }
public boolean adaptiveRateControlEnabled() { public boolean adaptiveRateControlEnabled() {
if (getLc() == null) return false;
return getLc().adaptiveRateControlEnabled(); return getLc().adaptiveRateControlEnabled();
} }
public void enableAdaptiveRateControl(boolean enabled) { public void enableAdaptiveRateControl(boolean enabled) {
if (getLc() == null) return;
getLc().enableAdaptiveRateControl(enabled); getLc().enableAdaptiveRateControl(enabled);
} }
@ -1501,10 +1563,12 @@ public class LinphonePreferences {
} }
public LimeState limeEnabled() { public LimeState limeEnabled() {
if (getLc() == null) return LimeState.Disabled;
return getLc().limeEnabled(); return getLc().limeEnabled();
} }
public void enableLime(LimeState lime) { public void enableLime(LimeState lime) {
if (getLc() == null) return;
getLc().enableLime(lime); getLc().enableLime(lime);
} }

View file

@ -843,6 +843,8 @@ public final class LinphoneUtils {
} }
public static Spanned getTextWithHttpLinks(String text) { public static Spanned getTextWithHttpLinks(String text) {
if (text == null) return null;
if (text.contains("<")) { if (text.contains("<")) {
text = text.replace("<", "&lt;"); text = text.replace("<", "&lt;");
} }

View file

@ -279,8 +279,11 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
} }
}; };
int missedCalls = (LinphoneManager.isInstanciated()) ? LinphoneManager.getLc().getMissedCallsCount() : 0; Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
int missedCalls = lc.getMissedCallsCount();
displayMissedCalls(missedCalls); displayMissedCalls(missedCalls);
}
int rotation = getWindowManager().getDefaultDisplay().getRotation(); int rotation = getWindowManager().getDefaultDisplay().getRotation();
switch (rotation) { switch (rotation) {

View file

@ -521,7 +521,10 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
} }
}); });
initCallStatsRefresher(LinphoneManager.getLc().getCurrentCall(), findViewById(R.id.incall_stats)); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
initCallStatsRefresher(lc.getCurrentCall(), findViewById(R.id.incall_stats));
}
} }
private void refreshIncallUi(){ private void refreshIncallUi(){

View file

@ -281,7 +281,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
removeVirtualKeyboardVisiblityListener(); removeVirtualKeyboardVisiblityListener();
LinphoneManager.getInstance().setCurrentChatRoomAddress(null); LinphoneManager.getInstance().setCurrentChatRoomAddress(null);
if (mChatRoom != null) mChatRoom.removeListener(this); if (mChatRoom != null) mChatRoom.removeListener(this);
mEventsAdapter.clear(); if (mEventsAdapter != null) mEventsAdapter.clear();
super.onPause(); super.onPause();
} }

View file

@ -75,12 +75,13 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
String tag = (String)v.getTag(); String tag = (String)v.getTag();
Core lc = LinphoneManager.getLc(); Core lc = LinphoneManager.getLc();
Address participant = Factory.instance().createAddress(tag); Address participant = Factory.instance().createAddress(tag);
ChatRoom room = lc.findOneToOneChatRoom(lc.getDefaultProxyConfig().getContact(), participant); ProxyConfig defaultProxyConfig = lc.getDefaultProxyConfig();
if (defaultProxyConfig != null) {
ChatRoom room = lc.findOneToOneChatRoom(defaultProxyConfig.getContact(), participant);
if (room != null) { if (room != null) {
LinphoneActivity.instance().goToChat(room.getPeerAddress().asStringUriOnly(), null); LinphoneActivity.instance().goToChat(room.getPeerAddress().asStringUriOnly(), null);
} else { } else {
ProxyConfig lpc = lc.getDefaultProxyConfig(); if (defaultProxyConfig.getConferenceFactoryUri() != null && !LinphonePreferences.instance().useBasicChatRoomFor1To1()) {
if (lpc != null && lpc.getConferenceFactoryUri() != null && !LinphonePreferences.instance().useBasicChatRoomFor1To1()) {
mWaitLayout.setVisibility(View.VISIBLE); mWaitLayout.setVisibility(View.VISIBLE);
mChatRoom = lc.createClientGroupChatRoom(getString(R.string.dummy_group_chat_subject), true); mChatRoom = lc.createClientGroupChatRoom(getString(R.string.dummy_group_chat_subject), true);
mChatRoom.addListener(mChatRoomCreationListener); mChatRoom.addListener(mChatRoomCreationListener);
@ -92,6 +93,7 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
} }
} }
} }
}
}; };
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

View file

@ -414,9 +414,10 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
private void createOrUpdateFriend() { private void createOrUpdateFriend() {
boolean created = false; boolean created = false;
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc == null) return;
if (!isFriend()) { if (!isFriend()) {
friend = LinphoneManager.getLc().createFriend(); friend = lc.createFriend();
friend.enableSubscribes(false); friend.enableSubscribes(false);
friend.setIncSubscribePolicy(SubscribePolicy.SPDeny); friend.setIncSubscribePolicy(SubscribePolicy.SPDeny);
if (isAndroidContact()) { if (isAndroidContact()) {

View file

@ -40,8 +40,9 @@ public class LinphoneNumberOrAddress implements Serializable, Comparable<Linphon
@Override @Override
public int compareTo(LinphoneNumberOrAddress noa) { public int compareTo(LinphoneNumberOrAddress noa) {
if (noa.isSIPAddress() == isSIPAddress() && noa.getValue() != null) { String value = noa.getValue();
return noa.getValue().compareTo(getValue()); if (noa.isSIPAddress() == isSIPAddress() && value != null) {
return value.compareTo(getValue());
} else { } else {
return isSIPAddress() ? -1 : 1; return isSIPAddress() ? -1 : 1;
} }

View file

@ -265,7 +265,7 @@ public class SearchContactsListAdapter extends RecyclerView.Adapter<SearchContac
} }
if (sr.getAddress() != null || sr.getPhoneNumber() != null) { if (sr.getAddress() != null || sr.getPhoneNumber() != null) {
for (ContactAddress ca : result) { for (ContactAddress ca : result) {
String normalizedPhoneNumber = (ca.getPhoneNumber() != null) ? prx.normalizePhoneNumber(ca.getPhoneNumber()) : null; String normalizedPhoneNumber = (ca != null && ca.getPhoneNumber() != null && prx != null) ? prx.normalizePhoneNumber(ca.getPhoneNumber()) : null;
if ((sr.getAddress() != null && ca.getAddress() != null if ((sr.getAddress() != null && ca.getAddress() != null
&& ca.getAddress().asStringUriOnly().equals(sr.getAddress().asStringUriOnly())) && ca.getAddress().asStringUriOnly().equals(sr.getAddress().asStringUriOnly()))
|| (sr.getPhoneNumber() != null && normalizedPhoneNumber != null || (sr.getPhoneNumber() != null && normalizedPhoneNumber != null

View file

@ -526,6 +526,7 @@ public class SettingsFragment extends PreferencesListFragment {
codecs.removeAll(); codecs.removeAll();
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
for (final PayloadType pt : lc.getAudioPayloadTypes()) { for (final PayloadType pt : lc.getAudioPayloadTypes()) {
CheckBoxPreference codec = new CheckBoxPreference(getActivity()); CheckBoxPreference codec = new CheckBoxPreference(getActivity());
codec.setTitle(pt.getMimeType()); codec.setTitle(pt.getMimeType());
@ -554,6 +555,7 @@ public class SettingsFragment extends PreferencesListFragment {
codecs.addPreference(codec); codecs.addPreference(codec);
} }
}
CheckBoxPreference echoCancellation = (CheckBoxPreference) findPreference(getString(R.string.pref_echo_cancellation_key)); CheckBoxPreference echoCancellation = (CheckBoxPreference) findPreference(getString(R.string.pref_echo_cancellation_key));
echoCancellation.setChecked(mPrefs.echoCancellationEnabled()); echoCancellation.setChecked(mPrefs.echoCancellationEnabled());
@ -1062,8 +1064,13 @@ public class SettingsFragment extends PreferencesListFragment {
@Override @Override
public boolean onPreferenceChange(Preference preference, Object newValue) { public boolean onPreferenceChange(Preference preference, Object newValue) {
String value = (String)newValue; String value = (String)newValue;
try {
mPrefs.setIncTimeout(Integer.valueOf(value)); mPrefs.setIncTimeout(Integer.valueOf(value));
preference.setSummary(value); preference.setSummary(value);
} catch (NumberFormatException nfe) {
Log.e("Value is not an Integer ! " + value);
return false;
}
return true; return true;
} }
}); });

View file

@ -24,6 +24,8 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import org.linphone.core.Core;
import org.linphone.LinphoneManager; import org.linphone.LinphoneManager;
/** /**
@ -39,7 +41,8 @@ public class PhoneStateChangedReceiver extends BroadcastReceiver {
if (TelephonyManager.EXTRA_STATE_OFFHOOK.equals(extraState) || TelephonyManager.EXTRA_STATE_RINGING.equals(extraState)) { if (TelephonyManager.EXTRA_STATE_OFFHOOK.equals(extraState) || TelephonyManager.EXTRA_STATE_RINGING.equals(extraState)) {
LinphoneManager.getInstance().setCallGsmON(true); LinphoneManager.getInstance().setCallGsmON(true);
LinphoneManager.getLc().pauseAllCalls(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
lc.pauseAllCalls();
} else if (TelephonyManager.EXTRA_STATE_IDLE.equals(extraState)) { } else if (TelephonyManager.EXTRA_STATE_IDLE.equals(extraState)) {
LinphoneManager.getInstance().setCallGsmON(false); LinphoneManager.getInstance().setCallGsmON(false);
} }

View file

@ -64,7 +64,7 @@ public class ListSelectionHelper {
mEditButton.setOnClickListener(new View.OnClickListener() { mEditButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (mAdapter.getCount() > 0) { if (mAdapter != null && mAdapter.getCount() > 0) {
mAdapter.enableEdition(true); mAdapter.enableEdition(true);
mTopBar.setVisibility(View.GONE); mTopBar.setVisibility(View.GONE);
mEditTopBar.setVisibility(View.VISIBLE); mEditTopBar.setVisibility(View.VISIBLE);

@ -1 +1 @@
Subproject commit 0f999ecc3d304923b6338d3f48d44ac8ddfd9be8 Subproject commit 11f4c9c61feece2d46909ae62e91ac1bace64c2c

@ -1 +1 @@
Subproject commit d1a8d275b553c82b56a21ebb32d34024b0adbb99 Subproject commit d0232344c705a482feb5ca272abcb044303ef284