From c3ea2d2236c7a3774394e421dcbbd7e96d507df6 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 13 Sep 2012 14:04:17 +0200 Subject: [PATCH] Fix contact NPE + fix debug on at startup + add pref to disable PN --- res/values/non_localizable_strings.xml | 1 + res/values/strings.xml | 1 + res/xml/preferences.xml | 321 ++++++++++++------ src/org/linphone/LinphoneManager.java | 6 +- .../linphone/compatibility/ApiFivePlus.java | 2 +- 5 files changed, 216 insertions(+), 115 deletions(-) diff --git a/res/values/non_localizable_strings.xml b/res/values/non_localizable_strings.xml index eb2e4d4b8..3e298eea6 100644 --- a/res/values/non_localizable_strings.xml +++ b/res/values/non_localizable_strings.xml @@ -85,4 +85,5 @@ zrtp push_reg_id_key + pref_push_notification_key diff --git a/res/values/strings.xml b/res/values/strings.xml index 001fe9aea..6a7e658ce 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -239,6 +239,7 @@ SIP Accounts Use wifi only + Enable push notifications An error occurred, try again later. Server unreachable, verify your internet connection. diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index cc9cbcf7e..9f469a451 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -1,182 +1,281 @@ - + - + - - + + + - + - + + + + + + - - - - + + - - - - + + + + + - - - - - - - - - + + - - - - - - - - - - - + - - - - - + + + android:dependency="@string/pref_video_enable_key"/> - + android:dependency="@string/pref_video_enable_key"/> + android:defaultValue="true" + android:summary="@string/pref_video_automatically_share_my_video" + android:dependency="@string/pref_video_enable_key"/> + android:defaultValue="true" + android:summary="@string/pref_video_automatically_accept_video" + android:dependency="@string/pref_video_enable_key"/> - - - + + - + + - + + + android:defaultValue="false" + android:layout="@layout/hidden"/> + + - - - - - - - - - - - - - - - - - - + - - - + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java index 011738bc4..a36b0606f 100644 --- a/src/org/linphone/LinphoneManager.java +++ b/src/org/linphone/LinphoneManager.java @@ -470,7 +470,7 @@ public final class LinphoneManager implements LinphoneCoreListener { copyAssetsFromPackage(); //traces alway start with traces enable to not missed first initialization ; - LinphoneCoreFactory.instance().setDebugMode(getPrefBoolean(R.string.pref_debug_key,true)); + LinphoneCoreFactory.instance().setDebugMode(getPrefBoolean(R.string.pref_debug_key, false)); mLc = LinphoneCoreFactory.instance().createLinphoneCore( this, mLinphoneConfigFile, mLinphoneInitialConfigFile, null); @@ -623,7 +623,7 @@ public final class LinphoneManager implements LinphoneCoreListener { // Add parameters for push notifications String regId = getPrefString(R.string.push_reg_id_key, null); String appId = getString(R.string.push_sender_id); - if (regId != null) { + if (regId != null && getPrefBoolean(R.string.pref_push_notification_key, true)) { String contactInfos = "app-id=" + appId + ";pn-type=google;pn-tok=" + regId + ";pn-msg-str=IM_MSG;pn-call-str=IC_MSG;pn-call-snd=ring.caf;pn-msg-snd=msg.caf;"; proxycon.setContactParameters(contactInfos); } @@ -646,7 +646,7 @@ public final class LinphoneManager implements LinphoneCoreListener { public void initFromConf() throws LinphoneConfigException { - LinphoneCoreFactory.instance().setDebugMode(getPrefBoolean(R.string.pref_debug_key,true)); + LinphoneCoreFactory.instance().setDebugMode(getPrefBoolean(R.string.pref_debug_key, false)); initFromConfTunnel(); if (initialTransports == null) diff --git a/src/org/linphone/compatibility/ApiFivePlus.java b/src/org/linphone/compatibility/ApiFivePlus.java index fd15a4ca6..20082aff1 100644 --- a/src/org/linphone/compatibility/ApiFivePlus.java +++ b/src/org/linphone/compatibility/ApiFivePlus.java @@ -67,7 +67,7 @@ public class ApiFivePlus { intent.putExtra(ContactsContract.Intents.Insert.NAME, displayName); if (Version.sdkAboveOrEqual(Version.API09_GINGERBREAD_23)) { - if (sipUri.startsWith("sip:")) { + if (sipUri != null && sipUri.startsWith("sip:")) { sipUri = sipUri.substring(4); }