Merge branch 'master' into dev_group_chat

This commit is contained in:
Sylvain Berfini 2017-10-19 17:10:51 +02:00
commit bd30ad946b
16 changed files with 76 additions and 74 deletions

View file

@ -146,6 +146,29 @@
android:gravity="center" android:gravity="center"
android:layout_margin="10dp"> android:layout_margin="10dp">
<LinearLayout
android:orientation="vertical"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content">
<TextView
android:text="@string/userid"
style="@style/font13"
android:textAllCaps="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<EditText
android:id="@+id/assistant_userid"
android:background="@drawable/resizable_textfield"
android:textColor="@color/colorB"
android:inputType="text|textNoSuggestions"
android:contentDescription="@string/content_description_username_field"
android:layout_width="match_parent"
android:layout_height="40dp"
android:maxLines="1"/>
</LinearLayout>
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_width="0dp" android:layout_width="0dp"

View file

@ -105,7 +105,6 @@
android:maxLines="1"/> android:maxLines="1"/>
<TextView <TextView
android:visibility="gone"
android:text="@string/assistant_display_name_optional" android:text="@string/assistant_display_name_optional"
style="@style/font13" style="@style/font13"
android:textAllCaps="true" android:textAllCaps="true"
@ -114,7 +113,6 @@
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>
<EditText <EditText
android:visibility="gone"
android:id="@+id/assistant_display_name" android:id="@+id/assistant_display_name"
android:background="@drawable/resizable_textfield" android:background="@drawable/resizable_textfield"
android:textColor="@color/colorB" android:textColor="@color/colorB"

View file

@ -7,7 +7,7 @@
<entry name="quality_reporting_collector" overwrite="true">sip:voip-metrics@sip.linphone.org;transport=tls</entry> <entry name="quality_reporting_collector" overwrite="true">sip:voip-metrics@sip.linphone.org;transport=tls</entry>
<entry name="quality_reporting_enabled" overwrite="true">1</entry> <entry name="quality_reporting_enabled" overwrite="true">1</entry>
<entry name="quality_reporting_interval" overwrite="true">180</entry> <entry name="quality_reporting_interval" overwrite="true">180</entry>
<entry name="reg_expires" overwrite="true">600</entry> <entry name="reg_expires" overwrite="true">31536000</entry>
<entry name="reg_identity" overwrite="true">sip:?@sip.linphone.org</entry> <entry name="reg_identity" overwrite="true">sip:?@sip.linphone.org</entry>
<entry name="reg_proxy" overwrite="true">&lt;sip:sip.linphone.org;transport=tls&gt;</entry> <entry name="reg_proxy" overwrite="true">&lt;sip:sip.linphone.org;transport=tls&gt;</entry>
<entry name="reg_sendregister" overwrite="true">1</entry> <entry name="reg_sendregister" overwrite="true">1</entry>

View file

@ -93,6 +93,7 @@
<string name="about_bugreport_email">linphone-android@belledonne-communications.com</string> <string name="about_bugreport_email">linphone-android@belledonne-communications.com</string>
<bool name="enable_call_notification">true</bool> <bool name="enable_call_notification">true</bool>
<bool name="kill_service_with_task_manager">true</bool> <bool name="kill_service_with_task_manager">true</bool>
<string name="notification_service_channel_id">linphone_notification_service_id</string>
<string name="notification_channel_id">linphone_notification_id</string> <string name="notification_channel_id">linphone_notification_id</string>
<integer name="notification_ms_on">1000</integer> <integer name="notification_ms_on">1000</integer>
<integer name="notification_ms_off">7000</integer> <integer name="notification_ms_off">7000</integer>

View file

