From 315d9257a712afba3a5c60a803a679a93ba32d02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Tue, 19 Apr 2016 16:05:38 +0200 Subject: [PATCH 01/50] Update bzrtp and liblinphone --- submodules/bzrtp | 2 +- submodules/linphone | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/submodules/bzrtp b/submodules/bzrtp index 8a82f7a64..5a6196e3d 160000 --- a/submodules/bzrtp +++ b/submodules/bzrtp @@ -1 +1 @@ -Subproject commit 8a82f7a645765480a90f41ce18c85cf9a62dcc14 +Subproject commit 5a6196e3d0a5d5b2998522379c9fdc2788378570 diff --git a/submodules/linphone b/submodules/linphone index 6f48b4151..465559dd6 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 6f48b4151cce800cb300a2c4c8dd8b32e7275c1b +Subproject commit 465559dd662d8e1c2a05dea873154c1d2dbdd241 From abfda3a7a5453b1680c810441f07d9ffd659ec6f Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 22 Apr 2016 11:03:06 +0200 Subject: [PATCH 02/50] Updated linphone --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index 465559dd6..f5f80c92b 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 465559dd662d8e1c2a05dea873154c1d2dbdd241 +Subproject commit f5f80c92bd4545881279014b0151e2092b07759e From d92fae163ecc12dfb1c668c4d4644dfcacfa8418 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 22 Apr 2016 11:46:33 +0200 Subject: [PATCH 03/50] Updated linphone to fix build --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index f5f80c92b..5f3cca344 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit f5f80c92bd4545881279014b0151e2092b07759e +Subproject commit 5f3cca3449e94796b3dc7b59a9ee9820e2022001 From 672b0337cceee22bf294bb89a4f840fbffd01099 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 27 Apr 2016 16:33:52 +0200 Subject: [PATCH 04/50] Prevent crash when download bitmap is invalid --- src/org/linphone/LinphoneManager.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java index 006b27168..e5427e20f 100644 --- a/src/org/linphone/LinphoneManager.java +++ b/src/org/linphone/LinphoneManager.java @@ -84,6 +84,8 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Resources; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; @@ -286,15 +288,18 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag @Override public void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, LinphoneChatMessage.State state) { if (state == LinphoneChatMessage.State.FileTransferDone) { - if(msg.isOutgoing() && mUploadingImageStream != null){ + if (msg.isOutgoing() && mUploadingImageStream != null) { mUploadPendingFileMessage = null; mUploadingImageStream = null; } else { File file = new File(Environment.getExternalStorageDirectory(), msg.getAppData()); try { - String url = MediaStore.Images.Media.insertImage(getContext().getContentResolver(), file.getPath(), file.getName(), null); - msg.setAppData(url); - file.delete(); + Bitmap bm = BitmapFactory.decodeFile(file.getPath()); + if (bm != null) { + String url = MediaStore.Images.Media.insertImage(getContext().getContentResolver(), file.getPath(), file.getName(), null); + msg.setAppData(url); + file.delete(); + } } catch (FileNotFoundException e) { e.printStackTrace(); } @@ -302,7 +307,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } } - if(state == LinphoneChatMessage.State.FileTransferError) { + if (state == LinphoneChatMessage.State.FileTransferError) { //TODO } From 2bb0e3bdbbd36e5f8c354c472cc9589466f19989 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Thu, 28 Apr 2016 15:30:07 +0200 Subject: [PATCH 05/50] sqlite3: do not download it each time --- .gitmodules | 1 + submodules/cmake-builder | 2 +- submodules/externals/sqlite3/CMakeLists.txt | 70 +++++++++++++++++++++ 3 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 submodules/externals/sqlite3/CMakeLists.txt diff --git a/.gitmodules b/.gitmodules index 9753c1b84..f82548a74 100644 --- a/.gitmodules +++ b/.gitmodules @@ -90,6 +90,7 @@ [submodule "submodules/externals/mbedtls"] path = submodules/externals/mbedtls url = git://git.linphone.org/mbedtls.git + ignore = dirty [submodule "submodules/cmake-builder"] path = submodules/cmake-builder url = git://git.linphone.org/linphone-cmake-builder.git diff --git a/submodules/cmake-builder b/submodules/cmake-builder index 1bff470db..2492823c4 160000 --- a/submodules/cmake-builder +++ b/submodules/cmake-builder @@ -1 +1 @@ -Subproject commit 1bff470db4829ed6c83712ee4a4b8cf973c6188a +Subproject commit 2492823c427c208dd73a42815404c117f654c32f diff --git a/submodules/externals/sqlite3/CMakeLists.txt b/submodules/externals/sqlite3/CMakeLists.txt new file mode 100644 index 000000000..8c722641d --- /dev/null +++ b/submodules/externals/sqlite3/CMakeLists.txt @@ -0,0 +1,70 @@ +############################################################################ +# CMakeLists.txt +# Copyright (C) 2014 Belledonne Communications, Grenoble France +# +############################################################################ +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################ + +cmake_minimum_required(VERSION 2.6) +project(SQLITE3 C) + + +option(ENABLE_STATIC "Build static library (default is shared library)." OFF) + + +set(SOURCE_FILES sqlite3.c) +if(WIN32) + list(APPEND SOURCE_FILES sqlite3.def) +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + add_definitions( + -DSQLITE_OS_WINRT=1 + -DSQLITE_WIN32_FILEMAPPING_API=1 + -DSQLITE_OMIT_LOAD_EXTENSION + ) +endif() + +if(ENABLE_STATIC) + add_library(sqlite3 STATIC ${SOURCE_FILES}) +else() + add_library(sqlite3 SHARED ${SOURCE_FILES}) + if(MSVC) + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/sqlite3.pdb + DESTINATION bin + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) + endif() + endif() +endif() + +install(TARGETS sqlite3 + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE +) + + +file(GLOB HEADER_FILES "*.h") + +install(FILES ${HEADER_FILES} + DESTINATION include + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ +) From a3ad1105e24abf9c0b04f40bd7fe1394dab202e1 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 29 Apr 2016 10:06:03 +0200 Subject: [PATCH 06/50] Fixed crash when contact doesn't have a name --- src/org/linphone/ContactsListFragment.java | 12 ++++++++++-- src/org/linphone/LinphoneContact.java | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/org/linphone/ContactsListFragment.java b/src/org/linphone/ContactsListFragment.java index df9abcefd..f40336f64 100644 --- a/src/org/linphone/ContactsListFragment.java +++ b/src/org/linphone/ContactsListFragment.java @@ -431,7 +431,11 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O String prevLetter = null; for (int i = 0; i < contacts.size(); i++) { LinphoneContact contact = contacts.get(i); - String firstLetter = contact.getFullName().substring(0, 1).toUpperCase(Locale.getDefault()); + String fullName = contact.getFullName(); + if (fullName == null || fullName.isEmpty()) { + continue; + } + String firstLetter = fullName.substring(0, 1).toUpperCase(Locale.getDefault()); if (!firstLetter.equals(prevLetter)) { prevLetter = firstLetter; map.put(firstLetter, i); @@ -561,7 +565,11 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O return 0; } LinphoneContact contact = contacts.get(position); - String letter = contact.getFullName().substring(0, 1); + String fullName = contact.getFullName(); + if (fullName == null || fullName.isEmpty()) { + return 0; + } + String letter = fullName.substring(0, 1); return sectionsList.indexOf(letter); } } diff --git a/src/org/linphone/LinphoneContact.java b/src/org/linphone/LinphoneContact.java index 2a77c1660..6efda5d61 100644 --- a/src/org/linphone/LinphoneContact.java +++ b/src/org/linphone/LinphoneContact.java @@ -368,16 +368,7 @@ public class LinphoneContact implements Serializable, Comparable(); hasSipAddress = false; - if (!isAndroidContact() && isLinphoneFriend()) { - fullName = friend.getName(); - thumbnailUri = null; - photoUri = null; - LinphoneAddress addr = friend.getAddress(); - if (addr != null) { - addresses.add(new LinphoneNumberOrAddress(addr.asStringUriOnly(), true)); - hasSipAddress = true; - } - } else if (isAndroidContact()) { + if (isAndroidContact()) { String id = getAndroidId(); getContactNames(id); setThumbnailUri(getContactPictureUri(id)); @@ -416,6 +407,15 @@ public class LinphoneContact implements Serializable, Comparable Date: Fri, 29 Apr 2016 10:31:02 +0200 Subject: [PATCH 07/50] Improved file transfer server url handling --- res/raw-sw600dp/linphonerc_default | 5 ++++- res/raw-sw600dp/linphonerc_factory | 3 +-- res/raw/linphonerc_default | 5 ++++- res/raw/linphonerc_factory | 4 +--- src/org/linphone/LinphoneManager.java | 1 - src/org/linphone/LinphonePreferences.java | 4 ++-- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/res/raw-sw600dp/linphonerc_default b/res/raw-sw600dp/linphonerc_default index 8ee2fbaba..e05864072 100644 --- a/res/raw-sw600dp/linphonerc_default +++ b/res/raw-sw600dp/linphonerc_default @@ -12,10 +12,13 @@ keepalive_period=30000 size=vga [app] -sharing_server=https://www.linphone.org:444/lft.php tunnel=disabled push_notification=1 [tunnel] host= port=443 + +[misc] +log_collection_upload_server_url=https://www.linphone.org:444/lft.php +file_transfer_server_url=https://www.linphone.org:444/lft.php \ No newline at end of file diff --git a/res/raw-sw600dp/linphonerc_factory b/res/raw-sw600dp/linphonerc_factory index a1314bcce..adf12c2f5 100644 --- a/res/raw-sw600dp/linphonerc_factory +++ b/res/raw-sw600dp/linphonerc_factory @@ -31,5 +31,4 @@ dtmf_player_amp=0.1 ec_calibrator_cool_tones=1 [misc] -max_calls=10 -log_collection_upload_server_url=https://www.linphone.org:444/lft.php \ No newline at end of file +max_calls=10 \ No newline at end of file diff --git a/res/raw/linphonerc_default b/res/raw/linphonerc_default index 2238536a3..490709b92 100644 --- a/res/raw/linphonerc_default +++ b/res/raw/linphonerc_default @@ -12,7 +12,6 @@ keepalive_period=30000 size=qvga [app] -sharing_server=https://www.linphone.org:444/lft.php tunnel=disabled push_notification=1 auto_start=1 @@ -20,3 +19,7 @@ auto_start=1 [tunnel] host= port=443 + +[misc] +log_collection_upload_server_url=https://www.linphone.org:444/lft.php +file_transfer_server_url=https://www.linphone.org:444/lft.php \ No newline at end of file diff --git a/res/raw/linphonerc_factory b/res/raw/linphonerc_factory index 2a919c8d6..e13273368 100644 --- a/res/raw/linphonerc_factory +++ b/res/raw/linphonerc_factory @@ -31,6 +31,4 @@ dtmf_player_amp=0.1 ec_calibrator_cool_tones=1 [misc] -max_calls=10 -log_collection_upload_server_url=https://www.linphone.org:444/lft.php - +max_calls=10 \ No newline at end of file diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java index e5427e20f..f4b0ddb17 100644 --- a/src/org/linphone/LinphoneManager.java +++ b/src/org/linphone/LinphoneManager.java @@ -690,7 +690,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } resetCameraFromPreferences(); - mLc.setFileTransferServer(LinphonePreferences.instance().getSharingPictureServerUrl()); } private void copyAssetsFromPackage() throws IOException { diff --git a/src/org/linphone/LinphonePreferences.java b/src/org/linphone/LinphonePreferences.java index 041e43078..c5ef97bf3 100644 --- a/src/org/linphone/LinphonePreferences.java +++ b/src/org/linphone/LinphonePreferences.java @@ -1039,11 +1039,11 @@ public class LinphonePreferences { } public String getSharingPictureServerUrl() { - return getConfig().getString("app", "sharing_server", null); + return getLc().getFileTransferServer(); } public void setSharingPictureServerUrl(String url) { - getConfig().setString("app", "sharing_server", url); + getLc().setFileTransferServer(url); } public void setRemoteProvisioningUrl(String url) { From ac7382973925da91b8e69bb71c76cd994ff65f9d Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 29 Apr 2016 11:01:09 +0200 Subject: [PATCH 08/50] Fixed another crash if contact name is empty --- src/org/linphone/ContactsListFragment.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/org/linphone/ContactsListFragment.java b/src/org/linphone/ContactsListFragment.java index f40336f64..a656d69fe 100644 --- a/src/org/linphone/ContactsListFragment.java +++ b/src/org/linphone/ContactsListFragment.java @@ -481,7 +481,10 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O separator.setVisibility(View.GONE); } else { separator.setVisibility(View.VISIBLE); - separatorText.setText(String.valueOf(contact.getFullName().charAt(0))); + String fullName = contact.getFullName(); + if (fullName != null && !fullName.isEmpty()) { + separatorText.setText(String.valueOf(fullName.charAt(0))); + } } ImageView icon = (ImageView) view.findViewById(R.id.contact_picture); From fce9b60de962db974fc44ae0e8a9aae5d49bf7dd Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 29 Apr 2016 14:15:28 +0200 Subject: [PATCH 09/50] Another fix --- src/org/linphone/LinphoneContact.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/org/linphone/LinphoneContact.java b/src/org/linphone/LinphoneContact.java index 6efda5d61..66a2920f5 100644 --- a/src/org/linphone/LinphoneContact.java +++ b/src/org/linphone/LinphoneContact.java @@ -440,8 +440,10 @@ public class LinphoneContact implements Serializable, Comparable Date: Sat, 30 Apr 2016 15:16:19 +0200 Subject: [PATCH 10/50] update bcg729 (fixes build issue) --- submodules/bcg729 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/bcg729 b/submodules/bcg729 index 78aedfdf5..bdb7c3870 160000 --- a/submodules/bcg729 +++ b/submodules/bcg729 @@ -1 +1 @@ -Subproject commit 78aedfdf5cb02565ceb48e4acef202462c2f0dbf +Subproject commit bdb7c3870085830ef2226b8938578de64f9934b9 From 6e95a839559d02d92597d740b9cca0d30adda170 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 2 May 2016 14:00:23 +0200 Subject: [PATCH 11/50] remove Android.mk info traces to workaround ndk-gdb.py issue with APP_ABI --- jni/Android.mk | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/jni/Android.mk b/jni/Android.mk index 256939495..f44ba5cc0 100755 --- a/jni/Android.mk +++ b/jni/Android.mk @@ -15,7 +15,6 @@ endif ifeq ($(_BUILD_VIDEO),0) ifeq (,$(DUMP_VAR)) -$(info $(TARGET_ARCH_ABI): Video is disabled for targets other than armeabi-v7a and x86) endif endif @@ -86,7 +85,6 @@ endif ifeq ($(BUILD_SILK), 1) ifeq (,$(DUMP_VAR)) -$(info $(TARGET_ARCH_ABI): Build proprietary SILK plugin for mediastreamer2) endif include $(linphone-root-dir)/submodules/mssilk/Android.mk endif @@ -100,7 +98,6 @@ ifeq ($(_BUILD_VIDEO),1) ifeq ($(_BUILD_X264),1) ifeq (,$(DUMP_VAR)) -$(info $(TARGET_ARCH_ABI): Build X264 plugin for mediastreamer2) endif include $(linphone-root-dir)/submodules/msx264/Android.mk include $(linphone-root-dir)/submodules/externals/build/x264/Android.mk @@ -108,7 +105,6 @@ endif ifeq ($(_BUILD_OPENH264),1) ifeq (,$(DUMP_VAR)) -$(info $(TARGET_ARCH_ABI): Build OpenH264 plugin for mediastreamer2) endif include $(linphone-root-dir)/submodules/msopenh264/Android.mk include $(linphone-root-dir)/submodules/externals/build/openh264/Android.mk @@ -123,7 +119,6 @@ endif #_BUILD_VIDEO ifeq ($(BUILD_ZRTP), 1) ifeq (,$(DUMP_VAR)) -$(info $(TARGET_ARCH_ABI): Build ZRTP support) endif include $(linphone-root-dir)/submodules/bzrtp/Android.mk endif @@ -166,11 +161,9 @@ WEBRTC_BUILD_NEON_LIBS=false # AECM ifneq ($(BUILD_WEBRTC_AECM),0) ifeq ($(TARGET_ARCH_ABI), armeabi-v7a) -$(info $(TARGET_ARCH_ABI): Build NEON modules for AECM) WEBRTC_BUILD_NEON_LIBS=true endif -$(info $(TARGET_ARCH_ABI): Build AECM from WebRTC) include $(linphone-root-dir)/submodules/mswebrtc/build/android/system_wrappers/Android.mk include $(linphone-root-dir)/submodules/mswebrtc/build/android/modules/audio_processing/utility/Android.mk include $(linphone-root-dir)/submodules/mswebrtc/build/android/modules/audio_processing/aecm/Android.mk @@ -180,18 +173,15 @@ endif ifneq ($(BUILD_WEBRTC_ISAC),0) # don't build for neon in x86 ifeq ($(TARGET_ARCH_ABI), armeabi-v7a) -$(info $(TARGET_ARCH_ABI): Build NEON modules for ISAC) WEBRTC_BUILD_NEON_LIBS=true endif -$(info $(TARGET_ARCH_ABI): Build iSAC and ilbc plugin for mediastreamer2) include $(linphone-root-dir)/submodules/mswebrtc/build/android/modules/audio_coding/codecs/isac/fix/source/Android.mk include $(linphone-root-dir)/submodules/mswebrtc/build/android/modules/audio_coding/codecs/ilbc/Android.mk endif # common modules for ISAC and AECM ifneq ($(BUILD_WEBRTC_AECM)$(BUILD_WEBRTC_ISAC)$(BUILD_ILBC),000) -$(info $(TARGET_ARCH_ABI): Build common modules for iSAC, ilbc and AECM ($(BUILD_WEBRTC_AECM)$(BUILD_WEBRTC_ISAC))) include $(linphone-root-dir)/submodules/mswebrtc/build/android/common_audio/signal_processing/Android.mk include $(linphone-root-dir)/submodules/mswebrtc/Android.mk endif From b00e49d2d59df3eed3d3c92e5607b82606a9a8e9 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 3 May 2016 11:41:13 +0200 Subject: [PATCH 12/50] [Switch submodule branch] Update cmake-builder, linphone and ffmpeg submodules. --- submodules/cmake-builder | 2 +- submodules/externals/ffmpeg | 2 +- submodules/linphone | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/submodules/cmake-builder b/submodules/cmake-builder index 2492823c4..b73209d6c 160000 --- a/submodules/cmake-builder +++ b/submodules/cmake-builder @@ -1 +1 @@ -Subproject commit 2492823c427c208dd73a42815404c117f654c32f +Subproject commit b73209d6ca3810cf0d7f1683aa98265ced4e8c0b diff --git a/submodules/externals/ffmpeg b/submodules/externals/ffmpeg index 26617b47f..644296e73 160000 --- a/submodules/externals/ffmpeg +++ b/submodules/externals/ffmpeg @@ -1 +1 @@ -Subproject commit 26617b47faccaf3646b767ed3062affd8252499d +Subproject commit 644296e736ee219cd02f7b7d7b7b4c7c5a464217 diff --git a/submodules/linphone b/submodules/linphone index 5f3cca344..61509e105 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 5f3cca3449e94796b3dc7b59a9ee9820e2022001 +Subproject commit 61509e105bbd49fa6f56ec7cc15175db231a7acf From 0c9c9d578e68eb1063feccc00c10bc41a5ae573e Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 3 May 2016 11:42:35 +0200 Subject: [PATCH 13/50] Add CMakeLists.txt to build cpufeatures library. --- .../build/cpufeatures/CMakeLists.txt | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 submodules/externals/build/cpufeatures/CMakeLists.txt diff --git a/submodules/externals/build/cpufeatures/CMakeLists.txt b/submodules/externals/build/cpufeatures/CMakeLists.txt new file mode 100644 index 000000000..8ba144dd5 --- /dev/null +++ b/submodules/externals/build/cpufeatures/CMakeLists.txt @@ -0,0 +1,36 @@ +############################################################################ +# CMakeLists.txt +# Copyright (C) 2016 Belledonne Communications, Grenoble France +# +############################################################################ +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################ + +cmake_minimum_required(VERSION 3.0) +project(androidcpufeatures LANGUAGES C) + +include(GNUInstallDirs) + + +add_library(cpufeatures STATIC "${ANDROID_CPU_FEATURES_INCLUDE_DIRS}/cpu-features.c") + +install(TARGETS cpufeatures + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE +) From 4ca3351b0938d3695714b51c2524f27ce194ae2a Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Fri, 29 Apr 2016 12:00:17 +0200 Subject: [PATCH 14/50] .gitmodules: ignore dirty antlr3c --- .gitmodules | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitmodules b/.gitmodules index f82548a74..9b67a5397 100644 --- a/.gitmodules +++ b/.gitmodules @@ -50,6 +50,7 @@ [submodule "submodules/externals/antlr3"] path = submodules/externals/antlr3 url = git://git.linphone.org/antlr3.git + ignore = dirty [submodule "submodules/externals/libxml2"] path = submodules/externals/libxml2 url = git://git.gnome.org/libxml2.git From 7a0d03932c118240db09503cec021906e3102000 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Tue, 3 May 2016 14:10:19 +0200 Subject: [PATCH 15/50] submodules: update bcg729 --- submodules/bcg729 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/bcg729 b/submodules/bcg729 index bdb7c3870..20614c1ed 160000 --- a/submodules/bcg729 +++ b/submodules/bcg729 @@ -1 +1 @@ -Subproject commit bdb7c3870085830ef2226b8938578de64f9934b9 +Subproject commit 20614c1ede14e02adbd6518a278334e9388602f3 From b6edbee3cc17d419556f407e601e3ac0064b1407 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 4 May 2016 15:22:48 +0200 Subject: [PATCH 16/50] Fixes for push notifications --- src/org/linphone/LinphonePreferences.java | 1 + src/org/linphone/LinphoneService.java | 14 -------------- src/org/linphone/compatibility/ApiEightPlus.java | 2 -- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/org/linphone/LinphonePreferences.java b/src/org/linphone/LinphonePreferences.java index c5ef97bf3..abae7649d 100644 --- a/src/org/linphone/LinphonePreferences.java +++ b/src/org/linphone/LinphonePreferences.java @@ -988,6 +988,7 @@ public class LinphonePreferences { public void setPushNotificationRegistrationID(String regId) { getConfig().setString("app", "push_notification_regid", regId); + setPushNotificationEnabled(isPushNotificationEnabled()); } public String getPushNotificationRegistrationID() { diff --git a/src/org/linphone/LinphoneService.java b/src/org/linphone/LinphoneService.java index 6999872ab..9d1a50efb 100644 --- a/src/org/linphone/LinphoneService.java +++ b/src/org/linphone/LinphoneService.java @@ -172,20 +172,6 @@ public final class LinphoneService extends Service { if (state == LinphoneCall.State.IncomingReceived) { onIncomingReceived(); } - - if (state == State.CallUpdatedByRemote) { - // If the correspondent proposes video while audio call - boolean remoteVideo = call.getRemoteParams().getVideoEnabled(); - boolean localVideo = call.getCurrentParamsCopy().getVideoEnabled(); - boolean autoAcceptCameraPolicy = LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests(); - if (remoteVideo && !localVideo && !autoAcceptCameraPolicy && !LinphoneManager.getLc().isInConference()) { - try { - LinphoneManager.getLc().deferCallUpdate(call); - } catch (LinphoneCoreException e) { - e.printStackTrace(); - } - } - } if (state == State.StreamsRunning) { // Workaround bug current call seems to be updated after state changed to streams running diff --git a/src/org/linphone/compatibility/ApiEightPlus.java b/src/org/linphone/compatibility/ApiEightPlus.java index c9e47a198..30f5a78fb 100644 --- a/src/org/linphone/compatibility/ApiEightPlus.java +++ b/src/org/linphone/compatibility/ApiEightPlus.java @@ -48,9 +48,7 @@ public class ApiEightPlus { String currentPushSenderID = LinphonePreferences.instance().getPushNotificationRegistrationID(); if (regId.equals("") || currentPushSenderID == null || !currentPushSenderID.equals(newPushSenderID)) { GCMRegistrar.getMethod("register", Context.class, String[].class).invoke(null, context, new String[]{newPushSenderID}); - Log.d("Push Notification: storing current sender id = " + newPushSenderID); - LinphonePreferences.instance().setPushNotificationRegistrationID(newPushSenderID); } else { Log.d("Push Notification: already registered with id = " + regId); LinphonePreferences.instance().setPushNotificationRegistrationID(regId); From 46a5128e2811917be35da35a95706a865406e129 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 5 May 2016 16:50:44 +0200 Subject: [PATCH 17/50] don't use getCurrentParamsCopy() to update a call or accept an update of call. --- src/org/linphone/CallActivity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/org/linphone/CallActivity.java b/src/org/linphone/CallActivity.java index 4c830acb8..7a03d80ac 100644 --- a/src/org/linphone/CallActivity.java +++ b/src/org/linphone/CallActivity.java @@ -724,7 +724,7 @@ public class CallActivity extends Activity implements OnClickListener, SensorEve } if (isVideoEnabled) { - LinphoneCallParams params = call.getCurrentParamsCopy(); + LinphoneCallParams params = LinphoneManager.getLc().createCallParams(call); params.setVideoEnabled(false); LinphoneManager.getLc().updateCall(call, params); } else { @@ -1317,7 +1317,7 @@ public class CallActivity extends Activity implements OnClickListener, SensorEve return; } - LinphoneCallParams params = call.getCurrentParamsCopy(); + LinphoneCallParams params = LinphoneManager.getLc().createCallParams(call); if (accept) { params.setVideoEnabled(true); LinphoneManager.getLc().enableVideo(true, true); From 315353b174a5ee3013ce27a51595907551f3f2aa Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 5 May 2016 16:51:28 +0200 Subject: [PATCH 18/50] update linphone submodule (MediaCodec improvements) --- README | 6 +++++- submodules/linphone | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README b/README index 779491944..743d12b6b 100644 --- a/README +++ b/README @@ -9,7 +9,11 @@ To build liblinphone for Android, you must: ------------------------------------------- 0) download the Android sdk with platform-tools and tools updated to latest revision (at least API 16 is needed), then add both 'tools' and 'platform-tools' folders in your path. 1) download the Android ndk (=r10c) from google and add it to your path (no symlink !!!). -2) install yasm, nasm, ant, python, cmake +2) install yasm, nasm, ant, python, cmake, and gas-precessor.pl + gas-preprocessor.pl is a simple perl script that can be downloaded from + https://git.libav.org/?p=gas-preprocessor.git;a=blob_plain;f=gas-preprocessor.pl;hb=HEAD + After copying it into /usr/local/bin, don't forget to give it exec permission with chmod +x gas-preprocessor.pl + On 64 bits linux systems you'll need the ia32-libs package With the latest Debian (multiarch), you need this: dpkg --add-architecture i386 diff --git a/submodules/linphone b/submodules/linphone index 61509e105..39f82d4e0 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 61509e105bbd49fa6f56ec7cc15175db231a7acf +Subproject commit 39f82d4e05c00e042939141b3a84f3a810bdadca From c4aea1b1c8b86a5a63675e44efd6e9b604ae69e5 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 5 May 2016 17:46:09 +0200 Subject: [PATCH 19/50] update openh264 --- submodules/externals/openh264 | 2 +- submodules/msopenh264 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/submodules/externals/openh264 b/submodules/externals/openh264 index 2610ab183..9e75838c8 160000 --- a/submodules/externals/openh264 +++ b/submodules/externals/openh264 @@ -1 +1 @@ -Subproject commit 2610ab183249aee91862d2ad065f61db89107b34 +Subproject commit 9e75838c8638c48a32b15c73c9da7b1fe942fd5f diff --git a/submodules/msopenh264 b/submodules/msopenh264 index 4f66208c1..a944a9587 160000 --- a/submodules/msopenh264 +++ b/submodules/msopenh264 @@ -1 +1 @@ -Subproject commit 4f66208c15e771d5814c988bf5d11efb9e53d76b +Subproject commit a944a95878821451e828d3c5e432c442c6f2c842 From dc9b7ffca1b500c21491fe98d9cbffed4f838ec7 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 5 May 2016 23:20:46 +0200 Subject: [PATCH 20/50] update linphone (fixes a MediaCodec related crash) --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index 39f82d4e0..d0652895f 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 39f82d4e05c00e042939141b3a84f3a810bdadca +Subproject commit d0652895feac01d3f1c2cc3ebcb2787ca6cbde32 From 043da11d2676bf3d83277cad9f25c4cf27e6ec61 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 6 May 2016 11:18:03 +0200 Subject: [PATCH 21/50] Fix video request accept dialog --- src/org/linphone/LinphoneManager.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java index f4b0ddb17..004d3f695 100644 --- a/src/org/linphone/LinphoneManager.java +++ b/src/org/linphone/LinphoneManager.java @@ -1034,6 +1034,20 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } } + if (state == State.CallUpdatedByRemote) { + // If the correspondent proposes video while audio call + boolean remoteVideo = call.getRemoteParams().getVideoEnabled(); + boolean localVideo = call.getCurrentParamsCopy().getVideoEnabled(); + boolean autoAcceptCameraPolicy = LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests(); + if (remoteVideo && !localVideo && !autoAcceptCameraPolicy && !LinphoneManager.getLc().isInConference()) { + try { + LinphoneManager.getLc().deferCallUpdate(call); + } catch (LinphoneCoreException e) { + e.printStackTrace(); + } + } + } + if (state == State.StreamsRunning) { if (BluetoothManager.getInstance().isBluetoothHeadsetAvailable()) { BluetoothManager.getInstance().routeAudioToBluetooth(); From 320757c24af1c0d3a1d8a80adec6c6fdc106f48f Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 6 May 2016 11:44:21 +0200 Subject: [PATCH 22/50] Ask for external file storage permission for Android 6+ when a file transfer message is received or when attemping to download it --- src/org/linphone/ChatFragment.java | 8 ++++++++ src/org/linphone/LinphoneActivity.java | 7 +++++++ src/org/linphone/ui/BubbleChat.java | 27 +++++++++++++++++--------- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/src/org/linphone/ChatFragment.java b/src/org/linphone/ChatFragment.java index 6e30ddd1a..feac6ef48 100644 --- a/src/org/linphone/ChatFragment.java +++ b/src/org/linphone/ChatFragment.java @@ -38,6 +38,7 @@ import org.linphone.core.LinphoneCoreListenerBase; import org.linphone.mediastream.Log; import org.linphone.ui.BubbleChat; +import android.Manifest; import android.annotation.SuppressLint; import android.app.Activity; import android.app.Dialog; @@ -45,6 +46,7 @@ import android.app.Fragment; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; +import android.content.pm.PackageManager; import android.content.res.Configuration; import android.database.Cursor; import android.graphics.Bitmap; @@ -218,6 +220,12 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC if (from.asStringUriOnly().equals(sipUri)) { invalidate(); messagesList.setSelection(adapter.getCount()-1); + + String externalBodyUrl = message.getExternalBodyUrl(); + LinphoneContent fileTransferContent = message.getFileTransferInformation(); + if (externalBodyUrl != null || fileTransferContent != null) { + LinphoneActivity.instance().checkAndRequestExternalStoragePermission(); + } } } diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java index 235b8a763..7559e5bcf 100644 --- a/src/org/linphone/LinphoneActivity.java +++ b/src/org/linphone/LinphoneActivity.java @@ -100,6 +100,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta private static final int PERMISSIONS_REQUEST_READ_CONTACTS = 200; private static final int PERMISSIONS_REQUEST_RECORD_AUDIO = 201; private static final int PERMISSIONS_REQUEST_RECORD_AUDIO_INCOMING_CALL = 203; + private static final int PERMISSIONS_REQUEST_EXTERNAL_FILE_STORAGE = 204; private static LinphoneActivity instance; @@ -1196,6 +1197,12 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta getIntent().putExtra("PreviousActivity", 0); super.onPause(); } + + public void checkAndRequestExternalStoragePermission() { + if (getPackageManager().checkPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, getPackageName()) != PackageManager.PERMISSION_GRANTED) { + checkAndRequestPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, PERMISSIONS_REQUEST_EXTERNAL_FILE_STORAGE); + } + } public void checkAndRequestPermission(String permission, int result) { if (getPackageManager().checkPermission(permission, getPackageName()) != PackageManager.PERMISSION_GRANTED) { diff --git a/src/org/linphone/ui/BubbleChat.java b/src/org/linphone/ui/BubbleChat.java index 8081bece6..651ca6087 100644 --- a/src/org/linphone/ui/BubbleChat.java +++ b/src/org/linphone/ui/BubbleChat.java @@ -26,8 +26,10 @@ import java.util.Calendar; import java.util.HashMap; import java.util.Map.Entry; +import org.linphone.LinphoneActivity; import org.linphone.LinphoneContact; import org.linphone.LinphoneManager; +import org.linphone.LinphonePreferences; import org.linphone.LinphoneUtils; import org.linphone.R; import org.linphone.core.LinphoneBuffer; @@ -36,9 +38,11 @@ import org.linphone.core.LinphoneChatMessage.State; import org.linphone.core.LinphoneContent; import org.linphone.mediastream.Log; +import android.Manifest; import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; +import android.content.pm.PackageManager; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; @@ -138,7 +142,7 @@ public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListen LinphoneManager.addListener(this); } - if (externalBodyUrl != null || fileTransferContent != null ) { + if (externalBodyUrl != null || fileTransferContent != null) { String appData = message.getAppData(); ImageView imageView = (ImageView) view.findViewById(R.id.image); @@ -167,14 +171,19 @@ public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListen acceptDownload.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { - v.setEnabled(false); - String filename = context.getString(R.string.temp_photo_name_with_date).replace("%s", String.valueOf(System.currentTimeMillis())); - File file = new File(Environment.getExternalStorageDirectory(), filename); - nativeMessage.setAppData(filename); - LinphoneManager.getInstance().addDownloadMessagePending(nativeMessage); - nativeMessage.setListener(LinphoneManager.getInstance()); - nativeMessage.setFileTransferFilepath(file.getPath()); - nativeMessage.downloadFile(); + if (mContext.getPackageManager().checkPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, mContext.getPackageName()) == PackageManager.PERMISSION_GRANTED) { + v.setEnabled(false); + String filename = context.getString(R.string.temp_photo_name_with_date).replace("%s", String.valueOf(System.currentTimeMillis())); + File file = new File(Environment.getExternalStorageDirectory(), filename); + nativeMessage.setAppData(filename); + LinphoneManager.getInstance().addDownloadMessagePending(nativeMessage); + nativeMessage.setListener(LinphoneManager.getInstance()); + nativeMessage.setFileTransferFilepath(file.getPath()); + nativeMessage.downloadFile(); + } else { + Log.w("WRITE_EXTERNAL_STORAGE permission not granted, won't be able to store the downloaded file"); + LinphoneActivity.instance().checkAndRequestExternalStoragePermission(); + } } }); } else { From 50ff97568f3c6077622efd40f00aa75110fd9362 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 6 May 2016 14:54:59 +0200 Subject: [PATCH 23/50] [Switch submodule branch] Update cmake-builder, msopenh264 and vo-amrwbenc submodules. --- submodules/cmake-builder | 2 +- submodules/externals/vo-amrwbenc | 2 +- submodules/msopenh264 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/submodules/cmake-builder b/submodules/cmake-builder index b73209d6c..777529e7e 160000 --- a/submodules/cmake-builder +++ b/submodules/cmake-builder @@ -1 +1 @@ -Subproject commit b73209d6ca3810cf0d7f1683aa98265ced4e8c0b +Subproject commit 777529e7e69fc0cd6de637f73ce65b4f46d32b6c diff --git a/submodules/externals/vo-amrwbenc b/submodules/externals/vo-amrwbenc index 3b3fcd0d2..60b925e62 160000 --- a/submodules/externals/vo-amrwbenc +++ b/submodules/externals/vo-amrwbenc @@ -1 +1 @@ -Subproject commit 3b3fcd0d250948e74cd67e7ea81af431ab3928f9 +Subproject commit 60b925e621fd8d2bd3000207ceb5596a0fa20fb3 diff --git a/submodules/msopenh264 b/submodules/msopenh264 index a944a9587..7744dc572 160000 --- a/submodules/msopenh264 +++ b/submodules/msopenh264 @@ -1 +1 @@ -Subproject commit a944a95878821451e828d3c5e432c442c6f2c842 +Subproject commit 7744dc572470de6caf11b7e4ce7e79ba0c5efd55 From 3e9816adc99673aed882ec07547eaab413d14074 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Sat, 7 May 2016 13:20:23 +0200 Subject: [PATCH 24/50] update linphone (mediacodec fixes) --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index d0652895f..bff229349 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit d0652895feac01d3f1c2cc3ebcb2787ca6cbde32 +Subproject commit bff229349dcd60cc3763a606cbc8979df21879e1 From dece953b1c43307daf6658a319f4cc963dba1418 Mon Sep 17 00:00:00 2001 From: Margaux Clerc Date: Mon, 9 May 2016 11:18:34 +0200 Subject: [PATCH 25/50] Fix test transfer call --- tests/src/org/linphone/test/ConferenceAndMultiCall.java | 2 +- tests/src/org/linphone/test/Transfer.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/src/org/linphone/test/ConferenceAndMultiCall.java b/tests/src/org/linphone/test/ConferenceAndMultiCall.java index 1c71dbe78..076640ac8 100644 --- a/tests/src/org/linphone/test/ConferenceAndMultiCall.java +++ b/tests/src/org/linphone/test/ConferenceAndMultiCall.java @@ -249,7 +249,7 @@ public class ConferenceAndMultiCall extends SampleTest { solo.waitForActivity("LinphoneActivity", 2000); solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class); solo.clickOnView(solo.getView(org.linphone.R.id.side_menu_button)); - solo.clickOnText("Settings"); + solo.clickOnText(aContext.getString(org.linphone.R.string.menu_settings)); } private void startTwoCalls() { diff --git a/tests/src/org/linphone/test/Transfer.java b/tests/src/org/linphone/test/Transfer.java index a7bd3498e..783e0cc1a 100644 --- a/tests/src/org/linphone/test/Transfer.java +++ b/tests/src/org/linphone/test/Transfer.java @@ -18,6 +18,7 @@ public class Transfer extends SampleTest { @LargeTest public void testACallTransfer() { solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain)); + solo.sleep(1000); solo.clickOnView(solo.getView(org.linphone.R.id.call)); assertCallIsCorrectlyRunning(); From c2ea3734f9371ff3021744375e40c9c471b93b24 Mon Sep 17 00:00:00 2001 From: Margaux Clerc Date: Tue, 10 May 2016 09:46:51 +0200 Subject: [PATCH 26/50] Update linphone --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index bff229349..392271334 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit bff229349dcd60cc3763a606cbc8979df21879e1 +Subproject commit 392271334671ff505926215847f42ae79a136e88 From 02ce719cc28db22e66a7785dcaaed273ae2b2695 Mon Sep 17 00:00:00 2001 From: Margaux Clerc Date: Tue, 10 May 2016 11:05:42 +0200 Subject: [PATCH 27/50] Update transfer test --- tests/src/org/linphone/test/Transfer.java | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/src/org/linphone/test/Transfer.java b/tests/src/org/linphone/test/Transfer.java index 783e0cc1a..351a89a00 100644 --- a/tests/src/org/linphone/test/Transfer.java +++ b/tests/src/org/linphone/test/Transfer.java @@ -29,6 +29,7 @@ public class Transfer extends SampleTest { solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class); solo.enterText(0, iContext.getString(org.linphone.test.R.string.conference_account_login) + "@" + iContext.getString(org.linphone.test.R.string.conference_account_domain)); + solo.sleep(1000); solo.clickOnView(solo.getView(org.linphone.R.id.call)); // Transfer button as the same id, only the image changes solo.sleep(2000); From c32a058b9bd77a25da4f0b14b5995a7377ae4fdf Mon Sep 17 00:00:00 2001 From: Christophe Deschamps Date: Tue, 10 May 2016 15:09:18 +0200 Subject: [PATCH 28/50] tunnel update --- submodules/cmake-builder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/cmake-builder b/submodules/cmake-builder index 777529e7e..713f57812 160000 --- a/submodules/cmake-builder +++ b/submodules/cmake-builder @@ -1 +1 @@ -Subproject commit 777529e7e69fc0cd6de637f73ce65b4f46d32b6c +Subproject commit 713f57812306d142683a1417c97bab9984fb6f37 From 8e9f7aa1d4f264076654a22e6d07b0735168bb6d Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 10 May 2016 16:04:35 +0200 Subject: [PATCH 29/50] optimize ChatMessage handling and remove dead code --- src/org/linphone/ChatFragment.java | 37 +++++--------- src/org/linphone/ChatStorage.java | 67 +++----------------------- src/org/linphone/LinphoneActivity.java | 6 --- submodules/linphone | 2 +- 4 files changed, 19 insertions(+), 93 deletions(-) diff --git a/src/org/linphone/ChatFragment.java b/src/org/linphone/ChatFragment.java index feac6ef48..91a8408bd 100644 --- a/src/org/linphone/ChatFragment.java +++ b/src/org/linphone/ChatFragment.java @@ -22,6 +22,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Locale; @@ -334,60 +335,44 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } class ChatMessageAdapter extends BaseAdapter { - LinphoneChatMessage[] history; + ArrayList history; Context context; public ChatMessageAdapter(Context context, LinphoneChatMessage[] history) { - this.history = history; + this.history = new ArrayList(Arrays.asList(history)); this.context = context; } public void destroy() { - this.history = null; + history = null; } public void refreshHistory() { - this.history = null; - this.history = chatRoom.getHistory(); + this.history = new ArrayList(Arrays.asList(chatRoom.getHistory())); } public void addMessage(LinphoneChatMessage message) { - LinphoneChatMessage[] newHist = new LinphoneChatMessage[getCount() +1]; - for(int i=0; i< getCount(); i++){ - newHist[i] = this.history[i]; - } - newHist[getCount()] = message; - this.history = newHist; - } - - public void removeMessage(LinphoneChatMessage message) { - LinphoneChatMessage[] newHist = new LinphoneChatMessage[getCount() -1]; - for(int i=0; i< getCount(); i++){ - if(this.history[i].getStorageId() != newHist[i].getStorageId()) - newHist[i] = this.history[i]; - } - newHist[getCount()] = message; - this.history = newHist; + history.add(message); } @Override public int getCount() { - return history.length; + return history.size(); } @Override public LinphoneChatMessage getItem(int position) { - return history[position]; + return history.get(position); } @Override public long getItemId(int position) { - return history[position].getStorageId(); + return history.get(position).getStorageId(); } @Override public View getView(final int position, View convertView, ViewGroup parent) { - LinphoneChatMessage message = history[position]; + LinphoneChatMessage message = history.get(position); BubbleChat bubble = new BubbleChat(context, message, contact); View v = bubble.getView(); @@ -753,7 +738,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC if (newChatConversation) { exitNewConversationMode(lAddress.asStringUriOnly()); } else { - invalidate(); + displayBubbleChat(message); } Log.i("Sent message current status: " + message.getStatus()); diff --git a/src/org/linphone/ChatStorage.java b/src/org/linphone/ChatStorage.java index c7a5a36bc..e379e06c3 100644 --- a/src/org/linphone/ChatStorage.java +++ b/src/org/linphone/ChatStorage.java @@ -280,64 +280,14 @@ public class ChatStorage { return drafts; } - public List getMessages(String correspondent) { - List chatMessages = new ArrayList(); - - if (!useNativeAPI) { - Cursor c = db.query(TABLE_NAME, null, "remoteContact LIKE \"" + correspondent + "\"", null, null, null, "id ASC"); - - while (c.moveToNext()) { - try { - String message, timestamp, url; - int id = c.getInt(c.getColumnIndex("id")); - int direction = c.getInt(c.getColumnIndex("direction")); - message = c.getString(c.getColumnIndex("message")); - timestamp = c.getString(c.getColumnIndex("time")); - int status = c.getInt(c.getColumnIndex("status")); - byte[] rawImage = c.getBlob(c.getColumnIndex("image")); - int read = c.getInt(c.getColumnIndex("read")); - url = c.getString(c.getColumnIndex("url")); - - ChatMessage chatMessage = new ChatMessage(id, message, rawImage, timestamp, direction == INCOMING, status, read == READ); - chatMessage.setUrl(url); - chatMessages.add(chatMessage); - } catch (Exception e) { - e.printStackTrace(); - } - } - c.close(); - } else { - LinphoneChatRoom room = LinphoneManager.getLc().getOrCreateChatRoom(correspondent); - LinphoneChatMessage[] history = room.getHistory(); - for (int i = 0; i < history.length; i++) { - LinphoneChatMessage message = history[i]; - - Bitmap bm = null; - String url = message.getExternalBodyUrl(); - if (url != null && !url.startsWith("http")) { - bm = BitmapFactory.decodeFile(url); - } - ChatMessage chatMessage = new ChatMessage(i+1, message.getText(), bm, - String.valueOf(message.getTime()), !message.isOutgoing(), - message.getStatus().toInt(), message.isRead()); - chatMessage.setUrl(url); - chatMessages.add(chatMessage); - } - } - - return chatMessages; - } - public String getTextMessageForId(LinphoneChatRoom chatroom, int id) { String message = null; if (useNativeAPI) { - LinphoneChatMessage[] history = chatroom.getHistory(); - for (LinphoneChatMessage msg : history) { - if (msg.getStorageId() == id) { - message = msg.getText(); - break; - } + LinphoneChatMessage msg = getMessage(chatroom, id); + + if (msg != null) { + message = msg.getText(); } } else { Cursor c = db.query(TABLE_NAME, null, "id LIKE " + id, null, null, null, null); @@ -410,12 +360,9 @@ public class ChatStorage { public void deleteMessage(LinphoneChatRoom chatroom, int id) { if (useNativeAPI) { - LinphoneChatMessage[] history = chatroom.getHistory(); - for (LinphoneChatMessage message : history) { - if (message.getStorageId() == id) { - chatroom.deleteMessage(message); - break; - } + LinphoneChatMessage msg = getMessage(chatroom, id); + if (msg != null){ + chatroom.deleteMessage(msg); } } else { db.delete(TABLE_NAME, "id LIKE " + id, null); diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java index 7559e5bcf..b85e24116 100644 --- a/src/org/linphone/LinphoneActivity.java +++ b/src/org/linphone/LinphoneActivity.java @@ -864,10 +864,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta return getChatStorage().getDrafts(); } - public List getChatMessages(String correspondent) { - return getChatStorage().getMessages(correspondent); - } - public void removeFromChatList(String sipUri) { getChatStorage().removeDiscussion(sipUri); } @@ -876,8 +872,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta getChatStorage().deleteDraft(sipUri); } - - public void updateMissedChatCount() { displayMissedChats(getUnreadMessageCount()); } diff --git a/submodules/linphone b/submodules/linphone index 392271334..fa00efddb 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 392271334671ff505926215847f42ae79a136e88 +Subproject commit fa00efddbb22cda2dabf6e0629de27ad40bbe45b From a90fa14b7fcfc92520b8797e43e951d6d934fa2c Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 10 May 2016 18:02:23 +0200 Subject: [PATCH 30/50] Improve memory in chat --- src/org/linphone/ChatFragment.java | 32 +++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/src/org/linphone/ChatFragment.java b/src/org/linphone/ChatFragment.java index 91a8408bd..6b6801b4e 100644 --- a/src/org/linphone/ChatFragment.java +++ b/src/org/linphone/ChatFragment.java @@ -338,17 +338,24 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC ArrayList history; Context context; - public ChatMessageAdapter(Context context, LinphoneChatMessage[] history) { - this.history = new ArrayList(Arrays.asList(history)); + public ChatMessageAdapter(Context context) { this.context = context; + refreshHistory(); } public void destroy() { + history.clear(); history = null; + notifyDataSetInvalidated(); } public void refreshHistory() { - this.history = new ArrayList(Arrays.asList(chatRoom.getHistory())); + if (history != null) { + history.clear(); + } + LinphoneChatMessage[] messages = chatRoom.getHistory(); + history = new ArrayList(Arrays.asList(messages)); + messages = null; } public void addMessage(LinphoneChatMessage message) { @@ -373,12 +380,12 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC @Override public View getView(final int position, View convertView, ViewGroup parent) { LinphoneChatMessage message = history.get(position); + RelativeLayout rlayout = new RelativeLayout(context); BubbleChat bubble = new BubbleChat(context, message, contact); View v = bubble.getView(); registerForContextMenu(v); - RelativeLayout rlayout = new RelativeLayout(context); CheckBox deleteChatBubble = (CheckBox) v.findViewById(R.id.delete_message); @@ -470,9 +477,13 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC public void dispayMessageList() { messagesList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE); if(chatRoom != null) { - if (adapter != null) adapter.destroy(); - adapter = new ChatMessageAdapter(getActivity(), chatRoom.getHistory()); - messagesList.setAdapter(adapter); + if (adapter != null) { + adapter.refreshHistory(); + adapter.notifyDataSetChanged(); + } else { + adapter = new ChatMessageAdapter(getActivity()); + messagesList.setAdapter(adapter); + } } } @@ -541,6 +552,13 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } return true; } + + @Override + public void onDestroy() { + if (adapter != null) adapter.destroy(); + adapter = null; + super.onDestroy(); + } @Override public void onPause() { From 35a233462dff4e42486503eaa2c5907f2af17b66 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 11 May 2016 10:01:33 +0200 Subject: [PATCH 31/50] Fix huge fragment leak when switching between tabs --- src/org/linphone/LinphoneActivity.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java index b85e24116..cb70035a9 100644 --- a/src/org/linphone/LinphoneActivity.java +++ b/src/org/linphone/LinphoneActivity.java @@ -437,7 +437,8 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta } private void changeFragment(Fragment newFragment, FragmentsAvailable newFragmentType, boolean withoutAnimation) { - FragmentTransaction transaction = getFragmentManager().beginTransaction(); + FragmentManager fm = getFragmentManager(); + FragmentTransaction transaction = fm.beginTransaction(); /*if (!withoutAnimation && !isAnimationDisabled && currentFragment.shouldAnimate()) { if (newFragmentType.isRightOf(currentFragment)) { @@ -454,14 +455,19 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta }*/ if (newFragmentType != FragmentsAvailable.DIALER - || newFragmentType != FragmentsAvailable.CONTACTS_LIST - || newFragmentType != FragmentsAvailable.CHAT_LIST - || newFragmentType != FragmentsAvailable.HISTORY_LIST) { + && newFragmentType != FragmentsAvailable.CONTACTS_LIST + && newFragmentType != FragmentsAvailable.CHAT_LIST + && newFragmentType != FragmentsAvailable.HISTORY_LIST) { transaction.addToBackStack(newFragmentType.toString()); + } else { + while (fm.getBackStackEntryCount() > 0) { + fm.popBackStackImmediate(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); + } } + transaction.replace(R.id.fragmentContainer, newFragment, newFragmentType.toString()); transaction.commitAllowingStateLoss(); - getFragmentManager().executePendingTransactions(); + fm.executePendingTransactions(); currentFragment = newFragmentType; } From 06089a8ed8a96858ad3c3a18116624ed54780937 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 11 May 2016 14:19:18 +0200 Subject: [PATCH 32/50] Use new Android logger --- src/org/linphone/LinphoneLauncherActivity.java | 3 --- src/org/linphone/LinphoneManager.java | 6 ------ src/org/linphone/LinphonePreferences.java | 9 --------- src/org/linphone/LinphoneService.java | 3 ++- src/org/linphone/ui/Digit.java | 6 +++--- submodules/linphone | 2 +- 6 files changed, 6 insertions(+), 23 deletions(-) diff --git a/src/org/linphone/LinphoneLauncherActivity.java b/src/org/linphone/LinphoneLauncherActivity.java index 02460c7a9..362769bc0 100644 --- a/src/org/linphone/LinphoneLauncherActivity.java +++ b/src/org/linphone/LinphoneLauncherActivity.java @@ -46,9 +46,6 @@ public class LinphoneLauncherActivity extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - // Used to change for the lifetime of the app the name used to tag the logs - new Log(getResources().getString(R.string.app_name), !getResources().getBoolean(R.bool.disable_every_log)); - // Hack to avoid to draw twice LinphoneActivity on tablets if (getResources().getBoolean(R.bool.orientation_portrait_only)) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java index 004d3f695..7464aa8b8 100644 --- a/src/org/linphone/LinphoneManager.java +++ b/src/org/linphone/LinphoneManager.java @@ -588,9 +588,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag try { copyAssetsFromPackage(); //traces alway start with traces enable to not missed first initialization - boolean isDebugLogEnabled = !(mR.getBoolean(R.bool.disable_every_log)); - LinphoneCoreFactory.instance().setDebugMode(isDebugLogEnabled, getString(R.string.app_name)); - LinphoneCoreFactory.instance().enableLogCollection(isDebugLogEnabled); mLc = LinphoneCoreFactory.instance().createLinphoneCore(this, mLinphoneConfigFile, mLinphoneFactoryConfigFile, null, c); @@ -619,9 +616,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag private synchronized void initLiblinphone(LinphoneCore lc) throws LinphoneCoreException { mLc = lc; - boolean isDebugLogEnabled = !(mR.getBoolean(R.bool.disable_every_log)) && mPrefs.isDebugEnabled(); - LinphoneCoreFactory.instance().setDebugMode(isDebugLogEnabled, getString(R.string.app_name)); - LinphoneCoreFactory.instance().enableLogCollection(isDebugLogEnabled); PreferencesMigrator prefMigrator = new PreferencesMigrator(mServiceContext); prefMigrator.migrateRemoteProvisioningUriIfNeeded(); diff --git a/src/org/linphone/LinphonePreferences.java b/src/org/linphone/LinphonePreferences.java index abae7649d..ea1cee5a0 100644 --- a/src/org/linphone/LinphonePreferences.java +++ b/src/org/linphone/LinphonePreferences.java @@ -81,7 +81,6 @@ public class LinphonePreferences { } if (!LinphoneManager.isInstanciated()) { - Log.w("LinphoneManager not instanciated yet..."); return LinphoneCoreFactory.instance().createLpConfig(mContext.getFilesDir().getAbsolutePath() + "/.linphonerc"); } @@ -1198,14 +1197,6 @@ public class LinphonePreferences { return getConfig().getString("app", "debug_popup_magic", null); } - public void enableDebugLogs(Boolean debugMode){ - getConfig().setBool("app", "debug_logs_enabled", debugMode); - } - - public Boolean isDebugLogsEnabled(){ - return getConfig().getBool("app", "debug_logs_enabled", false); - } - public Boolean audioPermAsked(){ return getConfig().getBool("app", "audio_perm", false); } diff --git a/src/org/linphone/LinphoneService.java b/src/org/linphone/LinphoneService.java index 9d1a50efb..a25ed0769 100644 --- a/src/org/linphone/LinphoneService.java +++ b/src/org/linphone/LinphoneService.java @@ -135,8 +135,9 @@ public final class LinphoneService extends Service { mNotificationTitle = getString(R.string.service_name); // Needed in order for the two next calls to succeed, libraries must have been loaded first + LinphonePreferences.instance().setContext(getApplicationContext()); LinphoneCoreFactory.instance().setLogCollectionPath(getFilesDir().getAbsolutePath()); - LinphoneCoreFactory.instance().enableLogCollection(!(getResources().getBoolean(R.bool.disable_every_log))); + LinphoneCoreFactory.instance().enableLogCollection(LinphonePreferences.instance().isDebugEnabled()); // Dump some debugging information to the logs Log.i(START_LINPHONE_LOGS); diff --git a/src/org/linphone/ui/Digit.java b/src/org/linphone/ui/Digit.java index 8eb705cf3..dbe2c6b55 100644 --- a/src/org/linphone/ui/Digit.java +++ b/src/org/linphone/ui/Digit.java @@ -132,11 +132,11 @@ public class Digit extends Button implements AddressAware { public void displayDebugPopup(){ AlertDialog.Builder alertDialog = new AlertDialog.Builder(getContext()); alertDialog.setTitle(getContext().getString(R.string.debug_popup_title)); - if(LinphonePreferences.instance().isDebugLogsEnabled()) { + if(LinphonePreferences.instance().isDebugEnabled()) { alertDialog.setItems(getContext().getResources().getStringArray(R.array.popup_send_log), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if(which == 0){ - LinphonePreferences.instance().enableDebugLogs(false); + LinphonePreferences.instance().setDebugEnabled(false); LinphoneCoreFactory.instance().enableLogCollection(false); } if(which == 1) { @@ -152,7 +152,7 @@ public class Digit extends Button implements AddressAware { alertDialog.setItems(getContext().getResources().getStringArray(R.array.popup_enable_log), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if(which == 0) { - LinphonePreferences.instance().enableDebugLogs(true); + LinphonePreferences.instance().setDebugEnabled(true); LinphoneCoreFactory.instance().enableLogCollection(true); } } diff --git a/submodules/linphone b/submodules/linphone index fa00efddb..5872dddc3 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit fa00efddbb22cda2dabf6e0629de27ad40bbe45b +Subproject commit 5872dddc3c49838899a1eec80cbb61eaa0fbf299 From 5f197709105c72898ce72c9e3e0906e08e4ca841 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 11 May 2016 15:48:04 +0200 Subject: [PATCH 33/50] Fix first read of debug value and enable/disable logs accordingly --- res/raw-sw600dp/linphonerc_default | 1 + res/raw/linphonerc_default | 1 + src/org/linphone/LinphonePreferences.java | 26 ++++++++++++++++++++++- src/org/linphone/LinphoneService.java | 6 ++++-- submodules/linphone | 2 +- 5 files changed, 32 insertions(+), 4 deletions(-) diff --git a/res/raw-sw600dp/linphonerc_default b/res/raw-sw600dp/linphonerc_default index e05864072..bb1ff0146 100644 --- a/res/raw-sw600dp/linphonerc_default +++ b/res/raw-sw600dp/linphonerc_default @@ -14,6 +14,7 @@ size=vga [app] tunnel=disabled push_notification=1 +debug=0 [tunnel] host= diff --git a/res/raw/linphonerc_default b/res/raw/linphonerc_default index 490709b92..61e812811 100644 --- a/res/raw/linphonerc_default +++ b/res/raw/linphonerc_default @@ -15,6 +15,7 @@ size=qvga tunnel=disabled push_notification=1 auto_start=1 +debug=0 [tunnel] host= diff --git a/src/org/linphone/LinphonePreferences.java b/src/org/linphone/LinphonePreferences.java index ea1cee5a0..bf09dafb7 100644 --- a/src/org/linphone/LinphonePreferences.java +++ b/src/org/linphone/LinphonePreferences.java @@ -19,6 +19,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + import org.linphone.core.LinphoneAddress; import org.linphone.core.LinphoneAddress.TransportType; import org.linphone.core.LinphoneAuthInfo; @@ -81,7 +87,25 @@ public class LinphonePreferences { } if (!LinphoneManager.isInstanciated()) { - return LinphoneCoreFactory.instance().createLpConfig(mContext.getFilesDir().getAbsolutePath() + "/.linphonerc"); + File linphonerc = new File(mContext.getFilesDir().getAbsolutePath() + "/.linphonerc"); + if (linphonerc.exists()) { + return LinphoneCoreFactory.instance().createLpConfig(linphonerc.getAbsolutePath()); + } else { + InputStream inputStream = mContext.getResources().openRawResource(R.raw.linphonerc_default); + InputStreamReader inputreader = new InputStreamReader(inputStream); + BufferedReader buffreader = new BufferedReader(inputreader); + StringBuilder text = new StringBuilder(); + String line; + try { + while ((line = buffreader.readLine()) != null) { + text.append(line); + text.append('\n'); + } + } catch (IOException ioe) { + + } + return LinphoneCoreFactory.instance().createLpConfigFromString(text.toString()); + } } return LinphoneCoreFactory.instance().createLpConfig(LinphoneManager.getInstance().mLinphoneConfigFile); diff --git a/src/org/linphone/LinphoneService.java b/src/org/linphone/LinphoneService.java index a25ed0769..c73277966 100644 --- a/src/org/linphone/LinphoneService.java +++ b/src/org/linphone/LinphoneService.java @@ -135,9 +135,11 @@ public final class LinphoneService extends Service { mNotificationTitle = getString(R.string.service_name); // Needed in order for the two next calls to succeed, libraries must have been loaded first - LinphonePreferences.instance().setContext(getApplicationContext()); + LinphonePreferences.instance().setContext(getBaseContext()); LinphoneCoreFactory.instance().setLogCollectionPath(getFilesDir().getAbsolutePath()); - LinphoneCoreFactory.instance().enableLogCollection(LinphonePreferences.instance().isDebugEnabled()); + boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled(); + LinphoneCoreFactory.instance().enableLogCollection(isDebugEnabled); + LinphoneCoreFactory.instance().setDebugMode(isDebugEnabled, getString(R.string.app_name)); // Dump some debugging information to the logs Log.i(START_LINPHONE_LOGS); diff --git a/submodules/linphone b/submodules/linphone index 5872dddc3..618661f0b 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 5872dddc3c49838899a1eec80cbb61eaa0fbf299 +Subproject commit 618661f0b72e8a0284afd779ba4773e3e80af5da From d2c2bfa7576b401b6163f5e5502c255af1ced7b8 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 11 May 2016 16:19:42 +0200 Subject: [PATCH 34/50] Fix add contact from history if display name is set --- src/org/linphone/HistoryDetailFragment.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/org/linphone/HistoryDetailFragment.java b/src/org/linphone/HistoryDetailFragment.java index d7c598666..5c49c80f3 100644 --- a/src/org/linphone/HistoryDetailFragment.java +++ b/src/org/linphone/HistoryDetailFragment.java @@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. import org.linphone.core.LinphoneAddress; import org.linphone.core.LinphoneCoreException; import org.linphone.core.LinphoneCoreFactory; +import org.linphone.mediastream.Log; import android.app.Fragment; import android.net.Uri; @@ -156,8 +157,14 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener { } else if (id == R.id.chat) { LinphoneActivity.instance().displayChat(sipUri); } else if (id == R.id.add_contact) { - String uriToAdd = sipUri; - LinphoneActivity.instance().displayContactsForEdition(uriToAdd); + String uri = sipUri; + try { + LinphoneAddress addr = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri); + uri = addr.asStringUriOnly(); + } catch (LinphoneCoreException e) { + Log.e(e); + } + LinphoneActivity.instance().displayContactsForEdition(uri); } } } From 82fe152b5c33c2213d23cd6b285284bcd05a7ed4 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 11 May 2016 16:49:29 +0200 Subject: [PATCH 35/50] Replaced e.printStackTrace by Log.e(e) --- src/org/linphone/AccountPreferencesFragment.java | 3 ++- src/org/linphone/BluetoothManager.java | 2 +- src/org/linphone/CallActivity.java | 2 +- src/org/linphone/ChatFragment.java | 2 +- src/org/linphone/ChatStorage.java | 10 +++++----- src/org/linphone/ContactEditorFragment.java | 3 ++- src/org/linphone/HistoryDetailFragment.java | 2 +- src/org/linphone/LinphoneActivity.java | 2 +- src/org/linphone/LinphoneManager.java | 14 +++++++------- src/org/linphone/LinphonePreferences.java | 16 ++++++++-------- src/org/linphone/LinphoneUtils.java | 4 ++-- src/org/linphone/PreferencesMigrator.java | 4 ++-- src/org/linphone/SettingsFragment.java | 6 +++--- src/org/linphone/StatusFragment.java | 4 ++-- .../linphone/assistant/AssistantActivity.java | 6 +++--- .../RemoteProvisioningLoginActivity.java | 2 +- src/org/linphone/compatibility/ApiNinePlus.java | 3 ++- .../tutorials/TutorialBuddyStatusActivity.java | 3 ++- .../tutorials/TutorialChatRoomActivity.java | 3 ++- .../tutorials/TutorialHelloWorldActivity.java | 3 ++- .../tutorials/TutorialRegistrationActivity.java | 3 ++- src/org/linphone/ui/PreferencesListFragment.java | 15 ++++++++------- 22 files changed, 60 insertions(+), 52 deletions(-) diff --git a/src/org/linphone/AccountPreferencesFragment.java b/src/org/linphone/AccountPreferencesFragment.java index 2a36f0156..84c0ca59a 100644 --- a/src/org/linphone/AccountPreferencesFragment.java +++ b/src/org/linphone/AccountPreferencesFragment.java @@ -23,6 +23,7 @@ import java.util.List; import org.linphone.LinphonePreferences.AccountBuilder; import org.linphone.core.LinphoneCoreException; +import org.linphone.mediastream.Log; import org.linphone.ui.PreferencesListFragment; import android.os.Bundle; @@ -455,7 +456,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment { builder.saveNewAccount(); } } catch (LinphoneCoreException e) { - e.printStackTrace(); + Log.e(e); } LinphoneActivity.instance().isNewProxyConfig(); LinphoneManager.getLc().refreshRegisters(); diff --git a/src/org/linphone/BluetoothManager.java b/src/org/linphone/BluetoothManager.java index d4ad16cfe..0b183f6bb 100644 --- a/src/org/linphone/BluetoothManager.java +++ b/src/org/linphone/BluetoothManager.java @@ -269,7 +269,7 @@ public class BluetoothManager extends BroadcastReceiver { Log.d("Bluetooth receiver stopped"); } catch (Exception e) {} } catch (Exception e) { - e.printStackTrace(); + Log.e(e); } } diff --git a/src/org/linphone/CallActivity.java b/src/org/linphone/CallActivity.java index 7a03d80ac..635adba9f 100644 --- a/src/org/linphone/CallActivity.java +++ b/src/org/linphone/CallActivity.java @@ -1326,7 +1326,7 @@ public class CallActivity extends Activity implements OnClickListener, SensorEve try { LinphoneManager.getLc().acceptCallUpdate(call, params); } catch (LinphoneCoreException e) { - e.printStackTrace(); + Log.e(e); } } diff --git a/src/org/linphone/ChatFragment.java b/src/org/linphone/ChatFragment.java index 6b6801b4e..b19cd6a9a 100644 --- a/src/org/linphone/ChatFragment.java +++ b/src/org/linphone/ChatFragment.java @@ -905,7 +905,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC bm = Bitmap.createBitmap(bm, 0, 0, bm.getWidth(), bm.getHeight(), matrix, true); } } catch (Exception e) { - e.printStackTrace(); + Log.e(e); } ByteArrayOutputStream stream = new ByteArrayOutputStream(); diff --git a/src/org/linphone/ChatStorage.java b/src/org/linphone/ChatStorage.java index e379e06c3..370f366cc 100644 --- a/src/org/linphone/ChatStorage.java +++ b/src/org/linphone/ChatStorage.java @@ -71,7 +71,7 @@ public class ChatStorage { try { return context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode >= 2200; } catch (NameNotFoundException e) { - e.printStackTrace(); + Log.e(e); } return true; } @@ -110,7 +110,7 @@ public class ChatStorage { try { id = c.getString(c.getColumnIndex("id")); } catch (Exception e) { - e.printStackTrace(); + Log.e(e); } } c.close(); @@ -250,7 +250,7 @@ public class ChatStorage { try { message = c.getString(c.getColumnIndex("message")); } catch (Exception e) { - e.printStackTrace(); + Log.e(e); } } c.close(); @@ -271,7 +271,7 @@ public class ChatStorage { String to = c.getString(c.getColumnIndex("remoteContact")); drafts.add(to); } catch (Exception e) { - e.printStackTrace(); + Log.e(e); } } c.close(); @@ -296,7 +296,7 @@ public class ChatStorage { try { message = c.getString(c.getColumnIndex("message")); } catch (Exception e) { - e.printStackTrace(); + Log.e(e); } } c.close(); diff --git a/src/org/linphone/ContactEditorFragment.java b/src/org/linphone/ContactEditorFragment.java index f8f759eb5..131c0aa2d 100644 --- a/src/org/linphone/ContactEditorFragment.java +++ b/src/org/linphone/ContactEditorFragment.java @@ -25,6 +25,7 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.List; +import org.linphone.mediastream.Log; import org.linphone.mediastream.Version; import android.annotation.SuppressLint; @@ -354,7 +355,7 @@ public class ContactEditorFragment extends Fragment { Bitmap selectedImage = MediaStore.Images.Media.getBitmap(LinphoneManager.getInstance().getContext().getContentResolver(), selectedImageUri); selectedImage = Bitmap.createScaledBitmap(selectedImage, PHOTO_SIZE, PHOTO_SIZE, false); editContactPicture(null, selectedImage); - } catch (IOException e) { e.printStackTrace(); } + } catch (IOException e) { Log.e(e); } } else if (pickedPhotoForContactUri != null) { String filePath = pickedPhotoForContactUri.getPath(); diff --git a/src/org/linphone/HistoryDetailFragment.java b/src/org/linphone/HistoryDetailFragment.java index 5c49c80f3..f96b0e955 100644 --- a/src/org/linphone/HistoryDetailFragment.java +++ b/src/org/linphone/HistoryDetailFragment.java @@ -104,7 +104,7 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener { try { lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri); } catch (LinphoneCoreException e) { - e.printStackTrace(); + Log.e(e); } if(lAddress != null) { diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java index cb70035a9..58d463648 100644 --- a/src/org/linphone/LinphoneActivity.java +++ b/src/org/linphone/LinphoneActivity.java @@ -1466,7 +1466,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta return R.drawable.led_disconnected; } } catch (Exception e) { - e.printStackTrace(); + Log.e(e); } return R.drawable.led_disconnected; diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java index 7464aa8b8..77c6437f4 100644 --- a/src/org/linphone/LinphoneManager.java +++ b/src/org/linphone/LinphoneManager.java @@ -301,7 +301,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag file.delete(); } } catch (FileNotFoundException e) { - e.printStackTrace(); + Log.e(e); } removePendingMessage(msg); } @@ -570,7 +570,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag mLc.destroy(); } catch (RuntimeException e) { - e.printStackTrace(); + Log.e(e); } finally { mServiceContext.unregisterReceiver(instance.mKeepAliveReceiver); @@ -609,7 +609,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag mTimer.schedule(lTask, 0, 20); } catch (Exception e) { - e.printStackTrace(); + Log.e(e); Log.e(e, "Cannot start linphone"); } } @@ -786,7 +786,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag mLc.destroy(); } catch (RuntimeException e) { - e.printStackTrace(); + Log.e(e); } finally { mServiceContext.unregisterReceiver(instance.mKeepAliveReceiver); @@ -943,7 +943,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag else if (LinphoneService.isReady()) return LinphoneService.instance().getApplicationContext(); } catch (Exception e) { - e.printStackTrace(); + Log.e(e); } return null; } @@ -963,7 +963,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag try { mLc.acceptCall(call); } catch (LinphoneCoreException e) { - e.printStackTrace(); + Log.e(e); } } else if (state == State.IncomingReceived || (state == State.CallIncomingEarlyMedia && mR.getBoolean(R.bool.allow_ringing_while_early_media))) { @@ -1037,7 +1037,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag try { LinphoneManager.getLc().deferCallUpdate(call); } catch (LinphoneCoreException e) { - e.printStackTrace(); + Log.e(e); } } } diff --git a/src/org/linphone/LinphonePreferences.java b/src/org/linphone/LinphonePreferences.java index bf09dafb7..92092781d 100644 --- a/src/org/linphone/LinphonePreferences.java +++ b/src/org/linphone/LinphonePreferences.java @@ -156,7 +156,7 @@ public class LinphonePreferences { LinphoneAuthInfo authInfo = getLc().findAuthInfo(addr.getUserName(), null, addr.getDomain()); return authInfo; } catch (LinphoneCoreException e) { - e.printStackTrace(); + Log.e(e); } return null; @@ -399,7 +399,7 @@ public class LinphonePreferences { setAccountOutboundProxyEnabled(n, true); } } catch (LinphoneCoreException e) { - e.printStackTrace(); + Log.e(e); } } } @@ -414,7 +414,7 @@ public class LinphonePreferences { proxyAddr = LinphoneCoreFactory.instance().createLinphoneAddress(proxyConfig.getProxy()); transport = proxyAddr.getTransport(); } catch (LinphoneCoreException e) { - e.printStackTrace(); + Log.e(e); } } @@ -458,7 +458,7 @@ public class LinphonePreferences { saveAuthInfo(info); } } catch (LinphoneCoreException e) { - e.printStackTrace(); + Log.e(e); } } @@ -476,7 +476,7 @@ public class LinphonePreferences { prxCfg.setIdentity(addr.asString()); prxCfg.done(); } catch (Exception e) { - e.printStackTrace(); + Log.e(e); } } @@ -527,7 +527,7 @@ public class LinphonePreferences { prxCfg.setIdentity(identity); prxCfg.done(); } catch (LinphoneCoreException e) { - e.printStackTrace(); + Log.e(e); } } @@ -559,7 +559,7 @@ public class LinphonePreferences { setAccountOutboundProxyEnabled(n, true); } } catch (LinphoneCoreException e) { - e.printStackTrace(); + Log.e(e); } } @@ -581,7 +581,7 @@ public class LinphonePreferences { } prxCfg.done(); } catch (LinphoneCoreException e) { - e.printStackTrace(); + Log.e(e); } } diff --git a/src/org/linphone/LinphoneUtils.java b/src/org/linphone/LinphoneUtils.java index 781b3ac67..8d3668418 100644 --- a/src/org/linphone/LinphoneUtils.java +++ b/src/org/linphone/LinphoneUtils.java @@ -392,7 +392,7 @@ public final class LinphoneUtils { try { Runtime.getRuntime().exec(new String[] { "logcat", "-c" }); } catch (IOException e) { - e.printStackTrace(); + Log.e(e); } } @@ -452,7 +452,7 @@ public final class LinphoneUtils { } } catch (IOException e) { - e.printStackTrace(); + Log.e(e); } } } diff --git a/src/org/linphone/PreferencesMigrator.java b/src/org/linphone/PreferencesMigrator.java index f6cae93c4..e03a757b1 100644 --- a/src/org/linphone/PreferencesMigrator.java +++ b/src/org/linphone/PreferencesMigrator.java @@ -22,12 +22,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. import org.linphone.LinphonePreferences.AccountBuilder; import org.linphone.core.LinphoneCore; import org.linphone.core.LinphoneCoreException; +import org.linphone.mediastream.Log; import android.content.Context; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.content.res.Resources; - import android.preference.PreferenceManager; /** @@ -155,7 +155,7 @@ public class PreferencesMigrator { try { builder.saveNewAccount(); } catch (LinphoneCoreException e) { - e.printStackTrace(); + Log.e(e); } if (isDefaultAccount) { diff --git a/src/org/linphone/SettingsFragment.java b/src/org/linphone/SettingsFragment.java index dd0627726..b82ae71e1 100644 --- a/src/org/linphone/SettingsFragment.java +++ b/src/org/linphone/SettingsFragment.java @@ -442,7 +442,7 @@ public class SettingsFragment extends PreferencesListFragment { try { lc.enablePayloadType(pt, false); } catch (LinphoneCoreException e) { - e.printStackTrace(); + Log.e(e); } continue; } else { @@ -460,7 +460,7 @@ public class SettingsFragment extends PreferencesListFragment { try { LinphoneManager.getLcIfManagerNotDestroyedOrNull().enablePayloadType(pt, enable); } catch (LinphoneCoreException e) { - e.printStackTrace(); + Log.e(e); } return true; } @@ -579,7 +579,7 @@ public class SettingsFragment extends PreferencesListFragment { try { LinphoneManager.getLcIfManagerNotDestroyedOrNull().enablePayloadType(pt, enable); } catch (LinphoneCoreException e) { - e.printStackTrace(); + Log.e(e); } return true; } diff --git a/src/org/linphone/StatusFragment.java b/src/org/linphone/StatusFragment.java index a87cc2765..952ee2632 100644 --- a/src/org/linphone/StatusFragment.java +++ b/src/org/linphone/StatusFragment.java @@ -222,7 +222,7 @@ public class StatusFragment extends Fragment { return R.drawable.led_disconnected; } } catch (Exception e) { - e.printStackTrace(); + Log.e(e); } return R.drawable.led_disconnected; @@ -246,7 +246,7 @@ public class StatusFragment extends Fragment { return context.getString(R.string.status_not_connected); } } catch (Exception e) { - e.printStackTrace(); + Log.e(e); } return context.getString(R.string.status_not_connected); diff --git a/src/org/linphone/assistant/AssistantActivity.java b/src/org/linphone/assistant/AssistantActivity.java index 68213147f..cf74a770c 100644 --- a/src/org/linphone/assistant/AssistantActivity.java +++ b/src/org/linphone/assistant/AssistantActivity.java @@ -31,6 +31,7 @@ import org.linphone.core.LinphoneCoreException; import org.linphone.core.LinphoneCoreFactory; import org.linphone.core.LinphoneCoreListenerBase; import org.linphone.core.LinphoneProxyConfig; +import org.linphone.mediastream.Log; import android.Manifest; import android.app.Activity; @@ -48,7 +49,6 @@ import android.graphics.drawable.Drawable; import android.os.Bundle; import android.support.v4.app.ActivityCompat; import android.text.TextUtils; - import android.view.View; import android.view.View.OnClickListener; import android.view.WindowManager; @@ -367,7 +367,7 @@ private static AssistantActivity instance; try { address = LinphoneCoreFactory.instance().createLinphoneAddress(identity); } catch (LinphoneCoreException e) { - e.printStackTrace(); + Log.e(e); } if(address != null && displayName != null && !displayName.equals("")){ @@ -432,7 +432,7 @@ private static AssistantActivity instance; } accountCreated = true; } catch (LinphoneCoreException e) { - e.printStackTrace(); + Log.e(e); } } diff --git a/src/org/linphone/assistant/RemoteProvisioningLoginActivity.java b/src/org/linphone/assistant/RemoteProvisioningLoginActivity.java index a3aa2bca9..4987aeaf9 100644 --- a/src/org/linphone/assistant/RemoteProvisioningLoginActivity.java +++ b/src/org/linphone/assistant/RemoteProvisioningLoginActivity.java @@ -106,7 +106,7 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick prxCfg.setIdentity(identity); lc.addProxyConfig(prxCfg); } catch (LinphoneCoreException e) { - e.printStackTrace(); + Log.e(e); return false; } diff --git a/src/org/linphone/compatibility/ApiNinePlus.java b/src/org/linphone/compatibility/ApiNinePlus.java index 82e4d9ad8..70dd126cf 100644 --- a/src/org/linphone/compatibility/ApiNinePlus.java +++ b/src/org/linphone/compatibility/ApiNinePlus.java @@ -8,6 +8,7 @@ import org.linphone.LinphoneContact; import org.linphone.LinphoneUtils; import org.linphone.R; import org.linphone.core.LinphoneAddress; +import org.linphone.mediastream.Log; import android.annotation.TargetApi; import android.content.ContentProviderOperation; @@ -275,7 +276,7 @@ public class ApiNinePlus { try { contentResolver.applyBatch(ContactsContract.AUTHORITY, ops); } catch (Exception e) { - e.printStackTrace(); + Log.e(e); } } } diff --git a/src/org/linphone/tutorials/TutorialBuddyStatusActivity.java b/src/org/linphone/tutorials/TutorialBuddyStatusActivity.java index 94b30b43c..1b371a878 100644 --- a/src/org/linphone/tutorials/TutorialBuddyStatusActivity.java +++ b/src/org/linphone/tutorials/TutorialBuddyStatusActivity.java @@ -22,6 +22,7 @@ import org.linphone.R; import org.linphone.core.LinphoneCoreException; import org.linphone.core.tutorials.TutorialBuddyStatus; import org.linphone.core.tutorials.TutorialNotifier; +import org.linphone.mediastream.Log; import android.app.Activity; import android.os.Bundle; @@ -104,7 +105,7 @@ public class TutorialBuddyStatusActivity extends Activity { } }); } catch (LinphoneCoreException e) { - e.printStackTrace(); + Log.e(e); } } } diff --git a/src/org/linphone/tutorials/TutorialChatRoomActivity.java b/src/org/linphone/tutorials/TutorialChatRoomActivity.java index fe83fec89..2ec9ac628 100644 --- a/src/org/linphone/tutorials/TutorialChatRoomActivity.java +++ b/src/org/linphone/tutorials/TutorialChatRoomActivity.java @@ -22,6 +22,7 @@ import org.linphone.R; import org.linphone.core.LinphoneCoreException; import org.linphone.core.tutorials.TutorialChatRoom; import org.linphone.core.tutorials.TutorialNotifier; +import org.linphone.mediastream.Log; import android.app.Activity; import android.os.Bundle; @@ -93,7 +94,7 @@ public class TutorialChatRoomActivity extends Activity { } }); } catch (LinphoneCoreException e) { - e.printStackTrace(); + Log.e(e); } } } diff --git a/src/org/linphone/tutorials/TutorialHelloWorldActivity.java b/src/org/linphone/tutorials/TutorialHelloWorldActivity.java index df326dc3d..2a18799b2 100644 --- a/src/org/linphone/tutorials/TutorialHelloWorldActivity.java +++ b/src/org/linphone/tutorials/TutorialHelloWorldActivity.java @@ -22,6 +22,7 @@ import org.linphone.R; import org.linphone.core.LinphoneCoreException; import org.linphone.core.tutorials.TutorialHelloWorld; import org.linphone.core.tutorials.TutorialNotifier; +import org.linphone.mediastream.Log; import android.app.Activity; import android.os.Bundle; @@ -93,7 +94,7 @@ public class TutorialHelloWorldActivity extends Activity { } }); } catch (LinphoneCoreException e) { - e.printStackTrace(); + Log.e(e); } } } diff --git a/src/org/linphone/tutorials/TutorialRegistrationActivity.java b/src/org/linphone/tutorials/TutorialRegistrationActivity.java index 7fae5f477..7f0ca40b1 100644 --- a/src/org/linphone/tutorials/TutorialRegistrationActivity.java +++ b/src/org/linphone/tutorials/TutorialRegistrationActivity.java @@ -22,6 +22,7 @@ import org.linphone.R; import org.linphone.core.LinphoneCoreException; import org.linphone.core.tutorials.TutorialNotifier; import org.linphone.core.tutorials.TutorialRegistration; +import org.linphone.mediastream.Log; import android.os.Bundle; import android.os.Handler; @@ -97,7 +98,7 @@ public class TutorialRegistrationActivity extends TutorialHelloWorldActivity { sipAddressWidget.getText().toString(), sipPasswordWidget.getText().toString()); } catch (LinphoneCoreException e) { - e.printStackTrace(); + Log.e(e); outputText.setText(e.getMessage() +"\n"+outputText.getText()); } } diff --git a/src/org/linphone/ui/PreferencesListFragment.java b/src/org/linphone/ui/PreferencesListFragment.java index af35cc6fc..635813c5a 100644 --- a/src/org/linphone/ui/PreferencesListFragment.java +++ b/src/org/linphone/ui/PreferencesListFragment.java @@ -21,6 +21,7 @@ import java.lang.reflect.Constructor; import java.lang.reflect.Method; import org.linphone.R; +import org.linphone.mediastream.Log; import android.annotation.SuppressLint; import android.app.Activity; @@ -122,7 +123,7 @@ public class PreferencesListFragment extends ListFragment { m.setAccessible(true); m.invoke(mPreferenceManager); } catch(Exception e) { - e.printStackTrace(); + Log.e(e); } } @@ -135,7 +136,7 @@ public class PreferencesListFragment extends ListFragment { m.setAccessible(true); m.invoke(mPreferenceManager); } catch(Exception e) { - e.printStackTrace(); + Log.e(e); } } @@ -153,7 +154,7 @@ public class PreferencesListFragment extends ListFragment { m.setAccessible(true); m.invoke(mPreferenceManager, requestCode, resultCode, data); } catch(Exception e) { - e.printStackTrace(); + Log.e(e); } } @@ -187,7 +188,7 @@ public class PreferencesListFragment extends ListFragment { PreferenceManager preferenceManager = c.newInstance(this.getActivity(), FIRST_REQUEST_CODE); return preferenceManager; } catch(Exception e) { - e.printStackTrace(); + Log.e(e); return null; } } @@ -214,7 +215,7 @@ public class PreferencesListFragment extends ListFragment { postBindPreferences(); } }catch(Exception e){ - e.printStackTrace(); + Log.e(e); } } @@ -230,7 +231,7 @@ public class PreferencesListFragment extends ListFragment { m.setAccessible(true); return (PreferenceScreen) m.invoke(mPreferenceManager); } catch(Exception e) { - e.printStackTrace(); + Log.e(e); } return null; @@ -249,7 +250,7 @@ public class PreferencesListFragment extends ListFragment { PreferenceScreen prefScreen = (PreferenceScreen) m.invoke(mPreferenceManager, getActivity(), preferencesResId, getPreferenceScreen()); setPreferenceScreen(prefScreen); } catch(Exception e) { - e.printStackTrace(); + Log.e(e); } } From ac6bf5dfe2054fa7d71d0f9f88c036aa43efb73a Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 12 May 2016 08:42:31 +0200 Subject: [PATCH 36/50] Use popBackStack instead of creating a new fragment --- src/org/linphone/AboutFragment.java | 2 +- src/org/linphone/ContactDetailsFragment.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/org/linphone/AboutFragment.java b/src/org/linphone/AboutFragment.java index a2501193a..77a5f516f 100644 --- a/src/org/linphone/AboutFragment.java +++ b/src/org/linphone/AboutFragment.java @@ -93,7 +93,7 @@ public class AboutFragment extends Fragment implements OnClickListener { lc.resetLogCollection(); } } else if (v == cancel) { - LinphoneActivity.instance().displayDialer(); + getFragmentManager().popBackStackImmediate(); } } } diff --git a/src/org/linphone/ContactDetailsFragment.java b/src/org/linphone/ContactDetailsFragment.java index 8146b3be6..7909e0f1e 100644 --- a/src/org/linphone/ContactDetailsFragment.java +++ b/src/org/linphone/ContactDetailsFragment.java @@ -253,7 +253,7 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener dialog.show(); } if (id == R.id.back) { - LinphoneActivity.instance().displayContacts(false); + getFragmentManager().popBackStackImmediate(); } } } From cebe5d9b00b13b21ee4bd3d89f04b9cfb6ffae93 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 12 May 2016 12:03:45 +0200 Subject: [PATCH 37/50] Improved memory again (and a few other things along the way) --- src/org/linphone/ChatFragment.java | 20 +------ src/org/linphone/ChatListFragment.java | 27 ++++++++- src/org/linphone/ContactEditorFragment.java | 8 --- src/org/linphone/ContactsListFragment.java | 12 ---- src/org/linphone/LinphoneActivity.java | 61 ++++----------------- src/org/linphone/LinphoneManager.java | 10 +--- 6 files changed, 40 insertions(+), 98 deletions(-) diff --git a/src/org/linphone/ChatFragment.java b/src/org/linphone/ChatFragment.java index b19cd6a9a..05d96eb24 100644 --- a/src/org/linphone/ChatFragment.java +++ b/src/org/linphone/ChatFragment.java @@ -39,7 +39,6 @@ import org.linphone.core.LinphoneCoreListenerBase; import org.linphone.mediastream.Log; import org.linphone.ui.BubbleChat; -import android.Manifest; import android.annotation.SuppressLint; import android.app.Activity; import android.app.Dialog; @@ -47,7 +46,6 @@ import android.app.Fragment; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; -import android.content.pm.PackageManager; import android.content.res.Configuration; import android.database.Cursor; import android.graphics.Bitmap; @@ -89,8 +87,6 @@ import android.widget.Toast; public class ChatFragment extends Fragment implements OnClickListener, LinphoneChatMessage.LinphoneChatMessageListener { - private static ChatFragment instance; - private static final int ADD_PHOTO = 1337; private static final int MENU_DELETE_MESSAGE = 0; private static final int MENU_PICTURE_SMALL = 2; @@ -128,14 +124,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC private ByteArrayInputStream mUploadingImageStream; private boolean newChatConversation = false; - public static boolean isInstanciated() { - return instance != null; - } - @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState); - instance = this; final View view = inflater.inflate(R.layout.chat, container, false); LinphoneManager.addListener(this); @@ -219,6 +210,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) { LinphoneAddress from = cr.getPeerAddress(); if (from.asStringUriOnly().equals(sipUri)) { + LinphoneService.instance().removeMessageNotification(); + cr.markAsRead(); invalidate(); messagesList.setSelection(adapter.getCount()-1); @@ -257,10 +250,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC return view; } - public static ChatFragment instance() { - return instance; - } - public String getSipUri() { return sipUri; } @@ -567,10 +556,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC LinphoneService.instance().removeMessageNotification(); - if (LinphoneActivity.isInstanciated()) { - LinphoneActivity.instance().updateChatFragment(null); - } - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.removeListener(mListener); @@ -598,7 +583,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC if (LinphoneActivity.isInstanciated()) { LinphoneActivity.instance().selectMenu(FragmentsAvailable.CHAT); - LinphoneActivity.instance().updateChatFragment(this); } if(LinphoneManager.getLc().isIncall()){ diff --git a/src/org/linphone/ChatListFragment.java b/src/org/linphone/ChatListFragment.java index 584f60bf7..b0dfbeb3c 100644 --- a/src/org/linphone/ChatListFragment.java +++ b/src/org/linphone/ChatListFragment.java @@ -22,8 +22,10 @@ import java.util.List; import org.linphone.core.LinphoneAddress; import org.linphone.core.LinphoneChatMessage; import org.linphone.core.LinphoneChatRoom; +import org.linphone.core.LinphoneCore; import org.linphone.core.LinphoneCoreException; import org.linphone.core.LinphoneCoreFactory; +import org.linphone.core.LinphoneCoreListenerBase; import org.linphone.mediastream.Log; import android.app.Dialog; @@ -61,6 +63,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte private ImageView edit, selectAll, deselectAll, delete, newDiscussion, cancel, backInCall; private LinearLayout editList, topbar; private boolean isEditMode = false; + private LinphoneCoreListenerBase mListener; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, @@ -97,6 +100,13 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte delete = (ImageView) view.findViewById(R.id.delete); delete.setOnClickListener(this); + + mListener = new LinphoneCoreListenerBase() { + @Override + public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) { + refresh(); + } + }; return view; } @@ -194,12 +204,25 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte if (LinphoneActivity.isInstanciated()) { LinphoneActivity.instance().selectMenu(FragmentsAvailable.CHAT_LIST); - LinphoneActivity.instance().updateChatListFragment(this); LinphoneActivity.instance().hideTabBar(false); } + LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + if (lc != null) { + lc.addListener(mListener); + } + refresh(); } + + @Override + public void onPause() { + LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + if (lc != null) { + lc.removeListener(mListener); + } + super.onPause(); + } @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { @@ -381,7 +404,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte displayName.setText(contact == null ? LinphoneUtils.getAddressDisplayName(address) : contact.getFullName()); - if(contact != null){ + if (contact != null) { LinphoneUtils.setImagePictureFromUri(view.getContext(), contactPicture, contact.getPhotoUri(), contact.getThumbnailUri()); } else { contactPicture.setImageResource(R.drawable.avatar); diff --git a/src/org/linphone/ContactEditorFragment.java b/src/org/linphone/ContactEditorFragment.java index 131c0aa2d..134abcb6a 100644 --- a/src/org/linphone/ContactEditorFragment.java +++ b/src/org/linphone/ContactEditorFragment.java @@ -144,14 +144,6 @@ public class ContactEditorFragment extends Fragment { contact.addOrUpdateNumberOrAddress(numberOrAddress); } contact.save(); - - if (!isNewContact) { - if (LinphoneActivity.instance().getResources().getBoolean(R.bool.isTablet)) { - if(ContactsListFragment.isInstanciated()) { - ContactsListFragment.instance().invalidate(); - } - } - } getFragmentManager().popBackStackImmediate(); } }); diff --git a/src/org/linphone/ContactsListFragment.java b/src/org/linphone/ContactsListFragment.java index a656d69fe..9dffdeac4 100644 --- a/src/org/linphone/ContactsListFragment.java +++ b/src/org/linphone/ContactsListFragment.java @@ -68,16 +68,6 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O private ImageView clearSearchField; private EditText searchField; - private static ContactsListFragment instance; - - static final boolean isInstanciated() { - return instance != null; - } - - public static final ContactsListFragment instance() { - return instance; - } - @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mInflater = inflater; @@ -379,7 +369,6 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O @Override public void onResume() { - instance = this; ContactsManager.addContactsListener(this); super.onResume(); @@ -399,7 +388,6 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O @Override public void onPause() { - instance = null; ContactsManager.removeContactsListener(this); super.onPause(); } diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java index 58d463648..82889f9b8 100644 --- a/src/org/linphone/LinphoneActivity.java +++ b/src/org/linphone/LinphoneActivity.java @@ -112,8 +112,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta private ImageView cancel; private FragmentsAvailable currentFragment, nextFragment; private List fragmentsHistory; - private Fragment dialerFragment, chatListFragment, historyListFragment, contactListFragment; - private ChatFragment chatFragment; + private Fragment dialerFragment; private Fragment.SavedState dialerSavedState; private boolean newProxyConfig; private boolean isAnimationDisabled = true, emptyFragment = false, permissionAsked = false; @@ -195,13 +194,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta mListener = new LinphoneCoreListenerBase(){ @Override public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) { - if(!displayChatMessageNotification(message.getFrom().asStringUriOnly())) { - cr.markAsRead(); - } displayMissedChats(getUnreadMessageCount()); - if (chatListFragment != null && chatListFragment.isVisible()) { - ((ChatListFragment) chatListFragment).refresh(); - } } @Override @@ -373,14 +366,18 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta switch (newFragmentType) { case HISTORY_LIST: newFragment = new HistoryListFragment(); - historyListFragment = newFragment; + if (isTablet()) { + ((HistoryListFragment) newFragment).displayFirstLog(); + } break; case HISTORY_DETAIL: newFragment = new HistoryDetailFragment(); break; case CONTACTS_LIST: newFragment = new ContactsListFragment(); - contactListFragment = newFragment; + if (isTablet()) { + ((ContactsListFragment) newFragment).displayFirstContact(); + } break; case CONTACT_DETAIL: newFragment = new ContactDetailsFragment(); @@ -409,7 +406,9 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta break; case CHAT_LIST: newFragment = new ChatListFragment(); - chatListFragment = newFragment; + if (isTablet()) { + ((ChatListFragment) newFragment).displayFirstChat(); + } break; case CHAT: newFragment = new ChatFragment(); @@ -642,15 +641,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta startActivity(new Intent(LinphoneActivity.this, AssistantActivity.class)); } - public boolean displayChatMessageNotification(String address){ - if(chatFragment != null) { - if(chatFragment.getSipUri().equals(address)) { - return false; - } - } - return true; - } - public int getUnreadMessageCount() { int count = 0; LinphoneChatRoom[] chats = LinphoneManager.getLc().getChatRooms(); @@ -718,10 +708,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta } } - if (chatListFragment != null && chatListFragment.isVisible()) { - ((ChatListFragment) chatListFragment).refresh(); - } - LinphoneService.instance().resetMessageNotifCount(); LinphoneService.instance().removeMessageNotification(); displayMissedChats(getUnreadMessageCount()); @@ -737,30 +723,15 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta history_selected.setVisibility(View.VISIBLE); LinphoneManager.getLc().resetMissedCallsCount(); displayMissedCalls(0); - if(isTablet()) { - if (historyListFragment != null && historyListFragment.isVisible()) { - ((HistoryListFragment) historyListFragment).displayFirstLog(); - } - } } else if (id == R.id.contacts) { changeCurrentFragment(FragmentsAvailable.CONTACTS_LIST, null); contacts_selected.setVisibility(View.VISIBLE); - if(isTablet()) { - if (contactListFragment != null && contactListFragment.isVisible()) { - ((ContactsListFragment) contactListFragment).displayFirstContact(); - } - } } else if (id == R.id.dialer) { changeCurrentFragment(FragmentsAvailable.DIALER, null); dialer_selected.setVisibility(View.VISIBLE); } else if (id == R.id.chat) { changeCurrentFragment(FragmentsAvailable.CHAT_LIST, null); chat_selected.setVisibility(View.VISIBLE); - if(isTablet()) { - if (chatListFragment != null && chatListFragment.isVisible()) { - ((ChatListFragment) chatListFragment).displayFirstChat(); - } - } } else if (id == R.id.cancel){ hideTopBar(); displayDialer(); @@ -825,14 +796,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN | WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); } - public void updateChatFragment(ChatFragment fragment) { - chatFragment = fragment; - } - - public void updateChatListFragment(ChatListFragment fragment) { - chatListFragment = fragment; - } - public void updateStatusFragment(StatusFragment fragment) { statusFragment = fragment; } @@ -884,10 +847,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta public int onMessageSent(String to, String message) { getChatStorage().deleteDraft(to); - if (chatListFragment != null && chatListFragment.isVisible()) { - ((ChatListFragment) chatListFragment).refresh(); - } - return getChatStorage().saveTextMessage("", to, message, System.currentTimeMillis()); } diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java index 77c6437f4..61192d309 100644 --- a/src/org/linphone/LinphoneManager.java +++ b/src/org/linphone/LinphoneManager.java @@ -864,14 +864,10 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag try { LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(from); if (!mServiceContext.getResources().getBoolean(R.bool.disable_chat_message_notification)) { - if (LinphoneActivity.isInstanciated() && !LinphoneActivity.instance().displayChatMessageNotification(from.asStringUriOnly())) { - return; + if (contact != null) { + LinphoneService.instance().displayMessageNotification(from.asStringUriOnly(), contact.getFullName(), textMessage); } else { - if (contact != null) { - LinphoneService.instance().displayMessageNotification(from.asStringUriOnly(), contact.getFullName(), textMessage); - } else { - LinphoneService.instance().displayMessageNotification(from.asStringUriOnly(), from.getUserName(), textMessage); - } + LinphoneService.instance().displayMessageNotification(from.asStringUriOnly(), from.getUserName(), textMessage); } } } catch (Exception e) { From 19381472a44cc74e08376f1eebcb6b54dffc5f7b Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 12 May 2016 12:26:04 +0200 Subject: [PATCH 38/50] Improved memory while in chat view --- src/org/linphone/ChatFragment.java | 14 ++++++++++++-- src/org/linphone/HistoryListFragment.java | 2 +- src/org/linphone/ui/BubbleChat.java | 4 ++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/org/linphone/ChatFragment.java b/src/org/linphone/ChatFragment.java index 05d96eb24..fb5c94427 100644 --- a/src/org/linphone/ChatFragment.java +++ b/src/org/linphone/ChatFragment.java @@ -369,10 +369,20 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC @Override public View getView(final int position, View convertView, ViewGroup parent) { LinphoneChatMessage message = history.get(position); - RelativeLayout rlayout = new RelativeLayout(context); + RelativeLayout rlayout; + if (convertView != null) { + rlayout = (RelativeLayout) convertView; + View bbv = rlayout.getChildAt(0); + rlayout.removeAllViews(); + BubbleChat bbc = (BubbleChat) bbv.getTag(); + bbc.destroy(); + } else { + rlayout = new RelativeLayout(context); + } BubbleChat bubble = new BubbleChat(context, message, contact); View v = bubble.getView(); + v.setTag(bubble); registerForContextMenu(v); @@ -470,7 +480,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC adapter.refreshHistory(); adapter.notifyDataSetChanged(); } else { - adapter = new ChatMessageAdapter(getActivity()); + adapter = new ChatMessageAdapter(getActivity().getApplicationContext()); messagesList.setAdapter(adapter); } } diff --git a/src/org/linphone/HistoryListFragment.java b/src/org/linphone/HistoryListFragment.java index 98aff2296..53357bf36 100644 --- a/src/org/linphone/HistoryListFragment.java +++ b/src/org/linphone/HistoryListFragment.java @@ -208,7 +208,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs()); if (!hideHistoryListAndDisplayMessageIfEmpty()) { historyList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE); - historyList.setAdapter(new CallHistoryAdapter(getActivity())); + historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext())); } } diff --git a/src/org/linphone/ui/BubbleChat.java b/src/org/linphone/ui/BubbleChat.java index 651ca6087..50b3d4ea6 100644 --- a/src/org/linphone/ui/BubbleChat.java +++ b/src/org/linphone/ui/BubbleChat.java @@ -236,6 +236,10 @@ public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListen public View getView() { return view; } + + public void destroy() { + defaultBitmap.recycle(); + } private String timestampToHumanDate(Context context, long timestamp) { try { From 35019ff3d999c12cddefb109eefe59994ec347a0 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 12 May 2016 12:35:24 +0200 Subject: [PATCH 39/50] update linphone submodule (fixes mute button) --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index 618661f0b..bf2032919 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 618661f0b72e8a0284afd779ba4773e3e80af5da +Subproject commit bf20329191979a80a1bec9d54ee2020b4d91e74f From 6f06aeacd1efdf361ef783cae429c9f0fac8447e Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 12 May 2016 16:08:15 +0200 Subject: [PATCH 40/50] Fix tester compilation --- tests/src/org/linphone/test/Contacts.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/src/org/linphone/test/Contacts.java b/tests/src/org/linphone/test/Contacts.java index 19fc953b6..49ce52ccb 100644 --- a/tests/src/org/linphone/test/Contacts.java +++ b/tests/src/org/linphone/test/Contacts.java @@ -51,11 +51,7 @@ public class Contacts extends SampleTest { solo.enterText(0, iContext.getString(org.linphone.test.R.string.contact_name)); solo.enterText(3, iContext.getString(org.linphone.test.R.string.contact_number)); solo.clickOnView(solo.getView(org.linphone.R.id.ok)); - - if (ContactsListFragment.instance() != null) { - ContactsListFragment.instance().invalidate(); - solo.sleep(1000); - } + solo.sleep(2000); Assert.assertTrue(solo.searchText(iContext.getString(org.linphone.test.R.string.contact_name))); } From 15379a8cbe1f789ddd5d3ee3f78df8f062cce2aa Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 12 May 2016 16:22:57 +0200 Subject: [PATCH 41/50] Prevent keepalivehandler to crash, to fix --- src/org/linphone/KeepAliveHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/org/linphone/KeepAliveHandler.java b/src/org/linphone/KeepAliveHandler.java index 5f674893d..bc617389c 100644 --- a/src/org/linphone/KeepAliveHandler.java +++ b/src/org/linphone/KeepAliveHandler.java @@ -36,7 +36,7 @@ public class KeepAliveHandler extends BroadcastReceiver { try { Thread.sleep(2000); } catch (InterruptedException e) { - Log.e("Cannot sleep for 2s", e); + //Log.e("Cannot sleep for 2s", e); //TODO FIXME Crash since the log rework } } From 83141e49f004a8fb5f59442b124e7b09c40d7a14 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 12 May 2016 16:26:26 +0200 Subject: [PATCH 42/50] Forgot one log in previous commit... --- src/org/linphone/KeepAliveHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/org/linphone/KeepAliveHandler.java b/src/org/linphone/KeepAliveHandler.java index bc617389c..7c3ec6fee 100644 --- a/src/org/linphone/KeepAliveHandler.java +++ b/src/org/linphone/KeepAliveHandler.java @@ -28,7 +28,7 @@ public class KeepAliveHandler extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { - Log.i("Keep alive handler invoked"); + //Log.i("Keep alive handler invoked"); //TODO FIXME Crash since the log rework if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) { //first refresh registers LinphoneManager.getLc().refreshRegisters(); From 924b67f01cf4aa5bef53c7f919807691e1bac61a Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 12 May 2016 21:44:23 +0200 Subject: [PATCH 43/50] update linphone & bc-toolbox --- submodules/bctoolbox | 2 +- submodules/linphone | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/submodules/bctoolbox b/submodules/bctoolbox index b3a628c7d..0f2997200 160000 --- a/submodules/bctoolbox +++ b/submodules/bctoolbox @@ -1 +1 @@ -Subproject commit b3a628c7de0f6f74e09e60b134de6e3ebfbd3a54 +Subproject commit 0f29972001c023ead9041412c64d7f1ab46434f7 diff --git a/submodules/linphone b/submodules/linphone index bf2032919..5de034898 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit bf20329191979a80a1bec9d54ee2020b4d91e74f +Subproject commit 5de034898db55521547dc89d6fd160225709a203 From 08b763479afb2542dc60ec21a68e2adc876b8651 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 13 May 2016 12:14:09 +0200 Subject: [PATCH 44/50] Fix empty chat list on rotation --- src/org/linphone/ChatFragment.java | 49 ++++++++++++++---------------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/src/org/linphone/ChatFragment.java b/src/org/linphone/ChatFragment.java index fb5c94427..40372e916 100644 --- a/src/org/linphone/ChatFragment.java +++ b/src/org/linphone/ChatFragment.java @@ -145,6 +145,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC //Initialize UI contactName = (TextView) view.findViewById(R.id.contact_name); messagesList = (ListView) view.findViewById(R.id.chat_message_list); + messagesList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE); searchContactField = (EditText) view.findViewById(R.id.search_contact_field); resultContactsSearch = (ListView) view.findViewById(R.id.result_contacts); @@ -250,10 +251,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC return view; } - public String getSipUri() { - return sipUri; - } - @Override public void onSaveInstanceState(Bundle outState) { if (message != null) { @@ -327,28 +324,28 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC ArrayList history; Context context; - public ChatMessageAdapter(Context context) { - this.context = context; + public ChatMessageAdapter(Context c) { + context = c; + history = new ArrayList(); refreshHistory(); } public void destroy() { - history.clear(); - history = null; - notifyDataSetInvalidated(); - } - - public void refreshHistory() { if (history != null) { history.clear(); } + } + + public void refreshHistory() { + history.clear(); LinphoneChatMessage[] messages = chatRoom.getHistory(); - history = new ArrayList(Arrays.asList(messages)); - messages = null; + history.addAll(Arrays.asList(messages)); + notifyDataSetChanged(); } public void addMessage(LinphoneChatMessage message) { history.add(message); + notifyDataSetChanged(); } @Override @@ -474,16 +471,14 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } public void dispayMessageList() { - messagesList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE); if(chatRoom != null) { if (adapter != null) { adapter.refreshHistory(); - adapter.notifyDataSetChanged(); } else { adapter = new ChatMessageAdapter(getActivity().getApplicationContext()); - messagesList.setAdapter(adapter); } } + messagesList.setAdapter(adapter); } private void displayChatHeader(LinphoneAddress address) { @@ -551,13 +546,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } return true; } - - @Override - public void onDestroy() { - if (adapter != null) adapter.destroy(); - adapter = null; - super.onDestroy(); - } @Override public void onPause() { @@ -577,12 +565,23 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC //Hide keybord InputMethodManager imm = (InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(message.getWindowToken(), 0); + super.onPause(); } + + @Override + public void onDestroy() { + if (adapter != null) { + adapter.destroy(); + } + super.onDestroy(); + } @SuppressLint("UseSparseArrays") @Override public void onResume() { + super.onResume(); + message.addTextChangedListener(textWatcher); addVirtualKeyboardVisiblityListener(); @@ -619,7 +618,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC resultContactsSearch.setVisibility(View.GONE); remoteComposing.setVisibility(chatRoom.isRemoteComposing() ? View.VISIBLE : View.GONE); } - super.onResume(); } private void selectAllList(boolean isSelectAll){ @@ -801,7 +799,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC private void invalidate() { adapter.refreshHistory(); - adapter.notifyDataSetChanged(); chatRoom.markAsRead(); } From 839353de7ada4bc2911a6cb4597c329a15c4521a Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 13 May 2016 14:25:36 +0200 Subject: [PATCH 45/50] Fixed reference to dialerFragment in LinphoneActivity Fixed DialerFragment instance Improved fragment transactions commits --- src/org/linphone/DialerFragment.java | 8 +++- src/org/linphone/LinphoneActivity.java | 59 ++++++++++---------------- 2 files changed, 30 insertions(+), 37 deletions(-) diff --git a/src/org/linphone/DialerFragment.java b/src/org/linphone/DialerFragment.java index 5e0abac44..bd3ef11a0 100644 --- a/src/org/linphone/DialerFragment.java +++ b/src/org/linphone/DialerFragment.java @@ -53,7 +53,6 @@ public class DialerFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - instance = this; View view = inflater.inflate(R.layout.dialer, container, false); mAddress = (AddressText) view.findViewById(R.id.address); @@ -133,9 +132,16 @@ public class DialerFragment extends Fragment { return instance; } + @Override + public void onPause() { + instance = null; + super.onPause(); + } + @Override public void onResume() { super.onResume(); + instance = this; if (LinphoneActivity.isInstanciated()) { LinphoneActivity.instance().selectMenu(FragmentsAvailable.DIALER); diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java index 82889f9b8..317ed5b8b 100644 --- a/src/org/linphone/LinphoneActivity.java +++ b/src/org/linphone/LinphoneActivity.java @@ -110,9 +110,8 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta private View contacts_selected, history_selected, dialer_selected, chat_selected; private RelativeLayout mTopBar; private ImageView cancel; - private FragmentsAvailable currentFragment, nextFragment; + private FragmentsAvailable pendingFragmentTransaction, currentFragment, nextFragment; private List fragmentsHistory; - private Fragment dialerFragment; private Fragment.SavedState dialerSavedState; private boolean newProxyConfig; private boolean isAnimationDisabled = true, emptyFragment = false, permissionAsked = false; @@ -176,19 +175,14 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta setContentView(R.layout.main); instance = this; fragmentsHistory = new ArrayList(); + pendingFragmentTransaction = FragmentsAvailable.UNKNOW; initButtons(); initSideMenu(); - currentFragment = nextFragment = FragmentsAvailable.DIALER; - fragmentsHistory.add(currentFragment); + currentFragment = nextFragment = FragmentsAvailable.EMPTY; if (savedInstanceState == null) { - if (findViewById(R.id.fragmentContainer) != null) { - dialerFragment = new DialerFragment(); - dialerFragment.setArguments(getIntent().getExtras()); - getFragmentManager().beginTransaction().add(R.id.fragmentContainer, dialerFragment, currentFragment.toString()).commit(); - selectMenu(FragmentsAvailable.DIALER); - } + changeCurrentFragment(FragmentsAvailable.DIALER, getIntent().getExtras()); } mListener = new LinphoneCoreListenerBase(){ @@ -356,6 +350,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta if (currentFragment == FragmentsAvailable.DIALER) { try { + DialerFragment dialerFragment = DialerFragment.instance(); dialerSavedState = getFragmentManager().saveFragmentInstanceState(dialerFragment); } catch (Exception e) { } @@ -390,7 +385,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta if (extras == null) { newFragment.setInitialSavedState(dialerSavedState); } - dialerFragment = newFragment; break; case SETTINGS: newFragment = new SettingsFragment(); @@ -465,7 +459,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta } transaction.replace(R.id.fragmentContainer, newFragment, newFragmentType.toString()); - transaction.commitAllowingStateLoss(); + transaction.commit(); fm.executePendingTransactions(); currentFragment = newFragmentType; @@ -488,7 +482,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta ll.setVisibility(View.VISIBLE); emptyFragment = true; transaction.replace(R.id.fragmentContainer2, newFragment); - transaction.commitAllowingStateLoss(); + transaction.commit(); getFragmentManager().executePendingTransactions(); } else { if (newFragmentType.shouldAddItselfToTheRightOf(currentFragment)) { @@ -524,7 +518,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta }*/ transaction.replace(R.id.fragmentContainer, newFragment); } - transaction.commitAllowingStateLoss(); + transaction.commit(); getFragmentManager().executePendingTransactions(); currentFragment = newFragmentType; @@ -621,11 +615,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta changeCurrentFragment(FragmentsAvailable.CONTACTS_LIST, extras); } - public void displayChatList() { - Bundle extras = new Bundle(); - changeCurrentFragment(FragmentsAvailable.CHAT_LIST, extras); - } - public void displayContactsForEdition(String sipAddress) { Bundle extras = new Bundle(); extras.putBoolean("EditOnClick", true); @@ -791,7 +780,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta } public void updateDialerFragment(DialerFragment fragment) { - dialerFragment = fragment; // Hack to maintain soft input flags getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN | WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); } @@ -973,17 +961,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta LinphoneManager.getInstance().newOutgoingCall(address); } - public void setAddressAndGoToDialer(String number) { - Bundle extras = new Bundle(); - extras.putString("SipUri", number); - changeCurrentFragment(FragmentsAvailable.DIALER, extras); - } - - @Override - public void goToDialer() { - changeCurrentFragment(FragmentsAvailable.DIALER, null); - } - public void startVideoActivity(LinphoneCall currentCall) { Intent intent = new Intent(this, CallActivity.class); intent.putExtra("VideoEnabled", true); @@ -1065,12 +1042,14 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta private void initInCallMenuLayout(boolean callTransfer) { selectMenu(FragmentsAvailable.DIALER); + DialerFragment dialerFragment = DialerFragment.instance(); if (dialerFragment != null) { ((DialerFragment) dialerFragment).resetLayout(callTransfer); } } public void resetClassicMenuLayoutAndGoBackToCallIfStillRunning() { + DialerFragment dialerFragment = DialerFragment.instance(); if (dialerFragment != null) { ((DialerFragment) dialerFragment).resetLayout(false); } @@ -1123,6 +1102,16 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta finish(); stopService(new Intent(Intent.ACTION_MAIN).setClass(this, LinphoneService.class)); } + + @Override + protected void onPostResume() { + super.onPostResume(); + if (pendingFragmentTransaction != FragmentsAvailable.UNKNOW) { + changeCurrentFragment(pendingFragmentTransaction, null, true); + selectMenu(pendingFragmentTransaction); + pendingFragmentTransaction = FragmentsAvailable.UNKNOW; + } + } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { @@ -1130,16 +1119,14 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta if (data.getExtras().getBoolean("Exit", false)) { quit(); } else { - FragmentsAvailable newFragment = (FragmentsAvailable) data.getExtras().getSerializable("FragmentToDisplay"); - changeCurrentFragment(newFragment, null, true); - selectMenu(newFragment); + pendingFragmentTransaction = (FragmentsAvailable) data.getExtras().getSerializable("FragmentToDisplay"); } } else if (resultCode == Activity.RESULT_FIRST_USER && requestCode == CALL_ACTIVITY) { getIntent().putExtra("PreviousActivity", CALL_ACTIVITY); boolean callTransfer = data == null ? false : data.getBooleanExtra("Transfer", false); boolean chat = data == null ? false : data.getBooleanExtra("chat", false); if(chat){ - displayChatList(); + pendingFragmentTransaction = FragmentsAvailable.CHAT_LIST; } if (LinphoneManager.getLc().getCallsNb() > 0) { initInCallMenuLayout(callTransfer); @@ -1291,6 +1278,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta } } } else { + DialerFragment dialerFragment = DialerFragment.instance(); if (dialerFragment != null) { if (extras != null && extras.containsKey("SipUriOrNumber")) { if (getResources().getBoolean(R.bool.automatically_start_intercepted_outgoing_gsm_call)) { @@ -1564,5 +1552,4 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta interface ContactPicked { void setAddresGoToDialerAndCall(String number, String name, Uri photo); - void goToDialer(); } From c58e24aaedf5833290bf79c4f7e41062abea28a2 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 13 May 2016 15:02:38 +0200 Subject: [PATCH 46/50] Unregister when task is killed and push is disabled and when device shuts down --- AndroidManifest.xml | 5 +++-- src/org/linphone/BootReceiver.java | 23 ++++++++++++++++------- src/org/linphone/LinphoneService.java | 6 +++++- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 2bce65967..309e28424 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -189,6 +189,7 @@ + @@ -244,8 +245,8 @@ - + diff --git a/src/org/linphone/BootReceiver.java b/src/org/linphone/BootReceiver.java index aa2b1082c..f19591445 100644 --- a/src/org/linphone/BootReceiver.java +++ b/src/org/linphone/BootReceiver.java @@ -18,8 +18,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone; +import org.linphone.core.LinphoneCore; import org.linphone.core.LinphoneCoreFactory; import org.linphone.core.LpConfig; +import org.linphone.mediastream.Log; import android.content.BroadcastReceiver; import android.content.Context; @@ -29,13 +31,20 @@ public class BootReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { - - String path = context.getFilesDir().getAbsolutePath() + "/.linphonerc"; - LpConfig lpConfig = LinphoneCoreFactory.instance().createLpConfig(path); - if (lpConfig.getBool("app", "auto_start", false)) { - Intent lLinphoneServiceIntent = new Intent(Intent.ACTION_MAIN); - lLinphoneServiceIntent.setClass(context, LinphoneService.class); - context.startService(lLinphoneServiceIntent); + if (intent.getAction().equalsIgnoreCase(Intent.ACTION_SHUTDOWN)) { + LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + if (lc != null) { + Log.w("Device is shutting down, destroying LinphoneCore to unregister"); + lc.destroy(); + } + } else { + String path = context.getFilesDir().getAbsolutePath() + "/.linphonerc"; + LpConfig lpConfig = LinphoneCoreFactory.instance().createLpConfig(path); + if (lpConfig.getBool("app", "auto_start", false)) { + Intent lLinphoneServiceIntent = new Intent(Intent.ACTION_MAIN); + lLinphoneServiceIntent.setClass(context, LinphoneService.class); + context.startService(lLinphoneServiceIntent); + } } } } diff --git a/src/org/linphone/LinphoneService.java b/src/org/linphone/LinphoneService.java index c73277966..6017b5d68 100644 --- a/src/org/linphone/LinphoneService.java +++ b/src/org/linphone/LinphoneService.java @@ -539,7 +539,11 @@ public final class LinphoneService extends Service { public void onTaskRemoved(Intent rootIntent) { if (getResources().getBoolean(R.bool.kill_service_with_task_manager)) { Log.d("Task removed, stop service"); - LinphoneManager.getLc().setNetworkReachable(false); + + // If push is enabled, don't unregister account, otherwise do unregister + if (LinphonePreferences.instance().isPushNotificationEnabled()) { + LinphoneManager.getLc().setNetworkReachable(false); + } stopSelf(); } super.onTaskRemoved(rootIntent); From 0b548fa9f29d8d9a072c19cea0fed31c201387ee Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 13 May 2016 17:00:40 +0200 Subject: [PATCH 47/50] update submodules and fix arm/neon scaler context --- submodules/bctoolbox | 2 +- submodules/belle-sip | 2 +- submodules/linphone | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/submodules/bctoolbox b/submodules/bctoolbox index 0f2997200..b7dcaa7ec 160000 --- a/submodules/bctoolbox +++ b/submodules/bctoolbox @@ -1 +1 @@ -Subproject commit 0f29972001c023ead9041412c64d7f1ab46434f7 +Subproject commit b7dcaa7ec7edd34d5dd37abbe2a5b6a57a9dee53 diff --git a/submodules/belle-sip b/submodules/belle-sip index 2aa71018b..49d820f2c 160000 --- a/submodules/belle-sip +++ b/submodules/belle-sip @@ -1 +1 @@ -Subproject commit 2aa71018b2947732cec88d94de14d29b175cec5c +Subproject commit 49d820f2cbb4196d31454ab5f38d965d63d2a8e4 diff --git a/submodules/linphone b/submodules/linphone index 5de034898..d5792a73a 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 5de034898db55521547dc89d6fd160225709a203 +Subproject commit d5792a73ac46cd8857ee51fe94e07a9bd3fe0d81 From 72ccf7ea205081e80f278213bfa9737ed798c9d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Mon, 16 May 2016 17:01:29 +0200 Subject: [PATCH 48/50] Update linphone submodule --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index d5792a73a..7559624f5 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit d5792a73ac46cd8857ee51fe94e07a9bd3fe0d81 +Subproject commit 7559624f536755fa48d15d3281b589953c6a2721 From bd4ff3194c488acc7ea55d8419c9bb41c668ff8f Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 17 May 2016 15:44:49 +0200 Subject: [PATCH 49/50] update submodules --- submodules/bctoolbox | 2 +- submodules/belle-sip | 2 +- submodules/linphone | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/submodules/bctoolbox b/submodules/bctoolbox index b7dcaa7ec..e654c0082 160000 --- a/submodules/bctoolbox +++ b/submodules/bctoolbox @@ -1 +1 @@ -Subproject commit b7dcaa7ec7edd34d5dd37abbe2a5b6a57a9dee53 +Subproject commit e654c008283c942345ac20540981ba854d9138ba diff --git a/submodules/belle-sip b/submodules/belle-sip index 49d820f2c..2e4d15f34 160000 --- a/submodules/belle-sip +++ b/submodules/belle-sip @@ -1 +1 @@ -Subproject commit 49d820f2cbb4196d31454ab5f38d965d63d2a8e4 +Subproject commit 2e4d15f343b488d793d739fb169924a0bc7c7a96 diff --git a/submodules/linphone b/submodules/linphone index 7559624f5..4897a3add 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 7559624f536755fa48d15d3281b589953c6a2721 +Subproject commit 4897a3addbd2800279cad5796652e354c7400e3d From f470a0967192070ad4a09873ea5c32c37b1d30cf Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 17 May 2016 16:07:02 +0200 Subject: [PATCH 50/50] update belle-sip --- submodules/belle-sip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/belle-sip b/submodules/belle-sip index 2e4d15f34..978db14ca 160000 --- a/submodules/belle-sip +++ b/submodules/belle-sip @@ -1 +1 @@ -Subproject commit 2e4d15f343b488d793d739fb169924a0bc7c7a96 +Subproject commit 978db14caa4c7b5a3ca2db64a7aceb2bdd251773