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: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
android:orientation="vertical"
android:layout_width="0dp"

View file

@ -105,7 +105,6 @@
android:maxLines="1"/>
<TextView
android:visibility="gone"
android:text="@string/assistant_display_name_optional"
style="@style/font13"
android:textAllCaps="true"
@ -114,7 +113,6 @@
android:layout_height="wrap_content"/>
<EditText
android:visibility="gone"
android:id="@+id/assistant_display_name"
android:background="@drawable/resizable_textfield"
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_enabled" overwrite="true">1</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_proxy" overwrite="true">&lt;sip:sip.linphone.org;transport=tls&gt;</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>
<bool name="enable_call_notification">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>
<integer name="notification_ms_on">1000</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_audio_route">Audio route</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>
</resources>

View file

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

View file

@ -186,7 +186,6 @@ public class LinphoneManager implements CoreListener, ChatMessageListener, Senso
private IntentFilter mCallIntentFilter;
private IntentFilter mNetworkIntentFilter;
private Handler mHandler = new Handler();
private WakeLock mIncallWakeLock;
private WakeLock mProximityWakelock;
private AccountCreator accountCreator;
private static List<ChatMessage> mPendingChatFileMessage;
@ -1089,7 +1088,6 @@ public class LinphoneManager implements CoreListener, ChatMessageListener, Senso
boolean wifiOnly = LinphonePreferences.instance().isWifiOnlyEnabled();
if (wifiOnly){
if (networkInfo.getType() == ConnectivityManager.TYPE_WIFI) {
setDnsServers();
mLc.setNetworkReachable(true);
}
else {
@ -1105,7 +1103,6 @@ public class LinphoneManager implements CoreListener, ChatMessageListener, Senso
Log.i("Connectivity has changed.");
mLc.setNetworkReachable(false);
}
setDnsServers();
mLc.setNetworkReachable(true);
mLastNetworkType = curtype;
}
@ -1492,12 +1489,6 @@ public class LinphoneManager implements CoreListener, ChatMessageListener, Senso
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) {
@ -1520,15 +1511,6 @@ public class LinphoneManager implements CoreListener, ChatMessageListener, Senso
if (state == State.StreamsRunning) {
startBluetooth();
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;
}
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() {
return mDynamicConfigFile;
}

View file

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

View file

@ -308,6 +308,12 @@ public final class LinphoneService extends Service {
dumpDeviceInformation();
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.cancel(INCALL_NOTIF_ID); // in case of crash the icon is not removed
Compatibility.CreateChannel(this);
@ -316,10 +322,6 @@ public final class LinphoneService extends Service {
notifIntent.putExtra("Notification", true);
mNotifContentIntent = PendingIntent.getActivity(this, 0, notifIntent, PendingIntent.FLAG_UPDATE_CURRENT);
if (Version.sdkAboveOrEqual(Version.API26_O_80)) {
disableNotificationsAutomaticRegistrationStatusContent();
}
Bitmap bm = null;
try {
bm = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher);
@ -398,7 +400,7 @@ public final class LinphoneService extends Service {
@Override
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);
}
}
@ -753,10 +755,6 @@ public final class LinphoneService extends Service {
}
}
public void disableNotificationsAutomaticRegistrationStatusContent() {
mDisableRegistrationStatus = true;
}
private synchronized void sendNotification(int level, int textId) {
String text = getString(textId);
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.Dialog;
import android.app.Fragment;
import android.app.KeyguardManager;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
@ -413,8 +414,12 @@ public class StatusFragment extends Fragment {
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);
String newText = getString(R.string.zrtp_dialog1).replace("%s", zrtpToRead)
+ getString(R.string.zrtp_dialog2).replace("%s", zrtpToListen);

View file

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

View file

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

View file

@ -34,7 +34,7 @@ import android.widget.RadioGroup;
import android.widget.Toast;
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 Button apply;
@ -45,6 +45,8 @@ public class LoginFragment extends Fragment implements OnClickListener, TextWatc
login = (EditText) view.findViewById(R.id.assistant_username);
login.addTextChangedListener(this);
displayName = (EditText) view.findViewById(R.id.assistant_display_name);
displayName.addTextChangedListener(this);
userid = (EditText) view.findViewById(R.id.assistant_userid);
userid.addTextChangedListener(this);
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) {
AssistantActivity.instance().displayLoginLinphone(login.getText().toString(), password.getText().toString());
} 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.content.Context;
import android.graphics.Bitmap;
import android.media.AudioAttributes;
import android.view.ViewTreeObserver;
import org.linphone.R;
@ -37,12 +38,22 @@ public class ApiTwentySixPlus {
public static void CreateChannel(Context context) {
NotificationManager notificationManager =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
String id = context.getString(R.string.notification_channel_id);
CharSequence name = context.getString(R.string.content_title_notification);
String description = context.getString(R.string.content_title_notification);
int importance = NotificationManager.IMPORTANCE_HIGH;
// Create service notification channel
String id = context.getString(R.string.notification_service_channel_id);
CharSequence name = context.getString(R.string.content_title_notification_service);
String description = context.getString(R.string.content_title_notification_service);
int importance = NotificationManager.IMPORTANCE_NONE;
NotificationChannel mChannel = new NotificationChannel(id, name, importance);
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.setLightColor(context.getColor(R.color.notification_color_led));
mChannel.enableLights(true);
@ -103,7 +114,7 @@ public class ApiTwentySixPlus {
Notification notif;
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)
.setContentText(message)
.setSmallIcon(icon, level)
@ -114,7 +125,7 @@ public class ApiTwentySixPlus {
.setPriority(priority)
.build();
} 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)
.setContentText(message)
.setSmallIcon(icon, level)

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

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