@ -487,5 +487,6 @@
<string name="content_description_call_options">Call options</string> <string name="content_description_call_options">Call options</string>
<string name="content_description_audio_route">Audio route</string> <string name="content_description_audio_route">Audio route</string>
<string name="content_description_exit_conference">Exit conference</string> <string name="content_description_exit_conference">Exit conference</string>
<string name="content_title_notification_service">Linphone Service</string>
<string name="content_title_notification">Linphone Notification</string> <string name="content_title_notification">Linphone Notification</string>
</resources> </resources>

View file

@ -25,9 +25,9 @@ import android.content.pm.ActivityInfo;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.util.Log;
import org.linphone.assistant.RemoteProvisioningActivity; import org.linphone.assistant.RemoteProvisioningActivity;
import org.linphone.mediastream.Log;
import org.linphone.mediastream.Version; import org.linphone.mediastream.Version;
import static android.content.Intent.ACTION_MAIN; import static android.content.Intent.ACTION_MAIN;
@ -157,12 +157,12 @@ public class LinphoneLauncherActivity extends Activity {
} }
if (uriToResolve != null) { if (uriToResolve != null) {
addressToCall = ContactsManager.getInstance().getAddressOrNumberForAndroidContact(getContentResolver(), uriToResolve); addressToCall = ContactsManager.getInstance().getAddressOrNumberForAndroidContact(getContentResolver(), uriToResolve);
Log.i("Intent has uri to resolve : " + uriToResolve.toString()); Log.i("LinphoneLauncher", "Intent has uri to resolve : " + uriToResolve.toString());
uriToResolve = null; uriToResolve = null;
} }
if (addressToCall != null) { if (addressToCall != null) {
newIntent.putExtra("SipUriOrNumber", addressToCall); newIntent.putExtra("SipUriOrNumber", addressToCall);
Log.i("Intent has address to call : " + addressToCall); Log.i("LinphoneLauncher", "Intent has address to call : " + addressToCall);
addressToCall = null; addressToCall = null;
} }
startActivity(newIntent); startActivity(newIntent);

View file

@ -186,7 +186,6 @@ public class LinphoneManager implements CoreListener, ChatMessageListener, Senso
private IntentFilter mCallIntentFilter; private IntentFilter mCallIntentFilter;
private IntentFilter mNetworkIntentFilter; private IntentFilter mNetworkIntentFilter;
private Handler mHandler = new Handler(); private Handler mHandler = new Handler();
private WakeLock mIncallWakeLock;
private WakeLock mProximityWakelock; private WakeLock mProximityWakelock;
private AccountCreator accountCreator; private AccountCreator accountCreator;
private static List<ChatMessage> mPendingChatFileMessage; private static List<ChatMessage> mPendingChatFileMessage;
@ -1089,7 +1088,6 @@ public class LinphoneManager implements CoreListener, ChatMessageListener, Senso
boolean wifiOnly = LinphonePreferences.instance().isWifiOnlyEnabled(); boolean wifiOnly = LinphonePreferences.instance().isWifiOnlyEnabled();
if (wifiOnly){ if (wifiOnly){
if (networkInfo.getType() == ConnectivityManager.TYPE_WIFI) { if (networkInfo.getType() == ConnectivityManager.TYPE_WIFI) {
setDnsServers();
mLc.setNetworkReachable(true); mLc.setNetworkReachable(true);
} }
else { else {
@ -1105,7 +1103,6 @@ public class LinphoneManager implements CoreListener, ChatMessageListener, Senso
Log.i("Connectivity has changed."); Log.i("Connectivity has changed.");
mLc.setNetworkReachable(false); mLc.setNetworkReachable(false);
} }
setDnsServers();
mLc.setNetworkReachable(true); mLc.setNetworkReachable(true);
mLastNetworkType = curtype; mLastNetworkType = curtype;
} }
@ -1492,12 +1489,6 @@ public class LinphoneManager implements CoreListener, ChatMessageListener, Senso
routeAudioToReceiver(); routeAudioToReceiver();
} }
} }
if (mIncallWakeLock != null && mIncallWakeLock.isHeld()) {
mIncallWakeLock.release();
Log.i("Last call ended: releasing incall (CPU only) wake lock");
} else {
Log.i("Last call ended: no incall (CPU only) wake lock were held");
}
} }
} }
if (state == State.UpdatedByRemote) { if (state == State.UpdatedByRemote) {
@ -1520,15 +1511,6 @@ public class LinphoneManager implements CoreListener, ChatMessageListener, Senso
if (state == State.StreamsRunning) { if (state == State.StreamsRunning) {
startBluetooth(); startBluetooth();
setAudioManagerInCallMode(); setAudioManagerInCallMode();
if (mIncallWakeLock == null) {
mIncallWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "incall");
}
if (!mIncallWakeLock.isHeld()) {
Log.i("New call active : acquiring incall (CPU only) wake lock");
mIncallWakeLock.acquire();
} else {
Log.i("New call active while incall (CPU only) wake lock already active");
}
} }
} }
@ -1840,26 +1822,6 @@ public class LinphoneManager implements CoreListener, ChatMessageListener, Senso
dozeModeEnabled = b; dozeModeEnabled = b;
} }
public void setDnsServers() {
if (mConnectivityManager == null || Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
return;
if (mConnectivityManager.getActiveNetwork() == null
|| mConnectivityManager.getLinkProperties(mConnectivityManager.getActiveNetwork()) == null)
return;
int i = 0;
List<InetAddress> inetServers = null;
inetServers = mConnectivityManager.getLinkProperties(mConnectivityManager.getActiveNetwork()).getDnsServers();
String[] servers = new String[inetServers.size()];
for (InetAddress address : inetServers) {
servers[i++] = address.getHostAddress();
}
mLc.setDnsServers(servers);
}
public String getmDynamicConfigFile() { public String getmDynamicConfigFile() {
return mDynamicConfigFile; return mDynamicConfigFile;
} }

View file

@ -360,9 +360,7 @@ public class LinphonePreferences {
if (tempContactsParams != null) if (tempContactsParams != null)
prxCfg.setContactUriParameters(tempContactsParams); prxCfg.setContactUriParameters(tempContactsParams);
if (tempExpire != null) { if (tempExpire != null) {
try { prxCfg.setExpires(Integer.parseInt(tempExpire));
prxCfg.setExpires(Integer.parseInt(tempExpire));
} catch (NumberFormatException nfe) { }
} }
prxCfg.setAvpfMode(AVPFMode.Enabled); prxCfg.setAvpfMode(AVPFMode.Enabled);

View file

@ -308,6 +308,12 @@ public final class LinphoneService extends Service {
dumpDeviceInformation(); dumpDeviceInformation();
dumpInstalledLinphoneInformation(); dumpInstalledLinphoneInformation();
//Disable service notification for Android O
if ((Version.sdkAboveOrEqual(Version.API26_O_80))) {
LinphonePreferences.instance().setServiceNotificationVisibility(false);
mDisableRegistrationStatus = true;
}
mNM = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); mNM = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
mNM.cancel(INCALL_NOTIF_ID); // in case of crash the icon is not removed mNM.cancel(INCALL_NOTIF_ID); // in case of crash the icon is not removed
Compatibility.CreateChannel(this); Compatibility.CreateChannel(this);
@ -316,10 +322,6 @@ public final class LinphoneService extends Service {
notifIntent.putExtra("Notification", true); notifIntent.putExtra("Notification", true);
mNotifContentIntent = PendingIntent.getActivity(this, 0, notifIntent, PendingIntent.FLAG_UPDATE_CURRENT); mNotifContentIntent = PendingIntent.getActivity(this, 0, notifIntent, PendingIntent.FLAG_UPDATE_CURRENT);
if (Version.sdkAboveOrEqual(Version.API26_O_80)) {
disableNotificationsAutomaticRegistrationStatusContent();
}
Bitmap bm = null; Bitmap bm = null;
try { try {
bm = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher); bm = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher);
@ -398,7 +400,7 @@ public final class LinphoneService extends Service {
@Override @Override
public void onGlobalStateChanged(Core lc,Core.GlobalState state, String message) { public void onGlobalStateChanged(Core lc,Core.GlobalState state, String message) {
if (state == Core.GlobalState.On && displayServiceNotification()) { if (!mDisableRegistrationStatus && state == GlobalState.On && displayServiceNotification()) {
sendNotification(IC_LEVEL_ORANGE, R.string.notification_started); sendNotification(IC_LEVEL_ORANGE, R.string.notification_started);
} }
} }
@ -753,10 +755,6 @@ public final class LinphoneService extends Service {
} }
} }
public void disableNotificationsAutomaticRegistrationStatusContent() {
mDisableRegistrationStatus = true;
}
private synchronized void sendNotification(int level, int textId) { private synchronized void sendNotification(int level, int textId) {
String text = getString(textId); String text = getString(textId);
if (text.contains("%s") && LinphoneManager.getLc() != null) { if (text.contains("%s") && LinphoneManager.getLc() != null) {

View file

@ -32,6 +32,7 @@ import org.linphone.mediastream.Log;
import android.app.Activity; import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
import android.app.Fragment; import android.app.Fragment;
import android.app.KeyguardManager;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
@ -413,8 +414,12 @@ public class StatusFragment extends Fragment {
zrtpToRead = token.substring(2); zrtpToRead = token.substring(2);
} }
LinphoneService.instance().displaySasNotification(token); // Obiane specific dev : display sas notif only if screen locked
KeyguardManager myKM = (KeyguardManager) getActivity().getSystemService(Context.KEYGUARD_SERVICE);
if( myKM.inKeyguardRestrictedInputMode()) {
//Screen is locked
LinphoneService.instance().displaySasNotification(call.getAuthenticationToken());
}
TextView customText = (TextView) ZRTPdialog.findViewById(R.id.customText); TextView customText = (TextView) ZRTPdialog.findViewById(R.id.customText);
String newText = getString(R.string.zrtp_dialog1).replace("%s", zrtpToRead) String newText = getString(R.string.zrtp_dialog1).replace("%s", zrtpToRead)
+ getString(R.string.zrtp_dialog2).replace("%s", zrtpToListen); + getString(R.string.zrtp_dialog2).replace("%s", zrtpToListen);

View file

@ -365,9 +365,6 @@ private static AssistantActivity instance;
proxyConfig.setIdentityAddress(addr); proxyConfig.setIdentityAddress(addr);
if (LinphonePreferences.instance() != null)
proxyConfig.setContactUriParameters(LinphonePreferences.instance().getPushNotificationRegistrationID());
if (accountCreator.getPhoneNumber() != null && accountCreator.getPhoneNumber().length() > 0) if (accountCreator.getPhoneNumber() != null && accountCreator.getPhoneNumber().length() > 0)
proxyConfig.setDialPrefix(org.linphone.core.Utils.getPrefixFromE164(accountCreator.getPhoneNumber())); proxyConfig.setDialPrefix(org.linphone.core.Utils.getPrefixFromE164(accountCreator.getPhoneNumber()));
@ -388,6 +385,9 @@ private static AssistantActivity instance;
lc.setDefaultProxyConfig(proxyConfig); lc.setDefaultProxyConfig(proxyConfig);
if (LinphonePreferences.instance() != null)
LinphonePreferences.instance().setPushNotificationEnabled(true);
if (ContactsManager.getInstance() != null) if (ContactsManager.getInstance() != null)
ContactsManager.getInstance().fetchContactsAsync(); ContactsManager.getInstance().fetchContactsAsync();
@ -407,8 +407,8 @@ private static AssistantActivity instance;
configureProxyConfig(accountCreator); configureProxyConfig(accountCreator);
} }
public void genericLogIn(String username, String userid, String password, String prefix, String domain, TransportType transport) { public void genericLogIn(String username, String userid, String password, String displayname, String prefix, String domain, TransportType transport) {
saveCreatedAccount(username, userid, password, null, prefix, domain, transport); saveCreatedAccount(username, userid, password, displayname, null, prefix, domain, transport);
} }
private void display(AssistantFragmentsEnum fragment) { private void display(AssistantFragmentsEnum fragment) {
@ -504,7 +504,7 @@ private static AssistantActivity instance;
return phoneNumberWithCountry; return phoneNumberWithCountry;
} }
public void saveCreatedAccount(String username, String userid, String password, String ha1, String prefix, String domain, TransportType transport) { public void saveCreatedAccount(String username, String userid, String password, String displayname, String ha1, String prefix, String domain, TransportType transport) {
username = LinphoneUtils.getDisplayableUsernameFromAddress(username); username = LinphoneUtils.getDisplayableUsernameFromAddress(username);
domain = LinphoneUtils.getDisplayableUsernameFromAddress(domain); domain = LinphoneUtils.getDisplayableUsernameFromAddress(domain);
@ -517,6 +517,7 @@ private static AssistantActivity instance;
.setDomain(domain) .setDomain(domain)
.setHa1(ha1) .setHa1(ha1)
.setUserid(userid) .setUserid(userid)
.setDisplayName(displayname)
.setPassword(password); .setPassword(password);
if (prefix != null) { if (prefix != null) {

View file

@ -324,6 +324,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
} else { } else {
if (useEmail.isChecked()) accountCreator.setPhoneNumber(null, null); if (useEmail.isChecked()) accountCreator.setPhoneNumber(null, null);
if (!getResources().getBoolean(R.bool.isTablet) || getUsername().length() > 0) { if (!getResources().getBoolean(R.bool.isTablet) || getUsername().length() > 0) {
LinphoneManager.getLc().getConfig().loadFromXmlFile(LinphoneManager.getInstance().getmDynamicConfigFile());
accountCreator.isAccountExist(); accountCreator.isAccountExist();
} else { } else {
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForUsernameStatus(AccountCreator.UsernameStatus.TooShort) LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForUsernameStatus(AccountCreator.UsernameStatus.TooShort)
@ -590,6 +591,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status) LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status)
, AssistantActivity.instance()); , AssistantActivity.instance());
} else { } else {
LinphoneManager.getLc().getConfig().loadFromXmlFile(LinphoneManager.getInstance().getmDynamicConfigFile());
accountCreator.isAliasUsed(); accountCreator.isAliasUsed();
} }
} else { } else {

View file

@ -34,7 +34,7 @@ import android.widget.RadioGroup;
import android.widget.Toast; import android.widget.Toast;
public class LoginFragment extends Fragment implements OnClickListener, TextWatcher { public class LoginFragment extends Fragment implements OnClickListener, TextWatcher {
private EditText login, userid, password, domain; private EditText login, userid, password, domain, displayName;
private RadioGroup transports; private RadioGroup transports;
private Button apply; private Button apply;
@ -45,6 +45,8 @@ public class LoginFragment extends Fragment implements OnClickListener, TextWatc
login = (EditText) view.findViewById(R.id.assistant_username); login = (EditText) view.findViewById(R.id.assistant_username);
login.addTextChangedListener(this); login.addTextChangedListener(this);
displayName = (EditText) view.findViewById(R.id.assistant_display_name);
displayName.addTextChangedListener(this);
userid = (EditText) view.findViewById(R.id.assistant_userid); userid = (EditText) view.findViewById(R.id.assistant_userid);
userid.addTextChangedListener(this); userid.addTextChangedListener(this);
password = (EditText) view.findViewById(R.id.assistant_password); password = (EditText) view.findViewById(R.id.assistant_password);
@ -83,7 +85,7 @@ public class LoginFragment extends Fragment implements OnClickListener, TextWatc
if (domain.getText().toString().compareTo(getString(R.string.default_domain)) == 0) { if (domain.getText().toString().compareTo(getString(R.string.default_domain)) == 0) {
AssistantActivity.instance().displayLoginLinphone(login.getText().toString(), password.getText().toString()); AssistantActivity.instance().displayLoginLinphone(login.getText().toString(), password.getText().toString());
} else { } else {
AssistantActivity.instance().genericLogIn(login.getText().toString(), userid.getText().toString(), password.getText().toString(), null, domain.getText().toString(), transport); AssistantActivity.instance().genericLogIn(login.getText().toString(), userid.getText().toString(), password.getText().toString(), displayName.getText().toString(), null, domain.getText().toString(), transport);
} }
} }
} }

View file

@ -8,6 +8,7 @@ import android.app.NotificationManager;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.media.AudioAttributes;
import android.view.ViewTreeObserver; import android.view.ViewTreeObserver;
import org.linphone.R; import org.linphone.R;
@ -37,12 +38,22 @@ public class ApiTwentySixPlus {
public static void CreateChannel(Context context) { public static void CreateChannel(Context context) {
NotificationManager notificationManager = NotificationManager notificationManager =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
String id = context.getString(R.string.notification_channel_id); // Create service notification channel
CharSequence name = context.getString(R.string.content_title_notification); String id = context.getString(R.string.notification_service_channel_id);
String description = context.getString(R.string.content_title_notification); CharSequence name = context.getString(R.string.content_title_notification_service);
int importance = NotificationManager.IMPORTANCE_HIGH; String description = context.getString(R.string.content_title_notification_service);
int importance = NotificationManager.IMPORTANCE_NONE;
NotificationChannel mChannel = new NotificationChannel(id, name, importance); NotificationChannel mChannel = new NotificationChannel(id, name, importance);
mChannel.setDescription(description); mChannel.setDescription(description);
mChannel.enableVibration(false);
notificationManager.createNotificationChannel(mChannel);
// Create message/call notification channel
id = context.getString(R.string.notification_channel_id);
name = context.getString(R.string.content_title_notification);
description = context.getString(R.string.content_title_notification);
importance = NotificationManager.IMPORTANCE_HIGH;
mChannel = new NotificationChannel(id, name, importance);
mChannel.setDescription(description);
mChannel.enableLights(true); mChannel.enableLights(true);
mChannel.setLightColor(context.getColor(R.color.notification_color_led)); mChannel.setLightColor(context.getColor(R.color.notification_color_led));
mChannel.enableLights(true); mChannel.enableLights(true);
@ -103,7 +114,7 @@ public class ApiTwentySixPlus {
Notification notif; Notification notif;
if (largeIcon != null) { if (largeIcon != null) {
notif = new Notification.Builder(context, context.getString(R.string.notification_channel_id)) notif = new Notification.Builder(context, context.getString(R.string.notification_service_channel_id))
.setContentTitle(title) .setContentTitle(title)
.setContentText(message) .setContentText(message)
.setSmallIcon(icon, level) .setSmallIcon(icon, level)
@ -114,7 +125,7 @@ public class ApiTwentySixPlus {
.setPriority(priority) .setPriority(priority)
.build(); .build();
} else { } else {
notif = new Notification.Builder(context, context.getString(R.string.notification_channel_id)) notif = new Notification.Builder(context, context.getString(R.string.notification_service_channel_id))
.setContentTitle(title) .setContentTitle(title)
.setContentText(message) .setContentText(message)
.setSmallIcon(icon, level) .setSmallIcon(icon, level)

@ -1 +1 @@
Subproject commit f291076f8816ca634b4e815eded9786a96e9f28a Subproject commit 49540f6b6f5ab4553f52cae7bb998ebc167baecc

@ -1 +1 @@
Subproject commit b7e4901fb8bc4b1095b5dcddd691ae288cd86d0e Subproject commit 016e04c878d6ef3c807180ec4413aa0bac265977