From 7ad95e378999cf28d878c8e98c915268162877c4 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 7 Sep 2017 09:31:26 +0200 Subject: [PATCH 01/72] update submodules --- submodules/bctoolbox | 2 +- submodules/belle-sip | 2 +- submodules/linphone | 2 +- submodules/mediastreamer2 | 2 +- submodules/oRTP | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/submodules/bctoolbox b/submodules/bctoolbox index a37f4186b..02caea7df 160000 --- a/submodules/bctoolbox +++ b/submodules/bctoolbox @@ -1 +1 @@ -Subproject commit a37f4186b528d4e9b40e61b933dcf8df15735f64 +Subproject commit 02caea7df8381b0c5dadcfbfd39ff0b33a2577b7 diff --git a/submodules/belle-sip b/submodules/belle-sip index bac70d8b6..a33fb9dcf 160000 --- a/submodules/belle-sip +++ b/submodules/belle-sip @@ -1 +1 @@ -Subproject commit bac70d8b6c787bc204ea9bd60f8b1d0263b36447 +Subproject commit a33fb9dcfb4c1e111265798556d7f698e2a22720 diff --git a/submodules/linphone b/submodules/linphone index e095830bb..daa9ed3fa 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit e095830bb6a6dda714f2ca9889888e2132659f91 +Subproject commit daa9ed3fa2d52827228d0ed9ff49c79f7f61a78e diff --git a/submodules/mediastreamer2 b/submodules/mediastreamer2 index c83253958..c0b0271b9 160000 --- a/submodules/mediastreamer2 +++ b/submodules/mediastreamer2 @@ -1 +1 @@ -Subproject commit c83253958957fe4198e12b718c7b6298d16ddcdb +Subproject commit c0b0271b960b0848367fb177d7e6bc1c0b582e71 diff --git a/submodules/oRTP b/submodules/oRTP index 8c8a83bc7..e9c2d48c9 160000 --- a/submodules/oRTP +++ b/submodules/oRTP @@ -1 +1 @@ -Subproject commit 8c8a83bc74c3547138eb48c27877ac90ab4a360b +Subproject commit e9c2d48c917d78c529eefb9f824ae52238f950d4 From 990b6e602d7802004612f0bf19c867dd2db46139 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 8 Sep 2017 15:28:28 +0200 Subject: [PATCH 02/72] update linphone submodule --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index daa9ed3fa..0540ba410 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit daa9ed3fa2d52827228d0ed9ff49c79f7f61a78e +Subproject commit 0540ba4105543acc5dbf1874a83f5bc8e7f09466 From 1036b40a40a62902740d90a7e4955a11b2b206f4 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Sat, 9 Sep 2017 18:23:36 +0200 Subject: [PATCH 03/72] Finally optimize the loading of the chatlist view --- .../org/linphone/LinphoneActivity.java | 37 +++++++++++++------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/src/android/org/linphone/LinphoneActivity.java b/src/android/org/linphone/LinphoneActivity.java index 2686fbbcd..c5d759e70 100644 --- a/src/android/org/linphone/LinphoneActivity.java +++ b/src/android/org/linphone/LinphoneActivity.java @@ -834,26 +834,39 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick return statusFragment; } + static class ChatRoomContainer{ + private LinphoneChatRoom mCr; + long mTime; + public ChatRoomContainer(LinphoneChatRoom chatroom){ + mCr = chatroom; + LinphoneChatMessage[] lastMsg = chatroom.getHistory(1); + if (lastMsg != null && lastMsg[0] != null) { + mTime = lastMsg[0].getTime(); + }else mTime = 0; + } + LinphoneChatRoom getChatRoom(){ + return mCr; + } + long getTime(){ + return mTime; + } + }; public List getChatList() { ArrayList chatList = new ArrayList(); LinphoneChatRoom[] chats = LinphoneManager.getLc().getChatRooms(); - List rooms = new ArrayList(); + List rooms = new ArrayList(); for (LinphoneChatRoom chatroom : chats) { - if (chatroom.getHistorySize() > 0) { - rooms.add(chatroom); - } + rooms.add(new ChatRoomContainer(chatroom)); } if (rooms.size() > 1) { - Collections.sort(rooms, new Comparator() { + Collections.sort(rooms, new Comparator() { @Override - public int compare(LinphoneChatRoom a, LinphoneChatRoom b) { - LinphoneChatMessage[] messagesA = a.getHistory(1); - LinphoneChatMessage[] messagesB = b.getHistory(1); - long atime = messagesA[0].getTime(); - long btime = messagesB[0].getTime(); + public int compare(ChatRoomContainer a, ChatRoomContainer b) { + long atime = a.getTime(); + long btime = b.getTime(); if (atime > btime) return -1; @@ -865,8 +878,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick }); } - for (LinphoneChatRoom chatroom : rooms) { - chatList.add(chatroom.getPeerAddress().asStringUriOnly()); + for (ChatRoomContainer chatroomContainer : rooms) { + chatList.add(chatroomContainer.getChatRoom().getPeerAddress().asStringUriOnly()); } return chatList; From 8b75bb738da8b3efdcb8d1a12fcec5ae2d039137 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Turnel?= Date: Tue, 12 Sep 2017 13:17:01 +0200 Subject: [PATCH 04/72] Update submodule linphone --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index 0540ba410..e53139f31 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 0540ba4105543acc5dbf1874a83f5bc8e7f09466 +Subproject commit e53139f31598a2c8ec5daa2f392475997b867350 From 58c31f317f31af38b3e77f4e75a06e237e35600f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Turnel?= Date: Tue, 12 Sep 2017 13:22:54 +0200 Subject: [PATCH 05/72] Add estimated download bandwidth in media stats --- res/layout/incall_stats.xml | 10 ++++++++++ res/values-ar/strings.xml | 1 + res/values-de/strings.xml | 1 + res/values-es/strings.xml | 1 + res/values-fi/strings.xml | 1 + res/values-fr/strings.xml | 1 + res/values-ja/strings.xml | 1 + res/values-ka/strings.xml | 1 + res/values-nl/strings.xml | 1 + res/values-pl/strings.xml | 1 + res/values-pt-rBR/strings.xml | 1 + res/values-ru/strings.xml | 1 + res/values-sr/strings.xml | 1 + res/values-sv/strings.xml | 1 + res/values-tr/strings.xml | 1 + res/values-zh-rCN/strings.xml | 1 + res/values-zh-rTW/strings.xml | 1 + res/values/strings.xml | 1 + src/android/org/linphone/CallActivity.java | 13 +++++++++---- 19 files changed, 36 insertions(+), 4 deletions(-) diff --git a/res/layout/incall_stats.xml b/res/layout/incall_stats.xml index 6d8aee2cf..2589540dc 100644 --- a/res/layout/incall_stats.xml +++ b/res/layout/incall_stats.xml @@ -207,6 +207,16 @@ android:gravity="center" android:textColor="@color/colorB" android:textSize="12sp"/> + + صنف IP : صبيب الرفع : صبيب التنزيل : + عرض النطاق الترددي المتوقع للتنزيل : توصيل ICE : دقة الفيديو المُرسَل : دقة الفيديو المُستلَم : diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 46582d79c..d8caeab62 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -195,6 +195,7 @@ IP-Familie: Upload-Bandbreite: Download-Bandbreite: + Geschätzte Download-Bandbreite: ICE-Konnektivität: Gesendete Videoauflösung: Empfangene Videoauflösung: diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml index 185baf6c5..ca00f7615 100644 --- a/res/values-es/strings.xml +++ b/res/values-es/strings.xml @@ -73,6 +73,7 @@ Codec: Ancho de banda de subida: Ancho de banda de bajada: + Ancho de banda de bajada estimado: Conectividad ICE Llamar diff --git a/res/values-fi/strings.xml b/res/values-fi/strings.xml index 8d08b4d9f..81fa19c27 100644 --- a/res/values-fi/strings.xml +++ b/res/values-fi/strings.xml @@ -123,6 +123,7 @@ Koodekki: Lähetyskaistanleveys: Latauskaistanleveys: + Arvioitu latauskaistanleveys: ICE yhdistettävyys: Puhelu diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml index fb53093ef..a969c1638 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -203,6 +203,7 @@ Vos amis pourront vous joindre plus facilement si vous associez votre compte à Type d\'IP : Bande passante envoi : Bande passante réception : + Bande passante réception estimée : Connexion ICE : Résolution vidéo envoyée Résolution vidéo reçu diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml index bd5d0a6d7..24332f45d 100644 --- a/res/values-ja/strings.xml +++ b/res/values-ja/strings.xml @@ -190,6 +190,7 @@ IP: アップロード幅: ダウンロード幅: + 推定ダウンロード帯域幅: ICE 接続: 送信ビデオ解像度: 受信ビデオ解像度: diff --git a/res/values-ka/strings.xml b/res/values-ka/strings.xml index 3bc524924..9f5b0e57f 100644 --- a/res/values-ka/strings.xml +++ b/res/values-ka/strings.xml @@ -204,6 +204,7 @@ IP ოჯახი: ატვირთვის გამტარი უნარი: გადმოტვირთვის გამტარი უნარი: + სავარაუდო ჩამოტვირთვა სიჩქარის: ICE კავშირი: გაგზავნილი ვიდეოს გაფართოება: მიღებული ვიდეოს გაფართოება: diff --git a/res/values-nl/strings.xml b/res/values-nl/strings.xml index ffe45a90a..e3bb53b08 100644 --- a/res/values-nl/strings.xml +++ b/res/values-nl/strings.xml @@ -74,6 +74,7 @@ Codec: Uploadbandbreedte: Downloadbandbreedte: + Geschatte downloadbandbreedte: Oproep Log versturen diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml index f9ae013fc..85c9e773c 100644 --- a/res/values-pl/strings.xml +++ b/res/values-pl/strings.xml @@ -190,6 +190,7 @@ IP Rodzina: Prześlij przepustowość: Pobierz przepustowość: + Szacowana przepustowość pobierania: Łączność ICE: Wysłana rozdzielczość wideo: Odebrana rozdzielczość wideo: diff --git a/res/values-pt-rBR/strings.xml b/res/values-pt-rBR/strings.xml index d012d33c2..09173bf75 100644 --- a/res/values-pt-rBR/strings.xml +++ b/res/values-pt-rBR/strings.xml @@ -133,6 +133,7 @@ Codec: Velocidade de Upload Velocidade de Download: + Velocidade de Download estimada: Conectividade ICE: Ligar diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml index 70ddd03f4..edb1bde1d 100644 --- a/res/values-ru/strings.xml +++ b/res/values-ru/strings.xml @@ -124,6 +124,7 @@ Кодек: Полоса пропускания загрузки: Полоса пропускания скачивания: + Предполагаемая ширина загрузки: Подключение ICE: Вызов diff --git a/res/values-sr/strings.xml b/res/values-sr/strings.xml index 82144eb6f..532f369c9 100644 --- a/res/values-sr/strings.xml +++ b/res/values-sr/strings.xml @@ -78,6 +78,7 @@ Кодек: Пропусни опсег отпремања: Пропусни опсег преузимања: + Процењени пропусни опсег преноса: ИЦЕ повезивост: Позови diff --git a/res/values-sv/strings.xml b/res/values-sv/strings.xml index 1e39e7c83..251106765 100644 --- a/res/values-sv/strings.xml +++ b/res/values-sv/strings.xml @@ -70,6 +70,7 @@ Video Uppladdningsbandbredd: Nerladdningsbandbredd: + Beräknad nedladdning bandbredd: ICE-anslutning: Ring diff --git a/res/values-tr/strings.xml b/res/values-tr/strings.xml index 2c15e0000..3b7cd30ce 100644 --- a/res/values-tr/strings.xml +++ b/res/values-tr/strings.xml @@ -198,6 +198,7 @@ IP Ailesi: Karşıya yükleme hızı: İndirme hızı: + Tahmini karşıdan yükleme bant genişliği: İCE bağlanılabilirliği: Giden video çözünürlüğü: Alınan video çözünürlüğü: diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml index c6470e632..1882c19bc 100644 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -201,6 +201,7 @@ IP Family: 上传带宽 上传带宽 + 估計下載帶寬 ICE connectivity: 发送视频分辨率 接受视频分辨率 diff --git a/res/values-zh-rTW/strings.xml b/res/values-zh-rTW/strings.xml index 9f6ec6ce1..66e7d7ed9 100644 --- a/res/values-zh-rTW/strings.xml +++ b/res/values-zh-rTW/strings.xml @@ -135,6 +135,7 @@ 編解碼器: 上傳頻寬: 下載頻寬: + 估计下载带宽: 編碼器: 解碼器: 通話 diff --git a/res/values/strings.xml b/res/values/strings.xml index d6d650789..ef26950d0 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -221,6 +221,7 @@ IP Family: Upload bandwidth: Download bandwidth: + Estimated download bandwidth: ICE connectivity: Sent video resolution: Received video resolution: diff --git a/src/android/org/linphone/CallActivity.java b/src/android/org/linphone/CallActivity.java index 8dfadd1e7..72c4a5721 100644 --- a/src/android/org/linphone/CallActivity.java +++ b/src/android/org/linphone/CallActivity.java @@ -1595,7 +1595,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList private void displayMediaStats(LinphoneCallParams params, LinphoneCallStats stats , PayloadType media , View layout, TextView title, TextView codec, TextView dl - , TextView ul, TextView ice, TextView ip, TextView senderLossRate + , TextView ul, TextView edl, TextView ice, TextView ip, TextView senderLossRate , TextView receiverLossRate, TextView enc, TextView dec, TextView videoResolutionSent , TextView videoResolutionReceived, TextView videoFpsSent, TextView videoFpsReceived , boolean isVideo, TextView jitterBuffer) { @@ -1617,6 +1617,10 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList String.valueOf((int) stats.getDownloadBandwidth()) + " kbits/s"); formatText(ul, getString(R.string.call_stats_upload), String.valueOf((int) stats.getUploadBandwidth()) + " kbits/s"); + if (isVideo) { + formatText(edl, getString(R.string.call_stats_estimated_download), + String.valueOf((int) stats.getEstimatedDownloadBandwidth()) + " kbits/s"); + } formatText(ice, getString(R.string.call_stats_ice), stats.getIceState().toString()); formatText(ip, getString(R.string.call_stats_ip), @@ -1667,6 +1671,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList final TextView ulAudio = (TextView) view.findViewById(R.id.uploadBandwith_audio); final TextView dlVideo = (TextView) view.findViewById(R.id.downloadBandwith_video); final TextView ulVideo = (TextView) view.findViewById(R.id.uploadBandwith_video); + final TextView edlVideo = (TextView) view.findViewById(R.id.estimatedDownloadBandwidth_video); final TextView iceAudio = (TextView) view.findViewById(R.id.ice_audio); final TextView iceVideo = (TextView) view.findViewById(R.id.ice_video); final TextView videoResolutionSent = (TextView) view.findViewById(R.id.video_resolution_sent); @@ -1693,7 +1698,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList return; } - if (titleAudio == null || codecAudio == null || dlVideo == null || iceAudio == null + if (titleAudio == null || codecAudio == null || dlVideo == null || edlVideo == null || iceAudio == null || videoResolutionSent == null || videoLayout == null || titleVideo == null || ipVideo == null || ipAudio == null || codecVideo == null || dlAudio == null || ulAudio == null || ulVideo == null || iceVideo == null @@ -1720,13 +1725,13 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList PayloadType payloadVideo = params.getUsedVideoCodec(); displayMediaStats(params, audioStats, payloadAudio, audioLayout - , titleAudio, codecAudio, dlAudio, ulAudio, iceAudio + , titleAudio, codecAudio, dlAudio, ulAudio, null, iceAudio , ipAudio, senderLossRateAudio, receiverLossRateAudio , encoderAudio, decoderAudio, null, null, null, null , false, jitterBufferAudio); displayMediaStats(params, videoStats, payloadVideo, videoLayout - , titleVideo, codecVideo, dlVideo, ulVideo, iceVideo + , titleVideo, codecVideo, dlVideo, ulVideo, edlVideo, iceVideo , ipVideo, senderLossRateVideo, receiverLossRateVideo , encoderVideo, decoderVideo , videoResolutionSent, videoResolutionReceived From 0ac3cc41b6547f7acc86e6080aa0543b4bb7fc81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Turnel?= Date: Tue, 12 Sep 2017 13:48:01 +0200 Subject: [PATCH 06/72] Update submodule linphone --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index e53139f31..d981a246f 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit e53139f31598a2c8ec5daa2f392475997b867350 +Subproject commit d981a246f896c66ce53db19b626b6647dd529865 From e700807713e113da94e22034d7f4c03d841a7906 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 12 Sep 2017 13:59:41 +0200 Subject: [PATCH 07/72] update submodule mssilk msopenh264 mswebrtc --- submodules/msopenh264 | 2 +- submodules/mssilk | 2 +- submodules/mswebrtc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/submodules/msopenh264 b/submodules/msopenh264 index 3a398b400..18b41c256 160000 --- a/submodules/msopenh264 +++ b/submodules/msopenh264 @@ -1 +1 @@ -Subproject commit 3a398b4000f29c67e010057f718c136ca245a9a8 +Subproject commit 18b41c2569ea76b8eb1df9f85a32f16b3d001cc0 diff --git a/submodules/mssilk b/submodules/mssilk index 3a61f5dec..5359c58f3 160000 --- a/submodules/mssilk +++ b/submodules/mssilk @@ -1 +1 @@ -Subproject commit 3a61f5decf634f5fb311b2c5f2984525fccd81d9 +Subproject commit 5359c58f3a89cc581fadb7f76ac3a82672e574b8 diff --git a/submodules/mswebrtc b/submodules/mswebrtc index 475eb67b5..014011229 160000 --- a/submodules/mswebrtc +++ b/submodules/mswebrtc @@ -1 +1 @@ -Subproject commit 475eb67b5cb8d82f6636e69c3bde8b18daeb824e +Subproject commit 0140112290aa4f2b216155d28d8f70425042709d From c19d380d9b9efa1d7f037190b2d6cf15a0e99578 Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Tue, 12 Sep 2017 14:24:13 +0200 Subject: [PATCH 08/72] Fixing crash on chatroom delete --- src/android/org/linphone/LinphoneActivity.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/android/org/linphone/LinphoneActivity.java b/src/android/org/linphone/LinphoneActivity.java index c5d759e70..eae620b28 100644 --- a/src/android/org/linphone/LinphoneActivity.java +++ b/src/android/org/linphone/LinphoneActivity.java @@ -101,6 +101,8 @@ import java.util.Comparator; import java.util.Date; import java.util.List; +import static org.linphone.LinphoneActivity.ChatRoomContainer.createChatroomContainer; + /** * @author Sylvain Berfini */ @@ -837,10 +839,14 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick static class ChatRoomContainer{ private LinphoneChatRoom mCr; long mTime; + static public ChatRoomContainer createChatroomContainer(LinphoneChatRoom chatRoom) { + if (chatRoom.getHistorySize() <= 0) return null; + return new ChatRoomContainer(chatRoom); + } public ChatRoomContainer(LinphoneChatRoom chatroom){ mCr = chatroom; LinphoneChatMessage[] lastMsg = chatroom.getHistory(1); - if (lastMsg != null && lastMsg[0] != null) { + if (lastMsg != null && lastMsg.length > 0 && lastMsg[0] != null) { mTime = lastMsg[0].getTime(); }else mTime = 0; } @@ -858,7 +864,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick List rooms = new ArrayList(); for (LinphoneChatRoom chatroom : chats) { - rooms.add(new ChatRoomContainer(chatroom)); + ChatRoomContainer crc = createChatroomContainer(chatroom); + if (crc != null) rooms.add(crc); } if (rooms.size() > 1) { From c5b30659fa4e8ab677a8b59eb9781532e88c6696 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 12 Sep 2017 17:18:24 +0200 Subject: [PATCH 09/72] update mswebrtc --- submodules/mswebrtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/mswebrtc b/submodules/mswebrtc index 014011229..198143488 160000 --- a/submodules/mswebrtc +++ b/submodules/mswebrtc @@ -1 +1 @@ -Subproject commit 0140112290aa4f2b216155d28d8f70425042709d +Subproject commit 19814348807cdab7f13637993a05a696f47685eb From 706913502df7431a970877bed06dedcb2a9e2676 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 14 Sep 2017 09:19:45 +0200 Subject: [PATCH 10/72] update mssilk --- submodules/mssilk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/mssilk b/submodules/mssilk index 5359c58f3..fd1620c38 160000 --- a/submodules/mssilk +++ b/submodules/mssilk @@ -1 +1 @@ -Subproject commit 5359c58f3a89cc581fadb7f76ac3a82672e574b8 +Subproject commit fd1620c38e5ebeba63b4d8799769d94f0c6a956c From fce568a6bb67871495f37028382bb1ce613af39a Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Thu, 14 Sep 2017 16:37:50 +0200 Subject: [PATCH 11/72] Fix contacts permission --- src/android/org/linphone/LinphoneActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/android/org/linphone/LinphoneActivity.java b/src/android/org/linphone/LinphoneActivity.java index eae620b28..970f70298 100644 --- a/src/android/org/linphone/LinphoneActivity.java +++ b/src/android/org/linphone/LinphoneActivity.java @@ -373,7 +373,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick fragment = new HistoryDetailFragment(); break; case CONTACTS_LIST: - checkAndRequestReadContactsPermission(); + checkAndRequestWriteContactsPermission(); fragment = new ContactsListFragment(); break; case CONTACT_DETAIL: From d3ff81378cbd4e11403bafa6d4a10bd9dd4fb66b Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Thu, 14 Sep 2017 18:19:46 +0200 Subject: [PATCH 12/72] Fixing Audio Focus close #121 --- src/android/org/linphone/LinphoneManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/android/org/linphone/LinphoneManager.java b/src/android/org/linphone/LinphoneManager.java index ab72b1432..39e807d58 100644 --- a/src/android/org/linphone/LinphoneManager.java +++ b/src/android/org/linphone/LinphoneManager.java @@ -1393,7 +1393,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag //However, incoming call first use the MODE_RINGING to play the local ring. if(call.getDirection() == CallDirection.Incoming) { setAudioManagerInCallMode(); - mAudioManager.abandonAudioFocus(null); + //mAudioManager.abandonAudioFocus(null); requestAudioFocus(STREAM_VOICE_CALL); } } @@ -1572,7 +1572,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag mRingerPlayer = new MediaPlayer(); mRingerPlayer.setAudioStreamType(STREAM_RING); - String ringtone = LinphonePreferences.instance().getRingtone(android.provider.Settings.System.DEFAULT_RINGTONE_URI.toString()); + String ringtone = LinphonePreferences.instance().getRingtone(Settings.System.DEFAULT_RINGTONE_URI.toString()); try { if (ringtone.startsWith("content://")) { mRingerPlayer.setDataSource(mServiceContext, Uri.parse(ringtone)); From 47c4956b9d3b1fadcd922548b50eb72c662a599c Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Thu, 14 Sep 2017 18:28:54 +0200 Subject: [PATCH 13/72] Reloading contacts list after editing or deleting --- src/android/org/linphone/ContactsListFragment.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/android/org/linphone/ContactsListFragment.java b/src/android/org/linphone/ContactsListFragment.java index dbab611d7..d26a2bf2a 100644 --- a/src/android/org/linphone/ContactsListFragment.java +++ b/src/android/org/linphone/ContactsListFragment.java @@ -143,6 +143,7 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O contactsFetchInProgress = (ProgressBar) view.findViewById(R.id.contactsFetchInProgress); contactsFetchInProgress.setVisibility(View.VISIBLE); + ContactsManager.getInstance().fetchContactsAsync(); return view; } From 53356b015e90ed1abb39e1ca7b815bdb51892e87 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Sun, 17 Sep 2017 15:48:55 +0200 Subject: [PATCH 14/72] Fix android build. Belr dependency wasn't explicit when VCARD support was off, which resulted in random failures. --- submodules/belr | 2 +- submodules/cmake-builder | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/submodules/belr b/submodules/belr index fdce52526..9364d69fb 160000 --- a/submodules/belr +++ b/submodules/belr @@ -1 +1 @@ -Subproject commit fdce52526089e88c98f19b0d36483cc3d31ef9bd +Subproject commit 9364d69fb16b058066a129f993558d764a6836cf diff --git a/submodules/cmake-builder b/submodules/cmake-builder index 0773a40cf..404cd8694 160000 --- a/submodules/cmake-builder +++ b/submodules/cmake-builder @@ -1 +1 @@ -Subproject commit 0773a40cfd475fa357fd1ffcf825e5e5b6e0b9d5 +Subproject commit 404cd869464fa591c2a11fb91242c2983f73270f From 0029772911eecc380c8ca0a5dabdcdb4d4fa271c Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Sun, 17 Sep 2017 17:27:13 +0200 Subject: [PATCH 15/72] update ms2 (mediacodec fixes --- submodules/mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/mediastreamer2 b/submodules/mediastreamer2 index c0b0271b9..d765c5b94 160000 --- a/submodules/mediastreamer2 +++ b/submodules/mediastreamer2 @@ -1 +1 @@ -Subproject commit c0b0271b960b0848367fb177d7e6bc1c0b582e71 +Subproject commit d765c5b947f2de52d97061e80784091ec043f5a0 From a6aacef3a3374035b5d1b4507c3d3bf6f272dde7 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 18 Sep 2017 21:14:13 +0200 Subject: [PATCH 16/72] fix compilation with NDK >= 14 (bugs in google's unified headers) --- submodules/externals/sqlite3/sqlite3.c | 15 +++++++++++++++ submodules/linphone | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/submodules/externals/sqlite3/sqlite3.c b/submodules/externals/sqlite3/sqlite3.c index deef46089..e84d74f7c 100644 --- a/submodules/externals/sqlite3/sqlite3.c +++ b/submodules/externals/sqlite3/sqlite3.c @@ -23013,6 +23013,21 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){ #include #if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0 #include + +#if defined(__ANDROID__) + +/*this block is to workaround a bug introduced by google with its unified headers in NDK 14.*/ + +#include "android/api-level.h" + +# ifdef __ANDROID_API_O__ /*present with unified headers introduced with NDK14*/ +# if __ANDROID_API__ < 21 + /*mmap declaration is missing below api 21 in unified headers, but not in normal headers*/ + extern void* mmap(void*, size_t, int, int, int, off_t); +# endif +# endif +#endif /*defined(ANDROID)*/ + #endif diff --git a/submodules/linphone b/submodules/linphone index d981a246f..f28d968a6 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit d981a246f896c66ce53db19b626b6647dd529865 +Subproject commit f28d968a67eab65e07e60ef8a8b19621c6401e82 From 962654bf7d420f656500ec1b16623c3575b73b91 Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Thu, 21 Sep 2017 10:26:36 +0200 Subject: [PATCH 17/72] Changing how we decline call when call GSM is active --- src/android/org/linphone/LinphoneManager.java | 11 +++++++---- .../org/linphone/PhoneStateChangedReceiver.java | 8 -------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/android/org/linphone/LinphoneManager.java b/src/android/org/linphone/LinphoneManager.java index 39e807d58..08241d18b 100644 --- a/src/android/org/linphone/LinphoneManager.java +++ b/src/android/org/linphone/LinphoneManager.java @@ -87,6 +87,7 @@ import org.linphone.core.PresenceBasicStatus; import org.linphone.core.PresenceActivityType; import org.linphone.core.PresenceModel; import org.linphone.core.PublishState; +import org.linphone.core.Reason; import org.linphone.core.SubscriptionState; import org.linphone.core.TunnelConfig; import org.linphone.mediastream.Log; @@ -1352,8 +1353,11 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } } - - if (state == State.IncomingReceived && (LinphonePreferences.instance().isAutoAnswerEnabled()) && !getCallGsmON()) { + if (state == State.IncomingReceived && getCallGsmON()) { + if (mLc != null) { + mLc.declineCall(call, Reason.Busy); + } + } else if (state == State.IncomingReceived && (LinphonePreferences.instance().isAutoAnswerEnabled()) && !getCallGsmON()) { TimerTask lTask = new TimerTask() { @Override public void run() { @@ -1372,8 +1376,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag }; mTimer = new Timer("Auto answer"); mTimer.schedule(lTask, mPrefs.getAutoAnswerTime()); - } - else if (state == State.IncomingReceived || (state == State.CallIncomingEarlyMedia && mR.getBoolean(R.bool.allow_ringing_while_early_media))) { + } else if (state == State.IncomingReceived || (state == State.CallIncomingEarlyMedia && mR.getBoolean(R.bool.allow_ringing_while_early_media))) { // Brighten screen for at least 10 seconds if (mLc.getCallsNb() == 1) { requestAudioFocus(STREAM_RING); diff --git a/src/android/org/linphone/PhoneStateChangedReceiver.java b/src/android/org/linphone/PhoneStateChangedReceiver.java index 749909142..19b811d96 100644 --- a/src/android/org/linphone/PhoneStateChangedReceiver.java +++ b/src/android/org/linphone/PhoneStateChangedReceiver.java @@ -30,8 +30,6 @@ import android.telephony.TelephonyManager; * */ public class PhoneStateChangedReceiver extends BroadcastReceiver { - private static int oldTimeOut; - @Override public void onReceive(Context context, Intent intent) { final String extraState = intent.getStringExtra(TelephonyManager.EXTRA_STATE); @@ -40,15 +38,9 @@ public class PhoneStateChangedReceiver extends BroadcastReceiver { return; if (TelephonyManager.EXTRA_STATE_OFFHOOK.equals(extraState)) { - if (LinphonePreferences.instance() != null) { - oldTimeOut = LinphoneManager.getLc().getIncomingTimeout(); - LinphoneManager.getLc().setIncomingTimeout(0); - } LinphoneManager.getInstance().setCallGsmON(true); LinphoneManager.getLc().pauseAllCalls(); } else if (TelephonyManager.EXTRA_STATE_IDLE.equals(extraState)) { - if (LinphonePreferences.instance() != null) - LinphoneManager.getLc().setIncomingTimeout(oldTimeOut); LinphoneManager.getInstance().setCallGsmON(false); } } From 8e20f726e2402ff2354171b3687e64d1d6d07d05 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 25 Sep 2017 15:43:05 +0200 Subject: [PATCH 18/72] Revert "Reloading contacts list after editing or deleting" This reverts commit 47c4956b9d3b1fadcd922548b50eb72c662a599c. --- src/android/org/linphone/ContactsListFragment.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/android/org/linphone/ContactsListFragment.java b/src/android/org/linphone/ContactsListFragment.java index d26a2bf2a..dbab611d7 100644 --- a/src/android/org/linphone/ContactsListFragment.java +++ b/src/android/org/linphone/ContactsListFragment.java @@ -143,7 +143,6 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O contactsFetchInProgress = (ProgressBar) view.findViewById(R.id.contactsFetchInProgress); contactsFetchInProgress.setVisibility(View.VISIBLE); - ContactsManager.getInstance().fetchContactsAsync(); return view; } From e9c548de7fe5b88831683fb84577cbc3d3d5e20b Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 25 Sep 2017 15:43:21 +0200 Subject: [PATCH 19/72] update submodules --- submodules/linphone | 2 +- submodules/mediastreamer2 | 2 +- submodules/oRTP | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/submodules/linphone b/submodules/linphone index f28d968a6..e99fdee76 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit f28d968a67eab65e07e60ef8a8b19621c6401e82 +Subproject commit e99fdee766854038756d24f2cd2c7f5454783878 diff --git a/submodules/mediastreamer2 b/submodules/mediastreamer2 index d765c5b94..6b78f9562 160000 --- a/submodules/mediastreamer2 +++ b/submodules/mediastreamer2 @@ -1 +1 @@ -Subproject commit d765c5b947f2de52d97061e80784091ec043f5a0 +Subproject commit 6b78f95624660c4e1160c3caac74732250321ce1 diff --git a/submodules/oRTP b/submodules/oRTP index e9c2d48c9..ce3dedb58 160000 --- a/submodules/oRTP +++ b/submodules/oRTP @@ -1 +1 @@ -Subproject commit e9c2d48c917d78c529eefb9f824ae52238f950d4 +Subproject commit ce3dedb58706f154c647bc99412aca8a42416d9d From 31c5e69d985602c97be55edf43243e8d07b21f58 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 26 Sep 2017 10:23:13 +0200 Subject: [PATCH 20/72] update submodules --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index e99fdee76..ddd080522 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit e99fdee766854038756d24f2cd2c7f5454783878 +Subproject commit ddd08052226c879df63b08ab11d4a4917cfc1da5 From 8924dca7d55ef8fdaf26465f4ee0f8cf88d5af0d Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Mon, 25 Sep 2017 15:27:48 +0200 Subject: [PATCH 21/72] [DialerIntent] multiples updates to fix crashes --- AndroidManifest.xml | 10 ++++ res/values/non_localizable_strings.xml | 1 + res/values/strings.xml | 1 + res/xml/preferences.xml | 6 +++ src/android/org/linphone/ChatFragment.java | 1 - src/android/org/linphone/DialerFragment.java | 24 ++++----- .../org/linphone/LinphoneActivity.java | 10 +++- .../linphone/LinphoneLauncherActivity.java | 9 ++++ src/android/org/linphone/LinphoneManager.java | 52 ++++++++++++++----- .../org/linphone/LinphonePreferences.java | 30 +++++++---- .../org/linphone/SettingsFragment.java | 11 ++++ 11 files changed, 117 insertions(+), 38 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index b69c4f80a..f3f395885 100755 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -115,6 +115,10 @@ + + + + + + + + + Chat diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index 5fab85a1f..43ec3930e 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -225,6 +225,12 @@ android:key="@string/pref_voice_mail_key" android:persistent="false"/> + + + diff --git a/src/android/org/linphone/ChatFragment.java b/src/android/org/linphone/ChatFragment.java index 67534f69a..1453fa321 100644 --- a/src/android/org/linphone/ChatFragment.java +++ b/src/android/org/linphone/ChatFragment.java @@ -1639,7 +1639,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC file = new File(imageUri); contentUri = FileProvider.getUriForFile(getActivity(), "org.linphone.provider", file); } else if (imageUri.startsWith("content://")) { - Log.e("===>>> ChatFragment - getView() - imageUri = "+imageUri); contentUri = Uri.parse(imageUri); } else { file = new File(imageUri); diff --git a/src/android/org/linphone/DialerFragment.java b/src/android/org/linphone/DialerFragment.java index 770aeacf5..e5f6dca71 100644 --- a/src/android/org/linphone/DialerFragment.java +++ b/src/android/org/linphone/DialerFragment.java @@ -17,18 +17,11 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import org.linphone.core.LinphoneCore; -import org.linphone.mediastream.Log; -import org.linphone.ui.AddressAware; -import org.linphone.ui.AddressText; -import org.linphone.ui.CallButton; -import org.linphone.ui.EraseButton; - +import android.app.Fragment; import android.content.Intent; import android.content.res.Configuration; import android.net.Uri; import android.os.Bundle; -import android.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; @@ -36,6 +29,13 @@ import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; +import org.linphone.core.LinphoneCore; +import org.linphone.mediastream.Log; +import org.linphone.ui.AddressAware; +import org.linphone.ui.AddressText; +import org.linphone.ui.CallButton; +import org.linphone.ui.EraseButton; + /** * @author Sylvain Berfini */ @@ -63,14 +63,14 @@ public class DialerFragment extends Fragment { mCall = (CallButton) view.findViewById(R.id.call); mCall.setAddressWidget(mAddress); - if (LinphoneActivity.isInstanciated() && LinphoneManager.getLc().getCallsNb() > 0) { + if (LinphoneActivity.isInstanciated() && LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null && LinphoneManager.getLcIfManagerNotDestroyedOrNull().getCallsNb() > 0) { if (isCallTransferOngoing) { mCall.setImageResource(R.drawable.call_transfer); } else { mCall.setImageResource(R.drawable.call_add); } } else { - if (LinphoneManager.getLc().getVideoAutoInitiatePolicy()) { + if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null && LinphoneManager.getLcIfManagerNotDestroyedOrNull().getVideoAutoInitiatePolicy()) { mCall.setImageResource(R.drawable.call_video_start); } else { mCall.setImageResource(R.drawable.call_audio_start); @@ -83,7 +83,7 @@ public class DialerFragment extends Fragment { } mAddContact = (ImageView) view.findViewById(R.id.add_contact); - mAddContact.setEnabled(!(LinphoneActivity.isInstanciated() && LinphoneManager.getLc().getCallsNb() > 0)); + mAddContact.setEnabled(!(LinphoneActivity.isInstanciated() && LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null && LinphoneManager.getLc().getCallsNb() > 0)); addContactListener = new OnClickListener() { @Override @@ -215,7 +215,7 @@ public class DialerFragment extends Fragment { } public void enableDisableAddContact() { - mAddContact.setEnabled(LinphoneManager.getLc().getCallsNb() > 0 || !mAddress.getText().toString().equals("")); + mAddContact.setEnabled(LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null && LinphoneManager.getLc().getCallsNb() > 0 || !mAddress.getText().toString().equals("")); } public void displayTextInAddressBar(String numberOrSipAddress) { diff --git a/src/android/org/linphone/LinphoneActivity.java b/src/android/org/linphone/LinphoneActivity.java index 970f70298..ed1a4ca34 100644 --- a/src/android/org/linphone/LinphoneActivity.java +++ b/src/android/org/linphone/LinphoneActivity.java @@ -1475,7 +1475,6 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick ((SettingsFragment) fragment).closePreferenceScreen(); } } - Bundle extras = intent.getExtras(); if (extras != null && extras.getBoolean("GoToChat", false)) { LinphoneService.instance().removeMessageNotification(); @@ -1494,6 +1493,15 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick LinphoneCall call = LinphoneManager.getLc().getCalls()[0]; startIncallActivity(call); } + }else if (extras != null && extras.getBoolean("StartCall", false)) { + boolean extraBool = extras.getBoolean("StartCall", false); + if (CallActivity.isInstanciated()) { + CallActivity.instance().startIncomingCallActivity(); + } else { + mAddressWaitingToBeCalled = extras.getString("NumberToCall"); + goToDialerFragment(); + //startActivity(new Intent(this, CallIncomingActivity.class)); + } } else { DialerFragment dialerFragment = DialerFragment.instance(); if (dialerFragment != null) { diff --git a/src/android/org/linphone/LinphoneLauncherActivity.java b/src/android/org/linphone/LinphoneLauncherActivity.java index 9dd7dbd23..24ca01738 100644 --- a/src/android/org/linphone/LinphoneLauncherActivity.java +++ b/src/android/org/linphone/LinphoneLauncherActivity.java @@ -41,6 +41,8 @@ import static android.content.Intent.ACTION_MAIN; */ public class LinphoneLauncherActivity extends Activity { + private final String ACTION_CALL_LINPHONE = "org.linphone.intent.action.CallLaunched"; + private Handler mHandler; private ServiceWaitThread mServiceThread; private String addressToCall; @@ -148,6 +150,13 @@ public class LinphoneLauncherActivity extends Activity { } newIntent.putExtra("fileShared", stringUriFileShared); } + }else if( ACTION_CALL_LINPHONE.equals(action) && (intent.getStringExtra("NumberToCall") != null)) { + String numberToCall = intent.getStringExtra("NumberToCall"); + if (CallActivity.isInstanciated()) { + CallActivity.instance().startIncomingCallActivity(); + } else { + LinphoneManager.getInstance().newOutgoingCall(numberToCall, null); + } } } if (uriToResolve != null) { diff --git a/src/android/org/linphone/LinphoneManager.java b/src/android/org/linphone/LinphoneManager.java index 08241d18b..0a969e59e 100644 --- a/src/android/org/linphone/LinphoneManager.java +++ b/src/android/org/linphone/LinphoneManager.java @@ -154,10 +154,12 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag private BroadcastReceiver mKeepAliveReceiver; private BroadcastReceiver mDozeReceiver; private BroadcastReceiver mHookReceiver; + private BroadcastReceiver mCallReceiver; private BroadcastReceiver mNetworkReceiver; private IntentFilter mKeepAliveIntentFilter; private IntentFilter mDozeIntentFilter; private IntentFilter mHookIntentFilter; + private IntentFilter mCallIntentFilter; private IntentFilter mNetworkIntentFilter; private Handler mHandler = new Handler(); private WakeLock mIncallWakeLock; @@ -707,6 +709,11 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } catch (Exception e) { Log.e(e); } + try { + mServiceContext.unregisterReceiver(mCallReceiver); + } catch (Exception e) { + Log.e(e); + } try { mServiceContext.unregisterReceiver(mKeepAliveReceiver); } catch (Exception e) { @@ -714,7 +721,9 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } try { dozeManager(false); - } catch (Exception e) { + } catch (IllegalArgumentException iae) { + Log.e(iae); + }catch (Exception e) { Log.e(e); } mLc = null; @@ -731,9 +740,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag try { copyAssetsFromPackage(); //traces alway start with traces enable to not missed first initialization - mLc = LinphoneCoreFactory.instance().createLinphoneCore(this, mLinphoneConfigFile, mLinphoneFactoryConfigFile, null, c); - TimerTask lTask = new TimerTask() { @Override public void run() { @@ -750,8 +757,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag /*use schedule instead of scheduleAtFixedRate to avoid iterate from being call in burst after cpu wake up*/ mTimer = new Timer("Linphone scheduler"); mTimer.schedule(lTask, 0, 20); - } - catch (Exception e) { + } catch (Exception e) { Log.e(e, "Cannot start linphone"); } } @@ -840,15 +846,21 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag mKeepAliveReceiver = new KeepAliveReceiver(); mServiceContext.registerReceiver(mKeepAliveReceiver, mKeepAliveIntentFilter); - mDozeIntentFilter = new IntentFilter(); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - mDozeIntentFilter.addAction(PowerManager.ACTION_DEVICE_IDLE_MODE_CHANGED); - } + mCallIntentFilter = new IntentFilter("android.intent.action.ACTION_NEW_OUTGOING_CALL"); + mCallIntentFilter.setPriority(99999999); + mCallReceiver = new OutgoingCallReceiver(); + try { + mServiceContext.registerReceiver(mCallReceiver, mCallIntentFilter); + }catch(IllegalArgumentException e){e.printStackTrace();} + mProximityWakelock = mPowerManager.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, "manager_proximity_sensor"); + - mDozeReceiver = new DozeReceiver(); if (mPrefs.isDozeModeEnabled()) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + mDozeIntentFilter = new IntentFilter(); + mDozeIntentFilter.addAction(PowerManager.ACTION_DEVICE_IDLE_MODE_CHANGED); + mDozeReceiver = new DozeReceiver(); dozeModeEnabled = ((PowerManager) mServiceContext.getSystemService(Context.POWER_SERVICE)).isDeviceIdleMode(); if (dozeModeEnabled) mServiceContext.registerReceiver(mDozeReceiver, mDozeIntentFilter); @@ -860,8 +872,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag mHookReceiver = new HookReceiver(); mServiceContext.registerReceiver(mHookReceiver, mHookIntentFilter); - mProximityWakelock = mPowerManager.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, "manager_proximity_sensor"); - // Since Android N we need to register the network manager if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) { mNetworkReceiver = new NetworkManager(); @@ -1045,8 +1055,15 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } catch (Exception e) { Log.e(e); } + try { + mServiceContext.unregisterReceiver(mCallReceiver); + } catch (Exception e) { + Log.e(e); + } try { dozeManager(false); + } catch (IllegalArgumentException iae) { + Log.e(iae); } catch (Exception e) { Log.e(e); } @@ -1062,7 +1079,14 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag dozeModeEnabled = true; } else { Log.i("[Doze Mode]: unregister"); - mServiceContext.unregisterReceiver(mDozeReceiver); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + try { + mServiceContext.unregisterReceiver(mDozeReceiver); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + } + + } dozeModeEnabled = false; } } @@ -1274,6 +1298,8 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag Log.e("LinphoneManager"," globalState ON"); initLiblinphone(lc); + }catch(IllegalArgumentException iae){ + Log.e(iae); } catch (LinphoneCoreException e) { Log.e(e); } diff --git a/src/android/org/linphone/LinphonePreferences.java b/src/android/org/linphone/LinphonePreferences.java index b2fcdc7f0..3c6fac444 100644 --- a/src/android/org/linphone/LinphonePreferences.java +++ b/src/android/org/linphone/LinphonePreferences.java @@ -19,12 +19,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.ArrayList; +import android.Manifest; +import android.content.Context; +import android.content.pm.PackageManager; +import android.os.Build; import org.linphone.core.LinphoneAddress; import org.linphone.core.LinphoneAddress.TransportType; @@ -43,10 +41,12 @@ import org.linphone.core.TunnelConfig; import org.linphone.mediastream.Log; import org.linphone.purchase.Purchasable; -import android.Manifest; -import android.content.Context; -import android.content.pm.PackageManager; -import android.os.Build; +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.ArrayList; /** * @author Sylvain Berfini @@ -1001,7 +1001,15 @@ public class LinphonePreferences { public void setVoiceMailUri(String uri) { getConfig().setString("app", "voice_mail", uri); } - // End of call settings + + public boolean getNativeDialerCall() { + return getConfig().getBool("app", "native_dialer_call", false); + } + + public void setNativeDialerCall(boolean use) { + getConfig().setBool("app", "native_dialer_call", use); + } +// End of call settings // Network settings public void setWifiOnlyEnabled(Boolean enable) { diff --git a/src/android/org/linphone/SettingsFragment.java b/src/android/org/linphone/SettingsFragment.java index b88542f59..0a2c224da 100644 --- a/src/android/org/linphone/SettingsFragment.java +++ b/src/android/org/linphone/SettingsFragment.java @@ -885,6 +885,7 @@ public class SettingsFragment extends PreferencesListFragment { CheckBoxPreference autoAnswer = (CheckBoxPreference) findPreference(getString(R.string.pref_auto_answer_key)); CheckBoxPreference rfc2833 = (CheckBoxPreference) findPreference(getString(R.string.pref_rfc2833_dtmf_key)); CheckBoxPreference sipInfo = (CheckBoxPreference) findPreference(getString(R.string.pref_sipinfo_dtmf_key)); + CheckBoxPreference dialerCall = (CheckBoxPreference) findPreference(getString(R.string.pref_dialer_call_key)); EditTextPreference incTimeout = (EditTextPreference) findPreference(getString(R.string.pref_incoming_call_timeout_key)); EditTextPreference autoAnswerTime = (EditTextPreference) findPreference(getString(R.string.pref_auto_answer_time_key)); @@ -904,6 +905,7 @@ public class SettingsFragment extends PreferencesListFragment { } setPreferenceDefaultValueAndSummary(R.string.pref_voice_mail_key, mPrefs.getVoiceMailUri()); + dialerCall.setChecked(mPrefs.getNativeDialerCall()); } public void enableDeviceRingtone(boolean enabled) { @@ -997,6 +999,15 @@ public class SettingsFragment extends PreferencesListFragment { } }); + findPreference(getString(R.string.pref_dialer_call_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() { + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { + boolean use = (Boolean) newValue; + mPrefs.setNativeDialerCall(use); + return true; + } + }); + findPreference(getString(R.string.pref_incoming_call_timeout_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { From 21ed2955ef47ef89f5e71c812ea64b3ace074442 Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Tue, 26 Sep 2017 11:15:47 +0200 Subject: [PATCH 22/72] [DialerIntent] add OutgoingCallReceiver.java file to git --- .../org/linphone/OutgoingCallReceiver.java | 36 +++++++++++++++++++ submodules/mswebrtc | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 src/android/org/linphone/OutgoingCallReceiver.java diff --git a/src/android/org/linphone/OutgoingCallReceiver.java b/src/android/org/linphone/OutgoingCallReceiver.java new file mode 100644 index 000000000..5b6e5a84d --- /dev/null +++ b/src/android/org/linphone/OutgoingCallReceiver.java @@ -0,0 +1,36 @@ +package org.linphone; + + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; + + +public class OutgoingCallReceiver extends BroadcastReceiver { + private final static String TAG = "CallHandler"; + private final String ACTION_CALL_LINPHONE = "org.linphone.intent.action.CallLaunched"; + + private LinphonePreferences mPrefs; + + @Override + public void onReceive(Context context, Intent intent) { + mPrefs = LinphonePreferences.instance(); + Log.e(TAG, "===>>>> Linphone OutgoingCallReceiver "); + if (intent.getAction().equals(Intent.ACTION_NEW_OUTGOING_CALL)) { + Log.e(TAG, "===>>>> Linphone OutgoingCallReceiver : ACTION_NEW_OUTGOING_CALL"); + String number = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER); + if(mPrefs.getNativeDialerCall()){ + abortBroadcast(); + setResultData(null); + Intent newIntent = new Intent(ACTION_CALL_LINPHONE); + newIntent.setFlags(FLAG_ACTIVITY_NEW_TASK); + newIntent.putExtra("StartCall", true); + newIntent.putExtra("NumberToCall", number); + context.startActivity(newIntent); + } + } + } +} \ No newline at end of file diff --git a/submodules/mswebrtc b/submodules/mswebrtc index 198143488..475eb67b5 160000 --- a/submodules/mswebrtc +++ b/submodules/mswebrtc @@ -1 +1 @@ -Subproject commit 19814348807cdab7f13637993a05a696f47685eb +Subproject commit 475eb67b5cb8d82f6636e69c3bde8b18daeb824e From ab6e3737b19cecacc9ad68bf0122a99e61507b3a Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Wed, 27 Sep 2017 14:28:52 +0200 Subject: [PATCH 23/72] [DisplayName] automatically add displayName in contactEditor if create new contact and DisplayName exists --- .../org/linphone/ContactEditorFragment.java | 33 ++++++++++++------- .../org/linphone/ContactsListFragment.java | 24 ++++++++------ .../org/linphone/HistoryDetailFragment.java | 8 +++-- .../org/linphone/LinphoneActivity.java | 9 +++++ submodules/linphone | 2 +- submodules/mediastreamer2 | 2 +- submodules/oRTP | 2 +- 7 files changed, 54 insertions(+), 26 deletions(-) diff --git a/src/android/org/linphone/ContactEditorFragment.java b/src/android/org/linphone/ContactEditorFragment.java index 54df95532..b44332209 100644 --- a/src/android/org/linphone/ContactEditorFragment.java +++ b/src/android/org/linphone/ContactEditorFragment.java @@ -18,16 +18,6 @@ package org.linphone; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -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; import android.app.Activity; import android.app.Dialog; @@ -57,6 +47,16 @@ import android.widget.EditText; import android.widget.ImageView; import android.widget.LinearLayout; +import org.linphone.mediastream.Log; +import org.linphone.mediastream.Version; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + public class ContactEditorFragment extends Fragment { private View view; private ImageView cancel, deleteContact, ok; @@ -73,7 +73,7 @@ public class ContactEditorFragment extends Fragment { private List numbersAndAddresses; private int firstSipAddressIndex = -1; private LinearLayout sipAddresses, numbers; - private String newSipOrNumberToAdd; + private String newSipOrNumberToAdd, newDisplayName; private Uri pickedPhotoForContactUri; private byte[] photoToAdd; @@ -90,9 +90,14 @@ public class ContactEditorFragment extends Fragment { isNewContact = false; if (getArguments().getString("NewSipAdress") != null) { newSipOrNumberToAdd = getArguments().getString("NewSipAdress"); + }if (getArguments().getString("NewDisplayName") != null) { + newDisplayName = getArguments().getString("NewDisplayName"); } } else if (getArguments().getString("NewSipAdress") != null) { newSipOrNumberToAdd = getArguments().getString("NewSipAdress"); + if (getArguments().getString("NewDisplayName") != null) { + newDisplayName = getArguments().getString("NewDisplayName"); + } } } @@ -439,6 +444,12 @@ public class ContactEditorFragment extends Fragment { } } + if (newDisplayName != null) { + EditText lastNameEditText = (EditText) view.findViewById(R.id.contactLastName); + if (view != null) + lastNameEditText.setText(newDisplayName); + } + if (controls.getChildCount() == 0) { addEmptyRowToAllowNewNumberOrAddress(controls,false); } diff --git a/src/android/org/linphone/ContactsListFragment.java b/src/android/org/linphone/ContactsListFragment.java index dbab611d7..59b400167 100644 --- a/src/android/org/linphone/ContactsListFragment.java +++ b/src/android/org/linphone/ContactsListFragment.java @@ -19,12 +19,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. package org.linphone; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; - import android.app.Dialog; import android.app.Fragment; import android.os.Bundle; @@ -49,6 +43,12 @@ import android.widget.ProgressBar; import android.widget.SectionIndexer; import android.widget.TextView; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; + /** * @author Sylvain Berfini */ @@ -62,7 +62,7 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O private LinearLayout editList, topbar; private int lastKnownPosition; private boolean editOnClick = false, editConsumed = false, onlyDisplayChatAddress = false; - private String sipAddressToAdd; + private String sipAddressToAdd, displayName = null; private ImageView clearSearchField; private EditText searchField; private ProgressBar contactsFetchInProgress; @@ -75,8 +75,9 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O if (getArguments() != null) { editOnClick = getArguments().getBoolean("EditOnClick"); sipAddressToAdd = getArguments().getString("SipAddress"); - - onlyDisplayChatAddress = getArguments().getBoolean("ChatAddressOnly"); + if(getArguments().getString("DisplayName") != null) + displayName = getArguments().getString("DisplayName"); + onlyDisplayChatAddress = getArguments().getBoolean("ChatAddressOnly"); } noSipContact = (TextView) view.findViewById(R.id.noSipContact); @@ -253,7 +254,10 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O if (id == R.id.newContact) { editConsumed = true; - LinphoneActivity.instance().addContact(null, sipAddressToAdd); + if(displayName != null) + LinphoneActivity.instance().addContact(displayName, sipAddressToAdd); + else + LinphoneActivity.instance().addContact(null, sipAddressToAdd); } else if (id == R.id.clearSearchField) { searchField.setText(""); diff --git a/src/android/org/linphone/HistoryDetailFragment.java b/src/android/org/linphone/HistoryDetailFragment.java index 8ede8d395..5d66f0fbb 100644 --- a/src/android/org/linphone/HistoryDetailFragment.java +++ b/src/android/org/linphone/HistoryDetailFragment.java @@ -164,13 +164,17 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener { LinphoneActivity.instance().displayChat(sipUri, null, null); } else if (id == R.id.add_contact) { String uri = sipUri; + LinphoneAddress addr = null; try { - LinphoneAddress addr = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri); + addr = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri); uri = addr.asStringUriOnly(); } catch (LinphoneCoreException e) { Log.e(e); } - LinphoneActivity.instance().displayContactsForEdition(uri); + if(addr != null && !addr.getDisplayName().equals("Dust Android")) + LinphoneActivity.instance().displayContactsForEdition(addr.asStringUriOnly(), addr.getDisplayName()); + else + LinphoneActivity.instance().displayContactsForEdition(uri); } else if (id == R.id.goto_contact) { LinphoneActivity.instance().displayContact(contact, false); } diff --git a/src/android/org/linphone/LinphoneActivity.java b/src/android/org/linphone/LinphoneActivity.java index ed1a4ca34..1d318a58e 100644 --- a/src/android/org/linphone/LinphoneActivity.java +++ b/src/android/org/linphone/LinphoneActivity.java @@ -628,6 +628,14 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick changeCurrentFragment(FragmentsAvailable.ABOUT, null); } + public void displayContactsForEdition(String sipAddress, String displayName) { + Bundle extras = new Bundle(); + extras.putBoolean("EditOnClick", true); + extras.putString("SipAddress", sipAddress); + extras.putString("DisplayName", displayName); + changeCurrentFragment(FragmentsAvailable.CONTACTS_LIST, extras); + } + public void displayAssistant() { startActivity(new Intent(LinphoneActivity.this, AssistantActivity.class)); } @@ -1091,6 +1099,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick { Bundle extras = new Bundle(); extras.putSerializable("NewSipAdress", sipUri); + extras.putSerializable("NewDisplayName", displayName); changeCurrentFragment(FragmentsAvailable.CONTACT_EDITOR, extras); } diff --git a/submodules/linphone b/submodules/linphone index ddd080522..f28d968a6 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit ddd08052226c879df63b08ab11d4a4917cfc1da5 +Subproject commit f28d968a67eab65e07e60ef8a8b19621c6401e82 diff --git a/submodules/mediastreamer2 b/submodules/mediastreamer2 index 6b78f9562..d765c5b94 160000 --- a/submodules/mediastreamer2 +++ b/submodules/mediastreamer2 @@ -1 +1 @@ -Subproject commit 6b78f95624660c4e1160c3caac74732250321ce1 +Subproject commit d765c5b947f2de52d97061e80784091ec043f5a0 diff --git a/submodules/oRTP b/submodules/oRTP index ce3dedb58..e9c2d48c9 160000 --- a/submodules/oRTP +++ b/submodules/oRTP @@ -1 +1 @@ -Subproject commit ce3dedb58706f154c647bc99412aca8a42416d9d +Subproject commit e9c2d48c917d78c529eefb9f824ae52238f950d4 From c819a6ef58eea1b4ae3e9961920499f72dde9027 Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Fri, 29 Sep 2017 13:55:59 +0200 Subject: [PATCH 24/72] [ChatList] fix last chatMessage display problem + gsu --- src/android/org/linphone/ChatFragment.java | 7 ++++--- submodules/linphone | 2 +- submodules/mediastreamer2 | 2 +- submodules/mswebrtc | 2 +- submodules/oRTP | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/android/org/linphone/ChatFragment.java b/src/android/org/linphone/ChatFragment.java index 1453fa321..1df536951 100644 --- a/src/android/org/linphone/ChatFragment.java +++ b/src/android/org/linphone/ChatFragment.java @@ -1484,9 +1484,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } - - - if (externalBodyUrl != null || fileTransferContent != null) { String appData = message.getAppData(); @@ -1530,6 +1527,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC loadBitmap(appData, holder.messageImage); holder.messageImage.setTag(message.getAppData()); } + //displayMessageList(); } } } @@ -1842,6 +1840,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC final BitmapWorkerTask bitmapWorkerTask = getBitmapWorkerTask(imageView); if (this == bitmapWorkerTask && imageView != null) { imageView.setImageBitmap(bitmap); + //Force scroll too bottom with setSelection() after image loaded and last messages + if(((messagesList.getLastVisiblePosition() >= (getCount() - 1)) && (messagesList.getFirstVisiblePosition() <= (getCount() - 1)))) + messagesList.setSelection(getCount() - 1); imageView.setTag(path); imageView.setOnClickListener(new OnClickListener() { @Override diff --git a/submodules/linphone b/submodules/linphone index f28d968a6..ddd080522 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit f28d968a67eab65e07e60ef8a8b19621c6401e82 +Subproject commit ddd08052226c879df63b08ab11d4a4917cfc1da5 diff --git a/submodules/mediastreamer2 b/submodules/mediastreamer2 index d765c5b94..6b78f9562 160000 --- a/submodules/mediastreamer2 +++ b/submodules/mediastreamer2 @@ -1 +1 @@ -Subproject commit d765c5b947f2de52d97061e80784091ec043f5a0 +Subproject commit 6b78f95624660c4e1160c3caac74732250321ce1 diff --git a/submodules/mswebrtc b/submodules/mswebrtc index 475eb67b5..198143488 160000 --- a/submodules/mswebrtc +++ b/submodules/mswebrtc @@ -1 +1 @@ -Subproject commit 475eb67b5cb8d82f6636e69c3bde8b18daeb824e +Subproject commit 19814348807cdab7f13637993a05a696f47685eb diff --git a/submodules/oRTP b/submodules/oRTP index e9c2d48c9..ce3dedb58 160000 --- a/submodules/oRTP +++ b/submodules/oRTP @@ -1 +1 @@ -Subproject commit e9c2d48c917d78c529eefb9f824ae52238f950d4 +Subproject commit ce3dedb58706f154c647bc99412aca8a42416d9d From 0057a47cf1cdfa3f4bdc997bb112bbdd160456f0 Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Fri, 29 Sep 2017 17:00:31 +0200 Subject: [PATCH 25/72] Update transifex Close#124 --- res/values-ar/strings.xml | 13 +- res/values-de/strings.xml | 11 +- res/values-es/strings.xml | 1 - res/values-fi/strings.xml | 1 - res/values-fr/strings.xml | 1 - res/values-ja/strings.xml | 1 - res/values-ka/strings.xml | 10 +- res/values-nl/strings.xml | 1 - res/values-pl/strings.xml | 1 - res/values-pt-rBR/strings.xml | 1 - res/values-ru/strings.xml | 259 +++++++++++++++++++++++++--------- res/values-sr/strings.xml | 1 - res/values-sv/strings.xml | 259 +++++++++++++++++++++++++++++++++- res/values-tr/strings.xml | 1 - res/values-zh-rCN/strings.xml | 1 - res/values-zh-rTW/strings.xml | 1 - 16 files changed, 485 insertions(+), 78 deletions(-) diff --git a/res/values-ar/strings.xml b/res/values-ar/strings.xml index d1ccd117f..54c7c9833 100644 --- a/res/values-ar/strings.xml +++ b/res/values-ar/strings.xml @@ -45,6 +45,7 @@ ربما لاحقا لاحقا لا + حسنا نعم اربط حسابك @@ -176,6 +177,9 @@ تعذر عليك فك تعمية هذه الرسالة. إنك تحاول إرسال رسالة عبر LIME لجهة اتصال لم تتحقق منها بواسطة ZRTP.\nيُرجى الاتصال بجهة الاتصال هذه والتحقق من مفتاحها ZRTP قبل إرسال رسائلك. قد تستلزم معالجة الصور بضع ثوان حسب حجم الملف. + قُرِأ + سُلِّم + أعد اﻹرسال مُسجَّل غير مُسجَّل @@ -190,9 +194,14 @@ مكالمة واردة مكالمة صادرة + يود مخاطبك تشغيل الفيديو لا وجود لأي مكالمة نشيطة + أوقف مخاطبك المكالمة مؤقتا حدث خطأ خلال قبول المكالمة أكد رمز الاستيثاق مع نظيرك :\nقل : %s + \nمخاطبك يجب أن يقول : %s + رمز الاستيثاق + قم بتأكيد رمز الاستيثاق السابق مع مخاطبك مجهول الصوت الفيديو @@ -200,7 +209,6 @@ صنف IP : صبيب الرفع : صبيب التنزيل : - عرض النطاق الترددي المتوقع للتنزيل : توصيل ICE : دقة الفيديو المُرسَل : دقة الفيديو المُستلَم : @@ -230,6 +238,7 @@ المستخدم مشغول لم يعثر على المستخدم مُعامِلات الوسائط غير متوافقة + لمخاطبك سعة قناة ضيقة، لا يمكن بدء الفيديو تعذر الوصول إلى الشبكة الاعتمادات غير صحيحة غير مُصرَّح @@ -320,6 +329,7 @@ المكالمة استخدم رنة الجهاز رد تلقائيا على المكالمات الواردة + مهلة التشغيل التلقائي (بالميلي-ثواني) أرسل DTMF مع التدفق (RFC2833) أرسل DTMF خارج التدفق (SIP INFO) عنوان العلبة الصوتية @@ -444,4 +454,5 @@ خيارات المكالمة توجيه الصوت مغادرة الاجتماع + إشعارات لِنْفُونْ diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index d8caeab62..e64a4e312 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -16,6 +16,7 @@ Linphone-Kontakte Benutzername + Benutzerkennung (optional) Telefonnummer Anzeigename Passwort @@ -45,6 +46,7 @@ Vielleicht später Später Nein + OK Ja Verknüpfen Sie Ihr Konto @@ -170,6 +172,7 @@ Sie können diese Nachricht nicht entschlüsseln. Bild wird verarbeitet. Je nach Größe der Datei kann dies mehrere Sekunden in Anspruch nehmen Lesen + Ausgeliefert Erneut senden Registriert @@ -185,9 +188,13 @@ eingehender Anruf ausgehender Anruf + Ihr Anrufer möchte Video einschalten Kein aktiver Anruf Ihr Anrufer hat den Anruf pausiert Beim Annehmen des Anrufs ist ein Fehler aufgetreten + \nIhr Anrufer sollte sagen: %s + SAS + Bestätigen Sie den vorherigen SAS-Code mit Ihrem Korrespondenten Unbekannt Audio Video @@ -195,7 +202,6 @@ IP-Familie: Upload-Bandbreite: Download-Bandbreite: - Geschätzte Download-Bandbreite: ICE-Konnektivität: Gesendete Videoauflösung: Empfangene Videoauflösung: @@ -225,6 +231,7 @@ Benutzer beschäftigt Benutzer nicht gefunden Inkompatible Medienparameter + Ihr Anrufer hat eine geringe Bandbreite, Video kann nicht gestartet werden Netzwerk ist nicht erreichbar Falsche Anmeldedaten Unzulässig @@ -328,6 +335,7 @@ Netzwerk Nur WiFi verwenden + Schlummermodus STUN / TURN-Server ICE aktivieren TURN aktivieren @@ -436,4 +444,5 @@ Anrufoptionen Audioroute Konferenz beenden + Linphone-Benachrichtigung diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml index ca00f7615..185baf6c5 100644 --- a/res/values-es/strings.xml +++ b/res/values-es/strings.xml @@ -73,7 +73,6 @@ Codec: Ancho de banda de subida: Ancho de banda de bajada: - Ancho de banda de bajada estimado: Conectividad ICE Llamar diff --git a/res/values-fi/strings.xml b/res/values-fi/strings.xml index 81fa19c27..8d08b4d9f 100644 --- a/res/values-fi/strings.xml +++ b/res/values-fi/strings.xml @@ -123,7 +123,6 @@ Koodekki: Lähetyskaistanleveys: Latauskaistanleveys: - Arvioitu latauskaistanleveys: ICE yhdistettävyys: Puhelu diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml index a969c1638..fb53093ef 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -203,7 +203,6 @@ Vos amis pourront vous joindre plus facilement si vous associez votre compte à Type d\'IP : Bande passante envoi : Bande passante réception : - Bande passante réception estimée : Connexion ICE : Résolution vidéo envoyée Résolution vidéo reçu diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml index 24332f45d..bd5d0a6d7 100644 --- a/res/values-ja/strings.xml +++ b/res/values-ja/strings.xml @@ -190,7 +190,6 @@ IP: アップロード幅: ダウンロード幅: - 推定ダウンロード帯域幅: ICE 接続: 送信ビデオ解像度: 受信ビデオ解像度: diff --git a/res/values-ka/strings.xml b/res/values-ka/strings.xml index 9f5b0e57f..a076c2d2d 100644 --- a/res/values-ka/strings.xml +++ b/res/values-ka/strings.xml @@ -16,6 +16,7 @@ linphone კონტაქტები მომხმარებლის სახელი + User-id (არასავალდებულო) ტელეფონის ნომერი სახელი პაროლი @@ -45,6 +46,7 @@ შესაძლოა მოგვიანებით მოგვიანებით არა + OK დიახ ანგარიშის მიბმა @@ -197,6 +199,8 @@ ზარის მიღებისას მოხდა შეცდომა დაადასტურეთ შემდეგი SAS მომხმარებელთან:\nთქვით: %s \nთქვენმა მხმობელმა უნდა თქვას: %s + SAS + დაადასტურეთ წინა SAS კოდი თქვენს მოკავშირესთან უცნობი ხმა ვიდეო @@ -204,10 +208,11 @@ IP ოჯახი: ატვირთვის გამტარი უნარი: გადმოტვირთვის გამტარი უნარი: - სავარაუდო ჩამოტვირთვა სიჩქარის: ICE კავშირი: გაგზავნილი ვიდეოს გაფართოება: მიღებული ვიდეოს გაფართოება: + გაგზავნილი ვიდეოს კადრი/წმ: + მიღებული ვიდეოს კადრი/წმ: გამგზავნის დაკარგვის სიხშირე: მიმღების დაკარგვის სიხშირე: ჯიტერის ბუფერი: @@ -325,8 +330,10 @@ ზარი მოწყობილობის რეკვის ხმის გამოყენება შემომავალ პასუხებზე ავტო-პასუხი + ავტო პასუხის დრო (მილიწამებში) არხის-შიდა DTMF-ების გაგზავნა(RFC2833) არხის-გარე DTMF-ების გაგზავნა(SIP INFO) + ზარის ტაიმაუტი (წამებში) ხმოვანი ფოსტის URI ჩატი @@ -449,4 +456,5 @@ ზარის პარამეტრები ხმის მარშრუტი კონფერენციიდან გამოსვლა + Linphone-ის შეტყობინება diff --git a/res/values-nl/strings.xml b/res/values-nl/strings.xml index e3bb53b08..ffe45a90a 100644 --- a/res/values-nl/strings.xml +++ b/res/values-nl/strings.xml @@ -74,7 +74,6 @@ Codec: Uploadbandbreedte: Downloadbandbreedte: - Geschatte downloadbandbreedte: Oproep Log versturen diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml index 85c9e773c..f9ae013fc 100644 --- a/res/values-pl/strings.xml +++ b/res/values-pl/strings.xml @@ -190,7 +190,6 @@ IP Rodzina: Prześlij przepustowość: Pobierz przepustowość: - Szacowana przepustowość pobierania: Łączność ICE: Wysłana rozdzielczość wideo: Odebrana rozdzielczość wideo: diff --git a/res/values-pt-rBR/strings.xml b/res/values-pt-rBR/strings.xml index 09173bf75..d012d33c2 100644 --- a/res/values-pt-rBR/strings.xml +++ b/res/values-pt-rBR/strings.xml @@ -133,7 +133,6 @@ Codec: Velocidade de Upload Velocidade de Download: - Velocidade de Download estimada: Conectividade ICE: Ligar diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml index edb1bde1d..bdfe085f8 100644 --- a/res/values-ru/strings.xml +++ b/res/values-ru/strings.xml @@ -9,16 +9,22 @@ %s зарегистрирован %s зарегистрировать не удалось + Linphone Android %s + Linphone ядро %s + GNU General Public License V2\n © 2010-2017 Belledonne Communications + www.linphone.org + контакты linphone Имя пользователя + Идентификатор пользователя (необязательно) Номер телефона Отображаемое имя Пароль Подтверждение пароля Домен - URL + URL-адрес Электронная почта - Вы уверены, что хотите удалить выбранное? + Вы действительно хотите удалить выбранное? Удалить Повторить Отменить @@ -35,41 +41,103 @@ Подключение Отклонить Конференция + Ссылка + Вы хотите связать учетную запись %s с вашим номером телефона? + Может быть позже + Позже Нет + OK Да + Связать свою учетную запись + это бесплатный SIP-клиент Добро пожаловать Ассистент Создать аккаунт + Связать учетную запись Продолжить + Активировать учетную запись Завершить настройку - Пожалуйста, введите URL конфигурирования + Ваша учетная запись создана. Для подтверждения учетной записи проверьте свою почту: + После этого вернитесь и нажмите кнопку. + Этот помощник поможет вам настроить и использовать свой SIP-аккаунт. + Введите имя пользователя и пароль учетной записи Linphone + Введите имя пользователя и пароль вашего домена SIP + Укажите URL-адрес конфигурации Транспорт - Исп. аккаунт Linphone - Исп. SIP-аккаунт - Удалённое конфигурирование + Ваш SIP-адрес + Использовать учетную запись Linphone + Использовать учетную запись SIP + Выбор удаленной конфигурации + Подтвердите код страны и введите свой номер телефона + Мы отправили SMS-сообщение с кодом подтверждения на ваш номер телефона: + Чтобы завершить проверку номера телефона, введите 4-значный код ниже:\n + Введите имя пользователя, адрес электронной почты и пароль для вашей учетной записи Linphone Отображаемое имя (необязательно) - Исп. SIP-аккаунт - Удалённое конфигурирование - Извлечь и применить - Логин + Использовать учетную запись Linphone + Использовать учетную запись SIP + Выбор удаленной конфигурации + Получить и применить + Имя пользователя Выполняется калибровка эхоподавления - Введите логин - Ваша учётная запись ещё не подтверждена. - Ваша учётная запись подтверждена. + Введите имя пользователя + Ваша учетная запись еще не проверена. + Недопустимый код подтверждения.\r\nПожалуйста, повторите попытку. + Ваша учетная запись проверена. Неверное имя пользователя или пароль + Вы согласны загрузить OpenH264 Video Codec, предоставленный компанией Cisco Systems, Inc.? + Загрузка OpenH264 Video Codec, предоставленного компанией Cisco Systems, Inc. + Загрузка OpenH264 + Перед использованием кодека OpenH264 необходимо перезапустить %s. + Извините, произошла ошибка. + OpenH264 Video Codec, предоставленный компанией Cisco Systems, Inc. загружен. Произошла ошибка, повторите попытку позже. - Сервер недоступен, проверьте подключение к сети. + Сервер недоступен, проверьте сетевое подключение. Это имя пользователя уже используется. - Неверное имя пользователя. - Неверный адрес эл. почты. - Неверный пароль + Этот номер телефона уже используется.\r\nВведите другой номер.\r\nВы можете удалить свою существующую учетную запись, если хотите повторно использовать свой номер телефона. + Недопустимое имя пользователя. + Недопустимый номер телефона. + Недопустимый адрес электронной почты. + Недопустимый пароль Пароли не совпадают. - Ваше имя пользователя будет %s.\r\n\r\nОно может отличаться от введённого для соответствия требованиям.\r\nВы согласны? - Пожалуйста, введите имя пользователя и пароль + Ваше имя пользователя будет %s.\r\n\r\nОно может отличаться от выбранного вами для соответствия требованиям.\r\nВы согласны? + Введите имя пользователя и пароль + Забыли пароль ? + Выберите страну + Выберите свою страну + (%s) + Использовать имя пользователя (необязательно) + Использовать адрес электронной почты для проверки учетной записи + Вместо номера телефона использовать имя пользователя и пароль + Для чего будет использоваться мой номер телефона? + \nБлагодаря номеру телефона вашим друзьям будет проще вас найти.\n\n В вашей адресной книге вы увидите, кто использует Linphone, а ваши друзья смогут узнать, что вы также зарегистрированы в Linphone.\n + \nВашим друзьям будет проще связаться с вами, если вы свяжете свою учетную запись со своим номером телефона.\n\nВ вашей адресной книге вы увидите, кто использует Linphone, а ваши друзья смогут узнать, что вы также зарегистрированы в Linphone.\n + Номер телефона можно использовать только с одной учетной записью Linphone.\n\nЕсли ваш номер уже был связан с другой учетной записью, но вы предпочитаете использовать его, просто свяжите его сейчас, и ваш номер будет автоматически перенесен в эту учетную запись. + Недопустимый адрес электронной почты + Учетная запись уже существует + Эта учетная запись не существует + Неверное имя пользователя + Недопустимый домен + Недопустимый маршрут + Недопустимое имя + Слишком короткое имя пользователя + Слишком длинное имя пользователя + Недопустимая длина имени пользователя + Слишком длинный номер телефона + Слишком короткий номер телефона + Недопустимый номер телефона + Слишком короткий пароль + Слишком длинный пароль + Не удалось запросить сервер. Повторите попытку позже + Неподдерживаемый транспорт + Недопустимый код страны + В приложении + Покупка в приложении + Пробный период истекает %s + Срок действия подписки истекает %s Введите номер или адрес @@ -86,10 +154,11 @@ Адрес SIP Имя Фамилия + Организация Нет разговоров Вы действительно хотите удалить выбранный разговор? - Вы действительно хотите удалить выбранные сообщения? + Вы действительно хотите удалить выбранное сообщение? Собеседник пишет... Маленький Средний @@ -100,13 +169,21 @@ Выбрать источник Картинка сохранена Ошибка, картинка не сохранена - Пожалуйста, подождите... + Подождите... + При передаче файла произошла ошибка + Это сообщение не зашифровано + От %s получено зашифрованное сообщение, которое вы не можете расшифровать.\nВы должны позвонить своему собеседнику для обмена ключами ZRTP. Это необходимо для расшифровки будущих сообщений, которые вы получите. + Вы не можете расшифровать это сообщение. + Вы пытаетесь отправить сообщение при помощи LIME с неверифицированными ключом ZRTP.\nПожалуйста, позвоните этому контакту и подтвердите его ключ ZRTP перед отправкой сообщений. Обработка изображения может занять несколько секунд в зависимости от размера файла + Прочитано + Доставлено + Переслать Зарегистрирован Не зарегистрирован - В процессе регистрации - Ошибка регистрации + Выполняется регистрация + Регистрация не удалась непрочитанных сообщений Ассистент @@ -116,42 +193,62 @@ входящий вызов исходящий вызов + Ваш собеседник хотел бы включить видео Нет активного вызова + Ваш собеседник поставил вызов на удержание Произошла ошибка во время принятия вызова + Подтвердите следующие SAS с одноранговым узлом:\nСкажите: %s + \nВаш собеседник должен сказать: %s + SAS + Подтвердить предыдущий код SAS с вашим собеседником Неизвестный Аудио Видео Кодек: - Полоса пропускания загрузки: - Полоса пропускания скачивания: - Предполагаемая ширина загрузки: - Подключение ICE: + Семейство IP: + Пропускная способность передачи: + Пропускная способность приема: + Предполагаемая пропускная способность на прием: + ICE-соединение: + Разрешение передаваемого видео: + Разрешение принимаемого видео: + fps передаваемого видео: + fps принимаемого видео: + Коэффициент потерь отправителя: + Коэффициент потерь приемника: + Буфер джиттера: + Кодер: + Декодер Вызов Отправить журнал Сброс журнала - Идёт аудиозвонок - Звонок на паузе - Идёт видеозвонок + Установлено аудиосоединение + Вызов на удержании + Установлено видеосоединение начат %i непрочитанных сообщений + Пропущенный вызов + %i пропущенных вызовов - Внимание: сервис не готов + Предупреждение: служба не готова Ошибка - Невозможно установить адрес назначения из %s + Невозможно создать адрес назначения из %s Неизвестная ошибка - Вызов сброшен - Пользователь не найден + Вызов отклонен + Абонент занят + Абонент не найден Несовместимые параметры потока + У вашего собеседника низкая пропускная способность, видео не может быть запущено Сеть недоступна Неверные учетные данные Неавторизован Ошибка сети - Скачать не удалось. Пожалуйста, проверьте сетевое подключение или повторите попытку позже. - Не удалось скачать или применить профиль удалённого конфигурирования... + Загрузка не удалась. Проверьте сетевое подключение или повторите попытку позже. + Не удалось загрузить или применить профиль удаленного конфигурирования... Удаленное конфигурирование - Вы действительно хотите изменить URI конфигурирования? + Вы хотите изменить URI конфигурирования? SIP-аккаунт Управление @@ -161,15 +258,16 @@ Пароль* Имя пользователя* Исходящий прокси - Имя сервера SIP прокси или ip адрес (необязательно) - Отправлять все вызовы через SIP прокси + Имя прокси-сервера SIP или ip адрес (необязательно) + Маршрутизация всех вызовов через SIP-прокси Например: john если ваш адрес john@sip.example.org sip.example.org если ваш адрес john@sip.example.org - Вы должны повторно ввести ваш пароль, если вы измените имя пользователя и/или домен + Необходимо повторно ввести пароль, если вы измените имя пользователя и/или домен Истекает AVPF AVPF регулярный интервал RTCP в секундах (от 1 до 5) Заменить + на 00 + Связать свою учетную запись Имя для аутентификации Введите имя для аутентификации (необязательно) Отображаемое имя @@ -180,11 +278,14 @@ TCP TLS Удалить аккаунт + Изменить пароль Использовать по умолчанию + Пароль изменен - SIP-аккаунты - Аккаунт по умолчанию - Добавить аккаунт + Учетные записи SIP + Учетная запись по умолчанию + Добавить учетную запись + In-app Store Туннель Сервер Порт @@ -197,42 +298,62 @@ авто Нет - Настройки + Предпочтения Включить видео Аудио Эхоподавление Устраняет эхо, слышимое другой стороной Калибровка эхоподавления + Тест эхо Калибровка… Откалибровано в %s мс Нет эха не удалось - Адаптивное управление скорость - Ограничение битрейта кодека + Адаптивный контроль скорости + Предельная скорость кодека Кодеки Видео + Наложение видео + Отображать видеовызов наложением на стороннем приложении Использовать фронтальную камеру - Начинать видеозвонки - Всегда посылать видео запросы - Принимать входящие видеозвонки - Всегда принимать видео запросы - Предустановка видео - Предпочтительный размер видео - Предпочтительный FPS - Ограничение пропускной способности в Кбит/с + Инициирование видеозвонков + Всегда отправлять запросы на видео + Принимать входящие запросы на видео + Всегда принимать запросы на видео + Параметры видео + Предпочитаемый размер видео + Предпочитаемый FPS + Ограничение пропускной способности в кбит/с Кодеки Вызов + Использовать мелодию звонка устройства + Автоматический ответ на входящие звонки + Время автоматического ответа (в миллисекундах) + Отправить в потоке DTMFs(RFC2833) + Отправить вне потока DTMFs(SIP INFO) + Таймаут вызова(в секундах) URI голосовой почты Чат Сервер обмена + Не изменяйте, если вы не знаете, что делаете! + Использовать шифрование LIME + Отключено + Обязательно + Предпочтительно + LIME требует шифрования ZRTP.\nПри активации LIME вы автоматически активируете шифрование ZRTP. Сеть Использовать только WiFi + Режим Doze + Сервер STUN / TURN Включить ICE + Включить TURN + Имя пользователя STUN / TURN (необязательно) + Пароль STUN / TURN (необязательно) Включить UPNP Использовать случайный порт SIP порт занят @@ -247,17 +368,20 @@ Дополнительно Отладка Отладка + Подписка Фоновый режим Включить анимацию - Запуск при загрузке + Включить сервисное уведомление + Запуск во время загрузки Отклонение входящего вызова (в секундах) - Удалённое конфигурирование + Удаленное конфигурирование + Параметры приложения в Android Основной аккаунт Отображаемое имя Имя пользователя - Audio хаки - Использовать хаки спец. режима + Аудио хаки + Использовать хаки определенного режима 0=MODE_NORMAL (по умолчанию), 2=MODE_IN_CALL Использовать хак API маршрутизации Использовать аудио хак Galaxy S @@ -268,14 +392,17 @@ Переключить микрофон Переключить динамик Отклонить - Положить трубку + Завершить вызов Принять Редактировать Редактировать список + Действительный Добавить в контакты Новый контакт Вызов + Возврат Чат + Перезвонить Вернуться к номеронабирателю Изображение контакта Отправить сообщение @@ -285,6 +412,7 @@ Новая дискуссия Поиск Поиск контакта + Поиск страны Все контакты Контакты Linphone Направление вызова @@ -305,24 +433,29 @@ Конференция Поле имени пользователя Поле имени пользователя + Поле номера телефона Поле отображаемого имени Поле домена - Поле удалённого конфигурирования + Поле удаленного конфигурирования Поле подтверждения пароля Поле электронной почты - Аккаунт по умолчанию + Учетная запись по умолчанию Отменить выбор - Выбрать всё + Выбрать все Удалить выбранное Имя Фамилия + Организация Вернуться к вызову Отправить файл + Входящий файл Сообщение Непрочитанное сообщение чата - Перевести + Перевод Наушник Bluetooth Параметры вызова + Аудио маршрут Выйти из конференции + Уведомление Linphone diff --git a/res/values-sr/strings.xml b/res/values-sr/strings.xml index 532f369c9..82144eb6f 100644 --- a/res/values-sr/strings.xml +++ b/res/values-sr/strings.xml @@ -78,7 +78,6 @@ Кодек: Пропусни опсег отпремања: Пропусни опсег преузимања: - Процењени пропусни опсег преноса: ИЦЕ повезивост: Позови diff --git a/res/values-sv/strings.xml b/res/values-sv/strings.xml index 251106765..31e779931 100644 --- a/res/values-sv/strings.xml +++ b/res/values-sv/strings.xml @@ -6,13 +6,25 @@ Linphone Linphone Startar upp + %s registrerad + %s misslyckades med att registrera sig + Linphone Android %s + Linphone Core %s + GNU General Public License V2\n © 2010-2017 Belledonne Communications + www.linphone.org linphone-kontakter Användarnamn + Användar-ID (valfritt) Telefonnummer Visningsnamn Lösenord + Lösenordsbekräftelse + Domän + Webbadress + E-post + Är du säker på att du vill radera ta bort val? Ta bort Försök igen Avbryt @@ -20,58 +32,193 @@ Fortsätt Om Neka + Inget konto konfigurerat Sök Utgående Inkommande Missade Inställningar + Anslutning Avvisa Konferens + Länk + Vill du länka kontot%s med ditt telefonnummer ? + Kanske senare + Senare Nej + OK Ja + Länka ditt konto + libre SIP-klient + Välkommen + Assistent + Skapa konto + Länka konto Fortsätt + Aktivera ditt konto + Slutför konfiguration + Ditt konto har skapats. Kontrollera dina mejl för att validera ditt konto: + När det är klart, kom tillbaka hit och klicka på knappen. + Den här assistenten hjälper dig att konfigurera och använda ditt SIP-konto. + Ange ditt användarnamn och lösenord för Linphone-kontot + Ange ditt användarnamn och lösenord med din SIP-domän + Ange din provisioneringsadress + Transport + Din SIP-adress är + Använd Linphone-konto + Använd SIP-konto + Hämta fjärrkonfiguration + Bekräfta landskoden och ange ditt telefonnummer + Vi har skickat ett SMS med en validerings kod till ditt telefonnummer: + För att slutföra ditt telefonnummer verifiering ange den 4-siffriga koden nedan:\n + Ange ett användarnamn, e-postadress och lösenord för ditt Linphone-konto + Visningsnamn (valfritt) + Använd ditt Linphone-konto + Använd SIP-konto + Hämta fjärrkonfiguration + Hämta och tillämpa + Logga in + Ekoeliminerare kalibrering pågår + Ange din inloggning + Ditt konto har ännu inte validerats. + Bekräftelsekoden är ogiltig.\r\nFörsök igen. + Ditt konto har validerats. + Felaktigt användarnamn eller lösenord + Vill du hämta OpenH264 video kodek tillhandahållen av Cisco Systems, Inc.? + Hämtar OpenH264 video kodek tillhandahållen av Cisco Systems, Inc. + Hämtar OpenH264 + Innan du använder OpenH264 kodek måste du starta om %s. + Tyvärr har ett fel inträffat. + OpenH264 video kodek tillhandahållen av Cisco Systems, Inc. hämtad. + Ett fel inträffade, försök igen senare. + Server onåbar, verifiera din nätverksanslutning. Detta användarnamn används redan. + Det här telefonnumret är redan i bruk.\r\nAnge ett annat nummer.\r\nDu kan ta bort ditt befintliga konto om du vill återanvända ditt telefonnummer. + Ditt användarnamn är ogiltigt. + Ditt telefonnummer är ogiltigt. + Din e-postadress är ogiltig. + Ditt lösenord är ogiltigt + Lösenorden matchar inte. + Your username will be %s.\r\n\r\nDet kan skilja sig från din inmatning för att matcha kraven.\r\nVill du acceptera? Ange din inloggning och lösenord + Glömt lösenord ? + Välj ett land + Välj ditt land + (%s) + Använd ett användarnamn (valfritt) + Använd e-postadress för kontovalidering + Använd ditt användarnamn och lösenord istället för ditt telefonnummer + Vad ska mitt telefonnummer användas för? + \nTack vare ditt telefonnummer kommer dina vänner att hitta dig lättare.\n\nDu kommer att se i din adressbok vem som använder Linphone och dina vänner kommer att veta att de även kan nå dig på Linphone.\n + \nDina vänner hittar dig lättare om du kopplar ditt konto till ditt telefonnummer\n\nDu ser i din adressbok vilka som använder Linphone och dina vänner vet att de når dig på Linphone också.\n + Du kan bara använda ditt telefonnummer med ett Linphone-konto.\n\nOm du redan har länkat ditt nummer till ett annat konto, men du föredrar att använda det här, kopplar du bara det nu och ditt nummer flyttas automatiskt till det här kontot. + Ogiltig e-post + Konto finns redan + Det här kontot finns inte + Ogiltigt användarnamn + Ogiltig domän + Ogiltig rutt + Ogiltigt visningsnamn + Användarnamn för kort + Användarnamn för långt + Användarnamnslängd ogiltig + Telefonnummer för långt + Telefonnummer för kort + Ogiltigt telefonnummer + Lösenordet för kort + Lösenord för långt + Misslyckades med att fråga servern. Vänligen försök igen senare + Transport stöds inte + Landskod är ogiltig + Inom appen + Köp inom appen + Försöksperioden löper ut den %s + Teckningsperioden löper ut den %s + Ange ett nummer eller en adress + Inget samtal i din historia + Inget missat samtal i din historia + Vill du ta bort vald samtalslog? Idag Igår Inga kontakter i din adressbok. Inga SIP-kontakter i din adressbok. + Vill du ta bort valda kontakter? + Vill du ta bort vald kontakt? SIP-adress Förnamn Efternamn + Organisation + Inga konversationer + Vill du ta bort vald konversation? + Vill du ta bort valt meddelande? + Fjärr skriver... Liten Mellan Stor Riktig storlek + Text kopierades till urklipp Kopiera text Välj källa Bild sparad Fel, bild ej sparad Vänta... + Ett fel inträffade under filöverföringen + Detta meddelande är inte krypterat + Du har fått ett krypterat meddelande som du inte kan dekryptera från %s\nDu behöver ringa din korrespondent för att utbyta dina ZRTP-nycklar om du vill dekryptera de framtida meddelanden som du kommer att få. + Du behöver ringa din korrespondent för att utbyta dina ZRTP-nycklar om du vill dekryptera de framtida meddelanden som du kommer att få. + Du försöker skicka ett meddelande med hjälp av LIME till en kontakt som inte verifierats av ZRTP.\nRing den här kontakten och verifiera hans ZRTP-nyckel innan du skickar dina meddelanden. + Bearbetning av bild kan ta upp till några sekunder beroende på filens storlek + Läs + Levererades + Skicka igen Registrerad + Inte registrerad Registrering pågår Registrering misslyckades olästa meddelanden + Assistent Inställningar Om + Avsluta + inkommande samtal + utgående samtal + Din uppringare vill slå på video + Inget aktivt samtal + Din uppringare pausade samtalet + Ett fel uppstod när du accepterade samtalet + Bekräfta följande SAS med jämlike:\nSäg:%s + \Din uppringare bör säga: %s + SAS + Bekräfta tidigare SAS-kod med din korrespondent Okänd Ljud Video + Kodek: + IP-familj: Uppladdningsbandbredd: Nerladdningsbandbredd: - Beräknad nedladdning bandbredd: + Beräknad hämtningsbandbredd: ICE-anslutning: + Skickad videoupplösning: + Mottagen videoupplösning: + Skickade video fps: + Mottagna video fps: + Avsändare förlustfrekvens: + Mottagare förlustfrekvens: + Jitterbuffert: + Kodare: + Avkodare: Ring Skicka logg @@ -79,18 +226,29 @@ Ljudsamtal pågår Pausat samtal pågår + Videofångstsamtal pågående startad %i olästa meddelanden + Missat samtal + %i missat samtal Varning: tjänst inte redo Fel + Kan inte bygga destinationsadress från %s Okänt fel Samtal avvisat + Användare upptagen Användare ej funnen Okompatibla mediaparametrar + Din uppringare har låg bandbredd, video kan inte startas Nätverk otillgängligt Felaktigt inloggningsuppgifter + Obehörig Nätverksfel + Hämtning misslyckad. Kontrollera din nätverksanslutning eller försök igen senare. + Misslyckades med att ladda ner eller tillämpa fjärrleveransprofil... + Fjärrleverans + Vill du ändra leverans-URI? SIP-konto Hantera @@ -100,85 +258,162 @@ Lösenord* Användarnamn* Utgående proxy + SIP proxy värdnamn eller ip-adress (valfritt) + Dirigera alla samtal via SIP-proxy + Exempel: john om ditt konto är john@sip.exempel.org + sip.exempel.org om ditt konto är john@sip.exempel.org + Du måste skriva in ditt lösenord igen om du redigerar ditt användarnamn och/eller domänen + Upphör AVPF + AVPF-regelbundet RTCP-intervall i sekunder (mellan 1 och 5) Ersätt + med 00 + Länka ditt konto + Auth userid + Ange autentisering userid (valfritt) Visningsnamn + Ange visningsnamn (valfritt) Prefix + Transport UDP TCP TLS Ta bort detta konto + Ändra lösenord Använd som standard + Lösenordet ändrat SIP-konton Standardkonto Lägg till konto + Butik inom app Tunnel Värdnamn Port Läge + + inaktiverad + Endast 3G + alltid + automatisk + Ingen Inställningar Aktivera video Ljud + Ekoeliminering + Ta bort ekot som hörs av andra änden + Ekoeliminerarkalibrering + Testa eko Kalibrerar... + Kalibrerad om %s ms Inget eko misslyckades + Adaptiv hastighetskontroll + Kodek bithastighetsgräns + Kodek Video + Videoöverlagring + Visningsvideo i överlagring när det är utanför applikationen Använd front-kamera Initiera videosamtal Skicka alltid videoförfrågningar Acceptera inkommande videoförfrågningar Acceptera alltid videoförfrågningar + Förinställd video Föredragen videostorlek + Föredragen FPS Bandbreddsgräns i kbit/s + Kodek Ring + Använd enhetens ringsignal + Automatiskt svara på inkommande samtal + Automatisk svarstid (i millisekunder) + Skicka in-band DTMF (RFC2833) + Skicka ut-band DTMF (SIP INFO) + Röstbrevlåda URI Chatt Delar server + Redigera inte om du inte vet vad du gör! + Använd LIME-kryptering + Inaktiverad + Obligatorisk + Föredragen + LIME kräver ZRTP-kryptering.\nGenom att aktivera LIME aktiverar du automatiskt ZRTP-mediekryptering. Nätverk + Använd endast wifi + Doze-läge + STUN / TURN-server Aktivera ICE + Aktivera TURN + STUN / TURN användarnamn (valfritt) + STUN / TURN lösenord (valfritt) Aktivera UPNP Använd slumpade portar SIP-port att använda + Videoport eller portintervall + Ljudport eller portintervall + Videoport eller portintervall (minport-maxport) + Ljudport eller portintervall (minport-maxport) Media-kryptering + Aktivera push-meddelanden + Tillåt IPv6 Avancerat + Felsök + Felsök + Prenumerera på vänlista Bakgrundsläge Aktivera animeringar + Aktivera serviceanmälan Starta vid uppstart + Fjärrleverans + Android-appinställningar Primärt konto Visningsnamn Användarnamn Ljud-hacks + Använd specifikt läge hack + 0=MODE_NORMAL (standard), 2=MODE_IN_CALL + Använd rutt API hack Använd Galaxy S-ljudhack Tillbaka + Uppringare + Meny Växla micro Växla högtalare Avvisa Lägg på Acceptera Redigera + Redigera lista + Giltig Lägg till kontakter Ny kontakt Ring + Baksteg Chatt Ring tillbaka + Återgå till uppringare Kontakt-bild Skicka meddelande + Detaljer Ta bort Lägg till samtal Ny diskussion Sök + Sök kontakt + Sök land Alla kontakter Linphone-kontakter + Samtalsriktning Alla samtal Missade samtal Växla video @@ -193,9 +428,31 @@ Avbryt-knapp Meddelandestatus Konferens + Användarnamn fält + Användarnamn fält + Telefonnummerfält + Visningsnamn fält + Domänfält + Fjärrleverans fält + Bekräfta lösenordsfält + E-postfält Standardkonto + Avmarkera alla + Markera alla + Ta bort markering Förnamn Efternamn + Organisation + Tillbaka till samtal + Skicka en fil + Inkommande fil + Meddelande + Oläst chattmeddelande Överför + Hörlur Bluetooth + Samtalsalternativ + Ljudväg + Avsluta konferens + Linphone-avisering diff --git a/res/values-tr/strings.xml b/res/values-tr/strings.xml index 3b7cd30ce..2c15e0000 100644 --- a/res/values-tr/strings.xml +++ b/res/values-tr/strings.xml @@ -198,7 +198,6 @@ IP Ailesi: Karşıya yükleme hızı: İndirme hızı: - Tahmini karşıdan yükleme bant genişliği: İCE bağlanılabilirliği: Giden video çözünürlüğü: Alınan video çözünürlüğü: diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml index 1882c19bc..c6470e632 100644 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -201,7 +201,6 @@ IP Family: 上传带宽 上传带宽 - 估計下載帶寬 ICE connectivity: 发送视频分辨率 接受视频分辨率 diff --git a/res/values-zh-rTW/strings.xml b/res/values-zh-rTW/strings.xml index 66e7d7ed9..9f6ec6ce1 100644 --- a/res/values-zh-rTW/strings.xml +++ b/res/values-zh-rTW/strings.xml @@ -135,7 +135,6 @@ 編解碼器: 上傳頻寬: 下載頻寬: - 估计下载带宽: 編碼器: 解碼器: 通話 From d0a13971b8257276f0641059a18b1616fb618c11 Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Mon, 2 Oct 2017 10:26:27 +0200 Subject: [PATCH 26/72] Update submodules --- submodules/belcard | 2 +- submodules/bzrtp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/submodules/belcard b/submodules/belcard index a9d91af67..b9e1951be 160000 --- a/submodules/belcard +++ b/submodules/belcard @@ -1 +1 @@ -Subproject commit a9d91af675923cdc1bce3091e6ba828d9297de32 +Subproject commit b9e1951be4575c62e326d761a7f7c79c5cce9cb9 diff --git a/submodules/bzrtp b/submodules/bzrtp index 49a0bb2c0..37adaa053 160000 --- a/submodules/bzrtp +++ b/submodules/bzrtp @@ -1 +1 @@ -Subproject commit 49a0bb2c0237237fc1b4213918dc9032817b25f1 +Subproject commit 37adaa0536432149a51332d8eb04973a3ba6bac9 From e74e4bc8d2c4ccff3040049c7cc94ffbe16eba05 Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Mon, 2 Oct 2017 14:47:11 +0200 Subject: [PATCH 27/72] Update README --- README.md | 6 +++--- prepare.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a47a430d7..29a2a15b8 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,11 @@ Linphone is a free VoIP and video softphone based on the SIP protocol. ## To build liblinphone for Android, you must: -1. Download the Android sdk (API 25.2.3 at max) with platform-tools and tools updated to latest revision, then add both 'tools' and 'platform-tools' folders in your path and the android-sdk folder to ANDROID_HOME environment variable. +1. Download the Android sdk (API 26.0.1 at max) with platform-tools and tools updated to latest revision, then add both 'tools' and 'platform-tools' folders in your path and the android-sdk folder to ANDROID_HOME environment variable. -2. Download the Android ndk (version r11c or 13b) from google and add it to your path (no symlink !!!) and ANDROID_NDK environment variable. +2. Download the Android ndk (version r11c or 15) from google and add it to your path (no symlink !!!) and ANDROID_NDK environment variable. -3. Install _yasm_, _nasm_, _ant_, _python_, _intltoolize_, _cmake_ and _vim-common_. +3. Install _yasm_, _nasm_, _ant_, _python_, _intltoolize_, _cmake(3.7)_ and _vim-common_. * 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/prepare.py b/prepare.py index 760ea3f4d..442668615 100755 --- a/prepare.py +++ b/prepare.py @@ -95,7 +95,7 @@ class AndroidPreparator(prepare.Preparator): def __init__(self, targets=android_targets): prepare.Preparator.__init__(self, targets, default_targets=['armv7', 'arm64', 'x86']) - self.min_supported_ndk = 10 + self.min_supported_ndk = 11 self.max_supported_ndk = 15 self.unsupported_ndk_version = None self.min_cmake_version = "3.7" From 93d53d2ab5abe1d76fe0e73d3f807b21db0f2601 Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Mon, 2 Oct 2017 15:34:36 +0200 Subject: [PATCH 28/72] Fixing crash in chat view, close #110 --- src/android/org/linphone/ChatFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/android/org/linphone/ChatFragment.java b/src/android/org/linphone/ChatFragment.java index 1df536951..3c74ea0f0 100644 --- a/src/android/org/linphone/ChatFragment.java +++ b/src/android/org/linphone/ChatFragment.java @@ -701,7 +701,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } private void sendTextMessage() { - if (!LinphoneManager.isInstanciated() || LinphoneManager.getLc() == null) + if (!LinphoneManager.isInstanciated() || LinphoneManager.getLc() == null || searchContactField.getText().toString().length() < 1) return; LinphoneCore.LinphoneLimeState state = LinphoneManager.getLc().getLimeEncryption(); From f71eba53ab75ffcb2fcac860a8f8b319b2431862 Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Mon, 2 Oct 2017 15:42:07 +0200 Subject: [PATCH 29/72] Update version number --- AndroidManifest.xml | 2 +- AndroidManifestLibrary.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index f3f395885..8ccb8068b 100755 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -2,7 +2,7 @@ Date: Tue, 3 Oct 2017 10:38:28 +0200 Subject: [PATCH 30/72] Fixing crash in detail history --- src/android/org/linphone/HistoryDetailFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/android/org/linphone/HistoryDetailFragment.java b/src/android/org/linphone/HistoryDetailFragment.java index 5d66f0fbb..06b10e77b 100644 --- a/src/android/org/linphone/HistoryDetailFragment.java +++ b/src/android/org/linphone/HistoryDetailFragment.java @@ -171,7 +171,7 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener { } catch (LinphoneCoreException e) { Log.e(e); } - if(addr != null && !addr.getDisplayName().equals("Dust Android")) + if (addr != null && addr.getDisplayName() != null) LinphoneActivity.instance().displayContactsForEdition(addr.asStringUriOnly(), addr.getDisplayName()); else LinphoneActivity.instance().displayContactsForEdition(uri); From 9b13d2a5da58d18cbf0773c294fb34f3b6e2f76d Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Tue, 3 Oct 2017 13:47:46 +0200 Subject: [PATCH 31/72] Fixing freeze on contact update --- src/android/org/linphone/ChatFragment.java | 7 +++++-- src/android/org/linphone/ChatListFragment.java | 5 +++++ src/android/org/linphone/ContactsListFragment.java | 4 ++++ src/android/org/linphone/HistoryListFragment.java | 4 ++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/android/org/linphone/ChatFragment.java b/src/android/org/linphone/ChatFragment.java index 3c74ea0f0..89e145baf 100644 --- a/src/android/org/linphone/ChatFragment.java +++ b/src/android/org/linphone/ChatFragment.java @@ -102,6 +102,7 @@ import java.util.List; import java.util.Locale; import static android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION; +import static org.linphone.FragmentsAvailable.CHAT; public class ChatFragment extends Fragment implements OnClickListener, LinphoneChatMessage.LinphoneChatMessageListener, ContactsUpdatedListener{ @@ -544,7 +545,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } if (LinphoneActivity.isInstanciated()) { - LinphoneActivity.instance().selectMenu(FragmentsAvailable.CHAT); + LinphoneActivity.instance().selectMenu(CHAT); } LinphoneManager.addListener(this); @@ -973,7 +974,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC @Override public void onContactsUpdated() { - if(fileSharedUri != null || message.getText() != null){ + if(LinphoneActivity.isInstanciated() + && LinphoneActivity.instance().getCurrentFragment() == CHAT + && fileSharedUri != null || message.getText() != null){ initNewChatConversation(); } } diff --git a/src/android/org/linphone/ChatListFragment.java b/src/android/org/linphone/ChatListFragment.java index bd3162ab1..516d8482e 100644 --- a/src/android/org/linphone/ChatListFragment.java +++ b/src/android/org/linphone/ChatListFragment.java @@ -52,6 +52,8 @@ import org.linphone.mediastream.Log; import java.util.List; +import static org.linphone.FragmentsAvailable.CHAT_LIST; + /** * @author Sylvain Berfini */ @@ -231,6 +233,9 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte @Override public void onContactsUpdated() { + if (!LinphoneActivity.isInstanciated() || LinphoneActivity.instance().getCurrentFragment() != CHAT_LIST) + return; + ChatListAdapter adapter = (ChatListAdapter)chatList.getAdapter(); if (adapter != null) { adapter.notifyDataSetChanged(); diff --git a/src/android/org/linphone/ContactsListFragment.java b/src/android/org/linphone/ContactsListFragment.java index 59b400167..d7fc36d05 100644 --- a/src/android/org/linphone/ContactsListFragment.java +++ b/src/android/org/linphone/ContactsListFragment.java @@ -49,6 +49,8 @@ import java.util.List; import java.util.Locale; import java.util.Map; +import static org.linphone.FragmentsAvailable.CONTACTS_LIST; + /** * @author Sylvain Berfini */ @@ -418,6 +420,8 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O @Override public void onContactsUpdated() { + if (!LinphoneActivity.isInstanciated() || LinphoneActivity.instance().getCurrentFragment() != CONTACTS_LIST) + return; ContactsListAdapter adapter = (ContactsListAdapter)contactsList.getAdapter(); if (adapter != null) { contactsList.setFastScrollEnabled(false); diff --git a/src/android/org/linphone/HistoryListFragment.java b/src/android/org/linphone/HistoryListFragment.java index a58709000..a78e1f786 100644 --- a/src/android/org/linphone/HistoryListFragment.java +++ b/src/android/org/linphone/HistoryListFragment.java @@ -50,6 +50,8 @@ import android.widget.ListView; import android.widget.RelativeLayout; import android.widget.TextView; +import static org.linphone.FragmentsAvailable.HISTORY_LIST; + /** * @author Sylvain Berfini */ @@ -222,6 +224,8 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On @Override public void onContactsUpdated() { + if (!LinphoneActivity.isInstanciated() || LinphoneActivity.instance().getCurrentFragment() != HISTORY_LIST) + return; CallHistoryAdapter adapter = (CallHistoryAdapter)historyList.getAdapter(); if (adapter != null) { adapter.notifyDataSetChanged(); From 7140eea562d90d14d55abcd8c9968cddd6200774 Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Tue, 3 Oct 2017 13:57:27 +0200 Subject: [PATCH 32/72] Fixing last commit concerning ChatFragment --- src/android/org/linphone/ChatFragment.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/android/org/linphone/ChatFragment.java b/src/android/org/linphone/ChatFragment.java index 89e145baf..9eda4c917 100644 --- a/src/android/org/linphone/ChatFragment.java +++ b/src/android/org/linphone/ChatFragment.java @@ -702,7 +702,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } private void sendTextMessage() { - if (!LinphoneManager.isInstanciated() || LinphoneManager.getLc() == null || searchContactField.getText().toString().length() < 1) + if (!LinphoneManager.isInstanciated() || LinphoneManager.getLc() == null || + (searchContactField.getVisibility() == View.VISIBLE + && searchContactField.getText().toString().length() < 1)) return; LinphoneCore.LinphoneLimeState state = LinphoneManager.getLc().getLimeEncryption(); From f2a68887738c004e6083e3df840fc6e03c65172d Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Tue, 3 Oct 2017 16:49:51 +0200 Subject: [PATCH 33/72] Removing useless preference Doze mod --- res/xml/preferences.xml | 5 ----- src/android/org/linphone/LinphoneManager.java | 16 ++++++---------- .../org/linphone/LinphonePreferences.java | 10 ---------- src/android/org/linphone/SettingsFragment.java | 12 +----------- 4 files changed, 7 insertions(+), 36 deletions(-) diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index 43ec3930e..60dc49a79 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -270,11 +270,6 @@ android:key="@string/pref_wifi_only_key" android:persistent="false"/> - - = Build.VERSION_CODES.M) { - mDozeIntentFilter = new IntentFilter(); - mDozeIntentFilter.addAction(PowerManager.ACTION_DEVICE_IDLE_MODE_CHANGED); - mDozeReceiver = new DozeReceiver(); - dozeModeEnabled = ((PowerManager) mServiceContext.getSystemService(Context.POWER_SERVICE)).isDeviceIdleMode(); - if (dozeModeEnabled) - mServiceContext.registerReceiver(mDozeReceiver, mDozeIntentFilter); - } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + mDozeIntentFilter = new IntentFilter(); + mDozeIntentFilter.addAction(PowerManager.ACTION_DEVICE_IDLE_MODE_CHANGED); + mDozeReceiver = new DozeReceiver(); + dozeModeEnabled = ((PowerManager) mServiceContext.getSystemService(Context.POWER_SERVICE)).isDeviceIdleMode(); + mServiceContext.registerReceiver(mDozeReceiver, mDozeIntentFilter); } mHookIntentFilter = new IntentFilter("com.base.module.phone.HOOKEVENT"); @@ -1085,7 +1082,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } catch (IllegalArgumentException e) { e.printStackTrace(); } - } dozeModeEnabled = false; } diff --git a/src/android/org/linphone/LinphonePreferences.java b/src/android/org/linphone/LinphonePreferences.java index 3c6fac444..b1a8b6de0 100644 --- a/src/android/org/linphone/LinphonePreferences.java +++ b/src/android/org/linphone/LinphonePreferences.java @@ -1553,16 +1553,6 @@ public class LinphonePreferences { return getConfig().getInt("app", "activation_code_length", 0); } - public boolean isDozeModeEnabled() { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) - return false; - return getConfig().getBool("app", "doze_mode", true); - } - - public void enableDozeMode(boolean enable) { - getConfig().setBool("app", "doze_mode", enable); - } - public void disableFriendsStorage() { getConfig().setBool("misc", "store_friends", false); } diff --git a/src/android/org/linphone/SettingsFragment.java b/src/android/org/linphone/SettingsFragment.java index 0a2c224da..57ad5a43e 100644 --- a/src/android/org/linphone/SettingsFragment.java +++ b/src/android/org/linphone/SettingsFragment.java @@ -48,6 +48,7 @@ import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.media.AudioManager; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.preference.CheckBoxPreference; @@ -1081,8 +1082,6 @@ public class SettingsFragment extends PreferencesListFragment { private void initNetworkSettings() { ((CheckBoxPreference) findPreference(getString(R.string.pref_wifi_only_key))).setChecked(mPrefs.isWifiOnlyEnabled()); - ((CheckBoxPreference) findPreference(getString(R.string.pref_doze_mode_key))).setChecked(mPrefs.isDozeModeEnabled()); - // Disable UPnP if ICE si enabled, or disable ICE if UPnP is enabled CheckBoxPreference ice = (CheckBoxPreference) findPreference(getString(R.string.pref_ice_enable_key)); CheckBoxPreference turn = (CheckBoxPreference) findPreference(getString(R.string.pref_turn_enable_key)); @@ -1123,15 +1122,6 @@ public class SettingsFragment extends PreferencesListFragment { } }); - findPreference(getString(R.string.pref_doze_mode_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() { - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - mPrefs.enableDozeMode((Boolean) newValue); - LinphoneManager.getInstance().dozeManager((Boolean) newValue); - return true; - } - }); - findPreference(getString(R.string.pref_stun_server_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { From 6b5b894e8d9eb0f61fdd35fc8547b2b27d9a0957 Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Tue, 3 Oct 2017 16:50:38 +0200 Subject: [PATCH 34/72] Update changelog --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47658c629..ea336dee2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,15 @@ Group changes to describe their impact on the project, as follows: ## [Incomming] +## [3.2.8] + +### Added +- File sharing + +### Fixed +- Crashs in new chat view +- Contacts management + ## [3.2.7] - 2017-05-15 ### Fixed From 89084f729aa126ece62987286a1c5e742f63eb59 Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Tue, 3 Oct 2017 16:50:54 +0200 Subject: [PATCH 35/72] Trying to fix crash with thumbnail picture --- src/android/org/linphone/ChatFragment.java | 4 ++-- src/android/org/linphone/ChatListFragment.java | 2 +- src/android/org/linphone/ContactsListFragment.java | 2 +- src/android/org/linphone/HistoryListFragment.java | 2 +- src/android/org/linphone/LinphoneUtils.java | 3 +++ 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/android/org/linphone/ChatFragment.java b/src/android/org/linphone/ChatFragment.java index 9eda4c917..31db2fdfe 100644 --- a/src/android/org/linphone/ChatFragment.java +++ b/src/android/org/linphone/ChatFragment.java @@ -803,7 +803,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); boolean isNetworkReachable = lc == null ? false : lc.isNetworkReachable(); - if(newChatConversation && chatRoom == null) { + if (newChatConversation && chatRoom == null) { String address = searchContactField.getText().toString(); if (address != null && !address.equals("")) { initChatRoom(address); @@ -1445,7 +1445,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC displayName = contact.getFullName(); } if (contact.hasPhoto()) { - LinphoneUtils.setThumbnailPictureFromUri(getActivity(), holder.contactPicture, contact.getThumbnailUri()); + LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), holder.contactPicture, contact.getThumbnailUri()); } else { holder.contactPicture.setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap()); } diff --git a/src/android/org/linphone/ChatListFragment.java b/src/android/org/linphone/ChatListFragment.java index 516d8482e..150b47c90 100644 --- a/src/android/org/linphone/ChatListFragment.java +++ b/src/android/org/linphone/ChatListFragment.java @@ -436,7 +436,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte if (contact != null) { - LinphoneUtils.setThumbnailPictureFromUri(getActivity(), holder.contactPicture, contact.getThumbnailUri()); + LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), holder.contactPicture, contact.getThumbnailUri()); } else { holder.contactPicture.setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap()); } diff --git a/src/android/org/linphone/ContactsListFragment.java b/src/android/org/linphone/ContactsListFragment.java index d7fc36d05..a60255e9b 100644 --- a/src/android/org/linphone/ContactsListFragment.java +++ b/src/android/org/linphone/ContactsListFragment.java @@ -551,7 +551,7 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O } if (contact.hasPhoto()) { - LinphoneUtils.setThumbnailPictureFromUri(getActivity(), holder.contactPicture, contact.getThumbnailUri()); + LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), holder.contactPicture, contact.getThumbnailUri()); } else { holder.contactPicture.setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap()); } diff --git a/src/android/org/linphone/HistoryListFragment.java b/src/android/org/linphone/HistoryListFragment.java index a78e1f786..34c6b7e2b 100644 --- a/src/android/org/linphone/HistoryListFragment.java +++ b/src/android/org/linphone/HistoryListFragment.java @@ -471,7 +471,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On final String sipUri = address.asString(); if (c != null) { displayName = c.getFullName(); - LinphoneUtils.setThumbnailPictureFromUri(getActivity(), holder.contactPicture, c.getThumbnailUri()); + LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), holder.contactPicture, c.getThumbnailUri()); } else { holder.contactPicture.setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap()); } diff --git a/src/android/org/linphone/LinphoneUtils.java b/src/android/org/linphone/LinphoneUtils.java index c265a146a..4f6a5ce0b 100644 --- a/src/android/org/linphone/LinphoneUtils.java +++ b/src/android/org/linphone/LinphoneUtils.java @@ -48,6 +48,7 @@ import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; +import android.widget.Toast; import org.linphone.core.DialPlan; import org.linphone.core.LinphoneAccountCreator; @@ -278,6 +279,8 @@ public final class LinphoneUtils { try { bm = MediaStore.Images.Media.getBitmap(c.getContentResolver(),tUri); } catch (IOException e) { + LinphoneActivity.instance().displayCustomToast("Something wrong happened", Toast.LENGTH_LONG); + return; } if (bm != null) { view.setImageBitmap(bm); From fd69d6636faa86a4a92df12892e152ab1b420c67 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 3 Oct 2017 17:12:18 +0200 Subject: [PATCH 36/72] Don't set bandwidth explicitely anymore, in order to benefit from adaptive rate control --- res/raw/linphonerc_default | 4 +--- res/raw/linphonerc_factory | 3 +++ src/android/org/linphone/LinphonePreferences.java | 14 -------------- submodules/linphone | 2 +- submodules/mediastreamer2 | 2 +- submodules/oRTP | 2 +- 6 files changed, 7 insertions(+), 20 deletions(-) diff --git a/res/raw/linphonerc_default b/res/raw/linphonerc_default index c2acb3c86..8b595473c 100644 --- a/res/raw/linphonerc_default +++ b/res/raw/linphonerc_default @@ -1,6 +1,4 @@ -[net] -download_bw=380 -upload_bw=380 + [sip] contact="Linphone Android" diff --git a/res/raw/linphonerc_factory b/res/raw/linphonerc_factory index 469cd3f67..ef6c75878 100644 --- a/res/raw/linphonerc_factory +++ b/res/raw/linphonerc_factory @@ -4,6 +4,9 @@ #Paths to resources must be set from LinphoneManager, after creating LinphoneCore. [net] mtu=1300 +#Because dynamic bitrate adaption can increase bitrate, we must allow "no limit" +download_bw=0 +upload_bw=0 [sip] guess_hostname=1 diff --git a/src/android/org/linphone/LinphonePreferences.java b/src/android/org/linphone/LinphonePreferences.java index b1a8b6de0..e4cddacab 100644 --- a/src/android/org/linphone/LinphonePreferences.java +++ b/src/android/org/linphone/LinphonePreferences.java @@ -927,20 +927,6 @@ public class LinphonePreferences { public void setPreferredVideoSize(String preferredVideoSize) { getLc().setPreferredVideoSizeByName(preferredVideoSize); - String preset = getVideoPreset(); - if (!preset.equals("custom")) { - int bandwidth = 512; - if (preferredVideoSize.equals("720p")) { - bandwidth = 1024 + 128; - } else if (preferredVideoSize.equals("vga")) { - bandwidth = 660; - } else if (preferredVideoSize.equals("qvga")) { - bandwidth = 380; - } else if (preferredVideoSize.equals("qcif")) { - bandwidth = 256; - } - setBandwidthLimit(bandwidth); - } } public int getPreferredVideoFps() { diff --git a/submodules/linphone b/submodules/linphone index ddd080522..7e2a6a56f 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit ddd08052226c879df63b08ab11d4a4917cfc1da5 +Subproject commit 7e2a6a56fa6a70a6ec3875cea26f1f1e17910917 diff --git a/submodules/mediastreamer2 b/submodules/mediastreamer2 index 6b78f9562..410fca273 160000 --- a/submodules/mediastreamer2 +++ b/submodules/mediastreamer2 @@ -1 +1 @@ -Subproject commit 6b78f95624660c4e1160c3caac74732250321ce1 +Subproject commit 410fca273a8cf0de5992cd2c0d84bbb8e297a097 diff --git a/submodules/oRTP b/submodules/oRTP index ce3dedb58..5f8fcddce 160000 --- a/submodules/oRTP +++ b/submodules/oRTP @@ -1 +1 @@ -Subproject commit ce3dedb58706f154c647bc99412aca8a42416d9d +Subproject commit 5f8fcddce392f1510768949a4691f9e8c170badb From 240feadf0129a98b4ad7057d4950c77bd7043221 Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Tue, 3 Oct 2017 17:01:41 +0200 Subject: [PATCH 37/72] Prevent crash int OutgoingCallReceiver --- src/android/org/linphone/OutgoingCallReceiver.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/android/org/linphone/OutgoingCallReceiver.java b/src/android/org/linphone/OutgoingCallReceiver.java index 5b6e5a84d..8a984fb4f 100644 --- a/src/android/org/linphone/OutgoingCallReceiver.java +++ b/src/android/org/linphone/OutgoingCallReceiver.java @@ -22,7 +22,7 @@ public class OutgoingCallReceiver extends BroadcastReceiver { if (intent.getAction().equals(Intent.ACTION_NEW_OUTGOING_CALL)) { Log.e(TAG, "===>>>> Linphone OutgoingCallReceiver : ACTION_NEW_OUTGOING_CALL"); String number = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER); - if(mPrefs.getNativeDialerCall()){ + if(mPrefs.getConfig() != null && mPrefs.getNativeDialerCall()){ abortBroadcast(); setResultData(null); Intent newIntent = new Intent(ACTION_CALL_LINPHONE); From 58da65b26e95a5ff5998d4996455fc6b2b958d84 Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Tue, 3 Oct 2017 17:02:36 +0200 Subject: [PATCH 38/72] Prevent crash in setAccountPassword --- src/android/org/linphone/LinphonePreferences.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/android/org/linphone/LinphonePreferences.java b/src/android/org/linphone/LinphonePreferences.java index e4cddacab..3bb32ee27 100644 --- a/src/android/org/linphone/LinphonePreferences.java +++ b/src/android/org/linphone/LinphonePreferences.java @@ -548,7 +548,7 @@ public class LinphonePreferences { String userid = null; String realm = null; if(user != null && domain != null) { - if (LinphoneManager.getLc().getAuthInfosList()[n] != null) { + if (LinphoneManager.getLc().getAuthInfosList().length >= n && LinphoneManager.getLc().getAuthInfosList()[n] != null) { userid = getAccountUserId(n); realm = getAccountRealm(n); LinphoneManager.getLc().removeAuthInfo(LinphoneManager.getLc().getAuthInfosList()[n]); From 56bf83129ff014d89cb3ecd3776ea7b50d61d6c9 Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Tue, 3 Oct 2017 17:30:34 +0200 Subject: [PATCH 39/72] Lot of little fix --- src/android/org/linphone/ChatFragment.java | 1 + src/android/org/linphone/HistoryListFragment.java | 2 ++ src/android/org/linphone/LinphoneActivity.java | 3 ++- src/android/org/linphone/LinphonePreferences.java | 4 ++++ src/android/org/linphone/LinphoneUtils.java | 2 +- src/android/org/linphone/SettingsFragment.java | 8 +++++--- 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/android/org/linphone/ChatFragment.java b/src/android/org/linphone/ChatFragment.java index 31db2fdfe..64a6b7335 100644 --- a/src/android/org/linphone/ChatFragment.java +++ b/src/android/org/linphone/ChatFragment.java @@ -1344,6 +1344,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } public void refreshHistory() { + if (history == null || chatRoom == null) return; history.clear(); LinphoneChatMessage[] messages = chatRoom.getHistory(); history.addAll(Arrays.asList(messages)); diff --git a/src/android/org/linphone/HistoryListFragment.java b/src/android/org/linphone/HistoryListFragment.java index 34c6b7e2b..bde01bbd8 100644 --- a/src/android/org/linphone/HistoryListFragment.java +++ b/src/android/org/linphone/HistoryListFragment.java @@ -427,6 +427,8 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On view.setTag(holder); } + if (mLogs == null || mLogs.size() < position) return view; + final LinphoneCallLog log = mLogs.get(position); long timestamp = log.getTimestamp(); LinphoneAddress address; diff --git a/src/android/org/linphone/LinphoneActivity.java b/src/android/org/linphone/LinphoneActivity.java index 1d318a58e..8f653681d 100644 --- a/src/android/org/linphone/LinphoneActivity.java +++ b/src/android/org/linphone/LinphoneActivity.java @@ -1683,7 +1683,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick } public void refreshAccounts(){ - if (LinphoneManager.getLc().getProxyConfigList().length > 1) { + if (LinphoneManager.getLc().getProxyConfigList() != null && + LinphoneManager.getLc().getProxyConfigList().length > 1) { accountsList.setVisibility(View.VISIBLE); accountsList.setAdapter(new AccountsListAdapter()); accountsList.setOnItemClickListener(new AdapterView.OnItemClickListener() { diff --git a/src/android/org/linphone/LinphonePreferences.java b/src/android/org/linphone/LinphonePreferences.java index 3bb32ee27..772b5c84c 100644 --- a/src/android/org/linphone/LinphonePreferences.java +++ b/src/android/org/linphone/LinphonePreferences.java @@ -476,6 +476,10 @@ public class LinphonePreferences { LinphoneAuthInfo old_info = getAuthInfo(n); try { LinphoneProxyConfig prxCfg = getProxyConfig(n); + if (prxCfg == null) { + Log.e("Error, no proxy config at index " + n); + return; + } prxCfg.edit(); prxCfg.setIdentity(identity); prxCfg.enableRegister(true); diff --git a/src/android/org/linphone/LinphoneUtils.java b/src/android/org/linphone/LinphoneUtils.java index 4f6a5ce0b..28249e1ab 100644 --- a/src/android/org/linphone/LinphoneUtils.java +++ b/src/android/org/linphone/LinphoneUtils.java @@ -279,7 +279,7 @@ public final class LinphoneUtils { try { bm = MediaStore.Images.Media.getBitmap(c.getContentResolver(),tUri); } catch (IOException e) { - LinphoneActivity.instance().displayCustomToast("Something wrong happened", Toast.LENGTH_LONG); + Log.e("Error in setThumbnailPictureFromUri: " + e); return; } if (bm != null) { diff --git a/src/android/org/linphone/SettingsFragment.java b/src/android/org/linphone/SettingsFragment.java index 57ad5a43e..4ab28b6ef 100644 --- a/src/android/org/linphone/SettingsFragment.java +++ b/src/android/org/linphone/SettingsFragment.java @@ -1351,9 +1351,11 @@ public class SettingsFragment extends PreferencesListFragment { @Override public void onPause() { - if (LinphoneManager.getInstance().getEchoTesterStatus()) - stopEchoTester(); - LinphoneActivity.instance().hideTopBar(); + if (LinphoneActivity.isInstanciated() && LinphoneManager.isInstanciated()) { + if (LinphoneManager.getInstance().getEchoTesterStatus()) + stopEchoTester(); + LinphoneActivity.instance().hideTopBar(); + } super.onPause(); } } From 2cb99c7213b2789160c120e5b0700ce448ad669a Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Wed, 4 Oct 2017 13:53:43 +0200 Subject: [PATCH 40/72] Update build.gradle --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 43aae4280..bcd525310 100644 --- a/build.gradle +++ b/build.gradle @@ -45,7 +45,7 @@ dependencies { androidTestCompile 'junit:junit:+' compile 'org.apache.commons:commons-compress:+' if (firebaseEnable()) { - compile 'com.google.firebase:firebase-messaging:11.2.0' + compile 'com.google.firebase:firebase-messaging:11.4.0' } else { compile fileTree(include: 'gcm.jar', dir: 'libs') compile 'com.android.support:support-v4:+' @@ -87,7 +87,7 @@ excludePackage.add('**/LICENSE.txt') android { defaultConfig { compileSdkVersion 26 - buildToolsVersion "26.0.0" + buildToolsVersion "26.0.2" applicationId getPackageName() multiDexEnabled true From fa50ffcce5f96f6bf1a8076bb5fd0b2461d0483d Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Wed, 4 Oct 2017 13:53:55 +0200 Subject: [PATCH 41/72] Update cmake-builder --- submodules/cmake-builder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/cmake-builder b/submodules/cmake-builder index 404cd8694..935fc3a60 160000 --- a/submodules/cmake-builder +++ b/submodules/cmake-builder @@ -1 +1 @@ -Subproject commit 404cd869464fa591c2a11fb91242c2983f73270f +Subproject commit 935fc3a6034ed1b8f9abc4d6198aa525614c9f8c From 02026adb8691fad6feb46c5ac66eb3ae5e613791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Turnel?= Date: Wed, 4 Oct 2017 15:38:40 +0200 Subject: [PATCH 42/72] Set VGA for default resolution --- res/raw/linphonerc_default | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/raw/linphonerc_default b/res/raw/linphonerc_default index 8b595473c..e05f6d691 100644 --- a/res/raw/linphonerc_default +++ b/res/raw/linphonerc_default @@ -10,7 +10,7 @@ sip_tcp_port=-1 sip_tls_port=-1 [video] -size=qvga +size=vga [app] tunnel=disabled From 12b1618a198747e26cc522459cc82ebcd62ac901 Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Thu, 5 Oct 2017 15:17:41 +0200 Subject: [PATCH 43/72] Fix Chat list and Chat room for tablet --- src/android/org/linphone/ChatFragment.java | 35 +++++++++++++++++++ .../org/linphone/ChatListFragment.java | 13 ++++--- src/android/org/linphone/ContactsManager.java | 2 -- 3 files changed, 44 insertions(+), 6 deletions(-) diff --git a/src/android/org/linphone/ChatFragment.java b/src/android/org/linphone/ChatFragment.java index 64a6b7335..7792b9cea 100644 --- a/src/android/org/linphone/ChatFragment.java +++ b/src/android/org/linphone/ChatFragment.java @@ -104,6 +104,9 @@ import java.util.Locale; import static android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION; import static org.linphone.FragmentsAvailable.CHAT; +interface ChatUpdatedListener { + void onChatUpdated(); +} public class ChatFragment extends Fragment implements OnClickListener, LinphoneChatMessage.LinphoneChatMessageListener, ContactsUpdatedListener{ private static final int ADD_PHOTO = 1337; @@ -144,6 +147,20 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC private boolean newChatConversation = false; private String fileSharedUri, fileAlreadySharedUri; + private static ArrayList ChatUpdatedListeners; + + public static void createIfNotExist() { + if (ChatUpdatedListeners == null) + ChatUpdatedListeners = new ArrayList<>(); + } + + public static void addChatListener(ChatUpdatedListener listener) { + ChatUpdatedListeners.add(listener); + } + public static void removeChatListener(ChatUpdatedListener listener) { + ChatUpdatedListeners.remove(listener); + } + @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -256,6 +273,11 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC LinphoneActivity.instance().checkAndRequestExternalStoragePermission(); } } + if (getResources().getBoolean(R.bool.isTablet)) { + for (ChatUpdatedListener c : ChatUpdatedListeners) { + c.onChatUpdated(); + } + } } @Override @@ -389,6 +411,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC resultContactsSearch.setVisibility(View.GONE); displayChatHeader(lAddress); displayMessageList(); + remoteComposing.setVisibility(chatRoom.isRemoteComposing() ? View.VISIBLE : View.GONE); } } } @@ -875,6 +898,11 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC private void invalidate() { adapter.refreshHistory(); chatRoom.markAsRead(); + if (getResources().getBoolean(R.bool.isTablet)) { + for (ChatUpdatedListener c : ChatUpdatedListeners) { + c.onChatUpdated(); + } + } } private void resendMessage(LinphoneChatMessage message) { @@ -1588,6 +1616,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC chatRoom.markAsRead(); } + RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); if (message.isOutgoing()) { layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); @@ -1696,6 +1725,12 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } } + if (getResources().getBoolean(R.bool.isTablet)) { + for (ChatUpdatedListener c : ChatUpdatedListeners) { + c.onChatUpdated(); + } + } + return view; } diff --git a/src/android/org/linphone/ChatListFragment.java b/src/android/org/linphone/ChatListFragment.java index 150b47c90..a87392698 100644 --- a/src/android/org/linphone/ChatListFragment.java +++ b/src/android/org/linphone/ChatListFragment.java @@ -57,7 +57,7 @@ import static org.linphone.FragmentsAvailable.CHAT_LIST; /** * @author Sylvain Berfini */ -public class ChatListFragment extends Fragment implements OnClickListener, OnItemClickListener, ContactsUpdatedListener { +public class ChatListFragment extends Fragment implements OnClickListener, OnItemClickListener, ContactsUpdatedListener, ChatUpdatedListener { private LayoutInflater mInflater; private List mConversations; private ListView chatList; @@ -109,6 +109,9 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte refresh(); } }; + + ChatFragment.createIfNotExist(); + ChatFragment.addChatListener(this); return view; } @@ -183,9 +186,6 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte public void refresh() { mConversations = LinphoneActivity.instance().getChatList(); - if (getResources().getBoolean(R.bool.isTablet)) { - LinphoneActivity.instance().displayChat("", null, null); - } hideAndDisplayMessageIfNoChat(); } @@ -354,6 +354,11 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte } } + @Override + public void onChatUpdated() { + refresh(); + } + class ChatListAdapter extends BaseAdapter { private class ViewHolder { public TextView lastMessageView; diff --git a/src/android/org/linphone/ContactsManager.java b/src/android/org/linphone/ContactsManager.java index a11085162..bce9fc7fc 100644 --- a/src/android/org/linphone/ContactsManager.java +++ b/src/android/org/linphone/ContactsManager.java @@ -19,7 +19,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. package org.linphone; -import android.Manifest; import android.accounts.Account; import android.accounts.AccountManager; import android.content.ContentProviderOperation; @@ -43,7 +42,6 @@ import org.linphone.core.LinphoneFriend; import org.linphone.core.LinphoneFriendImpl; import org.linphone.core.LinphoneProxyConfig; import org.linphone.mediastream.Log; -import org.linphone.mediastream.Version; import java.util.ArrayList; import java.util.Collections; From 0d3599f7453899a38f8648cff5a920938ed56b92 Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Fri, 6 Oct 2017 10:20:59 +0200 Subject: [PATCH 44/72] Clean headers --- .../linphone/mini/LinphoneMiniActivity.java | 18 ++--- .../linphone/mini/LinphoneMiniManager.java | 68 ++++++++--------- .../org/linphone/mini/LinphoneMiniUtils.java | 12 ++- src/android/org/linphone/AboutFragment.java | 21 +++--- .../org/linphone/AccountEnableReceiver.java | 9 +-- .../linphone/AccountPreferencesFragment.java | 5 +- .../org/linphone/BandwidthManager.java | 9 ++- .../org/linphone/BluetoothManager.java | 6 +- src/android/org/linphone/BootReceiver.java | 5 +- src/android/org/linphone/CallActivity.java | 7 +- .../org/linphone/CallAudioFragment.java | 6 +- .../org/linphone/CallIncomingActivity.java | 5 +- src/android/org/linphone/CallManager.java | 30 ++++---- .../org/linphone/CallOutgoingActivity.java | 5 +- .../org/linphone/CallVideoFragment.java | 75 +++++++++---------- src/android/org/linphone/ChatFragment.java | 3 +- .../org/linphone/ChatListFragment.java | 7 +- .../org/linphone/ContactDetailsFragment.java | 7 +- .../org/linphone/ContactEditorFragment.java | 3 +- .../org/linphone/ContactsListFragment.java | 8 +- src/android/org/linphone/ContactsManager.java | 6 +- src/android/org/linphone/DialerFragment.java | 7 +- src/android/org/linphone/DozeReceiver.java | 19 +++++ src/android/org/linphone/EmptyFragment.java | 8 +- .../org/linphone/FragmentsAvailable.java | 7 +- .../org/linphone/HistoryDetailFragment.java | 7 +- .../org/linphone/HistoryListFragment.java | 7 +- src/android/org/linphone/HookReceiver.java | 19 +++++ .../org/linphone/KeepAliveReceiver.java | 5 +- .../org/linphone/LinphoneActivity.java | 5 +- src/android/org/linphone/LinphoneContact.java | 8 +- .../org/linphone/LinphoneException.java | 5 +- .../org/linphone/LinphoneGenericActivity.java | 19 +++++ .../linphone/LinphoneLauncherActivity.java | 9 +-- src/android/org/linphone/LinphoneManager.java | 21 +++++- .../org/linphone/LinphoneNumberOrAddress.java | 23 +++--- .../org/linphone/LinphonePreferences.java | 5 +- src/android/org/linphone/LinphoneService.java | 10 +-- src/android/org/linphone/LinphoneUtils.java | 7 +- src/android/org/linphone/NetworkManager.java | 9 +-- .../org/linphone/OutgoingCallReceiver.java | 18 +++++ .../linphone/PhoneStateChangedReceiver.java | 8 +- .../org/linphone/PreferencesMigrator.java | 5 +- .../org/linphone/SettingsFragment.java | 5 +- src/android/org/linphone/StatusFragment.java | 5 +- .../org/linphone/UIThreadDispatcher.java | 7 +- .../linphone/assistant/AssistantActivity.java | 5 +- .../assistant/AssistantFragmentsEnum.java | 6 +- .../assistant/CodecDownloaderFragment.java | 5 +- .../assistant/CountryListFragment.java | 19 +++++ .../CreateAccountActivationFragment.java | 6 +- .../CreateAccountCodeActivationFragment.java | 2 +- .../assistant/CreateAccountFragment.java | 5 +- .../EchoCancellerCalibrationFragment.java | 9 +-- .../assistant/LinphoneLoginFragment.java | 5 +- .../org/linphone/assistant/LoginFragment.java | 6 +- .../assistant/RemoteProvisioningActivity.java | 9 +-- .../assistant/RemoteProvisioningFragment.java | 12 +-- .../RemoteProvisioningLoginActivity.java | 17 ++--- .../linphone/assistant/WelcomeFragment.java | 5 +- .../linphone/compatibility/ApiElevenPlus.java | 4 +- .../compatibility/ApiNineteenPlus.java | 4 +- .../compatibility/ApiSixteenPlus.java | 4 +- .../compatibility/ApiTwentyOnePlus.java | 4 +- .../compatibility/ApiTwentySixPlus.java | 3 - .../compatibility/ApiTwentyThreePlus.java | 4 +- .../linphone/compatibility/Compatibility.java | 4 +- .../CompatibilityScaleGestureDetector.java | 33 ++++++-- .../CompatibilityScaleGestureListener.java | 18 +++++ .../linphone/firebase/FirebaseIdService.java | 4 +- .../linphone/firebase/FirebaseMessaging.java | 8 +- src/android/org/linphone/gcm/GCMReceiver.java | 6 +- src/android/org/linphone/gcm/GCMService.java | 5 +- .../purchase/InAppPurchaseActivity.java | 13 ++-- .../purchase/InAppPurchaseFragment.java | 4 +- .../purchase/InAppPurchaseHelper.java | 71 +++++++++--------- .../purchase/InAppPurchaseListFragment.java | 2 +- .../purchase/InAppPurchaseListener.java | 15 ++-- .../purchase/InAppPurchaseListenerBase.java | 33 ++++++-- .../org/linphone/purchase/Purchasable.java | 21 +++--- .../linphone/sync/AuthenticationService.java | 2 +- .../org/linphone/sync/Authenticator.java | 2 +- .../org/linphone/sync/SyncAdapter.java | 2 +- .../org/linphone/sync/SyncService.java | 2 +- .../tutorials/AndroidTutorialNotifier.java | 13 ++-- .../tutorials/TutorialCardDavSync.java | 19 +++++ .../tutorials/TutorialChatRoomActivity.java | 17 ++--- .../tutorials/TutorialLauncherActivity.java | 15 ++-- .../TutorialRegistrationActivity.java | 17 ++--- src/android/org/linphone/ui/AddressAware.java | 11 +-- src/android/org/linphone/ui/AddressText.java | 23 +++--- src/android/org/linphone/ui/CallButton.java | 14 ++-- src/android/org/linphone/ui/Digit.java | 27 +++---- .../org/linphone/ui/LedPreference.java | 7 +- .../org/linphone/ui/LinphoneOverlay.java | 19 +++++ .../org/linphone/ui/LinphoneScrollView.java | 5 +- .../org/linphone/ui/LinphoneSliders.java | 33 ++++---- src/android/org/linphone/ui/Numpad.java | 9 +-- .../linphone/ui/PreferencesListFragment.java | 54 ++++++------- .../org/linphone/ui/ScrollViewListener.java | 6 +- .../org/linphone/xmlrpc/XmlRpcHelper.java | 63 ++++++++++------ .../org/linphone/xmlrpc/XmlRpcListener.java | 19 +++++ .../linphone/xmlrpc/XmlRpcListenerBase.java | 49 ++++++++---- .../org/linphone/AccountAssistant.java | 22 +++++- .../org/linphone/AccountManagement.java | 23 +++++- .../org/linphone/AinitTestEnv.java | 22 +++++- src/androidTest/org/linphone/CallsAudio.java | 22 +++++- src/androidTest/org/linphone/CallsVideo.java | 22 +++++- src/androidTest/org/linphone/Chat.java | 23 +++++- .../org/linphone/ConferenceAndMultiCall.java | 26 +++++-- src/androidTest/org/linphone/Contacts.java | 22 +++++- src/androidTest/org/linphone/History.java | 22 +++++- .../org/linphone/LinphoneTestManager.java | 19 +++++ src/androidTest/org/linphone/SampleTest.java | 22 +++++- src/androidTest/org/linphone/Transfer.java | 19 +++++ 115 files changed, 967 insertions(+), 659 deletions(-) diff --git a/sample/src/org/linphone/mini/LinphoneMiniActivity.java b/sample/src/org/linphone/mini/LinphoneMiniActivity.java index 3c3e32e4b..2c69ecd91 100644 --- a/sample/src/org/linphone/mini/LinphoneMiniActivity.java +++ b/sample/src/org/linphone/mini/LinphoneMiniActivity.java @@ -1,7 +1,8 @@ package org.linphone.mini; + /* LinphoneMiniActivity.java -Copyright (C) 2014 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -21,33 +22,30 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. import android.app.Activity; import android.os.Bundle; -/** - * @author Sylvain Berfini - */ public class LinphoneMiniActivity extends Activity { private LinphoneMiniManager mManager; - + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - + mManager = new LinphoneMiniManager(this); } - + @Override protected void onResume() { super.onResume(); } - + @Override protected void onPause() { super.onPause(); } - + @Override protected void onDestroy() { mManager.destroy(); - + super.onDestroy(); } } diff --git a/sample/src/org/linphone/mini/LinphoneMiniManager.java b/sample/src/org/linphone/mini/LinphoneMiniManager.java index ed085f06e..24b480488 100644 --- a/sample/src/org/linphone/mini/LinphoneMiniManager.java +++ b/sample/src/org/linphone/mini/LinphoneMiniManager.java @@ -1,7 +1,8 @@ package org.linphone.mini; + /* LinphoneMiniManager.java -Copyright (C) 2014 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -51,25 +52,22 @@ import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration. import android.content.Context; import android.content.pm.PackageManager.NameNotFoundException; -/** - * @author Sylvain Berfini - */ public class LinphoneMiniManager implements LinphoneCoreListener { private static LinphoneMiniManager mInstance; private Context mContext; private LinphoneCore mLinphoneCore; private Timer mTimer; - + public LinphoneMiniManager(Context c) { mContext = c; LinphoneCoreFactory.instance().setDebugMode(true, "Linphone Mini"); - + try { String basePath = mContext.getFilesDir().getAbsolutePath(); copyAssetsFromPackage(basePath); mLinphoneCore = LinphoneCoreFactory.instance().createLinphoneCore(this, basePath + "/.linphonerc", basePath + "/linphonerc", null, mContext); initLinphoneCoreValues(basePath); - + setUserAgent(); setFrontCamAsDefault(); startIterate(); @@ -79,11 +77,11 @@ public class LinphoneMiniManager implements LinphoneCoreListener { } catch (IOException e) { } } - + public static LinphoneMiniManager getInstance() { return mInstance; } - + public void destroy() { try { mTimer.cancel(); @@ -96,7 +94,7 @@ public class LinphoneMiniManager implements LinphoneCoreListener { mInstance = null; } } - + private void startIterate() { TimerTask lTask = new TimerTask() { @Override @@ -104,12 +102,12 @@ public class LinphoneMiniManager implements LinphoneCoreListener { mLinphoneCore.iterate(); } }; - + /*use schedule instead of scheduleAtFixedRate to avoid iterate from being call in burst after cpu wake up*/ mTimer = new Timer("LinphoneMini scheduler"); - mTimer.schedule(lTask, 0, 20); + mTimer.schedule(lTask, 0, 20); } - + private void setUserAgent() { try { String versionName = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0).versionName; @@ -120,7 +118,7 @@ public class LinphoneMiniManager implements LinphoneCoreListener { } catch (NameNotFoundException e) { } } - + private void setFrontCamAsDefault() { int camId = 0; AndroidCamera[] cameras = AndroidCameraConfiguration.retrieveCameras(); @@ -130,7 +128,7 @@ public class LinphoneMiniManager implements LinphoneCoreListener { } mLinphoneCore.setVideoDevice(camId); } - + private void copyAssetsFromPackage(String basePath) throws IOException { LinphoneMiniUtils.copyIfNotExist(mContext, R.raw.oldphone_mono, basePath + "/oldphone_mono.wav"); LinphoneMiniUtils.copyIfNotExist(mContext, R.raw.ringback, basePath + "/ringback.wav"); @@ -140,21 +138,21 @@ public class LinphoneMiniManager implements LinphoneCoreListener { LinphoneMiniUtils.copyIfNotExist(mContext, R.raw.lpconfig, basePath + "/lpconfig.xsd"); LinphoneMiniUtils.copyIfNotExist(mContext, R.raw.rootca, basePath + "/rootca.pem"); } - + private void initLinphoneCoreValues(String basePath) { mLinphoneCore.setContext(mContext); mLinphoneCore.setRing(null); mLinphoneCore.setRootCA(basePath + "/rootca.pem"); mLinphoneCore.setPlayFile(basePath + "/toy_mono.wav"); mLinphoneCore.setChatDatabasePath(basePath + "/linphone-history.db"); - + int availableCores = Runtime.getRuntime().availableProcessors(); mLinphoneCore.setCpuCount(availableCores); } - + @Override public void authInfoRequested(LinphoneCore lc, String realm, String username) { - + } @Override @@ -171,13 +169,13 @@ public class LinphoneMiniManager implements LinphoneCoreListener { @Override public void callStatsUpdated(LinphoneCore lc, LinphoneCall call, LinphoneCallStats stats) { - + } @Override public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call, boolean encrypted, String authenticationToken) { - + } @Override @@ -189,18 +187,18 @@ public class LinphoneMiniManager implements LinphoneCoreListener { @Override public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf, String url) { - + } @Override public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) { - + } @Override public void textReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneAddress from, String message) { - + } @Override @@ -216,37 +214,37 @@ public class LinphoneMiniManager implements LinphoneCoreListener { @Override public void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf) { - + } @Override public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status, int delay_ms, Object data) { - + } @Override public void notifyReceived(LinphoneCore lc, LinphoneCall call, LinphoneAddress from, byte[] event) { - + } @Override public void transferState(LinphoneCore lc, LinphoneCall call, State new_call_state) { - + } @Override public void infoReceived(LinphoneCore lc, LinphoneCall call, LinphoneInfoMessage info) { - + } @Override public void subscriptionStateChanged(LinphoneCore lc, LinphoneEvent ev, SubscriptionState state) { - + } @Override @@ -258,7 +256,7 @@ public class LinphoneMiniManager implements LinphoneCoreListener { @Override public void publishStateChanged(LinphoneCore lc, LinphoneEvent ev, PublishState state) { - + } @Override @@ -269,22 +267,22 @@ public class LinphoneMiniManager implements LinphoneCoreListener { @Override public void show(LinphoneCore lc) { - + } @Override public void displayStatus(LinphoneCore lc, String message) { - + } @Override public void displayMessage(LinphoneCore lc, String message) { - + } @Override public void displayWarning(LinphoneCore lc, String message) { - + } } diff --git a/sample/src/org/linphone/mini/LinphoneMiniUtils.java b/sample/src/org/linphone/mini/LinphoneMiniUtils.java index 0fe163a50..41f35c256 100644 --- a/sample/src/org/linphone/mini/LinphoneMiniUtils.java +++ b/sample/src/org/linphone/mini/LinphoneMiniUtils.java @@ -1,7 +1,8 @@ package org.linphone.mini; + /* LinphoneMiniUtils.java -Copyright (C) 2014 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -25,19 +26,16 @@ import java.io.InputStream; import android.content.Context; -/** - * @author Sylvain Berfini - */ public class LinphoneMiniUtils { public static void copyIfNotExist(Context context, int ressourceId, String target) throws IOException { File lFileToCopy = new File(target); if (!lFileToCopy.exists()) { - copyFromPackage(context, ressourceId, lFileToCopy.getName()); + copyFromPackage(context, ressourceId, lFileToCopy.getName()); } } - + public static void copyFromPackage(Context context, int ressourceId, String target) throws IOException { - FileOutputStream lOutputStream = context.openFileOutput (target, 0); + FileOutputStream lOutputStream = context.openFileOutput (target, 0); InputStream lInputStream = context.getResources().openRawResource(ressourceId); int readByte; byte[] buff = new byte[8048]; diff --git a/src/android/org/linphone/AboutFragment.java b/src/android/org/linphone/AboutFragment.java index 09114cc97..20c4a369c 100644 --- a/src/android/org/linphone/AboutFragment.java +++ b/src/android/org/linphone/AboutFragment.java @@ -1,7 +1,7 @@ package org.linphone; /* AboutFragment.java -Copyright (C) 2012 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -40,9 +40,6 @@ import android.view.WindowManager; import android.widget.ImageView; import android.widget.TextView; -/** - * @author Sylvain Berfini - */ public class AboutFragment extends Fragment implements OnClickListener { View sendLogButton = null; View resetLogButton = null; @@ -74,12 +71,12 @@ public class AboutFragment extends Fragment implements OnClickListener { resetLogButton = view.findViewById(R.id.reset_log); resetLogButton.setOnClickListener(this); resetLogButton.setVisibility(LinphonePreferences.instance().isDebugEnabled() ? View.VISIBLE : View.GONE); - + mListener = new LinphoneCoreListenerBase() { @Override public void uploadProgressIndication(LinphoneCore lc, int offset, int total) { } - + @Override public void uploadStateChanged(LinphoneCore lc, LogCollectionUploadState state, String info) { if (state == LogCollectionUploadState.LogCollectionUploadStateInProgress) { @@ -96,13 +93,13 @@ public class AboutFragment extends Fragment implements OnClickListener { return view; } - + private void displayUploadLogsInProgress() { if (uploadInProgress) { return; } uploadInProgress = true; - + progress = ProgressDialog.show(LinphoneActivity.instance(), null, null); Drawable d = new ColorDrawable(ContextCompat.getColor(getActivity(), R.color.colorE)); d.setAlpha(200); @@ -134,7 +131,7 @@ public class AboutFragment extends Fragment implements OnClickListener { if (lc != null) { lc.removeListener(mListener); } - + super.onPause(); } @@ -144,11 +141,11 @@ public class AboutFragment extends Fragment implements OnClickListener { if (lc != null) { lc.addListener(mListener); } - + if (LinphoneActivity.isInstanciated()) { LinphoneActivity.instance().selectMenu(FragmentsAvailable.ABOUT); } - + super.onResume(); } @@ -169,7 +166,7 @@ public class AboutFragment extends Fragment implements OnClickListener { } } } - + @Override public void onDestroy() { super.onDestroy(); diff --git a/src/android/org/linphone/AccountEnableReceiver.java b/src/android/org/linphone/AccountEnableReceiver.java index 708b07d5d..de9af4c07 100644 --- a/src/android/org/linphone/AccountEnableReceiver.java +++ b/src/android/org/linphone/AccountEnableReceiver.java @@ -1,7 +1,8 @@ package org.linphone; + /* -RemoteProvisioningActivity.java -Copyright (C) 2014 Belledonne Communications, Grenoble, France +AccountEnableReceiver.java +Copyright (C) 2017 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 @@ -18,15 +19,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; -/** - * @author Graham Barnett - */ public class AccountEnableReceiver extends BroadcastReceiver { private static final String TAG = "AccountEnableReceiver"; private static final String FIELD_ID = "id"; diff --git a/src/android/org/linphone/AccountPreferencesFragment.java b/src/android/org/linphone/AccountPreferencesFragment.java index 6cc70d078..846748cee 100644 --- a/src/android/org/linphone/AccountPreferencesFragment.java +++ b/src/android/org/linphone/AccountPreferencesFragment.java @@ -1,7 +1,7 @@ package org.linphone; /* AccountPreferencesFragment.java -Copyright (C) 2012 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -53,9 +53,6 @@ import android.view.WindowManager; import android.widget.CheckBox; import android.widget.EditText; -/** - * @author Sylvain Berfini - */ public class AccountPreferencesFragment extends PreferencesListFragment implements LinphoneAccountCreator.LinphoneAccountCreatorListener { private int n; private boolean isNewAccount=false; diff --git a/src/android/org/linphone/BandwidthManager.java b/src/android/org/linphone/BandwidthManager.java index 706052617..3a4daf6bd 100644 --- a/src/android/org/linphone/BandwidthManager.java +++ b/src/android/org/linphone/BandwidthManager.java @@ -1,6 +1,8 @@ +package org.linphone; + /* BandwithManager.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -16,7 +18,6 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.linphone; import org.linphone.core.LinphoneCallParams; import org.linphone.core.LinphoneCore; @@ -28,7 +29,7 @@ public class BandwidthManager { public static final int LOW_BANDWIDTH = 2; private static BandwidthManager instance; - + private int currentProfile = HIGH_RESOLUTION; public int getCurrentProfile() {return currentProfile;} @@ -41,7 +42,7 @@ public class BandwidthManager { private BandwidthManager() { // FIXME register a listener on NetworkManager to get notified of network state // FIXME register a listener on Preference to get notified of change in video enable value - + // FIXME initially get those values } diff --git a/src/android/org/linphone/BluetoothManager.java b/src/android/org/linphone/BluetoothManager.java index b41a3aea9..414c9813c 100644 --- a/src/android/org/linphone/BluetoothManager.java +++ b/src/android/org/linphone/BluetoothManager.java @@ -1,7 +1,7 @@ package org.linphone; /* BluetoothManager.java -Copyright (C) 2012 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -17,6 +17,7 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + import java.util.List; import org.linphone.mediastream.Log; @@ -34,9 +35,6 @@ import android.content.IntentFilter; import android.media.AudioManager; import android.os.Build; -/** - * @author Sylvain Berfini - */ @TargetApi(Build.VERSION_CODES.HONEYCOMB) public class BluetoothManager extends BroadcastReceiver { public int PLANTRONICS_BUTTON_PRESS = 1; diff --git a/src/android/org/linphone/BootReceiver.java b/src/android/org/linphone/BootReceiver.java index 51f1b8282..3ec7f2148 100644 --- a/src/android/org/linphone/BootReceiver.java +++ b/src/android/org/linphone/BootReceiver.java @@ -1,6 +1,8 @@ +package org.linphone; + /* BootReceiver.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -16,7 +18,6 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.linphone; import org.linphone.core.LinphoneCoreFactory; import org.linphone.core.LpConfig; diff --git a/src/android/org/linphone/CallActivity.java b/src/android/org/linphone/CallActivity.java index 72c4a5721..1bbdf2c17 100644 --- a/src/android/org/linphone/CallActivity.java +++ b/src/android/org/linphone/CallActivity.java @@ -1,7 +1,8 @@ package org.linphone; + /* CallActivity.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -17,6 +18,7 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + import android.Manifest; import android.app.Activity; import android.app.Dialog; @@ -84,9 +86,6 @@ import java.util.List; import java.util.Timer; import java.util.TimerTask; -/** - * @author Sylvain Berfini - */ public class CallActivity extends LinphoneGenericActivity implements OnClickListener, ActivityCompat.OnRequestPermissionsResultCallback { private final static int SECONDS_BEFORE_HIDING_CONTROLS = 4000; private final static int SECONDS_BEFORE_DENYING_CALL_UPDATE = 30000; diff --git a/src/android/org/linphone/CallAudioFragment.java b/src/android/org/linphone/CallAudioFragment.java index edadd57ea..1c9fefe13 100644 --- a/src/android/org/linphone/CallAudioFragment.java +++ b/src/android/org/linphone/CallAudioFragment.java @@ -1,7 +1,8 @@ package org.linphone; + /* CallAudioFragment.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -25,9 +26,6 @@ import android.view.View; import android.view.View.OnTouchListener; import android.view.ViewGroup; -/** - * @author Sylvain Berfini - */ public class CallAudioFragment extends Fragment { private CallActivity incallActvityInstance; diff --git a/src/android/org/linphone/CallIncomingActivity.java b/src/android/org/linphone/CallIncomingActivity.java index aa519650c..6fce96d4e 100644 --- a/src/android/org/linphone/CallIncomingActivity.java +++ b/src/android/org/linphone/CallIncomingActivity.java @@ -1,6 +1,8 @@ +package org.linphone; + /* CallIncomingActivity.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -16,7 +18,6 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.linphone; import android.Manifest; import android.content.pm.ActivityInfo; diff --git a/src/android/org/linphone/CallManager.java b/src/android/org/linphone/CallManager.java index f095cb9d3..1aaad0392 100644 --- a/src/android/org/linphone/CallManager.java +++ b/src/android/org/linphone/CallManager.java @@ -1,6 +1,8 @@ +package org.linphone; + /* CallManager.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -16,7 +18,6 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.linphone; import org.linphone.core.LinphoneAddress; import org.linphone.core.LinphoneCall; @@ -28,30 +29,27 @@ import org.linphone.mediastream.Log; /** * Handle call updating, reinvites. - * - * @author Guillaume Beraudo - * */ public class CallManager { private static CallManager instance; - + private CallManager() {} public static final synchronized CallManager getInstance() { if (instance == null) instance = new CallManager(); return instance; } - + private BandwidthManager bm() { return BandwidthManager.getInstance(); } - - - + + + public void inviteAddress(LinphoneAddress lAddress, boolean videoEnabled, boolean lowBandwidth) throws LinphoneCoreException { LinphoneCore lc = LinphoneManager.getLc(); - + LinphoneCallParams params = lc.createCallParams(null); bm().updateWithProfileSettings(lc, params); @@ -60,7 +58,7 @@ public class CallManager { } else { params.setVideoEnabled(false); } - + if (lowBandwidth) { params.enableLowBandwidth(true); Log.d("Low bandwidth enabled in call params"); @@ -71,7 +69,7 @@ public class CallManager { - + /** * Add video to a currently running voice only call. * No re-invite is sent if the current call is already video @@ -88,7 +86,7 @@ public class CallManager { LinphoneCallParams params = lc.createCallParams(lCall); if (params.getVideoEnabled()) return false; - + // Check if video possible regarding bandwidth limitations bm().updateWithProfileSettings(lc, params); @@ -104,7 +102,7 @@ public class CallManager { } - + /** * Re-invite with parameters updated from profile. */ @@ -136,5 +134,5 @@ public class CallManager { bm().updateWithProfileSettings(lc, params); lc.updateCall(lCall, null); } - + } diff --git a/src/android/org/linphone/CallOutgoingActivity.java b/src/android/org/linphone/CallOutgoingActivity.java index 87a2ce203..bb1e3767c 100644 --- a/src/android/org/linphone/CallOutgoingActivity.java +++ b/src/android/org/linphone/CallOutgoingActivity.java @@ -1,6 +1,8 @@ +package org.linphone; + /* CallOutgoingActivity.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -16,7 +18,6 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.linphone; import java.util.ArrayList; import java.util.List; diff --git a/src/android/org/linphone/CallVideoFragment.java b/src/android/org/linphone/CallVideoFragment.java index 6767a9b84..ebc0d20c8 100644 --- a/src/android/org/linphone/CallVideoFragment.java +++ b/src/android/org/linphone/CallVideoFragment.java @@ -1,7 +1,8 @@ package org.linphone; + /* CallVideoFragment.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -17,6 +18,7 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + import org.linphone.compatibility.Compatibility; import org.linphone.compatibility.CompatibilityScaleGestureDetector; import org.linphone.compatibility.CompatibilityScaleGestureListener; @@ -39,9 +41,6 @@ import android.view.View.OnTouchListener; import android.view.ViewGroup; import android.widget.RelativeLayout; -/** - * @author Sylvain Berfini - */ public class CallVideoFragment extends Fragment implements OnGestureListener, OnDoubleTapListener, CompatibilityScaleGestureListener { private SurfaceView mVideoView; private SurfaceView mCaptureView; @@ -52,24 +51,24 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On private CompatibilityScaleGestureDetector mScaleDetector; private CallActivity inCallActivity; private int previewX, previewY; - + @SuppressWarnings("deprecation") // Warning useless because value is ignored and automatically set by new APIs. @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { View view; if (LinphoneManager.getLc().hasCrappyOpenGL()) { view = inflater.inflate(R.layout.video_no_opengl, container, false); } else { view = inflater.inflate(R.layout.video, container, false); } - + mVideoView = (SurfaceView) view.findViewById(R.id.videoSurface); mCaptureView = (SurfaceView) view.findViewById(R.id.videoCaptureSurface); mCaptureView.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); // Warning useless because value is ignored and automatically set by new APIs. fixZOrder(mVideoView, mCaptureView); - + androidVideoWindowImpl = new AndroidVideoWindowImpl(mVideoView, mCaptureView, new AndroidVideoWindowImpl.VideoWindowListener() { public void onVideoRenderingSurfaceReady(AndroidVideoWindowImpl vw, SurfaceView surface) { mVideoView = surface; @@ -77,7 +76,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On } public void onVideoRenderingSurfaceDestroyed(AndroidVideoWindowImpl vw) { - + } public void onVideoPreviewSurfaceReady(AndroidVideoWindowImpl vw, SurfaceView surface) { @@ -86,16 +85,16 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On } public void onVideoPreviewSurfaceDestroyed(AndroidVideoWindowImpl vw) { - + } }); - + mVideoView.setOnTouchListener(new OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { if (mScaleDetector != null) { mScaleDetector.onTouchEvent(event); } - + mGestureDetector.onTouchEvent(event); if (inCallActivity != null) { inCallActivity.displayVideoCallControlsIfHidden(); @@ -103,7 +102,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On return true; } }); - + mCaptureView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { @@ -130,7 +129,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On }); return view; } - + @Override public void onStart() { super.onStart(); @@ -145,14 +144,14 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On preview.setZOrderOnTop(true); preview.setZOrderMediaOverlay(true); // Needed to be able to display control layout over } - + public void switchCamera() { try { int videoDeviceId = LinphoneManager.getLc().getVideoDevice(); videoDeviceId = (videoDeviceId + 1) % AndroidCameraConfiguration.retrieveCameras().length; LinphoneManager.getLc().setVideoDevice(videoDeviceId); CallManager.getInstance().updateCall(); - + // previous call will cause graph reconstruction -> regive preview // window if (mCaptureView != null) { @@ -162,11 +161,11 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On Log.e("Cannot swtich camera : no camera"); } } - + @Override - public void onResume() { + public void onResume() { super.onResume(); - + if (LinphonePreferences.instance().isOverlayEnabled()) { LinphoneService.instance().destroyOverlay(); } @@ -175,13 +174,13 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On LinphoneManager.getLc().setVideoWindow(androidVideoWindowImpl); } } - - mGestureDetector = new GestureDetector(inCallActivity, this); + + mGestureDetector = new GestureDetector(inCallActivity, this); mScaleDetector = Compatibility.getScaleGestureDetector(inCallActivity, this); } @Override - public void onPause() { + public void onPause() { if (androidVideoWindowImpl != null) { synchronized (androidVideoWindowImpl) { /* @@ -194,10 +193,10 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On if (LinphonePreferences.instance().isOverlayEnabled()) { LinphoneService.instance().createOverlay(); } - + super.onPause(); } - + public boolean onScale(CompatibilityScaleGestureDetector detector) { mZoomFactor *= detector.getScaleFactor(); // Don't let the object get too small or too large. @@ -230,7 +229,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On } else if(distanceY > 0 && mZoomCenterY > 0) { mZoomCenterY -= 0.01; } - + if (mZoomCenterX > 1) mZoomCenterX = 1; if (mZoomCenterX < 0) @@ -239,12 +238,12 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On mZoomCenterY = 1; if (mZoomCenterY < 0) mZoomCenterY = 0; - + LinphoneManager.getLc().getCurrentCall().zoomVideo(mZoomFactor, mZoomCenterX, mZoomCenterY); return true; } } - + return false; } @@ -256,17 +255,17 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On float portraitZoomFactor = ((float) mVideoView.getHeight()) / (float) ((3 * mVideoView.getWidth()) / 4); // Zoom to make the video fill the screen horizontally float landscapeZoomFactor = ((float) mVideoView.getWidth()) / (float) ((3 * mVideoView.getHeight()) / 4); - + mZoomFactor = Math.max(portraitZoomFactor, landscapeZoomFactor); } else { resetZoom(); } - + LinphoneManager.getLc().getCurrentCall().zoomVideo(mZoomFactor, mZoomCenterX, mZoomCenterY); return true; } - + return false; } @@ -274,17 +273,17 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On mZoomFactor = 1.f; mZoomCenterX = mZoomCenterY = 0.5f; } - + @Override public void onDestroy() { inCallActivity = null; - + mCaptureView = null; if (mVideoView != null) { mVideoView.setOnTouchListener(null); mVideoView = null; } - if (androidVideoWindowImpl != null) { + if (androidVideoWindowImpl != null) { // Prevent linphone from crashing if correspondent hang up while you are rotating androidVideoWindowImpl.release(); androidVideoWindowImpl = null; @@ -297,10 +296,10 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On mScaleDetector.destroy(); mScaleDetector = null; } - + super.onDestroy(); } - + @Override public boolean onDown(MotionEvent e) { return true; // Needed to make the GestureDetector working @@ -324,12 +323,12 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On @Override public void onLongPress(MotionEvent e) { - + } @Override public void onShowPress(MotionEvent e) { - + } @Override diff --git a/src/android/org/linphone/ChatFragment.java b/src/android/org/linphone/ChatFragment.java index 7792b9cea..90c49d7e9 100644 --- a/src/android/org/linphone/ChatFragment.java +++ b/src/android/org/linphone/ChatFragment.java @@ -1,7 +1,8 @@ package org.linphone; + /* ChatFragment.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 diff --git a/src/android/org/linphone/ChatListFragment.java b/src/android/org/linphone/ChatListFragment.java index a87392698..f388760bc 100644 --- a/src/android/org/linphone/ChatListFragment.java +++ b/src/android/org/linphone/ChatListFragment.java @@ -1,7 +1,8 @@ package org.linphone; + /* ChatListFragment.java -Copyright (C) 2012 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -17,6 +18,7 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + import android.app.Dialog; import android.app.Fragment; import android.graphics.Typeface; @@ -54,9 +56,6 @@ import java.util.List; import static org.linphone.FragmentsAvailable.CHAT_LIST; -/** - * @author Sylvain Berfini - */ public class ChatListFragment extends Fragment implements OnClickListener, OnItemClickListener, ContactsUpdatedListener, ChatUpdatedListener { private LayoutInflater mInflater; private List mConversations; diff --git a/src/android/org/linphone/ContactDetailsFragment.java b/src/android/org/linphone/ContactDetailsFragment.java index 5061680d4..1018218d2 100644 --- a/src/android/org/linphone/ContactDetailsFragment.java +++ b/src/android/org/linphone/ContactDetailsFragment.java @@ -1,7 +1,8 @@ package org.linphone; + /* ContactDetailsFragment.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -17,6 +18,7 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + import org.linphone.core.LinphoneProxyConfig; import android.annotation.SuppressLint; @@ -32,9 +34,6 @@ import android.widget.ImageView; import android.widget.TableLayout; import android.widget.TextView; -/** - * @author Sylvain Berfini - */ public class ContactDetailsFragment extends Fragment implements OnClickListener { private LinphoneContact contact; private ImageView editContact, deleteContact, back; diff --git a/src/android/org/linphone/ContactEditorFragment.java b/src/android/org/linphone/ContactEditorFragment.java index b44332209..8d3edadbb 100644 --- a/src/android/org/linphone/ContactEditorFragment.java +++ b/src/android/org/linphone/ContactEditorFragment.java @@ -1,7 +1,8 @@ package org.linphone; + /* ContactEditorFragment.java - Copyright (C) 2012 Belledonne Communications, Grenoble, France + Copyright (C) 2017 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 diff --git a/src/android/org/linphone/ContactsListFragment.java b/src/android/org/linphone/ContactsListFragment.java index a60255e9b..146bd6d67 100644 --- a/src/android/org/linphone/ContactsListFragment.java +++ b/src/android/org/linphone/ContactsListFragment.java @@ -1,6 +1,8 @@ +package org.linphone; + /* ContactsListFragment.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -17,7 +19,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.linphone; import android.app.Dialog; import android.app.Fragment; @@ -51,9 +52,6 @@ import java.util.Map; import static org.linphone.FragmentsAvailable.CONTACTS_LIST; -/** - * @author Sylvain Berfini - */ public class ContactsListFragment extends Fragment implements OnClickListener, OnItemClickListener, ContactsUpdatedListener { private LayoutInflater mInflater; private ListView contactsList; diff --git a/src/android/org/linphone/ContactsManager.java b/src/android/org/linphone/ContactsManager.java index bce9fc7fc..cefe9547c 100644 --- a/src/android/org/linphone/ContactsManager.java +++ b/src/android/org/linphone/ContactsManager.java @@ -1,6 +1,8 @@ +package org.linphone; + /* ContactsManager.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -17,8 +19,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.linphone; - import android.accounts.Account; import android.accounts.AccountManager; import android.content.ContentProviderOperation; diff --git a/src/android/org/linphone/DialerFragment.java b/src/android/org/linphone/DialerFragment.java index e5f6dca71..c7cd468ea 100644 --- a/src/android/org/linphone/DialerFragment.java +++ b/src/android/org/linphone/DialerFragment.java @@ -1,7 +1,8 @@ package org.linphone; + /* DialerFragment.java -Copyright (C) 2012 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -17,6 +18,7 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + import android.app.Fragment; import android.content.Intent; import android.content.res.Configuration; @@ -36,9 +38,6 @@ import org.linphone.ui.AddressText; import org.linphone.ui.CallButton; import org.linphone.ui.EraseButton; -/** - * @author Sylvain Berfini - */ public class DialerFragment extends Fragment { private static DialerFragment instance; private static boolean isCallTransferOngoing = false; diff --git a/src/android/org/linphone/DozeReceiver.java b/src/android/org/linphone/DozeReceiver.java index 717e7a002..67e7b2770 100644 --- a/src/android/org/linphone/DozeReceiver.java +++ b/src/android/org/linphone/DozeReceiver.java @@ -1,5 +1,24 @@ package org.linphone; +/* +DozeReceiver.java +Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + import org.linphone.core.LinphoneCore; import org.linphone.core.LinphoneCoreFactory; import org.linphone.mediastream.Log; diff --git a/src/android/org/linphone/EmptyFragment.java b/src/android/org/linphone/EmptyFragment.java index 66ca6baa0..91cd899b4 100644 --- a/src/android/org/linphone/EmptyFragment.java +++ b/src/android/org/linphone/EmptyFragment.java @@ -1,7 +1,8 @@ package org.linphone; + /* -AboutFragment.java -Copyright (C) 2012 Belledonne Communications, Grenoble, France +EmptyFragment.java +Copyright (C) 2017 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 @@ -24,9 +25,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -/** - * @author Sylvain Berfini - */ public class EmptyFragment extends Fragment { @Override diff --git a/src/android/org/linphone/FragmentsAvailable.java b/src/android/org/linphone/FragmentsAvailable.java index cebeabcb8..4ce332838 100644 --- a/src/android/org/linphone/FragmentsAvailable.java +++ b/src/android/org/linphone/FragmentsAvailable.java @@ -1,7 +1,8 @@ package org.linphone; + /* FragmentsAvailable.java -Copyright (C) 2012 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -17,9 +18,7 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/** - * @author Sylvain Berfini - */ + public enum FragmentsAvailable { UNKNOW, DIALER, diff --git a/src/android/org/linphone/HistoryDetailFragment.java b/src/android/org/linphone/HistoryDetailFragment.java index 06b10e77b..9bee76883 100644 --- a/src/android/org/linphone/HistoryDetailFragment.java +++ b/src/android/org/linphone/HistoryDetailFragment.java @@ -1,7 +1,8 @@ package org.linphone; + /* HistoryDetailFragment.java -Copyright (C) 2012 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -17,6 +18,7 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + import android.app.Fragment; import android.net.Uri; import android.os.Bundle; @@ -32,9 +34,6 @@ import org.linphone.core.LinphoneCoreException; import org.linphone.core.LinphoneCoreFactory; import org.linphone.mediastream.Log; -/** - * @author Sylvain Berfini - */ public class HistoryDetailFragment extends Fragment implements OnClickListener { private ImageView dialBack, chat, addToContacts, goToContact, back; private View view; diff --git a/src/android/org/linphone/HistoryListFragment.java b/src/android/org/linphone/HistoryListFragment.java index bde01bbd8..01e4ead15 100644 --- a/src/android/org/linphone/HistoryListFragment.java +++ b/src/android/org/linphone/HistoryListFragment.java @@ -1,7 +1,8 @@ package org.linphone; + /* HistoryListFragment.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -17,6 +18,7 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; @@ -52,9 +54,6 @@ import android.widget.TextView; import static org.linphone.FragmentsAvailable.HISTORY_LIST; -/** - * @author Sylvain Berfini - */ public class HistoryListFragment extends Fragment implements OnClickListener, OnItemClickListener, ContactsUpdatedListener { private ListView historyList; private LayoutInflater mInflater; diff --git a/src/android/org/linphone/HookReceiver.java b/src/android/org/linphone/HookReceiver.java index a5068ffbe..436026075 100644 --- a/src/android/org/linphone/HookReceiver.java +++ b/src/android/org/linphone/HookReceiver.java @@ -1,5 +1,24 @@ package org.linphone; +/* +HookReceiver.java +Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; diff --git a/src/android/org/linphone/KeepAliveReceiver.java b/src/android/org/linphone/KeepAliveReceiver.java index 7595377e6..76e1695c0 100644 --- a/src/android/org/linphone/KeepAliveReceiver.java +++ b/src/android/org/linphone/KeepAliveReceiver.java @@ -1,6 +1,8 @@ +package org.linphone; + /* KeepAliveReceiver.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -16,7 +18,6 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.linphone; import org.linphone.compatibility.Compatibility; import org.linphone.core.LinphoneCore; diff --git a/src/android/org/linphone/LinphoneActivity.java b/src/android/org/linphone/LinphoneActivity.java index 8f653681d..151f01cc3 100644 --- a/src/android/org/linphone/LinphoneActivity.java +++ b/src/android/org/linphone/LinphoneActivity.java @@ -2,7 +2,7 @@ package org.linphone; /* LinphoneActivity.java - Copyright (C) 2012 Belledonne Communications, Grenoble, France + Copyright (C) 2017 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 @@ -103,9 +103,6 @@ import java.util.List; import static org.linphone.LinphoneActivity.ChatRoomContainer.createChatroomContainer; -/** - * @author Sylvain Berfini - */ public class LinphoneActivity extends LinphoneGenericActivity implements OnClickListener, ContactPicked, ActivityCompat.OnRequestPermissionsResultCallback { public static final String PREF_FIRST_LAUNCH = "pref_first_launch"; private static final int SETTINGS_ACTIVITY = 123; diff --git a/src/android/org/linphone/LinphoneContact.java b/src/android/org/linphone/LinphoneContact.java index 3065c35a4..9f0635924 100644 --- a/src/android/org/linphone/LinphoneContact.java +++ b/src/android/org/linphone/LinphoneContact.java @@ -1,6 +1,8 @@ +package org.linphone; + /* LinphoneContact.java -Copyright (C) 2016 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -16,7 +18,6 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.linphone; import java.io.Serializable; import java.util.ArrayList; @@ -44,9 +45,6 @@ import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds; public class LinphoneContact implements Serializable, Comparable { - /** - * - */ private static final long serialVersionUID = 9015568163905205244L; private transient LinphoneFriend friend; diff --git a/src/android/org/linphone/LinphoneException.java b/src/android/org/linphone/LinphoneException.java index 3a56084f3..4e4e65ad2 100644 --- a/src/android/org/linphone/LinphoneException.java +++ b/src/android/org/linphone/LinphoneException.java @@ -1,6 +1,8 @@ +package org.linphone; + /* LinphoneCoreException.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -16,7 +18,6 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.linphone; @SuppressWarnings("serial") public class LinphoneException extends Exception { diff --git a/src/android/org/linphone/LinphoneGenericActivity.java b/src/android/org/linphone/LinphoneGenericActivity.java index 3ae268c1a..916569f7e 100644 --- a/src/android/org/linphone/LinphoneGenericActivity.java +++ b/src/android/org/linphone/LinphoneGenericActivity.java @@ -1,5 +1,24 @@ package org.linphone; +/* +LinphoneGenericActivity.java +Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + import android.app.Activity; import android.os.Bundle; diff --git a/src/android/org/linphone/LinphoneLauncherActivity.java b/src/android/org/linphone/LinphoneLauncherActivity.java index 24ca01738..142d7e7f7 100644 --- a/src/android/org/linphone/LinphoneLauncherActivity.java +++ b/src/android/org/linphone/LinphoneLauncherActivity.java @@ -1,6 +1,8 @@ +package org.linphone; + /* LinphoneLauncherActivity.java -Copyright (C) 2011 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -16,7 +18,6 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.linphone; import android.app.Activity; import android.content.Intent; @@ -33,11 +34,7 @@ import org.linphone.tutorials.TutorialLauncherActivity; import static android.content.Intent.ACTION_MAIN; /** - * * Launch Linphone main activity when Service is ready. - * - * @author Guillaume Beraudo - * */ public class LinphoneLauncherActivity extends Activity { diff --git a/src/android/org/linphone/LinphoneManager.java b/src/android/org/linphone/LinphoneManager.java index ccfecb2aa..7aca759d8 100644 --- a/src/android/org/linphone/LinphoneManager.java +++ b/src/android/org/linphone/LinphoneManager.java @@ -18,6 +18,25 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.linphone; +/* +LinphoneManager.java +Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + import android.annotation.SuppressLint; import android.annotation.TargetApi; import android.app.AlertDialog; @@ -128,8 +147,6 @@ import static android.media.AudioManager.STREAM_VOICE_CALL; * * Add Service Listener to react to Linphone state changes. * - * @author Guillaume Beraudo - * */ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessage.LinphoneChatMessageListener, SensorEventListener, LinphoneAccountCreator.LinphoneAccountCreatorListener { diff --git a/src/android/org/linphone/LinphoneNumberOrAddress.java b/src/android/org/linphone/LinphoneNumberOrAddress.java index c31ea91eb..9572161aa 100644 --- a/src/android/org/linphone/LinphoneNumberOrAddress.java +++ b/src/android/org/linphone/LinphoneNumberOrAddress.java @@ -1,6 +1,8 @@ +package org.linphone; + /* LinphoneNumberOrAddress.java -Copyright (C) 2016 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -17,30 +19,25 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.linphone; - import java.io.Serializable; public class LinphoneNumberOrAddress implements Serializable, Comparable { - /** - * - */ private static final long serialVersionUID = -2301689469730072896L; - + private boolean isSIPAddress; private String value, oldValueForUpdatePurpose; - + public LinphoneNumberOrAddress(String v, boolean isSIP) { value = v; isSIPAddress = isSIP; oldValueForUpdatePurpose = null; } - + public LinphoneNumberOrAddress(String v, boolean isSip, String old) { this(v, isSip); oldValueForUpdatePurpose = old; } - + @Override public int compareTo(LinphoneNumberOrAddress noa) { if (noa.isSIPAddress() == isSIPAddress()) { @@ -53,7 +50,7 @@ public class LinphoneNumberOrAddress implements Serializable, Comparable * * Roles include:
    @@ -71,10 +71,6 @@ import android.view.WindowManager; *
  • Starting C libLinphone through LinphoneManager
  • *
  • Reacting to LinphoneManager state changes
  • *
  • Delegating GUI state change actions to GUI listener
  • - * - * - * @author Guillaume Beraudo - * */ public final class LinphoneService extends Service { /* Listener needs to be implemented in the Service as it calls diff --git a/src/android/org/linphone/LinphoneUtils.java b/src/android/org/linphone/LinphoneUtils.java index 28249e1ab..aa7b39f07 100644 --- a/src/android/org/linphone/LinphoneUtils.java +++ b/src/android/org/linphone/LinphoneUtils.java @@ -1,6 +1,8 @@ +package org.linphone; + /* SoftVolume.java -Copyright (C) 2011 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -16,7 +18,6 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.linphone; import android.app.Activity; import android.app.AlertDialog; @@ -93,8 +94,6 @@ import static android.view.View.VISIBLE; /** * Helpers. - * @author Guillaume Beraudo - * */ public final class LinphoneUtils { private static Context context = null; diff --git a/src/android/org/linphone/NetworkManager.java b/src/android/org/linphone/NetworkManager.java index 4348cd0da..bb0895a24 100644 --- a/src/android/org/linphone/NetworkManager.java +++ b/src/android/org/linphone/NetworkManager.java @@ -1,6 +1,8 @@ +package org.linphone; + /* ContactPickerActivity.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -16,17 +18,14 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.linphone; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.net.ConnectivityManager; - - /** - * + * * Intercept network state changes and update linphone core through LinphoneManager. * */ diff --git a/src/android/org/linphone/OutgoingCallReceiver.java b/src/android/org/linphone/OutgoingCallReceiver.java index 8a984fb4f..526b14a11 100644 --- a/src/android/org/linphone/OutgoingCallReceiver.java +++ b/src/android/org/linphone/OutgoingCallReceiver.java @@ -1,5 +1,23 @@ package org.linphone; +/* +OutgoingCallReceiver.java +Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ import android.content.BroadcastReceiver; import android.content.Context; diff --git a/src/android/org/linphone/PhoneStateChangedReceiver.java b/src/android/org/linphone/PhoneStateChangedReceiver.java index 19b811d96..e266374a8 100644 --- a/src/android/org/linphone/PhoneStateChangedReceiver.java +++ b/src/android/org/linphone/PhoneStateChangedReceiver.java @@ -1,6 +1,8 @@ +package org.linphone; + /* PhoneStateReceiver.java -Copyright (C) 2011 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -16,7 +18,6 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.linphone; import android.content.BroadcastReceiver; import android.content.Context; @@ -25,9 +26,6 @@ import android.telephony.TelephonyManager; /** * Pause current SIP calls when GSM phone rings or is active. - * - * @author Guillaume Beraudo - * */ public class PhoneStateChangedReceiver extends BroadcastReceiver { @Override diff --git a/src/android/org/linphone/PreferencesMigrator.java b/src/android/org/linphone/PreferencesMigrator.java index b42eafc40..cc42dee3a 100644 --- a/src/android/org/linphone/PreferencesMigrator.java +++ b/src/android/org/linphone/PreferencesMigrator.java @@ -2,7 +2,7 @@ package org.linphone; /* PreferencesMigrator.java -Copyright (C) 2013 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -32,9 +32,6 @@ import android.content.SharedPreferences.Editor; import android.content.res.Resources; import android.preference.PreferenceManager; -/** - * @author Sylvain Berfini - */ public class PreferencesMigrator { private LinphonePreferences mNewPrefs; private SharedPreferences mOldPrefs; diff --git a/src/android/org/linphone/SettingsFragment.java b/src/android/org/linphone/SettingsFragment.java index 4ab28b6ef..55a86fb94 100644 --- a/src/android/org/linphone/SettingsFragment.java +++ b/src/android/org/linphone/SettingsFragment.java @@ -2,7 +2,7 @@ package org.linphone; /* SettingsFragment.java -Copyright (C) 2013 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -61,9 +61,6 @@ import android.preference.PreferenceCategory; import android.preference.PreferenceScreen; import android.provider.Settings; -/** - * @author Sylvain Berfini - */ public class SettingsFragment extends PreferencesListFragment { private LinphonePreferences mPrefs; private Handler mHandler = new Handler(); diff --git a/src/android/org/linphone/StatusFragment.java b/src/android/org/linphone/StatusFragment.java index 169db023c..c5845aa86 100644 --- a/src/android/org/linphone/StatusFragment.java +++ b/src/android/org/linphone/StatusFragment.java @@ -1,7 +1,7 @@ package org.linphone; /* StatusFragment.java -Copyright (C) 2012 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -48,9 +48,6 @@ import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; -/** - * @author Sylvain Berfini - */ public class StatusFragment extends Fragment { private Handler refreshHandler = new Handler(); private TextView statusText, voicemailCount; diff --git a/src/android/org/linphone/UIThreadDispatcher.java b/src/android/org/linphone/UIThreadDispatcher.java index 90eba431c..d3e6d36a4 100644 --- a/src/android/org/linphone/UIThreadDispatcher.java +++ b/src/android/org/linphone/UIThreadDispatcher.java @@ -1,6 +1,8 @@ +package org.linphone; + /* UIThreadDispatcher.java -Copyright (C) 2014 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -16,14 +18,13 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.linphone; import android.os.Handler; import android.os.Looper; public class UIThreadDispatcher { private static Handler mHandler = new Handler(Looper.getMainLooper()); - + public static void dispatch(Runnable r) { mHandler.post(r); } diff --git a/src/android/org/linphone/assistant/AssistantActivity.java b/src/android/org/linphone/assistant/AssistantActivity.java index 0fa653f0e..d32ad79a2 100644 --- a/src/android/org/linphone/assistant/AssistantActivity.java +++ b/src/android/org/linphone/assistant/AssistantActivity.java @@ -1,7 +1,7 @@ package org.linphone.assistant; /* AssistantActivity.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -81,9 +81,6 @@ import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; -/** - * @author Sylvain Berfini - */ public class AssistantActivity extends Activity implements OnClickListener, ActivityCompat.OnRequestPermissionsResultCallback, LinphoneAccountCreator.LinphoneAccountCreatorListener { private static AssistantActivity instance; private ImageView back, cancel; diff --git a/src/android/org/linphone/assistant/AssistantFragmentsEnum.java b/src/android/org/linphone/assistant/AssistantFragmentsEnum.java index ae0d42ff5..52fcdd38a 100644 --- a/src/android/org/linphone/assistant/AssistantFragmentsEnum.java +++ b/src/android/org/linphone/assistant/AssistantFragmentsEnum.java @@ -1,7 +1,7 @@ package org.linphone.assistant; /* AssistantFragmentsEnum.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -17,9 +17,7 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/** - * @author Sylvain Berfini - */ + public enum AssistantFragmentsEnum { WELCOME, CREATE_ACCOUNT, diff --git a/src/android/org/linphone/assistant/CodecDownloaderFragment.java b/src/android/org/linphone/assistant/CodecDownloaderFragment.java index 41b8598ea..0937347f2 100644 --- a/src/android/org/linphone/assistant/CodecDownloaderFragment.java +++ b/src/android/org/linphone/assistant/CodecDownloaderFragment.java @@ -2,7 +2,7 @@ package org.linphone.assistant; /* CodecDownloaderFragment.java -Copyright (C) 2016 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -37,9 +37,6 @@ import android.widget.Button; import android.widget.ProgressBar; import android.widget.TextView; -/** - * @author Erwan CROZE - */ public class CodecDownloaderFragment extends Fragment { private Handler mHandler = new Handler(); private TextView question; diff --git a/src/android/org/linphone/assistant/CountryListFragment.java b/src/android/org/linphone/assistant/CountryListFragment.java index 294cf80c7..e4bcf4a52 100644 --- a/src/android/org/linphone/assistant/CountryListFragment.java +++ b/src/android/org/linphone/assistant/CountryListFragment.java @@ -1,5 +1,24 @@ package org.linphone.assistant; +/* +CountryListFragment.java +Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + import org.linphone.R; import org.linphone.core.DialPlan; diff --git a/src/android/org/linphone/assistant/CreateAccountActivationFragment.java b/src/android/org/linphone/assistant/CreateAccountActivationFragment.java index 21d286303..8a2a086e7 100644 --- a/src/android/org/linphone/assistant/CreateAccountActivationFragment.java +++ b/src/android/org/linphone/assistant/CreateAccountActivationFragment.java @@ -1,7 +1,7 @@ package org.linphone.assistant; /* CreateAccountActivationFragment.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -33,9 +33,7 @@ import org.linphone.R; import org.linphone.core.LinphoneAccountCreator; import org.linphone.core.LinphoneAccountCreator.LinphoneAccountCreatorListener; import org.linphone.core.LinphoneCoreFactory; -/** - * @author Sylvain Berfini - */ + public class CreateAccountActivationFragment extends Fragment implements OnClickListener, LinphoneAccountCreatorListener { private String username, password; private Button checkAccount; diff --git a/src/android/org/linphone/assistant/CreateAccountCodeActivationFragment.java b/src/android/org/linphone/assistant/CreateAccountCodeActivationFragment.java index 994132cd9..382494f69 100644 --- a/src/android/org/linphone/assistant/CreateAccountCodeActivationFragment.java +++ b/src/android/org/linphone/assistant/CreateAccountCodeActivationFragment.java @@ -1,7 +1,7 @@ package org.linphone.assistant; /* CreateAccountCodeActivationFragment.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 diff --git a/src/android/org/linphone/assistant/CreateAccountFragment.java b/src/android/org/linphone/assistant/CreateAccountFragment.java index f44022025..592a37cd8 100644 --- a/src/android/org/linphone/assistant/CreateAccountFragment.java +++ b/src/android/org/linphone/assistant/CreateAccountFragment.java @@ -1,7 +1,7 @@ package org.linphone.assistant; /* CreateAccountFragment.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -58,9 +58,6 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; -/** - * @author Sylvain Berfini - */ public class CreateAccountFragment extends Fragment implements CompoundButton.OnCheckedChangeListener , OnClickListener, LinphoneAccountCreatorListener { private EditText phoneNumberEdit, usernameEdit, passwordEdit, passwordConfirmEdit diff --git a/src/android/org/linphone/assistant/EchoCancellerCalibrationFragment.java b/src/android/org/linphone/assistant/EchoCancellerCalibrationFragment.java index 7bcbbbb7e..94d3986d2 100644 --- a/src/android/org/linphone/assistant/EchoCancellerCalibrationFragment.java +++ b/src/android/org/linphone/assistant/EchoCancellerCalibrationFragment.java @@ -2,7 +2,7 @@ package org.linphone.assistant; /* EchoCancellerCalibrationFragment.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -41,9 +41,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -/** - * @author Ghislain MARY - */ public class EchoCancellerCalibrationFragment extends Fragment implements LinphoneXmlRpcRequestListener { private Handler mHandler = new Handler(); private boolean mSendEcCalibrationResult = false; @@ -56,7 +53,7 @@ public class EchoCancellerCalibrationFragment extends Fragment implements Linpho public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.assistant_ec_calibration, container, false); - + mListener = new LinphoneCoreListenerBase(){ @Override public void ecCalibrationStatus(LinphoneCore lc, LinphoneCore.EcCalibratorStatus status, int delay_ms, Object data) { @@ -73,7 +70,7 @@ public class EchoCancellerCalibrationFragment extends Fragment implements Linpho AssistantActivity.instance().isEchoCalibrationFinished(); } }; - + xmlRpcSession = new LinphoneXmlRpcSessionImpl(LinphoneManager.getLcIfManagerNotDestroyedOrNull(), LinphonePreferences.instance().getXmlrpcUrl()); xmlRpcRequest = new LinphoneXmlRpcRequestImpl("add_ec_calibration_result", LinphoneXmlRpcRequest.ArgType.None); xmlRpcRequest.setListener(this); diff --git a/src/android/org/linphone/assistant/LinphoneLoginFragment.java b/src/android/org/linphone/assistant/LinphoneLoginFragment.java index 783e16cb3..3fe9b8ec5 100644 --- a/src/android/org/linphone/assistant/LinphoneLoginFragment.java +++ b/src/android/org/linphone/assistant/LinphoneLoginFragment.java @@ -1,7 +1,7 @@ package org.linphone.assistant; /* LinphoneLoginFragment.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -50,9 +50,6 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; -/** - * @author Sylvain Berfini - */ public class LinphoneLoginFragment extends Fragment implements CompoundButton.OnCheckedChangeListener, OnClickListener, TextWatcher, LinphoneAccountCreator.LinphoneAccountCreatorListener { private EditText login, password, phoneNumberEdit, dialCode; private Button apply, selectCountry; diff --git a/src/android/org/linphone/assistant/LoginFragment.java b/src/android/org/linphone/assistant/LoginFragment.java index f60e68b2b..4842bbc39 100644 --- a/src/android/org/linphone/assistant/LoginFragment.java +++ b/src/android/org/linphone/assistant/LoginFragment.java @@ -1,7 +1,7 @@ package org.linphone.assistant; /* LoginFragment.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -32,9 +32,7 @@ import android.widget.Button; import android.widget.EditText; import android.widget.RadioGroup; import android.widget.Toast; -/** - * @author Sylvain Berfini - */ + public class LoginFragment extends Fragment implements OnClickListener, TextWatcher { private EditText login, userid, password, domain; private RadioGroup transports; diff --git a/src/android/org/linphone/assistant/RemoteProvisioningActivity.java b/src/android/org/linphone/assistant/RemoteProvisioningActivity.java index ac7b341dc..cfc104955 100644 --- a/src/android/org/linphone/assistant/RemoteProvisioningActivity.java +++ b/src/android/org/linphone/assistant/RemoteProvisioningActivity.java @@ -1,7 +1,7 @@ package org.linphone.assistant; /* RemoteProvisioningActivity.java -Copyright (C) 2014 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -43,21 +43,18 @@ import android.view.View; import android.widget.ProgressBar; import android.widget.Toast; -/** - * @author Sylvain Berfini - */ public class RemoteProvisioningActivity extends Activity { private Handler mHandler = new Handler(); private String configUriParam = null; private ProgressBar spinner; private LinphoneCoreListenerBase mListener; - + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.remote_provisioning); spinner = (ProgressBar) findViewById(R.id.spinner); - + mListener = new LinphoneCoreListenerBase(){ @Override public void configuringStatus(LinphoneCore lc, final RemoteProvisioningState state, String message) { diff --git a/src/android/org/linphone/assistant/RemoteProvisioningFragment.java b/src/android/org/linphone/assistant/RemoteProvisioningFragment.java index c85244982..d547cbb55 100644 --- a/src/android/org/linphone/assistant/RemoteProvisioningFragment.java +++ b/src/android/org/linphone/assistant/RemoteProvisioningFragment.java @@ -1,7 +1,7 @@ package org.linphone.assistant; /* RemoteProvisioningFragment.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -37,25 +37,25 @@ import android.widget.EditText; public class RemoteProvisioningFragment extends Fragment implements OnClickListener, TextWatcher{ private EditText remoteProvisioningUrl; private Button apply; - + @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.assistant_remote_provisioning, container, false); - + remoteProvisioningUrl = (EditText) view.findViewById(R.id.assistant_remote_provisioning_url); remoteProvisioningUrl.addTextChangedListener(this); apply = (Button) view.findViewById(R.id.assistant_apply); apply.setEnabled(false); apply.setOnClickListener(this); - + return view; } - + @Override public void onClick(View v) { int id = v.getId(); - + if (id == R.id.assistant_apply) { String url = remoteProvisioningUrl.getText().toString(); AssistantActivity.instance().displayRemoteProvisioningInProgressDialog(); diff --git a/src/android/org/linphone/assistant/RemoteProvisioningLoginActivity.java b/src/android/org/linphone/assistant/RemoteProvisioningLoginActivity.java index 3e442400a..80cf0dda4 100644 --- a/src/android/org/linphone/assistant/RemoteProvisioningLoginActivity.java +++ b/src/android/org/linphone/assistant/RemoteProvisioningLoginActivity.java @@ -1,7 +1,7 @@ package org.linphone.assistant; /* RemoteProvisioningLoginActivity.java -Copyright (C) 2014 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -34,9 +34,6 @@ import android.widget.Button; import android.widget.EditText; import android.widget.Toast; -/** - * @author Sylvain Berfini - */ public class RemoteProvisioningLoginActivity extends Activity implements OnClickListener { private EditText login, password, domain; private Button connect; @@ -46,7 +43,7 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.assistant_remote_provisioning_login); - + login = (EditText) findViewById(R.id.assistant_username); password = (EditText) findViewById(R.id.assistant_password); domain = (EditText) findViewById(R.id.assistant_domain); @@ -71,7 +68,7 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick } }; } - + private void cancelWizard(boolean bypassCheck) { if (bypassCheck || getResources().getBoolean(R.bool.allow_cancel_remote_provisioning_login_activity)) { LinphonePreferences.instance().disableProvisioningLoginView(); @@ -79,7 +76,7 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick finish(); } } - + private boolean storeAccount(String username, String password, String domain) { XmlRpcHelper xmlRpcHelper = new XmlRpcHelper(); xmlRpcHelper.getRemoteProvisioningFilenameAsync(new XmlRpcListenerBase() { @@ -102,10 +99,10 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick Log.e(e); return false; } - + LinphoneAuthInfo authInfo = LinphoneCoreFactory.instance().createAuthInfo(username, null, password, null, null, domain); lc.addAuthInfo(authInfo); - + if (LinphonePreferences.instance().getAccountCount() == 1) lc.setDefaultProxyConfig(prxCfg); */ @@ -133,7 +130,7 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick @Override public void onClick(View v) { int id = v.getId(); - + if (id == R.id.cancel) { cancelWizard(false); } diff --git a/src/android/org/linphone/assistant/WelcomeFragment.java b/src/android/org/linphone/assistant/WelcomeFragment.java index 730e58c69..2dc7ca5cc 100644 --- a/src/android/org/linphone/assistant/WelcomeFragment.java +++ b/src/android/org/linphone/assistant/WelcomeFragment.java @@ -1,7 +1,7 @@ package org.linphone.assistant; /* WelcomeFragment.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -27,9 +27,6 @@ import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.Button; -/** - * @author Sylvain Berfini - */ public class WelcomeFragment extends Fragment implements OnClickListener { private Button createAccount, logLinphoneAccount, logGenericAccount, remoteProvisioning; diff --git a/src/android/org/linphone/compatibility/ApiElevenPlus.java b/src/android/org/linphone/compatibility/ApiElevenPlus.java index a5fef0d1b..cdfcaa8d2 100644 --- a/src/android/org/linphone/compatibility/ApiElevenPlus.java +++ b/src/android/org/linphone/compatibility/ApiElevenPlus.java @@ -38,9 +38,7 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/** - * @author Sylvain Berfini - */ + @TargetApi(11) public class ApiElevenPlus { diff --git a/src/android/org/linphone/compatibility/ApiNineteenPlus.java b/src/android/org/linphone/compatibility/ApiNineteenPlus.java index ad6253c73..278224221 100644 --- a/src/android/org/linphone/compatibility/ApiNineteenPlus.java +++ b/src/android/org/linphone/compatibility/ApiNineteenPlus.java @@ -21,9 +21,7 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/** - * @author Sylvain Berfini - */ + @TargetApi(19) public class ApiNineteenPlus { public static void scheduleAlarm(AlarmManager alarmManager, int type, long triggerAtMillis, PendingIntent operation) { diff --git a/src/android/org/linphone/compatibility/ApiSixteenPlus.java b/src/android/org/linphone/compatibility/ApiSixteenPlus.java index 5305ed09e..f9d0c1184 100644 --- a/src/android/org/linphone/compatibility/ApiSixteenPlus.java +++ b/src/android/org/linphone/compatibility/ApiSixteenPlus.java @@ -27,9 +27,7 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/** - * @author Sylvain Berfini - */ + @TargetApi(16) public class ApiSixteenPlus { diff --git a/src/android/org/linphone/compatibility/ApiTwentyOnePlus.java b/src/android/org/linphone/compatibility/ApiTwentyOnePlus.java index ad7696b43..8215d4e0d 100644 --- a/src/android/org/linphone/compatibility/ApiTwentyOnePlus.java +++ b/src/android/org/linphone/compatibility/ApiTwentyOnePlus.java @@ -28,9 +28,7 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/** - * @author Sylvain Berfini - */ + @TargetApi(21) public class ApiTwentyOnePlus { diff --git a/src/android/org/linphone/compatibility/ApiTwentySixPlus.java b/src/android/org/linphone/compatibility/ApiTwentySixPlus.java index 853d8bb60..53453cbdb 100644 --- a/src/android/org/linphone/compatibility/ApiTwentySixPlus.java +++ b/src/android/org/linphone/compatibility/ApiTwentySixPlus.java @@ -31,9 +31,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/** - * @author Erwan Croze - */ @TargetApi(26) public class ApiTwentySixPlus { diff --git a/src/android/org/linphone/compatibility/ApiTwentyThreePlus.java b/src/android/org/linphone/compatibility/ApiTwentyThreePlus.java index 9de44cae7..fb3db0484 100644 --- a/src/android/org/linphone/compatibility/ApiTwentyThreePlus.java +++ b/src/android/org/linphone/compatibility/ApiTwentyThreePlus.java @@ -21,9 +21,7 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/** - * @author Sylvain Berfini - */ + @TargetApi(23) public class ApiTwentyThreePlus { public static void setTextAppearance(TextView textview, int style) { diff --git a/src/android/org/linphone/compatibility/Compatibility.java b/src/android/org/linphone/compatibility/Compatibility.java index 34c5209eb..171bf5444 100644 --- a/src/android/org/linphone/compatibility/Compatibility.java +++ b/src/android/org/linphone/compatibility/Compatibility.java @@ -32,9 +32,7 @@ import android.text.Spanned; import android.view.ViewTreeObserver; import android.view.ViewTreeObserver.OnGlobalLayoutListener; import android.widget.TextView; -/** - * @author Sylvain Berfini - */ + public class Compatibility { public static void CreateChannel(Context context) { if (Version.sdkAboveOrEqual(Version.API26_O_80)) { diff --git a/src/android/org/linphone/compatibility/CompatibilityScaleGestureDetector.java b/src/android/org/linphone/compatibility/CompatibilityScaleGestureDetector.java index 68dc99b79..a8e315896 100644 --- a/src/android/org/linphone/compatibility/CompatibilityScaleGestureDetector.java +++ b/src/android/org/linphone/compatibility/CompatibilityScaleGestureDetector.java @@ -1,5 +1,24 @@ package org.linphone.compatibility; +/* +CompatibilityScaleGestureDetector.java +Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + import android.annotation.TargetApi; import android.content.Context; import android.view.MotionEvent; @@ -9,32 +28,32 @@ import android.view.ScaleGestureDetector; public class CompatibilityScaleGestureDetector extends ScaleGestureDetector.SimpleOnScaleGestureListener { private ScaleGestureDetector detector; private CompatibilityScaleGestureListener listener; - + public CompatibilityScaleGestureDetector(Context context) { detector = new ScaleGestureDetector(context, this); } - + public void setOnScaleListener(CompatibilityScaleGestureListener newListener) { listener = newListener; } - + public boolean onTouchEvent(MotionEvent event) { return detector.onTouchEvent(event); } - + @Override public boolean onScale(ScaleGestureDetector detector) { if (listener == null) { return false; } - + return listener.onScale(this); } - + public float getScaleFactor() { return detector.getScaleFactor(); } - + public void destroy() { listener = null; detector = null; diff --git a/src/android/org/linphone/compatibility/CompatibilityScaleGestureListener.java b/src/android/org/linphone/compatibility/CompatibilityScaleGestureListener.java index 67ffcfc57..48ec9b17b 100644 --- a/src/android/org/linphone/compatibility/CompatibilityScaleGestureListener.java +++ b/src/android/org/linphone/compatibility/CompatibilityScaleGestureListener.java @@ -1,5 +1,23 @@ package org.linphone.compatibility; +/* +CompatibilityScaleGestureListener.java +Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ public interface CompatibilityScaleGestureListener { public boolean onScale(CompatibilityScaleGestureDetector detector); diff --git a/src/android/org/linphone/firebase/FirebaseIdService.java b/src/android/org/linphone/firebase/FirebaseIdService.java index d75b9f399..0c1b01976 100644 --- a/src/android/org/linphone/firebase/FirebaseIdService.java +++ b/src/android/org/linphone/firebase/FirebaseIdService.java @@ -25,9 +25,7 @@ import com.google.firebase.iid.FirebaseInstanceIdService; import org.linphone.LinphonePreferences; import org.linphone.UIThreadDispatcher; -/** - * @author Erwan Croze - */ + public class FirebaseIdService extends FirebaseInstanceIdService { @Override public void onTokenRefresh() { diff --git a/src/android/org/linphone/firebase/FirebaseMessaging.java b/src/android/org/linphone/firebase/FirebaseMessaging.java index 472e1e1ad..c3141f4cc 100644 --- a/src/android/org/linphone/firebase/FirebaseMessaging.java +++ b/src/android/org/linphone/firebase/FirebaseMessaging.java @@ -1,3 +1,5 @@ +package org.linphone.firebase; + /* FirebaseMessaging.java Copyright (C) 2017 Belledonne Communications, Grenoble, France @@ -17,8 +19,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.linphone.firebase; - import android.content.Intent; import com.google.firebase.messaging.FirebaseMessagingService; @@ -29,9 +29,7 @@ import org.linphone.LinphoneService; import org.linphone.UIThreadDispatcher; import static android.content.Intent.ACTION_MAIN; -/** - * @author Erwan Croze - */ + public class FirebaseMessaging extends FirebaseMessagingService { public FirebaseMessaging() { } diff --git a/src/android/org/linphone/gcm/GCMReceiver.java b/src/android/org/linphone/gcm/GCMReceiver.java index a1dbf0271..75b38602b 100644 --- a/src/android/org/linphone/gcm/GCMReceiver.java +++ b/src/android/org/linphone/gcm/GCMReceiver.java @@ -1,7 +1,7 @@ package org.linphone.gcm; /* GCMReceiver.java -Copyright (C) 2012 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -22,9 +22,7 @@ import android.content.Context; import com.google.android.gcm.GCMBroadcastReceiver; -/** - * @author Sylvain Berfini - */ + public class GCMReceiver extends GCMBroadcastReceiver { @Override protected String getGCMIntentServiceClassName(Context context) { diff --git a/src/android/org/linphone/gcm/GCMService.java b/src/android/org/linphone/gcm/GCMService.java index c21f082fb..00b6abb09 100644 --- a/src/android/org/linphone/gcm/GCMService.java +++ b/src/android/org/linphone/gcm/GCMService.java @@ -1,7 +1,7 @@ package org.linphone.gcm; /* GCMService.java -Copyright (C) 2012 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -33,9 +33,6 @@ import android.content.Intent; import com.google.android.gcm.GCMBaseIntentService; -/** - * @author Sylvain Berfini - */ // Warning ! Do not rename the service ! public class GCMService extends GCMBaseIntentService { diff --git a/src/android/org/linphone/purchase/InAppPurchaseActivity.java b/src/android/org/linphone/purchase/InAppPurchaseActivity.java index 44e7af4ff..5061c3de8 100644 --- a/src/android/org/linphone/purchase/InAppPurchaseActivity.java +++ b/src/android/org/linphone/purchase/InAppPurchaseActivity.java @@ -1,7 +1,7 @@ package org.linphone.purchase; /* InAppPurchaseListener.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -39,9 +39,6 @@ import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.Toast; -/** - * @author Sylvain Berfini - */ public class InAppPurchaseActivity extends Activity implements InAppPurchaseListener, OnClickListener { private static InAppPurchaseActivity instance; private InAppPurchaseHelper inAppPurchaseHelper; @@ -128,12 +125,12 @@ public class InAppPurchaseActivity extends Activity implements InAppPurchaseList public static InAppPurchaseActivity instance() { return instance; } - + @Override public void onServiceAvailableForQueries() { //email.setText(inAppPurchaseHelper.getGmailAccount()); //email.setEnabled(false); - + //inAppPurchaseHelper.getPurchasedItemsAsync(); inAppPurchaseHelper.getAvailableItemsForPurchaseAsync(); } @@ -189,7 +186,7 @@ public class InAppPurchaseActivity extends Activity implements InAppPurchaseList onBackPressed(); } } - + @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { inAppPurchaseHelper.parseAndVerifyPurchaseItemResultAsync(requestCode, resultCode, data); @@ -206,7 +203,7 @@ public class InAppPurchaseActivity extends Activity implements InAppPurchaseList @Override public void run() { inProgress.setVisibility(View.GONE); - Toast.makeText(InAppPurchaseActivity.this, error, Toast.LENGTH_LONG).show(); + Toast.makeText(InAppPurchaseActivity.this, error, Toast.LENGTH_LONG).show(); } }); } diff --git a/src/android/org/linphone/purchase/InAppPurchaseFragment.java b/src/android/org/linphone/purchase/InAppPurchaseFragment.java index 685ddeecd..083095e30 100644 --- a/src/android/org/linphone/purchase/InAppPurchaseFragment.java +++ b/src/android/org/linphone/purchase/InAppPurchaseFragment.java @@ -1,7 +1,7 @@ package org.linphone.purchase; /* InAppPurchaseFragment.java -Copyright (C) 2016 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -50,7 +50,7 @@ public class InAppPurchaseFragment extends Fragment implements View.OnClickListe @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - + super.onCreate(savedInstanceState); View view = inflater.inflate(R.layout.in_app_store, container, false); diff --git a/src/android/org/linphone/purchase/InAppPurchaseHelper.java b/src/android/org/linphone/purchase/InAppPurchaseHelper.java index 62a584b06..1d7285ca7 100644 --- a/src/android/org/linphone/purchase/InAppPurchaseHelper.java +++ b/src/android/org/linphone/purchase/InAppPurchaseHelper.java @@ -1,7 +1,7 @@ package org.linphone.purchase; /* InAppPurchaseHelper.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -45,23 +45,20 @@ import android.util.Patterns; import com.android.vending.billing.IInAppBillingService; -/** - * @author Sylvain Berfini - */ public class InAppPurchaseHelper { public static final int API_VERSION = 3; public static final int ACTIVITY_RESULT_CODE_PURCHASE_ITEM = 11089; - + public static final String SKU_DETAILS_ITEM_LIST = "ITEM_ID_LIST"; public static final String SKU_DETAILS_LIST = "DETAILS_LIST"; public static final String SKU_DETAILS_PRODUCT_ID = "productId"; public static final String SKU_DETAILS_PRICE = "price"; public static final String SKU_DETAILS_TITLE = "title"; public static final String SKU_DETAILS_DESC = "description"; - + public static final String ITEM_TYPE_INAPP = "inapp"; public static final String ITEM_TYPE_SUBS = "subs"; - + public static final int RESPONSE_RESULT_OK = 0; public static final int RESULT_USER_CANCELED = 1; public static final int RESULT_SERVICE_UNAVAILABLE = 2; @@ -71,7 +68,7 @@ public class InAppPurchaseHelper { public static final int RESULT_ERROR = 6; public static final int RESULT_ITEM_ALREADY_OWNED = 7; public static final int RESULT_ITEM_NOT_OWNED = 8; - + public static final String RESPONSE_CODE = "RESPONSE_CODE"; public static final String RESPONSE_BUY_INTENT = "BUY_INTENT"; public static final String RESPONSE_INAPP_PURCHASE_DATA = "INAPP_PURCHASE_DATA"; @@ -80,7 +77,7 @@ public class InAppPurchaseHelper { public static final String RESPONSE_INAPP_PURCHASE_DATA_LIST = "INAPP_PURCHASE_DATA_LIST"; public static final String RESPONSE_INAPP_SIGNATURE_LIST = "INAPP_DATA_SIGNATURE_LIST"; public static final String RESPONSE_INAPP_CONTINUATION_TOKEN = "INAPP_CONTINUATION_TOKEN"; - + public static final String PURCHASE_DETAILS_PRODUCT_ID = "productId"; public static final String PURCHASE_DETAILS_ORDER_ID = "orderId"; public static final String PURCHASE_DETAILS_AUTO_RENEWING = "autoRenewing"; @@ -88,18 +85,18 @@ public class InAppPurchaseHelper { public static final String PURCHASE_DETAILS_PURCHASE_STATE = "purchaseState"; public static final String PURCHASE_DETAILS_PAYLOAD = "developerPayload"; public static final String PURCHASE_DETAILS_PURCHASE_TOKEN = "purchaseToken"; - + public static final String CLIENT_ERROR_SUBSCRIPTION_PURCHASE_NOT_AVAILABLE = "SUBSCRIPTION_PURCHASE_NOT_AVAILABLE"; public static final String CLIENT_ERROR_BIND_TO_BILLING_SERVICE_FAILED = "BIND_TO_BILLING_SERVICE_FAILED"; public static final String CLIENT_ERROR_BILLING_SERVICE_UNAVAILABLE = "BILLING_SERVICE_UNAVAILABLE"; - + private Context mContext; private InAppPurchaseListener mListener; private IInAppBillingService mService; private ServiceConnection mServiceConn; private Handler mHandler = new Handler(); private String mGmailAccount; - + private String responseCodeToErrorMessage(int responseCode) { switch (responseCode) { case RESULT_USER_CANCELED: @@ -121,7 +118,7 @@ public class InAppPurchaseHelper { } return "UNKNOWN_RESPONSE_CODE"; } - + public InAppPurchaseHelper(Activity context, InAppPurchaseListener listener) { mContext = context; mListener = listener; @@ -169,13 +166,13 @@ public class InAppPurchaseHelper { mListener.onError(CLIENT_ERROR_BILLING_SERVICE_UNAVAILABLE); } } - + private ArrayList getAvailableItemsForPurchase() { ArrayList products = new ArrayList(); ArrayList skuList = LinphonePreferences.instance().getInAppPurchasables(); Bundle querySkus = new Bundle(); querySkus.putStringArrayList(SKU_DETAILS_ITEM_LIST, skuList); - + Bundle skuDetails = null; try { skuDetails = mService.getSkuDetails(API_VERSION, mContext.getPackageName(), ITEM_TYPE_SUBS, querySkus); @@ -194,7 +191,7 @@ public class InAppPurchaseHelper { String price = object.getString(SKU_DETAILS_PRICE); String title = object.getString(SKU_DETAILS_TITLE); String desc = object.getString(SKU_DETAILS_DESC); - + Purchasable purchasable = new Purchasable(id).setTitle(title).setDescription(desc).setPrice(price); Log.w("Purchasable item " + purchasable.getDescription()); products.add(purchasable); @@ -207,10 +204,10 @@ public class InAppPurchaseHelper { mListener.onError(responseCodeToErrorMessage(response)); } } - + return products; } - + public void getAvailableItemsForPurchaseAsync() { new Thread(new Runnable() { public void run() { @@ -225,11 +222,11 @@ public class InAppPurchaseHelper { } }).start(); } - + public void getPurchasedItemsAsync() { new Thread(new Runnable() { public void run() { - + final ArrayList items = new ArrayList(); String continuationToken = null; do { @@ -239,19 +236,19 @@ public class InAppPurchaseHelper { } catch (RemoteException e) { Log.e(e); } - + if (purchasedItems != null) { int response = purchasedItems.getInt(RESPONSE_CODE); if (response == RESPONSE_RESULT_OK) { ArrayList purchaseDataList = purchasedItems.getStringArrayList(RESPONSE_INAPP_PURCHASE_DATA_LIST); ArrayList signatureList = purchasedItems.getStringArrayList(RESPONSE_INAPP_SIGNATURE_LIST); continuationToken = purchasedItems.getString(RESPONSE_INAPP_CONTINUATION_TOKEN); - + for (int i = 0; i < purchaseDataList.size(); ++i) { String purchaseData = purchaseDataList.get(i); String signature = signatureList.get(i); Log.d("[In-app purchase] " + purchaseData); - + Purchasable item = verifySignature(purchaseData, signature); if (item != null) { items.add(item); @@ -263,7 +260,7 @@ public class InAppPurchaseHelper { } } } while (continuationToken != null); - + if (mHandler != null && mListener != null) { mHandler.post(new Runnable() { public void run() { @@ -274,7 +271,7 @@ public class InAppPurchaseHelper { } }).start(); } - + public void parseAndVerifyPurchaseItemResultAsync(int requestCode, int resultCode, Intent data) { if (requestCode == ACTIVITY_RESULT_CODE_PURCHASE_ITEM) { int responseCode = data.getIntExtra(RESPONSE_CODE, 0); @@ -286,7 +283,7 @@ public class InAppPurchaseHelper { Purchasable item = LinphonePreferences.instance().getInAppPurchasedItem(); item.setPayloadAndSignature(payload, signature); LinphonePreferences.instance().setInAppPurchasedItem(item); - + XmlRpcHelper xmlRpcHelper = new XmlRpcHelper(); xmlRpcHelper.verifySignatureAsync(new XmlRpcListenerBase() { @Override @@ -297,7 +294,7 @@ public class InAppPurchaseHelper { } } } - + private void purchaseItem(String productId, String sipIdentity) { Bundle buyIntentBundle = null; try { @@ -305,7 +302,7 @@ public class InAppPurchaseHelper { } catch (RemoteException e) { Log.e(e); } - + if (buyIntentBundle != null) { PendingIntent pendingIntent = buyIntentBundle.getParcelable(RESPONSE_BUY_INTENT); if (pendingIntent != null) { @@ -317,7 +314,7 @@ public class InAppPurchaseHelper { } } } - + public void purchaseItemAsync(final String productId, final String sipIdentity) { new Thread(new Runnable() { public void run() { @@ -325,29 +322,29 @@ public class InAppPurchaseHelper { } }).start(); } - + public void destroy() { mContext.unbindService(mServiceConn); } - + public String getGmailAccount() { Account[] accounts = AccountManager.get(mContext).getAccountsByType("com.google"); - + for (Account account: accounts) { if (isEmailCorrect(account.name)) { String possibleEmail = account.name; return possibleEmail; } } - + return null; } - + private boolean isEmailCorrect(String email) { Pattern emailPattern = Patterns.EMAIL_ADDRESS; return emailPattern.matcher(email).matches(); } - + private Purchasable verifySignature(String payload, String signature) { // TODO FIXME rework to be async /*XmlRpcHelper helper = new XmlRpcHelper(); @@ -355,7 +352,7 @@ public class InAppPurchaseHelper { try { JSONObject json = new JSONObject(payload); String productId = json.getString(PURCHASE_DETAILS_PRODUCT_ID); - Purchasable item = new Purchasable(productId); + Purchasable item = new Purchasable(productId); item.setPayloadAndSignature(payload, signature); return item; } catch (JSONException e) { @@ -364,7 +361,7 @@ public class InAppPurchaseHelper { }*/ return null; } - + interface VerifiedSignatureListener { void onParsedAndVerifiedSignatureQueryFinished(Purchasable item); } diff --git a/src/android/org/linphone/purchase/InAppPurchaseListFragment.java b/src/android/org/linphone/purchase/InAppPurchaseListFragment.java index 5d696922b..c4de79cbb 100644 --- a/src/android/org/linphone/purchase/InAppPurchaseListFragment.java +++ b/src/android/org/linphone/purchase/InAppPurchaseListFragment.java @@ -2,7 +2,7 @@ package org.linphone.purchase; /* InAppPurchaseListFragment.java -Copyright (C) 2016 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 diff --git a/src/android/org/linphone/purchase/InAppPurchaseListener.java b/src/android/org/linphone/purchase/InAppPurchaseListener.java index 43ea62832..6105b0639 100644 --- a/src/android/org/linphone/purchase/InAppPurchaseListener.java +++ b/src/android/org/linphone/purchase/InAppPurchaseListener.java @@ -1,7 +1,7 @@ package org.linphone.purchase; /* InAppPurchaseListener.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -20,27 +20,24 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. import java.util.ArrayList; -/** - * @author Sylvain Berfini - */ public interface InAppPurchaseListener { /** * Callback called when the in-app purchase listener is connected and available for queries */ void onServiceAvailableForQueries(); - + /** * Callback called when the query for items available for purchase is done * @param items the list of items that can be purchased (also contains the ones already bought) */ void onAvailableItemsForPurchaseQueryFinished(ArrayList items); - + /** * Callback called when the query for items bought by the user is done * @param items the list of items already purchased by the user */ void onPurchasedItemsQueryFinished(ArrayList items); - + /** * Callback called when the purchase has been validated by our external server * @param success true if ok, false otherwise @@ -52,13 +49,13 @@ public interface InAppPurchaseListener { * @param success true if the recover has been successful, false otherwise */ void onRecoverAccountSuccessful(boolean success); - + /** * Callback called when the account has been activated (or not) * @param success true if the activation has been successful, false otherwise */ void onActivateAccountSuccessful(boolean success); - + /** * Callback called when an error occurred. * @param error the error that occurred diff --git a/src/android/org/linphone/purchase/InAppPurchaseListenerBase.java b/src/android/org/linphone/purchase/InAppPurchaseListenerBase.java index b99a97ddc..8917f9c4e 100644 --- a/src/android/org/linphone/purchase/InAppPurchaseListenerBase.java +++ b/src/android/org/linphone/purchase/InAppPurchaseListenerBase.java @@ -1,47 +1,66 @@ package org.linphone.purchase; +/* +InAppPurchaseListenerBase.java +Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + import java.util.ArrayList; public class InAppPurchaseListenerBase implements InAppPurchaseListener { @Override public void onServiceAvailableForQueries() { // TODO Auto-generated method stub - + } @Override public void onAvailableItemsForPurchaseQueryFinished(ArrayList items) { // TODO Auto-generated method stub - + } @Override public void onPurchasedItemsQueryFinished(ArrayList items) { // TODO Auto-generated method stub - + } @Override public void onPurchasedItemConfirmationQueryFinished(boolean success) { // TODO Auto-generated method stub - + } @Override public void onRecoverAccountSuccessful(boolean success) { // TODO Auto-generated method stub - + } @Override public void onActivateAccountSuccessful(boolean success) { // TODO Auto-generated method stub - + } @Override public void onError(String error) { // TODO Auto-generated method stub - + } } diff --git a/src/android/org/linphone/purchase/Purchasable.java b/src/android/org/linphone/purchase/Purchasable.java index 44156b520..f4eb9eaac 100644 --- a/src/android/org/linphone/purchase/Purchasable.java +++ b/src/android/org/linphone/purchase/Purchasable.java @@ -7,7 +7,7 @@ import java.util.Locale; /* Purchasable.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -24,15 +24,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/** - * @author Sylvain Berfini - */ public class Purchasable { private String id, title, description, price; private long expire; - private String purchasePayload, purchasePayloadSignature; + private String purchasePayload, purchasePayloadSignature; private String userData; - + public Purchasable(String id) { this.id = id; } @@ -71,7 +68,7 @@ public class Purchasable { public long getExpire() { return expire; } - + public String getExpireDate() { DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.getDefault()); Date date = new Date(expire); @@ -82,26 +79,26 @@ public class Purchasable { this.expire = expire; return this; } - + public Purchasable setPayloadAndSignature(String payload, String signature) { this.purchasePayload = payload; this.purchasePayloadSignature = signature; return this; } - + public String getPayload() { return this.purchasePayload; } - + public String getPayloadSignature() { return this.purchasePayloadSignature; } - + public Purchasable setUserData(String data) { this.userData = data; return this; } - + public String getUserData() { return this.userData; } diff --git a/src/android/org/linphone/sync/AuthenticationService.java b/src/android/org/linphone/sync/AuthenticationService.java index b999966d8..1b329f2fa 100644 --- a/src/android/org/linphone/sync/AuthenticationService.java +++ b/src/android/org/linphone/sync/AuthenticationService.java @@ -2,7 +2,7 @@ package org.linphone.sync; /* AuthenticationService.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 diff --git a/src/android/org/linphone/sync/Authenticator.java b/src/android/org/linphone/sync/Authenticator.java index fc0ffc4d5..5b6e705c1 100644 --- a/src/android/org/linphone/sync/Authenticator.java +++ b/src/android/org/linphone/sync/Authenticator.java @@ -2,7 +2,7 @@ package org.linphone.sync; /* Authenticator.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 diff --git a/src/android/org/linphone/sync/SyncAdapter.java b/src/android/org/linphone/sync/SyncAdapter.java index 291f5b448..95ae63940 100755 --- a/src/android/org/linphone/sync/SyncAdapter.java +++ b/src/android/org/linphone/sync/SyncAdapter.java @@ -2,7 +2,7 @@ package org.linphone.sync; /* SyncAdapter.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 diff --git a/src/android/org/linphone/sync/SyncService.java b/src/android/org/linphone/sync/SyncService.java index 6bec5b043..7caddd1d7 100755 --- a/src/android/org/linphone/sync/SyncService.java +++ b/src/android/org/linphone/sync/SyncService.java @@ -2,7 +2,7 @@ package org.linphone.sync; /* SyncService.java -Copyright (C) 2015 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 diff --git a/src/android/org/linphone/tutorials/AndroidTutorialNotifier.java b/src/android/org/linphone/tutorials/AndroidTutorialNotifier.java index 739bcaed1..c5b55a720 100644 --- a/src/android/org/linphone/tutorials/AndroidTutorialNotifier.java +++ b/src/android/org/linphone/tutorials/AndroidTutorialNotifier.java @@ -1,6 +1,8 @@ +package org.linphone.tutorials; + /* AndroidTutorialNotifier.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -16,7 +18,6 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.linphone.tutorials; import org.linphone.core.tutorials.TutorialNotifier; @@ -26,21 +27,19 @@ import android.widget.TextView; /** * Write notifications to a TextView widget. * This is an helper class, not a test activity. - * - * @author Guillaume Beraudo * */ class AndroidTutorialNotifier extends TutorialNotifier { private Handler mHandler; private TextView outputTextView; - + public AndroidTutorialNotifier(Handler mHandler, final TextView outputTextView) { this.mHandler = mHandler; this.outputTextView = outputTextView; } - - + + @Override public void notify(final String s) { mHandler.post(new Runnable() { diff --git a/src/android/org/linphone/tutorials/TutorialCardDavSync.java b/src/android/org/linphone/tutorials/TutorialCardDavSync.java index 660be41a2..3474b5fbb 100644 --- a/src/android/org/linphone/tutorials/TutorialCardDavSync.java +++ b/src/android/org/linphone/tutorials/TutorialCardDavSync.java @@ -1,5 +1,24 @@ package org.linphone.tutorials; +/* +TutorialCardDavSync.java +Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + import java.nio.ByteBuffer; import java.util.Timer; import java.util.TimerTask; diff --git a/src/android/org/linphone/tutorials/TutorialChatRoomActivity.java b/src/android/org/linphone/tutorials/TutorialChatRoomActivity.java index 23a9153e7..c93e2cd0a 100644 --- a/src/android/org/linphone/tutorials/TutorialChatRoomActivity.java +++ b/src/android/org/linphone/tutorials/TutorialChatRoomActivity.java @@ -1,6 +1,8 @@ +package org.linphone.tutorials; + /* TutorialChatRoomActivity.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -16,7 +18,6 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.linphone.tutorials; import org.linphone.R; import org.linphone.core.LinphoneCoreException; @@ -34,8 +35,6 @@ import android.widget.TextView; /** * Activity for displaying and starting the chatroom example on Android phone. * - * @author Guillaume Beraudo - * */ public class TutorialChatRoomActivity extends Activity { @@ -56,12 +55,12 @@ public class TutorialChatRoomActivity extends Activity { final TextView outputText = (TextView) findViewById(R.id.OutputText); final TutorialNotifier notifier = new AndroidTutorialNotifier(mHandler, outputText); - + // Create HelloWorld object tutorial = new TutorialChatRoom(notifier); - - + + // Assign call action to call button buttonCall = (Button) findViewById(R.id.CallButton); buttonCall.setOnClickListener(new View.OnClickListener() { @@ -80,8 +79,8 @@ public class TutorialChatRoomActivity extends Activity { } }); } - - + + private class TutorialLaunchingThread extends Thread { @Override public void run() { diff --git a/src/android/org/linphone/tutorials/TutorialLauncherActivity.java b/src/android/org/linphone/tutorials/TutorialLauncherActivity.java index b3668e635..1323ec529 100644 --- a/src/android/org/linphone/tutorials/TutorialLauncherActivity.java +++ b/src/android/org/linphone/tutorials/TutorialLauncherActivity.java @@ -1,7 +1,7 @@ package org.linphone.tutorials; /* TutorialLauncherActivity.java -Copyright (C) 2013 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -25,32 +25,29 @@ import android.content.Intent; import android.os.Bundle; import android.view.View; -/** - * @author Sylvain Berfini - */ public class TutorialLauncherActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tutorials); } - + public void startHelloWorldTutorial(View v) { startActivity(new Intent().setClass(TutorialLauncherActivity.this, TutorialHelloWorldActivity.class)); } - + public void startRegistrationTutorial(View v) { startActivity(new Intent().setClass(TutorialLauncherActivity.this, TutorialRegistrationActivity.class)); } - + public void startChatRoomTutorial(View v) { startActivity(new Intent().setClass(TutorialLauncherActivity.this, TutorialChatRoomActivity.class)); } - + public void startBuddyStatusTutorial(View v) { startActivity(new Intent().setClass(TutorialLauncherActivity.this, TutorialBuddyStatusActivity.class)); } - + public void startCardDavSyncTutorial(View v) { startActivity(new Intent().setClass(TutorialLauncherActivity.this, TutorialCardDavSync.class)); } diff --git a/src/android/org/linphone/tutorials/TutorialRegistrationActivity.java b/src/android/org/linphone/tutorials/TutorialRegistrationActivity.java index da95f7fb4..a781bc624 100644 --- a/src/android/org/linphone/tutorials/TutorialRegistrationActivity.java +++ b/src/android/org/linphone/tutorials/TutorialRegistrationActivity.java @@ -1,6 +1,8 @@ +package org.linphone.tutorials; + /* TutorialRegistrationActivity.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -16,7 +18,6 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.linphone.tutorials; import org.linphone.R; import org.linphone.core.LinphoneCoreException; @@ -32,8 +33,6 @@ import android.widget.TextView; /** * Activity for displaying and starting the registration example on Android phone. - * - * @author Guillaume Beraudo * */ public class TutorialRegistrationActivity extends TutorialHelloWorldActivity { @@ -62,12 +61,12 @@ public class TutorialRegistrationActivity extends TutorialHelloWorldActivity { outputText = (TextView) findViewById(R.id.OutputText); final TutorialNotifier notifier = new AndroidTutorialNotifier(mHandler, outputText); - + // Create Tutorial object tutorial = new TutorialRegistration(notifier); - - + + // Assign call action to call button buttonCall = (Button) findViewById(R.id.CallButton); buttonCall.setText("Register"); @@ -87,8 +86,8 @@ public class TutorialRegistrationActivity extends TutorialHelloWorldActivity { } }); } - - + + private class TutorialLaunchingThread extends Thread { @Override public void run() { diff --git a/src/android/org/linphone/ui/AddressAware.java b/src/android/org/linphone/ui/AddressAware.java index fe2f792c1..b5515d8c7 100644 --- a/src/android/org/linphone/ui/AddressAware.java +++ b/src/android/org/linphone/ui/AddressAware.java @@ -1,6 +1,8 @@ +package org.linphone.ui; + /* AddressAwareWidget.java -Copyright (C) 2011 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -16,14 +18,7 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.linphone.ui; - - -/** - * @author Guillaume Beraudo - * - */ public interface AddressAware { void setAddressWidget(AddressText address); diff --git a/src/android/org/linphone/ui/AddressText.java b/src/android/org/linphone/ui/AddressText.java index 8be3649e5..e453fc010 100644 --- a/src/android/org/linphone/ui/AddressText.java +++ b/src/android/org/linphone/ui/AddressText.java @@ -1,6 +1,8 @@ +package org.linphone.ui; + /* AddressView.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -16,7 +18,6 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.linphone.ui; import org.linphone.DialerFragment; import org.linphone.LinphoneManager.AddressType; @@ -29,17 +30,13 @@ import android.util.AttributeSet; import android.util.TypedValue; import android.widget.EditText; -/** - * @author Guillaume Beraudo - * - */ public class AddressText extends EditText implements AddressType { private String displayedName; private Uri pictureUri; private Paint mTestPaint; private DialerFragment dialer; - + public void setPictureUri(Uri uri) { pictureUri = uri; } @@ -71,7 +68,7 @@ public class AddressText extends EditText implements AddressType { public void setDisplayedName(String displayedName) { this.displayedName = displayedName; } - + private String getHintText() { String resizedText = getContext().getString(R.string.address_bar_hint); if (getHint() != null) { @@ -87,7 +84,7 @@ public class AddressText extends EditText implements AddressType { pictureUri = null; refitText(getWidth(), getHeight()); - + if (dialer != null) { dialer.enableDisableAddContact(); } @@ -101,7 +98,7 @@ public class AddressText extends EditText implements AddressType { refitText(getWidth(), getHeight()); } } - + private float getOptimizedTextSize(String text, int textWidth, int textHeight) { int targetWidth = textWidth - getPaddingLeft() - getPaddingRight(); int targetHeight = textHeight - getPaddingTop() - getPaddingBottom(); @@ -121,7 +118,7 @@ public class AddressText extends EditText implements AddressType { lo = size; } } - + return lo; } @@ -129,7 +126,7 @@ public class AddressText extends EditText implements AddressType { if (textWidth <= 0) { return; } - + float size = getOptimizedTextSize(getHintText(), textWidth, textHeight); float entrySize = getOptimizedTextSize(getText().toString(), textWidth, textHeight); if (entrySize < size) @@ -141,7 +138,7 @@ public class AddressText extends EditText implements AddressType { super.onMeasure(widthMeasureSpec, heightMeasureSpec); int parentWidth = MeasureSpec.getSize(widthMeasureSpec); int height = getMeasuredHeight(); - + refitText(parentWidth, height); setMeasuredDimension(parentWidth, height); } diff --git a/src/android/org/linphone/ui/CallButton.java b/src/android/org/linphone/ui/CallButton.java index 493769ee9..b5d9b58ae 100644 --- a/src/android/org/linphone/ui/CallButton.java +++ b/src/android/org/linphone/ui/CallButton.java @@ -1,6 +1,8 @@ +package org.linphone.ui; + /* CallButton.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -16,7 +18,6 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.linphone.ui; import org.linphone.LinphoneManager; import org.linphone.LinphonePreferences; @@ -33,9 +34,6 @@ import android.view.View.OnClickListener; import android.widget.ImageView; import android.widget.Toast; -/** - * @author Guillaume Beraudo - */ public class CallButton extends ImageView implements OnClickListener, AddressAware { private AddressText mAddress; @@ -52,7 +50,7 @@ public class CallButton extends ImageView implements OnClickListener, AddressAwa public void onClick(View v) { try { if (!LinphoneManager.getInstance().acceptCallIfIncomingPending()) { - if (mAddress.getText().length() > 0) { + if (mAddress.getText().length() > 0) { LinphoneManager.getInstance().newOutgoingCall(mAddress); } else { if (LinphonePreferences.instance().isBisFeatureEnabled()) { @@ -67,7 +65,7 @@ public class CallButton extends ImageView implements OnClickListener, AddressAwa if (log == null) { return; } - + LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig(); if (lpc != null && log.getTo().getDomain().equals(lpc.getDomain())) { mAddress.setText(log.getTo().getUserName()); @@ -84,7 +82,7 @@ public class CallButton extends ImageView implements OnClickListener, AddressAwa onWrongDestinationAddress(); } } - + protected void onWrongDestinationAddress() { Toast.makeText(getContext() ,String.format(getResources().getString(R.string.warning_wrong_destination_address),mAddress.getText().toString()) diff --git a/src/android/org/linphone/ui/Digit.java b/src/android/org/linphone/ui/Digit.java index 15c9282a9..5581266ce 100644 --- a/src/android/org/linphone/ui/Digit.java +++ b/src/android/org/linphone/ui/Digit.java @@ -1,6 +1,8 @@ +package org.linphone.ui; + /* Digit.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -16,7 +18,6 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.linphone.ui; import org.linphone.CallActivity; import org.linphone.LinphoneManager; @@ -52,7 +53,7 @@ public class Digit extends Button implements AddressAware { protected void onTextChanged(CharSequence text, int start, int before, int after) { super.onTextChanged(text, start, before, after); - + if (text == null || text.length() < 1) { return; } @@ -60,21 +61,21 @@ public class Digit extends Button implements AddressAware { DialKeyListener lListener = new DialKeyListener(); setOnClickListener(lListener); setOnTouchListener(lListener); - + if ("0+".equals(text)) { setOnLongClickListener(lListener); } - + if ("1".equals(text)) { setOnLongClickListener(lListener); } } - + public Digit(Context context, AttributeSet attrs, int style) { super(context, attrs, style); setLongClickable(true); } - + public Digit(Context context, AttributeSet attrs) { super(context, attrs); setLongClickable(true); @@ -112,7 +113,7 @@ public class Digit extends Button implements AddressAware { lc.sendDtmf(mKeyCode); } } - + if (mAddress != null) { int lBegin = mAddress.getSelectionStart(); if (lBegin == -1) { @@ -169,7 +170,7 @@ public class Digit extends Button implements AddressAware { if (CallActivity.isInstanciated()) { CallActivity.instance().resetControlsHidingCallBack(); } - + LinphoneCore lc = LinphoneManager.getLc(); if (event.getAction() == MotionEvent.ACTION_DOWN && !mIsDtmfStarted) { LinphoneManager.getInstance().playDtmf(getContext().getContentResolver(), mKeyCode); @@ -182,7 +183,7 @@ public class Digit extends Button implements AddressAware { } return false; } - + public boolean onLongClick(View v) { int id = v.getId(); LinphoneCore lc = LinphoneManager.getLc(); @@ -192,7 +193,7 @@ public class Digit extends Button implements AddressAware { // Called if "0+" dtmf lc.stopDtmf(); } - + if(id == R.id.Digit1 && lc.getCalls().length == 0){ String voiceMail = LinphonePreferences.instance().getVoiceMailUri(); mAddress.getEditableText().clear(); @@ -202,8 +203,8 @@ public class Digit extends Button implements AddressAware { } return true; } - - + + if (mAddress == null) return true; int lBegin = mAddress.getSelectionStart(); diff --git a/src/android/org/linphone/ui/LedPreference.java b/src/android/org/linphone/ui/LedPreference.java index 7aebe57a6..df67e128d 100644 --- a/src/android/org/linphone/ui/LedPreference.java +++ b/src/android/org/linphone/ui/LedPreference.java @@ -2,7 +2,7 @@ package org.linphone.ui; /* LedPreference.java -Copyright (C) 2012 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -26,13 +26,10 @@ import android.preference.Preference; import android.view.View; import android.widget.ImageView; -/** - * @author Sylvain Berfini - */ public class LedPreference extends Preference { private int ledDrawable; - + public LedPreference(Context context) { super(context); ledDrawable = R.drawable.led_disconnected; diff --git a/src/android/org/linphone/ui/LinphoneOverlay.java b/src/android/org/linphone/ui/LinphoneOverlay.java index 1a71ec66a..9924a6ded 100644 --- a/src/android/org/linphone/ui/LinphoneOverlay.java +++ b/src/android/org/linphone/ui/LinphoneOverlay.java @@ -1,5 +1,24 @@ package org.linphone.ui; +/* +LinphoneOverlay.java +Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + import org.linphone.LinphoneActivity; import org.linphone.LinphoneManager; import org.linphone.LinphoneService; diff --git a/src/android/org/linphone/ui/LinphoneScrollView.java b/src/android/org/linphone/ui/LinphoneScrollView.java index 997c8abf0..0ff59fe9a 100644 --- a/src/android/org/linphone/ui/LinphoneScrollView.java +++ b/src/android/org/linphone/ui/LinphoneScrollView.java @@ -1,7 +1,7 @@ package org.linphone.ui; /* LinphoneScrollView.java -Copyright (C) 2013 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -21,9 +21,6 @@ import android.content.Context; import android.util.AttributeSet; import android.widget.ScrollView; -/** - * @author Sylvain Berfini - */ public class LinphoneScrollView extends ScrollView { private ScrollViewListener scrollViewListener = null; diff --git a/src/android/org/linphone/ui/LinphoneSliders.java b/src/android/org/linphone/ui/LinphoneSliders.java index 4f6062b9b..656fde902 100644 --- a/src/android/org/linphone/ui/LinphoneSliders.java +++ b/src/android/org/linphone/ui/LinphoneSliders.java @@ -11,7 +11,7 @@ import android.view.View; /* LinphoneSliders.java -Copyright (C) 2012 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -28,9 +28,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/** - * @author Sylvain Berfini - */ public class LinphoneSliders extends View implements OnGestureListener { private Drawable leftSliderImg, rightSliderImg; private int leftSliderX, rightSliderX; @@ -39,36 +36,36 @@ public class LinphoneSliders extends View implements OnGestureListener { private LinphoneSliderTriggered mTriggerListener; private boolean slidingLeftHandle, slidingRightHandle; private static final double mCoeff = 0.5; - + public LinphoneSliders(Context context, AttributeSet attrs) { super(context, attrs); mGestures = new GestureDetector(getContext(), this); //leftSliderImg = getResources().getDrawable(R.drawable.slider_left); //rightSliderImg = getResources().getDrawable(R.drawable.slider_right); - + slidersHeight = leftSliderImg.getIntrinsicHeight(); slidersWidth = leftSliderImg.getIntrinsicWidth(); - + leftSliderX = 0; rightSliderX = 0; slidingLeftHandle = slidingRightHandle = false; } - + @Override protected void onDraw(Canvas canvas) { rightSliderImg.setBounds(getWidth() - slidersWidth - rightSliderX, getHeight() - slidersHeight, getWidth(), getHeight()); rightSliderImg.draw(canvas); - + leftSliderImg.setBounds(0, getHeight() - slidersHeight, slidersWidth + leftSliderX, getHeight()); leftSliderImg.draw(canvas); - + if (slidingLeftHandle && Math.abs(leftSliderX) >= mCoeff * getWidth()) { mTriggerListener.onLeftHandleTriggered(); } else if (slidingRightHandle && rightSliderX >= mCoeff * getWidth()) { mTriggerListener.onRightHandleTriggered(); } } - + @Override public boolean onTouchEvent(MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_UP) { @@ -77,8 +74,8 @@ public class LinphoneSliders extends View implements OnGestureListener { slidingLeftHandle = slidingRightHandle = false; invalidate(); } - - return mGestures.onTouchEvent(event); + + return mGestures.onTouchEvent(event); } @Override @@ -94,7 +91,7 @@ public class LinphoneSliders extends View implements OnGestureListener { @Override public void onLongPress(MotionEvent e) { - + } @Override @@ -103,7 +100,7 @@ public class LinphoneSliders extends View implements OnGestureListener { if (e1.getY() < getHeight() - slidersHeight) { return false; } - + if (e1.getX() < getWidth() / 2) { leftSliderX -= distanceX; slidingLeftHandle = true; @@ -112,20 +109,20 @@ public class LinphoneSliders extends View implements OnGestureListener { slidingRightHandle = true; } invalidate(); - + return true; } @Override public void onShowPress(MotionEvent e) { - + } @Override public boolean onSingleTapUp(MotionEvent e) { return false; } - + public void setOnTriggerListener(LinphoneSliderTriggered listener) { mTriggerListener = listener; } diff --git a/src/android/org/linphone/ui/Numpad.java b/src/android/org/linphone/ui/Numpad.java index 9c751dd8e..0af6032a4 100644 --- a/src/android/org/linphone/ui/Numpad.java +++ b/src/android/org/linphone/ui/Numpad.java @@ -1,6 +1,8 @@ +package org.linphone.ui; + /* NumpadView.java -Copyright (C) 2010 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -16,7 +18,6 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.linphone.ui; import java.util.ArrayList; import java.util.Collection; @@ -31,10 +32,6 @@ import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; -/** - * @author Guillaume Beraudo - * - */ public class Numpad extends LinearLayout implements AddressAware { private boolean mPlayDtmf; diff --git a/src/android/org/linphone/ui/PreferencesListFragment.java b/src/android/org/linphone/ui/PreferencesListFragment.java index 71b828d98..6719b48e9 100644 --- a/src/android/org/linphone/ui/PreferencesListFragment.java +++ b/src/android/org/linphone/ui/PreferencesListFragment.java @@ -1,7 +1,8 @@ package org.linphone.ui; + /* PreferencesListFragment.java -Copyright (C) 2012 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -17,6 +18,7 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + import java.lang.reflect.Constructor; import java.lang.reflect.Method; @@ -45,13 +47,13 @@ import android.widget.RelativeLayout; @SuppressLint("ValidFragment") public class PreferencesListFragment extends ListFragment { private PreferenceManager mPreferenceManager; - + /** * The starting request code given out to preference framework. */ private static final int FIRST_REQUEST_CODE = 100; private static final int MSG_BIND_PREFERENCES = 0; - + private Handler mHandler = new Handler() { @Override public void handleMessage(Message msg) { @@ -64,33 +66,33 @@ public class PreferencesListFragment extends ListFragment { }; private ListView preferencesList; private int xmlResID; - + public PreferencesListFragment(int xmlId) { this.xmlResID = xmlId; } - + // Must be provided public PreferencesListFragment() { - + } - + @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle b) { // Hack to correctly display preferences View view = inflater.inflate(R.layout.settings, null); - + ViewParent p = preferencesList.getParent(); if (p != null) { ((ViewGroup)p).removeView(preferencesList); } - + RelativeLayout layout = (RelativeLayout) view.findViewById(R.id.topLayout); layout.addView(preferencesList); - + postBindPreferences(); return view; } - + @Override public void onDestroyView(){ super.onDestroyView(); @@ -103,11 +105,11 @@ public class PreferencesListFragment extends ListFragment { @Override public void onCreate(Bundle bundle) { super.onCreate(bundle); - + if (bundle != null) { xmlResID = bundle.getInt("xml"); } - + mPreferenceManager = onCreatePreferenceManager(); preferencesList = (ListView) LayoutInflater.from(getActivity()).inflate(R.layout.preference_list_content, null); preferencesList.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); @@ -168,17 +170,17 @@ public class PreferencesListFragment extends ListFragment { if (mHandler.hasMessages(MSG_BIND_PREFERENCES)) return; mHandler.obtainMessage(MSG_BIND_PREFERENCES).sendToTarget(); } - + private void bindPreferences() { final PreferenceScreen preferenceScreen = getPreferenceScreen(); if (preferenceScreen != null && preferencesList != null) { preferenceScreen.bind(preferencesList); } } - + /** * Creates the {@link PreferenceManager}. - * + * * @return The {@link PreferenceManager} used by this activity. */ private PreferenceManager onCreatePreferenceManager() { @@ -192,7 +194,7 @@ public class PreferencesListFragment extends ListFragment { return null; } } - + /** * Returns the {@link PreferenceManager} used by this activity. * @return The {@link PreferenceManager}. @@ -203,7 +205,7 @@ public class PreferencesListFragment extends ListFragment { /** * Sets the root of the preference hierarchy that this activity is showing. - * + * * @param preferenceScreen The root {@link PreferenceScreen} of the preference hierarchy. */ public void setPreferenceScreen(PreferenceScreen preferenceScreen) { @@ -218,10 +220,10 @@ public class PreferencesListFragment extends ListFragment { Log.e("[PreferencesListFragment] setPreferenceScreen " + e); } } - + /** * Gets the root of the preference hierarchy that this activity is showing. - * + * * @return The {@link PreferenceScreen} that is the root of the preference * hierarchy. */ @@ -233,17 +235,17 @@ public class PreferencesListFragment extends ListFragment { } catch(Exception e) { Log.e("[PreferencesListFragment] getPreferenceScreen " + e); } - + return null; } - + /** * Inflates the given XML resource and adds the preference hierarchy to the current * preference hierarchy. - * + * * @param preferencesResId The XML resource ID to inflate. */ - public void addPreferencesFromResource(int preferencesResId) { + public void addPreferencesFromResource(int preferencesResId) { try { Method m = PreferenceManager.class.getDeclaredMethod("inflateFromResource", Context.class, int.class, PreferenceScreen.class); m.setAccessible(true); @@ -253,10 +255,10 @@ public class PreferencesListFragment extends ListFragment { Log.e("[PreferencesListFragment] addPreferencesFromResource " + e); } } - + /** * Finds a {@link Preference} based on its key. - * + * * @param key The key of the preference to retrieve. * @return The {@link Preference} with the key, or null. * @see PreferenceGroup#findPreference(CharSequence) diff --git a/src/android/org/linphone/ui/ScrollViewListener.java b/src/android/org/linphone/ui/ScrollViewListener.java index 980e09771..e4f278cf0 100644 --- a/src/android/org/linphone/ui/ScrollViewListener.java +++ b/src/android/org/linphone/ui/ScrollViewListener.java @@ -1,7 +1,8 @@ package org.linphone.ui; + /* ScrollViewListener.java -Copyright (C) 2013 Belledonne Communications, Grenoble, France +Copyright (C) 2017 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 @@ -18,9 +19,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/** - * @author Sylvain Berfini - */ public interface ScrollViewListener { void OnScrollToTop(int previousHeight); } diff --git a/src/android/org/linphone/xmlrpc/XmlRpcHelper.java b/src/android/org/linphone/xmlrpc/XmlRpcHelper.java index 30b025e56..0ed15a41e 100644 --- a/src/android/org/linphone/xmlrpc/XmlRpcHelper.java +++ b/src/android/org/linphone/xmlrpc/XmlRpcHelper.java @@ -1,5 +1,24 @@ package org.linphone.xmlrpc; +/* +XmlRpcHelper.java +Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + import org.linphone.LinphoneManager; import org.linphone.LinphonePreferences; import org.linphone.core.LinphoneXmlRpcRequest; @@ -20,7 +39,7 @@ public class XmlRpcHelper { public static final String SERVER_ERROR_SIGNATURE_VERIFICATION_FAILED = "ERROR_SIGNATURE_VERIFICATION_FAILED"; public static final String SERVER_ERROR_ACCOUNT_ALREADY_EXISTS = "ERROR_ACCOUNT_ALREADY_EXISTS"; public static final String SERVER_ERROR_UNKNOWN_ERROR = "ERROR_UNKNOWN_ERROR"; - + public static final String CLIENT_ERROR_INVALID_SERVER_URL = "INVALID_SERVER_URL"; public static final String CLIENT_ERROR_SERVER_NOT_REACHABLE = "SERVER_NOT_REACHABLE"; @@ -29,7 +48,7 @@ public class XmlRpcHelper { public XmlRpcHelper() { xmlRpcSession = new LinphoneXmlRpcSessionImpl(LinphoneManager.getLcIfManagerNotDestroyedOrNull(), LinphonePreferences.instance().getInAppPurchaseValidatingServerUrl()); } - + public void createAccountAsync(final XmlRpcListener listener, String username, String email, String password) { LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("create_account", LinphoneXmlRpcRequest.ArgType.String); xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { @@ -54,7 +73,7 @@ public class XmlRpcHelper { xmlRpcRequest.addStringArg(password == null ? "" : password); xmlRpcSession.sendRequest(xmlRpcRequest); } - + public void getAccountExpireAsync(final XmlRpcListener listener, String username, String password) { LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("get_account_expiration", LinphoneXmlRpcRequest.ArgType.String); xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { @@ -78,7 +97,7 @@ public class XmlRpcHelper { xmlRpcRequest.addStringArg(password); xmlRpcSession.sendRequest(xmlRpcRequest); } - + public void updateAccountExpireAsync(final XmlRpcListener listener, String username, String password, String domain, String payload, String signature) { LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("update_expiration_date", LinphoneXmlRpcRequest.ArgType.String); xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { @@ -105,7 +124,7 @@ public class XmlRpcHelper { xmlRpcRequest.addStringArg(signature); xmlRpcSession.sendRequest(xmlRpcRequest); } - + public void activateAccountAsync(final XmlRpcListener listener, String username, String password) { LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("activate_account", LinphoneXmlRpcRequest.ArgType.String); xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { @@ -129,7 +148,7 @@ public class XmlRpcHelper { xmlRpcRequest.addStringArg(password); xmlRpcSession.sendRequest(xmlRpcRequest); } - + public void isAccountActivatedAsync(final XmlRpcListener listener, String username) { LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("check_account_activated", LinphoneXmlRpcRequest.ArgType.String); xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { @@ -154,7 +173,7 @@ public class XmlRpcHelper { xmlRpcRequest.addStringArg(username); xmlRpcSession.sendRequest(xmlRpcRequest); } - + public void isTrialAccountAsync(final XmlRpcListener listener, String username, String password) { LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("is_account_trial", LinphoneXmlRpcRequest.ArgType.String); xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { @@ -176,7 +195,7 @@ public class XmlRpcHelper { xmlRpcRequest.addStringArg(password); xmlRpcSession.sendRequest(xmlRpcRequest); } - + public void isAccountAsync(final XmlRpcListener listener, String username) { LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("check_account_activated", LinphoneXmlRpcRequest.ArgType.String); xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { @@ -201,7 +220,7 @@ public class XmlRpcHelper { xmlRpcRequest.addStringArg(username); xmlRpcSession.sendRequest(xmlRpcRequest); } - + public void changeAccountEmailAsync(final XmlRpcListener listener, String username, String password, String newEmail) { LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("change_email", LinphoneXmlRpcRequest.ArgType.String); xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { @@ -214,7 +233,7 @@ public class XmlRpcHelper { listener.onError(result); return; } - + listener.onAccountEmailChanged(result); } else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) { Log.e(result); @@ -227,7 +246,7 @@ public class XmlRpcHelper { xmlRpcRequest.addStringArg(newEmail); xmlRpcSession.sendRequest(xmlRpcRequest); } - + public void changeAccountPasswordAsync(final XmlRpcListener listener, String username, String oldPassword, String newPassword) { LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("change_password", LinphoneXmlRpcRequest.ArgType.String); xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { @@ -240,7 +259,7 @@ public class XmlRpcHelper { listener.onError(result); return; } - + listener.onAccountPasswordChanged(result); } else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) { Log.e(result); @@ -253,7 +272,7 @@ public class XmlRpcHelper { xmlRpcRequest.addStringArg(newPassword); xmlRpcSession.sendRequest(xmlRpcRequest); } - + public void changeAccountHashPasswordAsync(final XmlRpcListener listener, String username, String oldPassword, String newPassword) { LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("change_hash", LinphoneXmlRpcRequest.ArgType.String); xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { @@ -266,7 +285,7 @@ public class XmlRpcHelper { listener.onError(result); return; } - + listener.onAccountPasswordChanged(result); } else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) { Log.e(result); @@ -279,7 +298,7 @@ public class XmlRpcHelper { xmlRpcRequest.addStringArg(newPassword); xmlRpcSession.sendRequest(xmlRpcRequest); } - + public void sendRecoverPasswordLinkByEmailAsync(final XmlRpcListener listener, String usernameOrEmail) { LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("send_reset_account_password_email", LinphoneXmlRpcRequest.ArgType.String); xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { @@ -292,7 +311,7 @@ public class XmlRpcHelper { listener.onError(result); return; } - + listener.onRecoverPasswordLinkSent(result); } else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) { Log.e(result); @@ -303,7 +322,7 @@ public class XmlRpcHelper { xmlRpcRequest.addStringArg(usernameOrEmail); xmlRpcSession.sendRequest(xmlRpcRequest); } - + public void sendActivateAccountLinkByEmailAsync(final XmlRpcListener listener, String usernameOrEmail) { LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("resend_activation_email", LinphoneXmlRpcRequest.ArgType.String); xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { @@ -316,7 +335,7 @@ public class XmlRpcHelper { listener.onError(result); return; } - + listener.onActivateAccountLinkSent(result); } else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) { Log.e(result); @@ -327,7 +346,7 @@ public class XmlRpcHelper { xmlRpcRequest.addStringArg(usernameOrEmail); xmlRpcSession.sendRequest(xmlRpcRequest); } - + public void sendUsernameByEmailAsync(final XmlRpcListener listener, String email) { LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("recover_username_from_email", LinphoneXmlRpcRequest.ArgType.String); xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { @@ -340,7 +359,7 @@ public class XmlRpcHelper { listener.onError(result); return; } - + listener.onUsernameSent(result); } else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) { Log.e(result); @@ -351,7 +370,7 @@ public class XmlRpcHelper { xmlRpcRequest.addStringArg(email); xmlRpcSession.sendRequest(xmlRpcRequest); } - + public void verifySignatureAsync(final XmlRpcListener listener, String payload, String signature) { LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("check_payload_signature", LinphoneXmlRpcRequest.ArgType.String); xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { @@ -365,7 +384,7 @@ public class XmlRpcHelper { listener.onError(result); return; } - + listener.onSignatureVerified("OK".equals(result)); } else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) { Log.e(result); diff --git a/src/android/org/linphone/xmlrpc/XmlRpcListener.java b/src/android/org/linphone/xmlrpc/XmlRpcListener.java index 976ad9316..47fe718d2 100644 --- a/src/android/org/linphone/xmlrpc/XmlRpcListener.java +++ b/src/android/org/linphone/xmlrpc/XmlRpcListener.java @@ -1,5 +1,24 @@ package org.linphone.xmlrpc; +/* +XmlRpcListener.java +Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + public interface XmlRpcListener { public void onError(String error); public void onAccountCreated(String result); diff --git a/src/android/org/linphone/xmlrpc/XmlRpcListenerBase.java b/src/android/org/linphone/xmlrpc/XmlRpcListenerBase.java index d849f40b5..1d0d86422 100644 --- a/src/android/org/linphone/xmlrpc/XmlRpcListenerBase.java +++ b/src/android/org/linphone/xmlrpc/XmlRpcListenerBase.java @@ -1,90 +1,109 @@ package org.linphone.xmlrpc; +/* +XmlRpcListenerBase.java +Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + public class XmlRpcListenerBase implements XmlRpcListener { @Override public void onError(String error) { // TODO Auto-generated method stub - + } @Override public void onAccountCreated(String result) { // TODO Auto-generated method stub - + } @Override public void onAccountExpireFetched(String result) { // TODO Auto-generated method stub - + } @Override public void onAccountActivated(String result) { // TODO Auto-generated method stub - + } @Override public void onAccountActivatedFetched(boolean isActivated) { // TODO Auto-generated method stub - + } @Override public void onTrialAccountFetched(boolean isTrial) { // TODO Auto-generated method stub - + } @Override public void onAccountFetched(boolean isExisting) { // TODO Auto-generated method stub - + } @Override public void onAccountEmailChanged(String result) { // TODO Auto-generated method stub - + } @Override public void onAccountPasswordChanged(String result) { // TODO Auto-generated method stub - + } @Override public void onRecoverPasswordLinkSent(String result) { // TODO Auto-generated method stub - + } @Override public void onActivateAccountLinkSent(String result) { // TODO Auto-generated method stub - + } @Override public void onAccountExpireUpdated(String result) { // TODO Auto-generated method stub - + } @Override public void onSignatureVerified(boolean success) { // TODO Auto-generated method stub - + } @Override public void onUsernameSent(String result) { // TODO Auto-generated method stub - + } - + @Override public void onRemoteProvisioningFilenameSent(String result) { // TODO Auto-generated method stub diff --git a/src/androidTest/org/linphone/AccountAssistant.java b/src/androidTest/org/linphone/AccountAssistant.java index af3397cff..c48997b4a 100644 --- a/src/androidTest/org/linphone/AccountAssistant.java +++ b/src/androidTest/org/linphone/AccountAssistant.java @@ -1,5 +1,24 @@ package org.linphone; +/* +AccountAssistant.java +Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + import junit.framework.Assert; import org.linphone.assistant.AssistantActivity; @@ -14,9 +33,6 @@ import android.widget.EditText; import android.widget.TextView; import android.widget.Button; -/** - * @author Sylvain Berfini - */ public class AccountAssistant extends SampleTest { @SmallTest diff --git a/src/androidTest/org/linphone/AccountManagement.java b/src/androidTest/org/linphone/AccountManagement.java index b87a2f2f0..c21eaf453 100644 --- a/src/androidTest/org/linphone/AccountManagement.java +++ b/src/androidTest/org/linphone/AccountManagement.java @@ -1,5 +1,24 @@ package org.linphone; +/* +AccountManagement.java +Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + import junit.framework.Assert; import org.linphone.FragmentsAvailable; @@ -9,9 +28,7 @@ import org.linphone.LinphonePreferences; import org.linphone.core.LinphoneProxyConfig; import android.test.suitebuilder.annotation.LargeTest; -/** - * @author Sylvain Berfini - */ + public class AccountManagement extends SampleTest { @LargeTest diff --git a/src/androidTest/org/linphone/AinitTestEnv.java b/src/androidTest/org/linphone/AinitTestEnv.java index 1ec9a6dfc..1daa95d39 100644 --- a/src/androidTest/org/linphone/AinitTestEnv.java +++ b/src/androidTest/org/linphone/AinitTestEnv.java @@ -1,14 +1,30 @@ package org.linphone; +/* +AinitTestEnv.java +Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + import junit.framework.Assert; import android.test.suitebuilder.annotation.LargeTest; import android.test.suitebuilder.annotation.MediumTest; import android.test.suitebuilder.annotation.SmallTest; -/** - * @author Sylvain Berfini - */ public class AinitTestEnv extends SampleTest { @SmallTest diff --git a/src/androidTest/org/linphone/CallsAudio.java b/src/androidTest/org/linphone/CallsAudio.java index f8a6f5494..39d8da491 100644 --- a/src/androidTest/org/linphone/CallsAudio.java +++ b/src/androidTest/org/linphone/CallsAudio.java @@ -1,5 +1,24 @@ package org.linphone; +/* +CallsAudio.java +Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + import junit.framework.Assert; import org.linphone.core.LinphoneCall; @@ -18,9 +37,6 @@ import static android.test.TouchUtils.dragViewToX; import static android.view.Gravity.CENTER_HORIZONTAL; import static android.view.Gravity.CENTER_VERTICAL; -/** - * @author Sylvain Berfini - */ public class CallsAudio extends SampleTest { @SmallTest diff --git a/src/androidTest/org/linphone/CallsVideo.java b/src/androidTest/org/linphone/CallsVideo.java index 1c1ea1953..5eaa257f1 100644 --- a/src/androidTest/org/linphone/CallsVideo.java +++ b/src/androidTest/org/linphone/CallsVideo.java @@ -1,5 +1,24 @@ package org.linphone; +/* +CallsVideo.java +Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + import junit.framework.Assert; import org.linphone.CallActivity; @@ -24,9 +43,6 @@ import static android.test.TouchUtils.dragViewToX; import static android.view.Gravity.CENTER_HORIZONTAL; import static android.view.Gravity.CENTER_VERTICAL; -/** - * @author Sylvain Berfini - */ public class CallsVideo extends SampleTest { @SmallTest diff --git a/src/androidTest/org/linphone/Chat.java b/src/androidTest/org/linphone/Chat.java index 5f8d6abd8..7b8bdd4dc 100644 --- a/src/androidTest/org/linphone/Chat.java +++ b/src/androidTest/org/linphone/Chat.java @@ -1,5 +1,24 @@ package org.linphone; +/* +Chat.java +Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + import junit.framework.Assert; import org.linphone.LinphoneActivity; @@ -16,10 +35,6 @@ import android.test.suitebuilder.annotation.SmallTest; import android.widget.EditText; import android.widget.AutoCompleteTextView; - -/** - * @author Sylvain Berfini - */ public class Chat extends SampleTest { @SmallTest diff --git a/src/androidTest/org/linphone/ConferenceAndMultiCall.java b/src/androidTest/org/linphone/ConferenceAndMultiCall.java index 7f8def150..b70c6aeb0 100644 --- a/src/androidTest/org/linphone/ConferenceAndMultiCall.java +++ b/src/androidTest/org/linphone/ConferenceAndMultiCall.java @@ -1,13 +1,27 @@ package org.linphone; -import java.util.ArrayList; +/* +ConferenceAndMultiCall.java +Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ import junit.framework.Assert; -import org.linphone.CallActivity; -import org.linphone.CallIncomingActivity; -import org.linphone.LinphoneActivity; -import org.linphone.LinphoneManager; + import org.linphone.core.LinphoneCall; import org.linphone.core.LinphoneCoreException; import org.linphone.mediastream.Log; @@ -15,9 +29,7 @@ import org.linphone.mediastream.Log; import android.test.suitebuilder.annotation.LargeTest; import android.test.suitebuilder.annotation.MediumTest; import android.test.suitebuilder.annotation.SmallTest; -import android.util.DisplayMetrics; import android.view.Gravity; -import android.view.View; import static android.test.TouchUtils.dragViewToX; diff --git a/src/androidTest/org/linphone/Contacts.java b/src/androidTest/org/linphone/Contacts.java index f6b862624..c0a8ddde8 100644 --- a/src/androidTest/org/linphone/Contacts.java +++ b/src/androidTest/org/linphone/Contacts.java @@ -1,5 +1,24 @@ package org.linphone; +/* +Contacts.java +Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + import junit.framework.Assert; @@ -7,9 +26,6 @@ import android.test.suitebuilder.annotation.LargeTest; import android.test.suitebuilder.annotation.MediumTest; import android.test.suitebuilder.annotation.SmallTest; -/** - * @author Sylvain Berfini - */ public class Contacts extends SampleTest { @MediumTest diff --git a/src/androidTest/org/linphone/History.java b/src/androidTest/org/linphone/History.java index d1d52b305..1a82dca17 100644 --- a/src/androidTest/org/linphone/History.java +++ b/src/androidTest/org/linphone/History.java @@ -1,5 +1,24 @@ package org.linphone; +/* +History.java +Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + import junit.framework.Assert; import org.linphone.CallActivity; @@ -10,9 +29,6 @@ import android.test.suitebuilder.annotation.LargeTest; import android.test.suitebuilder.annotation.MediumTest; import android.test.suitebuilder.annotation.SmallTest; -/** - * @author Sylvain Berfini - */ public class History extends SampleTest { @SmallTest diff --git a/src/androidTest/org/linphone/LinphoneTestManager.java b/src/androidTest/org/linphone/LinphoneTestManager.java index 628676013..a662980f5 100644 --- a/src/androidTest/org/linphone/LinphoneTestManager.java +++ b/src/androidTest/org/linphone/LinphoneTestManager.java @@ -1,5 +1,24 @@ package org.linphone; +/* +LinphoneTestManager.java +Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + import java.nio.ByteBuffer; import java.util.Timer; import java.util.TimerTask; diff --git a/src/androidTest/org/linphone/SampleTest.java b/src/androidTest/org/linphone/SampleTest.java index 27f420aa3..cd400106f 100644 --- a/src/androidTest/org/linphone/SampleTest.java +++ b/src/androidTest/org/linphone/SampleTest.java @@ -1,5 +1,24 @@ package org.linphone; +/* +SampleTest.java +Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + import org.linphone.core.LinphoneCall; import org.linphone.core.LinphoneCall.State; import org.linphone.core.LinphoneCore; @@ -13,9 +32,6 @@ import android.widget.ListView; import com.robotium.solo.Condition; import com.robotium.solo.Solo; -/** - * @author Sylvain Berfini - */ public abstract class SampleTest extends ActivityInstrumentationTestCase2{ protected final int STRING_LENGTH_MAX = 20; diff --git a/src/androidTest/org/linphone/Transfer.java b/src/androidTest/org/linphone/Transfer.java index 7a41cfba0..ee2487cd1 100644 --- a/src/androidTest/org/linphone/Transfer.java +++ b/src/androidTest/org/linphone/Transfer.java @@ -1,5 +1,24 @@ package org.linphone; +/* +Transfer.java +Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + import junit.framework.Assert; import org.linphone.CallActivity; From c8327a70d65e7b94aa9a95855dd99cf0ac337aa5 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 6 Oct 2017 13:41:21 +0200 Subject: [PATCH 45/72] Fix reference counting model of LinphoneChatMessage and its listener --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index 7e2a6a56f..145b05ee8 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 7e2a6a56fa6a70a6ec3875cea26f1f1e17910917 +Subproject commit 145b05ee8dddeca71518f327a69b474ac048f77a From 9b2936f10fc2e7fd5b1e5fa4481a47d1d5f5b5e4 Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Fri, 6 Oct 2017 15:07:45 +0200 Subject: [PATCH 46/72] Update version number --- AndroidManifest.xml | 2 +- AndroidManifestLibrary.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 8ccb8068b..ae3a76605 100755 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -2,7 +2,7 @@ Date: Sat, 7 Oct 2017 12:31:25 +0200 Subject: [PATCH 47/72] update submodules (framerate control fix) --- submodules/bctoolbox | 2 +- submodules/belle-sip | 2 +- submodules/mediastreamer2 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/submodules/bctoolbox b/submodules/bctoolbox index 02caea7df..f479ecd07 160000 --- a/submodules/bctoolbox +++ b/submodules/bctoolbox @@ -1 +1 @@ -Subproject commit 02caea7df8381b0c5dadcfbfd39ff0b33a2577b7 +Subproject commit f479ecd07f5ed8577afec2c36bb9efbdbe0317be diff --git a/submodules/belle-sip b/submodules/belle-sip index a33fb9dcf..e4e6459e0 160000 --- a/submodules/belle-sip +++ b/submodules/belle-sip @@ -1 +1 @@ -Subproject commit a33fb9dcfb4c1e111265798556d7f698e2a22720 +Subproject commit e4e6459e0ed148e2e3ad2394b8acf4743bde8c36 diff --git a/submodules/mediastreamer2 b/submodules/mediastreamer2 index 410fca273..7666b7580 160000 --- a/submodules/mediastreamer2 +++ b/submodules/mediastreamer2 @@ -1 +1 @@ -Subproject commit 410fca273a8cf0de5992cd2c0d84bbb8e297a097 +Subproject commit 7666b75803e8aa3df88183a40ec4f6b8a04f2018 From 167586c4729bc4de00aa9686ad90963c8f073f18 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Sun, 8 Oct 2017 19:09:43 +0200 Subject: [PATCH 48/72] Fix non-escaped string passed as a regexp, which was causing crashes. --- src/android/org/linphone/ChatFragment.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/android/org/linphone/ChatFragment.java b/src/android/org/linphone/ChatFragment.java index 90c49d7e9..0811b2045 100644 --- a/src/android/org/linphone/ChatFragment.java +++ b/src/android/org/linphone/ChatFragment.java @@ -101,6 +101,7 @@ import java.util.Arrays; import java.util.Calendar; import java.util.List; import java.util.Locale; +import java.util.regex.Pattern; import static android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION; import static org.linphone.FragmentsAvailable.CHAT; @@ -1782,14 +1783,14 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC int indexFinHttp = text.indexOf(" ", indexHttp) == -1 ? text.length() : text.indexOf(" ", indexHttp); String link = text.substring(indexHttp, indexFinHttp); String linkWithoutScheme = link.replace("http://", ""); - text = text.replaceFirst(link, "" + linkWithoutScheme + ""); + text = text.replaceFirst(Pattern.quote(link), "" + linkWithoutScheme + ""); } if (text.contains("https://")) { int indexHttp = text.indexOf("https://"); int indexFinHttp = text.indexOf(" ", indexHttp) == -1 ? text.length() : text.indexOf(" ", indexHttp); String link = text.substring(indexHttp, indexFinHttp); String linkWithoutScheme = link.replace("https://", ""); - text = text.replaceFirst(link, "" + linkWithoutScheme + ""); + text = text.replaceFirst(Pattern.quote(link), "" + linkWithoutScheme + ""); } return Compatibility.fromHtml(text); From a2bc717d8c28e4239411857bf5ab33e7ffa67c64 Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Wed, 11 Oct 2017 11:20:03 +0200 Subject: [PATCH 49/72] Updates bcmatroska2 --- submodules/bcmatroska2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/bcmatroska2 b/submodules/bcmatroska2 index 46f30179f..f4b87c521 160000 --- a/submodules/bcmatroska2 +++ b/submodules/bcmatroska2 @@ -1 +1 @@ -Subproject commit 46f30179fcc9d00f35f7d0ef8eacce0a204e4d07 +Subproject commit f4b87c521a513b540f34a72ef82a52364929d0be From 71a8005f55aef04db31a3ec0924069639ca0ac27 Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Wed, 11 Oct 2017 12:13:17 +0200 Subject: [PATCH 50/72] [DoubleCall] fix GSM/SIP double call behavior --- src/android/org/linphone/LinphoneService.java | 3 ++- src/android/org/linphone/PhoneStateChangedReceiver.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/android/org/linphone/LinphoneService.java b/src/android/org/linphone/LinphoneService.java index 6f27440df..67b86a5ff 100644 --- a/src/android/org/linphone/LinphoneService.java +++ b/src/android/org/linphone/LinphoneService.java @@ -345,7 +345,8 @@ public final class LinphoneService extends Service { } if (state == LinphoneCall.State.IncomingReceived) { - onIncomingReceived(); + if(! LinphoneManager.getInstance().getCallGsmON()) + onIncomingReceived(); } if (state == State.CallEnd || state == State.CallReleased || state == State.Error) { diff --git a/src/android/org/linphone/PhoneStateChangedReceiver.java b/src/android/org/linphone/PhoneStateChangedReceiver.java index e266374a8..c20fdae7f 100644 --- a/src/android/org/linphone/PhoneStateChangedReceiver.java +++ b/src/android/org/linphone/PhoneStateChangedReceiver.java @@ -35,7 +35,7 @@ public class PhoneStateChangedReceiver extends BroadcastReceiver { if (!LinphoneManager.isInstanciated()) return; - if (TelephonyManager.EXTRA_STATE_OFFHOOK.equals(extraState)) { + if (TelephonyManager.EXTRA_STATE_OFFHOOK.equals(extraState) || TelephonyManager.EXTRA_STATE_RINGING.equals(extraState)) { LinphoneManager.getInstance().setCallGsmON(true); LinphoneManager.getLc().pauseAllCalls(); } else if (TelephonyManager.EXTRA_STATE_IDLE.equals(extraState)) { From 445b95e7121139ec5b51f50df7e5e968e9a97883 Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Wed, 11 Oct 2017 15:33:20 +0200 Subject: [PATCH 51/72] [File sharing] fix Camera Image picking on Samsung devices --- src/android/org/linphone/ChatFragment.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/android/org/linphone/ChatFragment.java b/src/android/org/linphone/ChatFragment.java index 0811b2045..eb97f330d 100644 --- a/src/android/org/linphone/ChatFragment.java +++ b/src/android/org/linphone/ChatFragment.java @@ -1095,12 +1095,10 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); } - String fileName = path.substring(path.lastIndexOf("/") + 1); String extension = LinphoneUtils.getExtensionFromFileName(fileName); LinphoneContent content = LinphoneCoreFactory.instance().createLinphoneContent("image", extension, result, null); content.setName(fileName); - LinphoneChatMessage message = chatRoom.createFileTransferMessage(content); message.setListener(LinphoneManager.getInstance()); message.setAppData(path); @@ -1198,7 +1196,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC super.onActivityResult(requestCode, resultCode, data); } } else { - LinphoneActivity.instance().displayCustomToast("Something wrong happened", Toast.LENGTH_LONG); + if (LinphoneUtils.isExtensionImage(imageToUploadUri.getPath())) + sendImageMessage(imageToUploadUri.getPath(), 0); } } From ede40ca6d18ad59fa5340c6d143452e8c7200a90 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 11 Oct 2017 15:43:30 +0200 Subject: [PATCH 52/72] Updated submodules + added xerces/xsd --- .gitmodules | 6 ++++++ submodules/belle-sip | 2 +- submodules/cmake-builder | 2 +- submodules/externals/libxsd | 1 + submodules/externals/xerces-c | 1 + submodules/linphone | 2 +- 6 files changed, 11 insertions(+), 3 deletions(-) create mode 160000 submodules/externals/libxsd create mode 160000 submodules/externals/xerces-c diff --git a/.gitmodules b/.gitmodules index 55cee76e4..6a06d889f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -112,3 +112,9 @@ [submodule "submodules/bcmatroska2"] path = submodules/bcmatroska2 url = git://git.linphone.org/bcmatroska2.git +[submodule "submodules/externals/xerces-c"] + path = submodules/externals/xerces-c + url = git://git.linphone.org/xerces-c.git +[submodule "submodules/externals/libxsd"] + path = submodules/externals/libxsd + url = git://git.linphone.org/libxsd diff --git a/submodules/belle-sip b/submodules/belle-sip index e4e6459e0..e3b9709cc 160000 --- a/submodules/belle-sip +++ b/submodules/belle-sip @@ -1 +1 @@ -Subproject commit e4e6459e0ed148e2e3ad2394b8acf4743bde8c36 +Subproject commit e3b9709cc5c01250aa944a7cb6f8abbee885113f diff --git a/submodules/cmake-builder b/submodules/cmake-builder index 935fc3a60..270a5b24f 160000 --- a/submodules/cmake-builder +++ b/submodules/cmake-builder @@ -1 +1 @@ -Subproject commit 935fc3a6034ed1b8f9abc4d6198aa525614c9f8c +Subproject commit 270a5b24f22ba9c715c391d25ac53d181c299597 diff --git a/submodules/externals/libxsd b/submodules/externals/libxsd new file mode 160000 index 000000000..97dfa5b7a --- /dev/null +++ b/submodules/externals/libxsd @@ -0,0 +1 @@ +Subproject commit 97dfa5b7af486a2730aa66ef4b2b04259c9ab21b diff --git a/submodules/externals/xerces-c b/submodules/externals/xerces-c new file mode 160000 index 000000000..4a6d98d2a --- /dev/null +++ b/submodules/externals/xerces-c @@ -0,0 +1 @@ +Subproject commit 4a6d98d2ad797c37a9d12c1da772ca813c2f95b7 diff --git a/submodules/linphone b/submodules/linphone index 145b05ee8..9e73b3402 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 145b05ee8dddeca71518f327a69b474ac048f77a +Subproject commit 9e73b3402bcef27df12630f1a63f5a0ff5f2d666 From 2f73ed51bd92cd34b6ed2580c84b6ee05b45ce66 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 11 Oct 2017 17:41:16 +0200 Subject: [PATCH 53/72] Update submodules to fix build without new java wrapper --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index 9e73b3402..b744a8e02 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 9e73b3402bcef27df12630f1a63f5a0ff5f2d666 +Subproject commit b744a8e02516b3af583d6a3144e03e408228f0c8 From 2e00d7783ce306f35fc3a2fbd8c63b9e12abf530 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 12 Oct 2017 13:40:07 +0200 Subject: [PATCH 54/72] Compilation fixed --- src/android/org/linphone/CallActivity.java | 2 +- submodules/linphone | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/android/org/linphone/CallActivity.java b/src/android/org/linphone/CallActivity.java index 1bbdf2c17..3270e7f61 100644 --- a/src/android/org/linphone/CallActivity.java +++ b/src/android/org/linphone/CallActivity.java @@ -1618,7 +1618,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList String.valueOf((int) stats.getUploadBandwidth()) + " kbits/s"); if (isVideo) { formatText(edl, getString(R.string.call_stats_estimated_download), - String.valueOf((int) stats.getEstimatedDownloadBandwidth()) + " kbits/s"); + String.valueOf(0/*(int) stats.getEstimatedDownloadBandwidth()*/) + " kbits/s"); } formatText(ice, getString(R.string.call_stats_ice), stats.getIceState().toString()); diff --git a/submodules/linphone b/submodules/linphone index b744a8e02..d63af8a79 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit b744a8e02516b3af583d6a3144e03e408228f0c8 +Subproject commit d63af8a7991556d1384b94b014d3d2093fddd45c From 74b68c50fd985144cb34a8577bc601f14cf9daa1 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Mon, 16 Oct 2017 15:57:48 +0200 Subject: [PATCH 55/72] Updated linphone submodule --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index d63af8a79..0b95c162d 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit d63af8a7991556d1384b94b014d3d2093fddd45c +Subproject commit 0b95c162d35a743145dc945a535afb808245e07d From 312821c6b4eb2f784cf937d96aa34d508e2cc0fd Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Mon, 16 Oct 2017 17:47:11 +0200 Subject: [PATCH 56/72] Yet another linphone submodule update --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index 0b95c162d..e10297ba6 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 0b95c162d35a743145dc945a535afb808245e07d +Subproject commit e10297ba6df500b3154f539b11e4c44ded4a227a From 857c0ed130724225b06a9297d75f9f2ce3dc8c92 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 17 Oct 2017 19:57:58 +0200 Subject: [PATCH 57/72] Started migration of Android app to new JNI/Java wrapper --- build.gradle | 6 +- src/android/org/linphone/AboutFragment.java | 26 +- .../linphone/AccountPreferencesFragment.java | 74 +-- .../org/linphone/BandwidthManager.java | 14 +- src/android/org/linphone/BootReceiver.java | 10 +- src/android/org/linphone/CallActivity.java | 230 ++++--- .../org/linphone/CallIncomingActivity.java | 40 +- src/android/org/linphone/CallManager.java | 44 +- .../org/linphone/CallOutgoingActivity.java | 40 +- .../org/linphone/CallVideoFragment.java | 28 +- src/android/org/linphone/ChatFragment.java | 225 +++---- .../org/linphone/ChatListFragment.java | 43 +- .../org/linphone/ContactDetailsFragment.java | 6 +- .../org/linphone/ContactsListFragment.java | 4 +- src/android/org/linphone/ContactsManager.java | 89 +-- src/android/org/linphone/DialerFragment.java | 10 +- src/android/org/linphone/DozeReceiver.java | 10 +- .../org/linphone/HistoryDetailFragment.java | 24 +- .../org/linphone/HistoryListFragment.java | 53 +- src/android/org/linphone/HookReceiver.java | 4 +- .../org/linphone/KeepAliveReceiver.java | 10 +- .../org/linphone/LinphoneActivity.java | 158 +++-- src/android/org/linphone/LinphoneContact.java | 99 ++- .../org/linphone/LinphoneException.java | 2 +- .../linphone/LinphoneLauncherActivity.java | 5 +- src/android/org/linphone/LinphoneManager.java | 588 +++++++++--------- .../org/linphone/LinphonePreferences.java | 501 +++++++-------- src/android/org/linphone/LinphoneService.java | 102 ++- src/android/org/linphone/LinphoneUtils.java | 202 +++--- .../org/linphone/PreferencesMigrator.java | 30 +- .../org/linphone/SettingsFragment.java | 212 +++---- src/android/org/linphone/StatusFragment.java | 84 +-- .../linphone/assistant/AssistantActivity.java | 233 ++++--- .../assistant/CodecDownloaderFragment.java | 12 +- .../CreateAccountActivationFragment.java | 37 +- .../CreateAccountCodeActivationFragment.java | 42 +- .../assistant/CreateAccountFragment.java | 97 ++- .../EchoCancellerCalibrationFragment.java | 40 +- .../assistant/LinphoneLoginFragment.java | 69 +- .../org/linphone/assistant/LoginFragment.java | 8 +- .../assistant/RemoteProvisioningActivity.java | 22 +- .../assistant/RemoteProvisioningFragment.java | 4 +- .../RemoteProvisioningLoginActivity.java | 28 +- src/android/org/linphone/gcm/GCMService.java | 8 +- .../purchase/InAppPurchaseFragment.java | 6 +- src/android/org/linphone/ui/CallButton.java | 29 +- src/android/org/linphone/ui/Digit.java | 20 +- .../org/linphone/ui/LinphoneOverlay.java | 16 +- .../org/linphone/ui/SlidingDrawer.java | 1 + .../org/linphone/xmlrpc/XmlRpcHelper.java | 164 ++--- submodules/linphone | 2 +- .../AndroidTutorialNotifier.java | 4 +- .../TutorialBuddyStatusActivity.java | 14 +- .../TutorialCardDavSync.java | 200 +++--- .../TutorialChatRoomActivity.java | 14 +- .../TutorialHelloWorldActivity.java | 14 +- .../TutorialLauncherActivity.java | 4 +- .../TutorialRegistrationActivity.java | 14 +- 58 files changed, 2007 insertions(+), 2068 deletions(-) rename {src/android/org/linphone/tutorials => tutorials}/AndroidTutorialNotifier.java (100%) rename {src/android/org/linphone/tutorials => tutorials}/TutorialBuddyStatusActivity.java (97%) rename {src/android/org/linphone/tutorials => tutorials}/TutorialCardDavSync.java (55%) rename {src/android/org/linphone/tutorials => tutorials}/TutorialChatRoomActivity.java (97%) rename {src/android/org/linphone/tutorials => tutorials}/TutorialHelloWorldActivity.java (97%) rename {src/android/org/linphone/tutorials => tutorials}/TutorialLauncherActivity.java (100%) rename {src/android/org/linphone/tutorials => tutorials}/TutorialRegistrationActivity.java (97%) diff --git a/build.gradle b/build.gradle index bcd525310..5e5b3cc8d 100644 --- a/build.gradle +++ b/build.gradle @@ -58,10 +58,7 @@ if (firebaseEnable()) { //// Submodule Dir ///// def submoduleDir = ['submodules/mediastreamer2/java/src', - 'submodules/linphone/java/j2se', - 'submodules/linphone/java/common', - 'submodules/linphone/java/impl', - 'submodules/linphone/coreapi/help/examples/java'] + 'liblinphone-sdk/android-arm64/share/linphonej/java/'] //////////////////////// ///// Exclude Files ///// @@ -75,6 +72,7 @@ if (!firebaseEnable()) { println '[Push Notification] Firebase enabled' } excludeFiles.add('**/mediastream/MediastreamerActivity.java') +excludeFiles.add('src/android/org/linphone/tutorials/*.java') def excludePackage = [] diff --git a/src/android/org/linphone/AboutFragment.java b/src/android/org/linphone/AboutFragment.java index 20c4a369c..dbb29d918 100644 --- a/src/android/org/linphone/AboutFragment.java +++ b/src/android/org/linphone/AboutFragment.java @@ -18,9 +18,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import org.linphone.core.LinphoneCore; -import org.linphone.core.LinphoneCore.LogCollectionUploadState; -import org.linphone.core.LinphoneCoreListenerBase; +import org.linphone.core.Core; +import org.linphone.core.Core.LogCollectionUploadState; +import org.linphone.core.CoreListenerStub; import org.linphone.mediastream.Log; import android.app.Fragment; @@ -44,7 +44,7 @@ public class AboutFragment extends Fragment implements OnClickListener { View sendLogButton = null; View resetLogButton = null; ImageView cancel; - LinphoneCoreListenerBase mListener; + CoreListenerStub mListener; private ProgressDialog progress; private boolean uploadInProgress; @@ -72,19 +72,19 @@ public class AboutFragment extends Fragment implements OnClickListener { resetLogButton.setOnClickListener(this); resetLogButton.setVisibility(LinphonePreferences.instance().isDebugEnabled() ? View.VISIBLE : View.GONE); - mListener = new LinphoneCoreListenerBase() { + mListener = new CoreListenerStub() { @Override - public void uploadProgressIndication(LinphoneCore lc, int offset, int total) { + public void onLogCollectionUploadProgressIndication(Core lc, int offset, int total) { } @Override - public void uploadStateChanged(LinphoneCore lc, LogCollectionUploadState state, String info) { - if (state == LogCollectionUploadState.LogCollectionUploadStateInProgress) { + public void onLogCollectionUploadStateChanged(Core lc, LogCollectionUploadState state, String info) { + if (state == LogCollectionUploadState.InProgress) { displayUploadLogsInProgress(); - } else if (state == LogCollectionUploadState.LogCollectionUploadStateDelivered || state == LogCollectionUploadState.LogCollectionUploadStateNotDelivered) { + } else if (state == LogCollectionUploadState.Delivered || state == LogCollectionUploadState.NotDelivered) { uploadInProgress = false; if (progress != null) progress.dismiss(); - if (state == LogCollectionUploadState.LogCollectionUploadStateDelivered) { + if (state == LogCollectionUploadState.Delivered) { sendLogs(LinphoneService.instance().getApplicationContext(), info); } } @@ -127,7 +127,7 @@ public class AboutFragment extends Fragment implements OnClickListener { @Override public void onPause() { - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.removeListener(mListener); } @@ -137,7 +137,7 @@ public class AboutFragment extends Fragment implements OnClickListener { @Override public void onResume() { - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.addListener(mListener); } @@ -152,7 +152,7 @@ public class AboutFragment extends Fragment implements OnClickListener { @Override public void onClick(View v) { if (LinphoneActivity.isInstanciated()) { - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (v == sendLogButton) { if (lc != null) { lc.uploadLogCollection(); diff --git a/src/android/org/linphone/AccountPreferencesFragment.java b/src/android/org/linphone/AccountPreferencesFragment.java index 846748cee..85136fa6e 100644 --- a/src/android/org/linphone/AccountPreferencesFragment.java +++ b/src/android/org/linphone/AccountPreferencesFragment.java @@ -23,11 +23,12 @@ import java.util.List; import org.linphone.LinphonePreferences.AccountBuilder; import org.linphone.assistant.AssistantActivity; -import org.linphone.core.LinphoneAccountCreator; -import org.linphone.core.LinphoneCoreException; -import org.linphone.core.LinphoneCoreFactory; -import org.linphone.core.LinphoneNatPolicy; -import org.linphone.core.LinphoneProxyConfig; +import org.linphone.core.AccountCreator; +import org.linphone.core.AccountCreatorListener; +import org.linphone.core.CoreException; +import org.linphone.core.Factory; +import org.linphone.core.NatPolicy; +import org.linphone.core.ProxyConfig; import org.linphone.mediastream.Log; import org.linphone.ui.PreferencesListFragment; @@ -53,14 +54,14 @@ import android.view.WindowManager; import android.widget.CheckBox; import android.widget.EditText; -public class AccountPreferencesFragment extends PreferencesListFragment implements LinphoneAccountCreator.LinphoneAccountCreatorListener { +public class AccountPreferencesFragment extends PreferencesListFragment implements AccountCreatorListener { private int n; private boolean isNewAccount=false; private LinphonePreferences mPrefs; private EditTextPreference mProxyPreference; private ListPreference mTransportPreference; private AccountBuilder builder; - private LinphoneAccountCreator accountCreator; + private AccountCreator accountCreator; private ProgressDialog progress; public AccountPreferencesFragment() { @@ -104,7 +105,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen @Override public boolean onPreferenceChange(Preference preference, Object newValue) { if (isNewAccount) { - builder.setUserId(newValue.toString()); + builder.setUserid(newValue.toString()); } else { mPrefs.setAccountUserId(n, newValue.toString()); } @@ -154,7 +155,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen public boolean onPreferenceChange(Preference preference, Object newValue) { String value = newValue.toString(); if (isNewAccount) { - builder.setProxy(newValue.toString()); + builder.setServerAddr(newValue.toString()); preference.setSummary(newValue.toString()); } else { mPrefs.setAccountProxy(n, value); @@ -211,7 +212,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen if (isNewAccount) { builder.setAvpfEnabled(value); } else { - mPrefs.enableAvpf(n, value); + mPrefs.setAvpfMode(n, value); } return true; } @@ -229,7 +230,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen if (isNewAccount) { //TODO } else { - mPrefs.setAvpfRRInterval(n, value); + mPrefs.setAvpfRrInterval(n, value); } preference.setSummary(value); return true; @@ -320,11 +321,11 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen private void initAccountPreferencesFields(PreferenceScreen parent) { boolean isDefaultAccount = mPrefs.getDefaultAccountIndex() == n; - LinphoneNatPolicy natPolicy = null; + NatPolicy natPolicy = null; if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null && LinphoneManager.getLc().getProxyConfigList() != null && LinphoneManager.getLc().getProxyConfigList().length > n) { - LinphoneProxyConfig proxy = LinphoneManager.getLc().getProxyConfigList()[n]; + ProxyConfig proxy = LinphoneManager.getLc().getProxyConfigList()[n]; natPolicy = proxy.getNatPolicy(); if (natPolicy == null) { natPolicy = LinphoneManager.getLc().createNatPolicy(); @@ -334,8 +335,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen } } - accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc() - , LinphonePreferences.instance().getXmlrpcUrl()); + accountCreator = LinphoneManager.getLc().createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl()); accountCreator.setListener(this); PreferenceCategory account = (PreferenceCategory) getPreferenceScreen().findPreference(getString(R.string.pref_sipaccount_key)); @@ -430,8 +430,8 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen EditTextPreference avpfRRInterval = (EditTextPreference) advanced.getPreference(8); avpfRRInterval.setOnPreferenceChangeListener(avpfRRIntervalChangedListener); if (!isNewAccount){ - avpfRRInterval.setText(mPrefs.getAvpfRRInterval(n)); - avpfRRInterval.setSummary(mPrefs.getAvpfRRInterval(n)); + avpfRRInterval.setText(mPrefs.getAvpfRrInterval(n)); + avpfRRInterval.setSummary(mPrefs.getAvpfRrInterval(n)); } CheckBoxPreference escape = (CheckBoxPreference) advanced.getPreference(9); @@ -483,17 +483,17 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen dialog.dismiss(); } }); - alert.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { + /*alert.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - LinphoneAccountCreator.PasswordCheck status = accountCreator.setPassword(pass1.getText().toString()); - if (status.equals(LinphoneAccountCreator.PasswordCheck.Ok)) { + AccountCreator.PasswordStatus status = accountCreator.setPassword(pass1.getText().toString()); + if (status.equals(AccountCreator.PasswordStatus.Ok)) { if (pass1.getText().toString().compareTo(pass2.getText().toString()) == 0) { accountCreator.setUsername(mPrefs.getAccountUsername(n)); accountCreator.setHa1(mPrefs.getAccountHa1(n)); - LinphoneAccountCreator.RequestStatus req_status = accountCreator.updatePassword(pass1.getText().toString()); - if (!req_status.equals(LinphoneAccountCreator.RequestStatus.Ok)) { - LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(req_status) + AccountCreator.Status req_status = accountCreator.updatePassword(pass1.getText().toString()); + if (!req_status.equals(AccountCreator.Status.RequestOk)) { + LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(req_status) , LinphoneActivity.instance()); } else { progress = ProgressDialog.show(LinphoneActivity.instance(), null, null); @@ -512,7 +512,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen } LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForPasswordStatus(status), LinphoneActivity.instance()); } - }); + });*/ // TODO FIXME alert.setView(layout); alert.show(); @@ -587,7 +587,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen if(isNewAccount){ builder.saveNewAccount(); } - } catch (LinphoneCoreException e) { + } catch (CoreException e) { Log.e(e); } LinphoneActivity.instance().isNewProxyConfig(); @@ -597,58 +597,58 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen } @Override - public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onIsAccountExist(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onCreateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onActivateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onLinkAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onActivateAlias(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onIsAccountActivated(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onRecoverAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onIsAccountLinked(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onIsAliasUsed(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onUpdateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) { if (progress != null) progress.dismiss(); - if (status.equals(LinphoneAccountCreator.RequestStatus.Ok)) { + if (status.equals(AccountCreator.Status.RequestOk)) { mPrefs.setAccountPassword(n, accountCreator.getPassword()); PreferenceCategory account = (PreferenceCategory) getPreferenceScreen().findPreference(getString(R.string.pref_sipaccount_key)); ((EditTextPreference) account.getPreference(2)).setText(mPrefs.getAccountPassword(n)); LinphoneUtils.displayErrorAlert(getString(R.string.pref_password_changed), LinphoneActivity.instance()); } else { - LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status), LinphoneActivity.instance()); + LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status), LinphoneActivity.instance()); } } } diff --git a/src/android/org/linphone/BandwidthManager.java b/src/android/org/linphone/BandwidthManager.java index 3a4daf6bd..95be52c00 100644 --- a/src/android/org/linphone/BandwidthManager.java +++ b/src/android/org/linphone/BandwidthManager.java @@ -19,8 +19,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import org.linphone.core.LinphoneCallParams; -import org.linphone.core.LinphoneCore; +import org.linphone.core.CallParams; +import org.linphone.core.Core; public class BandwidthManager { @@ -47,15 +47,15 @@ public class BandwidthManager { } - public void updateWithProfileSettings(LinphoneCore lc, LinphoneCallParams callParams) { + public void updateWithProfileSettings(Core lc, CallParams callParams) { if (callParams != null) { // in call // Update video parm if if (!isVideoPossible()) { // NO VIDEO - callParams.setVideoEnabled(false); - callParams.setAudioBandwidth(40); + callParams.enableVideo(false); + callParams.setAudioBandwidthLimit(40); } else { - callParams.setVideoEnabled(true); - callParams.setAudioBandwidth(0); // disable limitation + callParams.enableVideo(true); + callParams.setAudioBandwidthLimit(0); // disable limitation } } } diff --git a/src/android/org/linphone/BootReceiver.java b/src/android/org/linphone/BootReceiver.java index 3ec7f2148..adbc15718 100644 --- a/src/android/org/linphone/BootReceiver.java +++ b/src/android/org/linphone/BootReceiver.java @@ -19,8 +19,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import org.linphone.core.LinphoneCoreFactory; -import org.linphone.core.LpConfig; +import org.linphone.core.Factory; +import org.linphone.core.Config; import org.linphone.mediastream.Log; import android.content.BroadcastReceiver; @@ -32,12 +32,10 @@ public class BootReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equalsIgnoreCase(Intent.ACTION_SHUTDOWN)) { - android.util.Log.d("LinphoneBootReceiver", "Device is shutting down, destroying LinphoneCore to unregister"); + android.util.Log.d("LinphoneBootReceiver", "Device is shutting down, destroying Core to unregister"); LinphoneManager.destroy(); } else { - String path = context.getFilesDir().getAbsolutePath() + "/.linphonerc"; - LpConfig lpConfig = LinphoneCoreFactory.instance().createLpConfig(path); - boolean autostart = lpConfig.getBool("app", "auto_start", false); + boolean autostart = LinphonePreferences.instance().isAutoStartEnabled(); android.util.Log.i("LinphoneBootReceiver", "Device is starting, auto_start is " + autostart); if (autostart) { Intent lLinphoneServiceIntent = new Intent(Intent.ACTION_MAIN); diff --git a/src/android/org/linphone/CallActivity.java b/src/android/org/linphone/CallActivity.java index 3270e7f61..e02625378 100644 --- a/src/android/org/linphone/CallActivity.java +++ b/src/android/org/linphone/CallActivity.java @@ -62,19 +62,20 @@ import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; -import org.linphone.core.LinphoneAddress; -import org.linphone.core.LinphoneCall; -import org.linphone.core.LinphoneCall.State; -import org.linphone.core.LinphoneCallParams; -import org.linphone.core.LinphoneCallStats; -import org.linphone.core.LinphoneCallStats.LinphoneAddressFamily; -import org.linphone.core.LinphoneChatMessage; -import org.linphone.core.LinphoneChatRoom; -import org.linphone.core.LinphoneCore; -import org.linphone.core.LinphoneCoreException; -import org.linphone.core.LinphoneCoreListenerBase; -import org.linphone.core.LinphonePlayer; +import org.linphone.core.Address; +import org.linphone.core.Call; +import org.linphone.core.Call.State; +import org.linphone.core.CallParams; +import org.linphone.core.CallStats; +import org.linphone.core.CallStats.AddressFamily; +import org.linphone.core.ChatMessage; +import org.linphone.core.ChatRoom; +import org.linphone.core.Core; +import org.linphone.core.CoreException; +import org.linphone.core.CoreListenerStub; +import org.linphone.core.Player; import org.linphone.core.PayloadType; +import org.linphone.core.StreamType; import org.linphone.mediastream.Log; import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration; import org.linphone.ui.Numpad; @@ -120,7 +121,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList private LayoutInflater inflater; private ViewGroup container; private boolean isConferenceRunning = false; - private LinphoneCoreListenerBase mListener; + private CoreListenerStub mListener; private DrawerLayout sideMenu; private Handler mHandler = new Handler(); @@ -156,14 +157,14 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList mEncoderTexts = new HashMap(); mDecoderTexts = new HashMap(); - mListener = new LinphoneCoreListenerBase() { + mListener = new CoreListenerStub() { @Override - public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) { + public void onMessageReceived(Core lc, ChatRoom cr, ChatMessage message) { displayMissedChats(); } @Override - public void callState(LinphoneCore lc, final LinphoneCall call, LinphoneCall.State state, String message) { + public void onCallStateChanged(Core lc, final Call call, Call.State state, String message) { if (LinphoneManager.getLc().getCallsNb() == 0) { if (status != null) { LinphoneService.instance().removeSasNotification(); @@ -186,7 +187,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList } else if (state == State.Resuming) { if(LinphonePreferences.instance().isVideoEnabled()){ status.refreshStatusItems(call, isVideoEnabled(call)); - if(call.getCurrentParams().getVideoEnabled()){ + if(call.getCurrentParams().videoEnabled()){ showVideoView(); } } @@ -201,21 +202,21 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList videoProgress.setVisibility(View.GONE); status.refreshStatusItems(call, isVideoEnabled(call)); } - } else if (state == State.CallUpdatedByRemote) { + } else if (state == State.UpdatedByRemote) { // If the correspondent proposes video while audio call boolean videoEnabled = LinphonePreferences.instance().isVideoEnabled(); if (!videoEnabled) { acceptCallUpdate(false); } - boolean remoteVideo = call.getRemoteParams().getVideoEnabled(); - boolean localVideo = call.getCurrentParams().getVideoEnabled(); + boolean remoteVideo = call.getRemoteParams().videoEnabled(); + boolean localVideo = call.getCurrentParams().videoEnabled(); boolean autoAcceptCameraPolicy = LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests(); - if (remoteVideo && !localVideo && !autoAcceptCameraPolicy && !LinphoneManager.getLc().isInConference()) { + if (remoteVideo && !localVideo && !autoAcceptCameraPolicy && !(LinphoneManager.getLc().getConference() != null)) { showAcceptCallUpdateDialog(); createTimerForDialog(SECONDS_BEFORE_DENYING_CALL_UPDATE); } -// else if (remoteVideo && !LinphoneManager.getLc().isInConference() && autoAcceptCameraPolicy) { +// else if (remoteVideo && !LinphoneManager.getLc().(getConference() != null) && autoAcceptCameraPolicy) { // mHandler.post(new Runnable() { // @Override // public void run() { @@ -230,12 +231,12 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList } @Override - public void callEncryptionChanged(LinphoneCore lc, final LinphoneCall call, boolean encrypted, String authenticationToken) { + public void onCallEncryptionChanged(Core lc, final Call call, boolean encrypted, String authenticationToken) { if (status != null) { - if(call.getCurrentParams().getMediaEncryption().equals(LinphoneCore.MediaEncryption.ZRTP) && !call.isAuthenticationTokenVerified()){ + if(call.getCurrentParams().getMediaEncryption().equals(Core.MediaEncryption.ZRTP) && !call.getAuthenticationTokenVerified()){ status.showZRTPDialog(call); } - status.refreshStatusItems(call, call.getCurrentParams().getVideoEnabled()); + status.refreshStatusItems(call, call.getCurrentParams().videoEnabled()); } } @@ -245,7 +246,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList initUI(); if (LinphoneManager.getLc().getCallsNb() > 0) { - LinphoneCall call = LinphoneManager.getLc().getCalls()[0]; + Call call = LinphoneManager.getLc().getCalls()[0]; if (LinphoneUtils.isCallEstablished(call)) { enableAndRefreshInCallActions(); @@ -267,8 +268,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList refreshInCallActions(); return; } else { - isSpeakerEnabled = LinphoneManager.getLc().isSpeakerEnabled(); - isMicMuted = LinphoneManager.getLc().isMicMuted(); + isSpeakerEnabled = LinphoneManager.getInstance().isSpeakerEnabled(); + isMicMuted = !LinphoneManager.getLc().micEnabled(); } Fragment callFragment; @@ -307,17 +308,17 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList }.start(); } - private boolean isVideoEnabled(LinphoneCall call) { + private boolean isVideoEnabled(Call call) { if(call != null){ - return call.getCurrentParams().getVideoEnabled(); + return call.getCurrentParams().videoEnabled(); } return false; } @Override protected void onSaveInstanceState(Bundle outState) { - outState.putBoolean("Speaker", LinphoneManager.getLc().isSpeakerEnabled()); - outState.putBoolean("Mic", LinphoneManager.getLc().isMicMuted()); + outState.putBoolean("Speaker", LinphoneManager.getInstance().isSpeakerEnabled()); + outState.putBoolean("Mic", !LinphoneManager.getLc().micEnabled()); outState.putBoolean("VideoCallPaused", isVideoCallPaused); outState.putBoolean("AskingVideo", isVideoAsk); outState.putLong("TimeRemind", TimeRemind); @@ -573,8 +574,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList private void enableAndRefreshInCallActions() { int confsize = 0; - if(LinphoneManager.getLc().isInConference()) { - confsize = LinphoneManager.getLc().getConferenceSize() - (LinphoneManager.getLc().isInConference() ? 1 : 0); + if( LinphoneManager.getLc().getConference() != null) { + confsize = LinphoneManager.getLc().getConferenceSize() - (LinphoneManager.getLc().getConference() != null ? 1 : 0); } //Enabled transfer button @@ -706,7 +707,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList } else if (id == R.id.call_pause) { - LinphoneCall call = (LinphoneCall) v.getTag(); + Call call = (Call) v.getTag(); pauseOrResumeCall(call); } else if (id == R.id.conference_pause) { @@ -749,18 +750,18 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList } private void disableVideo(final boolean videoDisabled) { - final LinphoneCall call = LinphoneManager.getLc().getCurrentCall(); + final Call call = LinphoneManager.getLc().getCurrentCall(); if (call == null) { return; } if (videoDisabled) { - LinphoneCallParams params = LinphoneManager.getLc().createCallParams(call); - params.setVideoEnabled(false); + CallParams params = LinphoneManager.getLc().createCallParams(call); + params.enableVideo(false); LinphoneManager.getLc().updateCall(call, params); } else { videoProgress.setVisibility(View.VISIBLE); - if (call.getRemoteParams() != null && !call.getRemoteParams().isLowBandwidthEnabled()) { + if (call.getRemoteParams() != null && !call.getRemoteParams().lowBandwidthEnabled()) { LinphoneManager.getInstance().addVideo(); } else { displayCustomToast(getString(R.string.error_low_bandwidth), Toast.LENGTH_LONG); @@ -783,18 +784,18 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList } private void switchVideo(final boolean displayVideo) { - final LinphoneCall call = LinphoneManager.getLc().getCurrentCall(); + final Call call = LinphoneManager.getLc().getCurrentCall(); if (call == null) { return; } //Check if the call is not terminated - if(call.getState() == State.CallEnd || call.getState() == State.CallReleased) return; + if(call.getState() == State.End || call.getState() == State.Released) return; if (!displayVideo) { showAudioView(); } else { - if (!call.getRemoteParams().isLowBandwidthEnabled()) { + if (!call.getRemoteParams().lowBandwidthEnabled()) { LinphoneManager.getInstance().addVideo(); if (videoCallFragment == null || !videoCallFragment.isVisible()) showVideoView(); @@ -879,9 +880,9 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList } private void toggleMicro() { - LinphoneCore lc = LinphoneManager.getLc(); + Core lc = LinphoneManager.getLc(); isMicMuted = !isMicMuted; - lc.muteMic(isMicMuted); + lc.enableMic(!isMicMuted); if (isMicMuted) { micro.setImageResource(R.drawable.micro_selected); } else { @@ -897,7 +898,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList if (isSpeakerEnabled) { LinphoneManager.getInstance().routeAudioToSpeaker(); speaker.setImageResource(R.drawable.speaker_selected); - LinphoneManager.getLc().enableSpeaker(isSpeakerEnabled); + LinphoneManager.getInstance().enableSpeaker(isSpeakerEnabled); } else { Log.d("Toggle speaker off, routing back to earpiece"); LinphoneManager.getInstance().routeAudioToReceiver(); @@ -905,8 +906,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList } } - public void pauseOrResumeCall(LinphoneCall call) { - LinphoneCore lc = LinphoneManager.getLc(); + public void pauseOrResumeCall(Call call) { + Core lc = LinphoneManager.getLc(); if (call != null && LinphoneManager.getLc().getCurrentCall() == call) { lc.pauseCall(call); if (isVideoEnabled(LinphoneManager.getLc().getCurrentCall())) { @@ -925,12 +926,12 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList } private void hangUp() { - LinphoneCore lc = LinphoneManager.getLc(); - LinphoneCall currentCall = lc.getCurrentCall(); + Core lc = LinphoneManager.getLc(); + Call currentCall = lc.getCurrentCall(); if (currentCall != null) { lc.terminateCall(currentCall); - } else if (lc.isInConference()) { + } else if (lc.getConference() != null) { lc.terminateConference(); } else { lc.terminateAllCalls(); @@ -1076,22 +1077,19 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList timer.cancel(); } - LinphoneCall call = LinphoneManager.getLc().getCurrentCall(); + Call call = LinphoneManager.getLc().getCurrentCall(); if (call == null) { return; } - LinphoneCallParams params = LinphoneManager.getLc().createCallParams(call); + CallParams params = LinphoneManager.getLc().createCallParams(call); if (accept) { - params.setVideoEnabled(true); - LinphoneManager.getLc().enableVideo(true, true); + params.enableVideo(true); + LinphoneManager.getLc().enableVideoCapture(true); + LinphoneManager.getLc().enableVideoDisplay(true); } - try { - LinphoneManager.getLc().acceptCallUpdate(call, params); - } catch (LinphoneCoreException e) { - Log.e(e); - } + LinphoneManager.getLc().acceptCallUpdate(call, params); } public void startIncomingCallActivity() { @@ -1176,11 +1174,11 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList instance = this; super.onResume(); - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.addListener(mListener); } - isSpeakerEnabled = LinphoneManager.getLc().isSpeakerEnabled(); + isSpeakerEnabled = LinphoneManager.getInstance().isSpeakerEnabled(); refreshIncallUi(); handleViewIntent(); @@ -1200,32 +1198,32 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList private void handleViewIntent() { Intent intent = getIntent(); if(intent != null && intent.getAction() == "android.intent.action.VIEW") { - LinphoneCall call = LinphoneManager.getLc().getCurrentCall(); + Call call = LinphoneManager.getLc().getCurrentCall(); if(call != null && isVideoEnabled(call)) { - LinphonePlayer player = call.getPlayer(); + Player player = call.getPlayer(); String path = intent.getData().getPath(); Log.i("Openning " + path); - int openRes = player.open(path); - if(openRes == -1) { + /*int openRes = */player.open(path); + /*if(openRes == -1) { String message = "Could not open " + path; Log.e(message); Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show(); return; - } + }*/ Log.i("Start playing"); - if(player.start() == -1) { - player.close(); + /*if(*/player.start()/* == -1) {*/; + /*player.close(); String message = "Could not start playing " + path; Log.e(message); Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show(); - } + }*/ } } } @Override protected void onPause() { - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.removeListener(mListener); } @@ -1300,14 +1298,14 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList //CALL INFORMATION - private void displayCurrentCall(LinphoneCall call){ - LinphoneAddress lAddress = call.getRemoteAddress(); + private void displayCurrentCall(Call call){ + Address lAddress = call.getRemoteAddress(); TextView contactName = (TextView) findViewById(R.id.current_contact_name); setContactInformation(contactName, contactPicture, lAddress); registerCallDurationTimer(null, call); } - private void displayPausedCalls(Resources resources, final LinphoneCall call, int index) { + private void displayPausedCalls(Resources resources, final Call call, int index) { // Control Row LinearLayout callView; @@ -1327,7 +1325,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList TextView contactName = (TextView) callView.findViewById(R.id.contact_name); ImageView contactImage = (ImageView) callView.findViewById(R.id.contact_picture); - LinphoneAddress lAddress = call.getRemoteAddress(); + Address lAddress = call.getRemoteAddress(); setContactInformation(contactName, contactImage, lAddress); displayCallStatusIconAndReturnCallPaused(callView, call); registerCallDurationTimer(callView, call); @@ -1335,7 +1333,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList callsList.addView(callView); } - private void setContactInformation(TextView contactName, ImageView contactPicture, LinphoneAddress lAddress) { + private void setContactInformation(TextView contactName, ImageView contactPicture, Address lAddress) { LinphoneContact lContact = ContactsManager.getInstance().findContactFromAddress(lAddress); if (lContact == null) { contactName.setText(LinphoneUtils.getAddressDisplayName(lAddress)); @@ -1346,28 +1344,28 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList } } - private boolean displayCallStatusIconAndReturnCallPaused(LinearLayout callView, LinphoneCall call) { + private boolean displayCallStatusIconAndReturnCallPaused(LinearLayout callView, Call call) { boolean isCallPaused, isInConference; - ImageView callState = (ImageView) callView.findViewById(R.id.call_pause); - callState.setTag(call); - callState.setOnClickListener(this); + ImageView onCallStateChanged = (ImageView) callView.findViewById(R.id.call_pause); + onCallStateChanged.setTag(call); + onCallStateChanged.setOnClickListener(this); if (call.getState() == State.Paused || call.getState() == State.PausedByRemote || call.getState() == State.Pausing) { - callState.setImageResource(R.drawable.pause); + onCallStateChanged.setImageResource(R.drawable.pause); isCallPaused = true; isInConference = false; } else if (call.getState() == State.OutgoingInit || call.getState() == State.OutgoingProgress || call.getState() == State.OutgoingRinging) { isCallPaused = false; isInConference = false; } else { - isInConference = isConferenceRunning && call.isInConference(); + isInConference = isConferenceRunning && call.getConference() != null; isCallPaused = false; } return isCallPaused || isInConference; } - private void registerCallDurationTimer(View v, LinphoneCall call) { + private void registerCallDurationTimer(View v, Call call) { int callDuration = call.getDuration(); if (callDuration == 0 && call.getState() != State.StreamsRunning) { return; @@ -1389,8 +1387,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList } public void refreshCallList(Resources resources) { - isConferenceRunning = LinphoneManager.getLc().isInConference(); - List pausedCalls = LinphoneUtils.getCallsInState(LinphoneManager.getLc(), Arrays.asList(State.PausedByRemote)); + isConferenceRunning = LinphoneManager.getLc().getConference() != null; + List pausedCalls = LinphoneUtils.getCallsInState(LinphoneManager.getLc(), Arrays.asList(State.PausedByRemote)); //MultiCalls if(LinphoneManager.getLc().getCallsNb() > 1){ @@ -1430,12 +1428,12 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList } boolean isConfPaused = false; - for (LinphoneCall call : LinphoneManager.getLc().getCalls()) { - if (call.isInConference() && !isConferenceRunning) { + for (Call call : LinphoneManager.getLc().getCalls()) { + if (call.getConference() != null && !isConferenceRunning) { isConfPaused = true; index++; } else { - if (call != LinphoneManager.getLc().getCurrentCall() && !call.isInConference()) { + if (call != LinphoneManager.getLc().getCurrentCall() && !(call.getConference() != null)) { displayPausedCalls(resources, call, index); index++; } else { @@ -1463,10 +1461,10 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList } //Conference - private void exitConference(final LinphoneCall call){ - LinphoneCore lc = LinphoneManager.getLc(); + private void exitConference(final Call call){ + Core lc = LinphoneManager.getLc(); - if (call.isInConference()) { + if (call.getConference() != null) { lc.removeFromConference(call); if (lc.getConferenceSize() <= 1) { lc.leaveConference(); @@ -1480,10 +1478,10 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList } public void pauseOrResumeConference() { - LinphoneCore lc = LinphoneManager.getLc(); + Core lc = LinphoneManager.getLc(); conferenceStatus = (ImageView) findViewById(R.id.conference_pause); if(conferenceStatus != null) { - if (lc.isInConference()) { + if (lc.getConference() != null) { conferenceStatus.setImageResource(R.drawable.pause_big_over_selected); lc.leaveConference(); } else { @@ -1494,14 +1492,14 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList refreshCallList(getResources()); } - private void displayConferenceParticipant(int index, final LinphoneCall call){ + private void displayConferenceParticipant(int index, final Call call){ LinearLayout confView = (LinearLayout) inflater.inflate(R.layout.conf_call_control_row, container, false); conferenceList.setId(index + 1); TextView contact = (TextView) confView.findViewById(R.id.contactNameOrNumber); LinphoneContact lContact = ContactsManager.getInstance().findContactFromAddress(call.getRemoteAddress()); if (lContact == null) { - contact.setText(call.getRemoteAddress().getUserName()); + contact.setText(call.getRemoteAddress().getUsername()); } else { contact.setText(lContact.getFullName()); } @@ -1540,8 +1538,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList //Conference participant int index = 1; - for (LinphoneCall call : LinphoneManager.getLc().getCalls()) { - if (call.isInConference()) { + for (Call call : LinphoneManager.getLc().getCalls()) { + if (call.getConference() != null) { displayConferenceParticipant(index, call); index++; } @@ -1554,8 +1552,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList private void displayMissedChats() { int count = 0; - LinphoneChatRoom[] chats = LinphoneManager.getLc().getChatRooms(); - for (LinphoneChatRoom chatroom : chats) { + ChatRoom[] chats = LinphoneManager.getLc().getChatRooms(); + for (ChatRoom chatroom : chats) { count += chatroom.getUnreadMessagesCount(); } @@ -1576,7 +1574,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList private String getEncoderText(String mime){ String ret = mEncoderTexts.get(mime); if (ret == null){ - org.linphone.mediastream.Factory msfactory = LinphoneManager.getLc().getMSFactory(); + org.linphone.mediastream.Factory msfactory = LinphoneManager.getLc().getMediastreamerFactory(); ret = msfactory.getEncoderText(mime); mEncoderTexts.put(mime, ret); } @@ -1585,14 +1583,14 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList private String getDecoderText(String mime){ String ret = mDecoderTexts.get(mime); if (ret == null){ - org.linphone.mediastream.Factory msfactory = LinphoneManager.getLc().getMSFactory(); + org.linphone.mediastream.Factory msfactory = LinphoneManager.getLc().getMediastreamerFactory(); ret = msfactory.getDecoderText(mime); mDecoderTexts.put(mime, ret); } return ret; } - private void displayMediaStats(LinphoneCallParams params, LinphoneCallStats stats + private void displayMediaStats(CallParams params, CallStats stats , PayloadType media , View layout, TextView title, TextView codec, TextView dl , TextView ul, TextView edl, TextView ice, TextView ip, TextView senderLossRate , TextView receiverLossRate, TextView enc, TextView dec, TextView videoResolutionSent @@ -1604,9 +1602,9 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList layout.setVisibility(View.VISIBLE); title.setVisibility(TextView.VISIBLE); if (media != null) { - mime = media.getMime(); + mime = media.getMimeType(); formatText(codec, getString(R.string.call_stats_codec), - mime + " / " + (media.getRate() / 1000) + "kHz"); + mime + " / " + (media.getClockRate() / 1000) + "kHz"); } if (mime != null ){ formatText(enc, getString(R.string.call_stats_encoder_name), getEncoderText(mime)); @@ -1623,8 +1621,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList formatText(ice, getString(R.string.call_stats_ice), stats.getIceState().toString()); formatText(ip, getString(R.string.call_stats_ip), - (stats.getIpFamilyOfRemote() == LinphoneAddressFamily.INET_6.getInt()) ? - "IpV6" : (stats.getIpFamilyOfRemote() == LinphoneAddressFamily.INET.getInt()) ? + (stats.getIpFamilyOfRemote() == AddressFamily.Inet6) ? + "IpV6" : (stats.getIpFamilyOfRemote() == AddressFamily.Inet) ? "IpV4" : "Unknown"); formatText(senderLossRate, getString(R.string.call_stats_sender_loss_rate), new DecimalFormat("##.##").format(stats.getSenderLossRate()) + "%"); @@ -1633,10 +1631,10 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList if (isVideo) { formatText(videoResolutionSent, getString(R.string.call_stats_video_resolution_sent), - "\u2191 " + params.getSentVideoSize().toDisplayableString()); + "\u2191 " + params.getSentVideoDefinition().getName()); formatText(videoResolutionReceived, getString(R.string.call_stats_video_resolution_received), - "\u2193 " + params.getReceivedVideoSize().toDisplayableString()); + "\u2193 " + params.getReceivedVideoDefinition().getName()); formatText(videoFpsSent, getString(R.string.call_stats_video_fps_sent), "\u2191 " + params.getSentFramerate()); @@ -1645,7 +1643,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList "\u2193 " + params.getReceivedFramerate()); } else { formatText(jitterBuffer, getString(R.string.call_stats_jitter_buffer), - new DecimalFormat("##.##").format(stats.getJitterBufferSize()) + " ms"); + new DecimalFormat("##.##").format(stats.getJitterBufferSizeMs()) + " ms"); } } else { layout.setVisibility(View.GONE); @@ -1653,7 +1651,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList } } - public void initCallStatsRefresher(final LinphoneCall call, final View view) { + public void initCallStatsRefresher(final Call call, final View view) { if (mTimer != null && mTask != null) { return; } @@ -1712,16 +1710,16 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() == null) return; synchronized(LinphoneManager.getLc()) { if (LinphoneActivity.isInstanciated()) { - LinphoneCallParams params = call.getCurrentParams(); + CallParams params = call.getCurrentParams(); if (params != null) { - LinphoneCallStats audioStats = call.getAudioStats(); - LinphoneCallStats videoStats = null; + CallStats audioStats = call.getStats(StreamType.Audio); + CallStats videoStats = null; - if (params.getVideoEnabled()) - videoStats = call.getVideoStats(); + if (params.videoEnabled()) + videoStats = call.getStats(StreamType.Video); - PayloadType payloadAudio = params.getUsedAudioCodec(); - PayloadType payloadVideo = params.getUsedVideoCodec(); + PayloadType payloadAudio = params.getUsedAudioPayloadType(); + PayloadType payloadVideo = params.getUsedVideoPayloadType(); displayMediaStats(params, audioStats, payloadAudio, audioLayout , titleAudio, codecAudio, dlAudio, ulAudio, null, iceAudio diff --git a/src/android/org/linphone/CallIncomingActivity.java b/src/android/org/linphone/CallIncomingActivity.java index 6fce96d4e..3b8db3f3e 100644 --- a/src/android/org/linphone/CallIncomingActivity.java +++ b/src/android/org/linphone/CallIncomingActivity.java @@ -33,12 +33,12 @@ import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; -import org.linphone.core.LinphoneAddress; -import org.linphone.core.LinphoneCall; -import org.linphone.core.LinphoneCall.State; -import org.linphone.core.LinphoneCallParams; -import org.linphone.core.LinphoneCore; -import org.linphone.core.LinphoneCoreListenerBase; +import org.linphone.core.Address; +import org.linphone.core.Call; +import org.linphone.core.Call.State; +import org.linphone.core.CallParams; +import org.linphone.core.Core; +import org.linphone.core.CoreListenerStub; import org.linphone.mediastream.Log; import org.linphone.ui.LinphoneSliders.LinphoneSliderTriggered; @@ -50,8 +50,8 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin private TextView name, number; private ImageView contactPicture, accept, decline, arrow; - private LinphoneCall mCall; - private LinphoneCoreListenerBase mListener; + private Call mCall; + private CoreListenerStub mListener; private LinearLayout acceptUnlock; private LinearLayout declineUnlock; private boolean alreadyAcceptedOrDeniedCall, begin; @@ -94,7 +94,7 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin lookupCurrentCall(); if (LinphonePreferences.instance() != null && mCall != null && mCall.getRemoteParams() != null && LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests() && - mCall.getRemoteParams().getVideoEnabled()) { + mCall.getRemoteParams().videoEnabled()) { accept.setImageResource(R.drawable.call_video_start); } decline = (ImageView) findViewById(R.id.decline); @@ -182,16 +182,16 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin } }); - mListener = new LinphoneCoreListenerBase(){ + mListener = new CoreListenerStub(){ @Override - public void callState(LinphoneCore lc, LinphoneCall call, State state, String message) { - if (call == mCall && State.CallEnd == state) { + public void onCallStateChanged(Core lc, Call call, State state, String message) { + if (call == mCall && State.End == state) { finish(); } if (state == State.StreamsRunning) { - Log.e("CallIncommingActivity - onCreate - State.StreamsRunning - speaker = "+LinphoneManager.getLc().isSpeakerEnabled()); + Log.e("CallIncommingActivity - onCreate - State.StreamsRunning - speaker = "+LinphoneManager.getInstance().isSpeakerEnabled()); // The following should not be needed except some devices need it (e.g. Galaxy S). - LinphoneManager.getLc().enableSpeaker(LinphoneManager.getLc().isSpeakerEnabled()); + LinphoneManager.getInstance().enableSpeaker(LinphoneManager.getInstance().isSpeakerEnabled()); } } }; @@ -204,7 +204,7 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin protected void onResume() { super.onResume(); instance = this; - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.addListener(mListener); } @@ -222,7 +222,7 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin } - LinphoneAddress address = mCall.getRemoteAddress(); + Address address = mCall.getRemoteAddress(); LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(address); if (contact != null) { LinphoneUtils.setImagePictureFromUri(this, contactPicture, contact.getPhotoUri(), contact.getThumbnailUri()); @@ -241,7 +241,7 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin @Override protected void onPause() { - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.removeListener(mListener); } @@ -265,8 +265,8 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin private void lookupCurrentCall() { if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) { - List calls = LinphoneUtils.getLinphoneCalls(LinphoneManager.getLc()); - for (LinphoneCall call : calls) { + List calls = LinphoneUtils.getCalls(LinphoneManager.getLc()); + for (Call call : calls) { if (State.IncomingReceived == call.getState()) { mCall = call; break; @@ -291,7 +291,7 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin } alreadyAcceptedOrDeniedCall = true; - LinphoneCallParams params = LinphoneManager.getLc().createCallParams(mCall); + CallParams params = LinphoneManager.getLc().createCallParams(mCall); boolean isLowBandwidthConnection = !LinphoneUtils.isHighBandwidthConnection(LinphoneService.instance().getApplicationContext()); diff --git a/src/android/org/linphone/CallManager.java b/src/android/org/linphone/CallManager.java index 1aaad0392..1af123396 100644 --- a/src/android/org/linphone/CallManager.java +++ b/src/android/org/linphone/CallManager.java @@ -19,11 +19,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import org.linphone.core.LinphoneAddress; -import org.linphone.core.LinphoneCall; -import org.linphone.core.LinphoneCallParams; -import org.linphone.core.LinphoneCore; -import org.linphone.core.LinphoneCoreException; +import org.linphone.core.Address; +import org.linphone.core.Call; +import org.linphone.core.CallParams; +import org.linphone.core.Core; +import org.linphone.core.CoreException; import org.linphone.mediastream.Log; @@ -47,16 +47,16 @@ public class CallManager { - public void inviteAddress(LinphoneAddress lAddress, boolean videoEnabled, boolean lowBandwidth) throws LinphoneCoreException { - LinphoneCore lc = LinphoneManager.getLc(); + public void inviteAddress(Address lAddress, boolean videoEnabled, boolean lowBandwidth) throws CoreException { + Core lc = LinphoneManager.getLc(); - LinphoneCallParams params = lc.createCallParams(null); + CallParams params = lc.createCallParams(null); bm().updateWithProfileSettings(lc, params); - if (videoEnabled && params.getVideoEnabled()) { - params.setVideoEnabled(true); + if (videoEnabled && params.videoEnabled()) { + params.enableVideo(true); } else { - params.setVideoEnabled(false); + params.enableVideo(false); } if (lowBandwidth) { @@ -77,22 +77,22 @@ public class CallManager { * @return if updateCall called */ boolean reinviteWithVideo() { - LinphoneCore lc = LinphoneManager.getLc(); - LinphoneCall lCall = lc.getCurrentCall(); + Core lc = LinphoneManager.getLc(); + Call lCall = lc.getCurrentCall(); if (lCall == null) { Log.e("Trying to reinviteWithVideo while not in call: doing nothing"); return false; } - LinphoneCallParams params = lc.createCallParams(lCall); + CallParams params = lc.createCallParams(lCall); - if (params.getVideoEnabled()) return false; + if (params.videoEnabled()) return false; // Check if video possible regarding bandwidth limitations bm().updateWithProfileSettings(lc, params); // Abort if not enough bandwidth... - if (!params.getVideoEnabled()) { + if (!params.videoEnabled()) { return false; } @@ -107,13 +107,13 @@ public class CallManager { * Re-invite with parameters updated from profile. */ void reinvite() { - LinphoneCore lc = LinphoneManager.getLc(); - LinphoneCall lCall = lc.getCurrentCall(); + Core lc = LinphoneManager.getLc(); + Call lCall = lc.getCurrentCall(); if (lCall == null) { Log.e("Trying to reinvite while not in call: doing nothing"); return; } - LinphoneCallParams params = lc.createCallParams(lCall); + CallParams params = lc.createCallParams(lCall); bm().updateWithProfileSettings(lc, params); lc.updateCall(lCall, params); } @@ -124,13 +124,13 @@ public class CallManager { * The camera will be restarted when mediastreamer chain is recreated and setParameters is called. */ public void updateCall() { - LinphoneCore lc = LinphoneManager.getLc(); - LinphoneCall lCall = lc.getCurrentCall(); + Core lc = LinphoneManager.getLc(); + Call lCall = lc.getCurrentCall(); if (lCall == null) { Log.e("Trying to updateCall while not in call: doing nothing"); return; } - LinphoneCallParams params = lc.createCallParams(lCall); + CallParams params = lc.createCallParams(lCall); bm().updateWithProfileSettings(lc, params); lc.updateCall(lCall, null); } diff --git a/src/android/org/linphone/CallOutgoingActivity.java b/src/android/org/linphone/CallOutgoingActivity.java index bb1e3767c..8094a0428 100644 --- a/src/android/org/linphone/CallOutgoingActivity.java +++ b/src/android/org/linphone/CallOutgoingActivity.java @@ -22,11 +22,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. import java.util.ArrayList; import java.util.List; -import org.linphone.core.LinphoneAddress; -import org.linphone.core.LinphoneCall; -import org.linphone.core.LinphoneCall.State; -import org.linphone.core.LinphoneCore; -import org.linphone.core.LinphoneCoreListenerBase; +import org.linphone.core.Address; +import org.linphone.core.Call; +import org.linphone.core.Call.State; +import org.linphone.core.Core; +import org.linphone.core.CoreListenerStub; import org.linphone.core.Reason; import org.linphone.mediastream.Log; @@ -51,8 +51,8 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC private TextView name, number; private ImageView contactPicture, micro, speaker, hangUp; - private LinphoneCall mCall; - private LinphoneCoreListenerBase mListener; + private Call mCall; + private CoreListenerStub mListener; private boolean isMicMuted, isSpeakerEnabled; public static CallOutgoingActivity instance() { @@ -93,9 +93,9 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC hangUp = (ImageView) findViewById(R.id.outgoing_hang_up); hangUp.setOnClickListener(this); - mListener = new LinphoneCoreListenerBase(){ + mListener = new CoreListenerStub(){ @Override - public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) { + public void onCallStateChanged(Core lc, Call call, Call.State state, String message) { if (call == mCall && State.Connected == state) { if (!LinphoneActivity.isInstanciated()) { return; @@ -104,14 +104,14 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC finish(); return; } else if (state == State.Error) { - // Convert LinphoneCore message for internalization + // Convert Core message for internalization if (call.getErrorInfo().getReason() == Reason.Declined) { displayCustomToast(getString(R.string.error_call_declined), Toast.LENGTH_SHORT); decline(); } else if (call.getErrorInfo().getReason() == Reason.NotFound) { displayCustomToast(getString(R.string.error_user_not_found), Toast.LENGTH_SHORT); decline(); - } else if (call.getErrorInfo().getReason() == Reason.Media) { + } else if (call.getErrorInfo().getReason() == Reason.NotAcceptable) { displayCustomToast(getString(R.string.error_incompatible_media), Toast.LENGTH_SHORT); decline(); } else if (call.getErrorInfo().getReason() == Reason.Busy) { @@ -121,8 +121,8 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC displayCustomToast(getString(R.string.error_unknown) + " - " + message, Toast.LENGTH_SHORT); decline(); } - }else if (state == State.CallEnd) { - // Convert LinphoneCore message for internalization + }else if (state == State.End) { + // Convert Core message for internalization if (call.getErrorInfo().getReason() == Reason.Declined) { displayCustomToast(getString(R.string.error_call_declined), Toast.LENGTH_SHORT); decline(); @@ -142,7 +142,7 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC protected void onResume() { super.onResume(); instance = this; - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.addListener(mListener); } @@ -151,8 +151,8 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC // Only one call ringing at a time is allowed if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) { - List calls = LinphoneUtils.getLinphoneCalls(LinphoneManager.getLc()); - for (LinphoneCall call : calls) { + List calls = LinphoneUtils.getCalls(LinphoneManager.getLc()); + for (Call call : calls) { State cstate = call.getState(); if (State.OutgoingInit == cstate || State.OutgoingProgress == cstate || State.OutgoingRinging == cstate || State.OutgoingEarlyMedia == cstate) { @@ -175,7 +175,7 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC return; } - LinphoneAddress address = mCall.getRemoteAddress(); + Address address = mCall.getRemoteAddress(); LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(address); if (contact != null) { LinphoneUtils.setImagePictureFromUri(this, contactPicture, contact.getPhotoUri(), contact.getThumbnailUri()); @@ -194,7 +194,7 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC @Override protected void onPause() { - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.removeListener(mListener); } @@ -218,7 +218,7 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC } else { micro.setImageResource(R.drawable.micro_default); } - LinphoneManager.getLc().muteMic(isMicMuted); + LinphoneManager.getLc().enableMic(!isMicMuted); } if (id == R.id.speaker) { isSpeakerEnabled = !isSpeakerEnabled; @@ -227,7 +227,7 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC } else { speaker.setImageResource(R.drawable.speaker_default); } - LinphoneManager.getLc().enableSpeaker(isSpeakerEnabled); + LinphoneManager.getInstance().enableSpeaker(isSpeakerEnabled); } if (id == R.id.outgoing_hang_up) { decline(); diff --git a/src/android/org/linphone/CallVideoFragment.java b/src/android/org/linphone/CallVideoFragment.java index ebc0d20c8..957b60f0e 100644 --- a/src/android/org/linphone/CallVideoFragment.java +++ b/src/android/org/linphone/CallVideoFragment.java @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. import org.linphone.compatibility.Compatibility; import org.linphone.compatibility.CompatibilityScaleGestureDetector; import org.linphone.compatibility.CompatibilityScaleGestureListener; -import org.linphone.core.LinphoneCall; +import org.linphone.core.Call; import org.linphone.mediastream.Log; import org.linphone.mediastream.video.AndroidVideoWindowImpl; import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration; @@ -57,7 +57,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view; - if (LinphoneManager.getLc().hasCrappyOpenGL()) { + if (LinphoneManager.getLc().hasCrappyOpengl()) { view = inflater.inflate(R.layout.video_no_opengl, container, false); } else { view = inflater.inflate(R.layout.video, container, false); @@ -72,7 +72,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On androidVideoWindowImpl = new AndroidVideoWindowImpl(mVideoView, mCaptureView, new AndroidVideoWindowImpl.VideoWindowListener() { public void onVideoRenderingSurfaceReady(AndroidVideoWindowImpl vw, SurfaceView surface) { mVideoView = surface; - LinphoneManager.getLc().setVideoWindow(vw); + LinphoneManager.getLc().setNativeVideoWindowId(vw); } public void onVideoRenderingSurfaceDestroyed(AndroidVideoWindowImpl vw) { @@ -81,7 +81,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On public void onVideoPreviewSurfaceReady(AndroidVideoWindowImpl vw, SurfaceView surface) { mCaptureView = surface; - LinphoneManager.getLc().setPreviewWindow(mCaptureView); + LinphoneManager.getLc().setNativePreviewWindowId(mCaptureView); } public void onVideoPreviewSurfaceDestroyed(AndroidVideoWindowImpl vw) { @@ -147,15 +147,17 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On public void switchCamera() { try { - int videoDeviceId = LinphoneManager.getLc().getVideoDevice(); + /*int videoDeviceId = LinphoneManager.getLc().getVideoDevice(); videoDeviceId = (videoDeviceId + 1) % AndroidCameraConfiguration.retrieveCameras().length; - LinphoneManager.getLc().setVideoDevice(videoDeviceId); + LinphoneManager.getLc().setVideoDevice(videoDeviceId);*/ + Log.e("TODO FIXME switchCamera"); + CallManager.getInstance().updateCall(); // previous call will cause graph reconstruction -> regive preview // window if (mCaptureView != null) { - LinphoneManager.getLc().setPreviewWindow(mCaptureView); + LinphoneManager.getLc().setNativePreviewWindowId(mCaptureView); } } catch (ArithmeticException ae) { Log.e("Cannot swtich camera : no camera"); @@ -171,7 +173,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On } if (androidVideoWindowImpl != null) { synchronized (androidVideoWindowImpl) { - LinphoneManager.getLc().setVideoWindow(androidVideoWindowImpl); + LinphoneManager.getLc().setNativeVideoWindowId(androidVideoWindowImpl); } } @@ -187,7 +189,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On * this call will destroy native opengl renderer which is used by * androidVideoWindowImpl */ - LinphoneManager.getLc().setVideoWindow(null); + LinphoneManager.getLc().setNativeVideoWindowId(null); } } if (LinphonePreferences.instance().isOverlayEnabled()) { @@ -206,9 +208,9 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On float landscapeZoomFactor = ((float) mVideoView.getWidth()) / (float) ((3 * mVideoView.getHeight()) / 4); mZoomFactor = Math.max(0.1f, Math.min(mZoomFactor, Math.max(portraitZoomFactor, landscapeZoomFactor))); - LinphoneCall currentCall = LinphoneManager.getLc().getCurrentCall(); + Call currentCall = LinphoneManager.getLc().getCurrentCall(); if (currentCall != null) { - currentCall.zoomVideo(mZoomFactor, mZoomCenterX, mZoomCenterY); + currentCall.zoom(mZoomFactor, mZoomCenterX, mZoomCenterY); return true; } return false; @@ -239,7 +241,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On if (mZoomCenterY < 0) mZoomCenterY = 0; - LinphoneManager.getLc().getCurrentCall().zoomVideo(mZoomFactor, mZoomCenterX, mZoomCenterY); + LinphoneManager.getLc().getCurrentCall().zoom(mZoomFactor, mZoomCenterX, mZoomCenterY); return true; } } @@ -262,7 +264,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On resetZoom(); } - LinphoneManager.getLc().getCurrentCall().zoomVideo(mZoomFactor, mZoomCenterX, mZoomCenterY); + LinphoneManager.getLc().getCurrentCall().zoom(mZoomFactor, mZoomCenterX, mZoomCenterY); return true; } diff --git a/src/android/org/linphone/ChatFragment.java b/src/android/org/linphone/ChatFragment.java index eb97f330d..76178bec5 100644 --- a/src/android/org/linphone/ChatFragment.java +++ b/src/android/org/linphone/ChatFragment.java @@ -77,16 +77,18 @@ import android.widget.TextView; import android.widget.Toast; import org.linphone.compatibility.Compatibility; -import org.linphone.core.LinphoneAddress; -import org.linphone.core.LinphoneBuffer; -import org.linphone.core.LinphoneChatMessage; -import org.linphone.core.LinphoneChatMessage.State; -import org.linphone.core.LinphoneChatRoom; -import org.linphone.core.LinphoneContent; -import org.linphone.core.LinphoneCore; -import org.linphone.core.LinphoneCoreFactory; -import org.linphone.core.LinphoneCoreListenerBase; -import org.linphone.core.LinphoneFriend; +import org.linphone.core.Address; +import org.linphone.core.Buffer; +import org.linphone.core.ChatMessage; +import org.linphone.core.ChatMessage.State; +import org.linphone.core.ChatMessageListener; +import org.linphone.core.ChatRoom; +import org.linphone.core.Content; +import org.linphone.core.Core; +import org.linphone.core.Factory; +import org.linphone.core.CoreListenerStub; +import org.linphone.core.Friend; +import org.linphone.core.FriendList; import org.linphone.mediastream.Log; import java.io.ByteArrayOutputStream; @@ -110,7 +112,7 @@ interface ChatUpdatedListener { void onChatUpdated(); } -public class ChatFragment extends Fragment implements OnClickListener, LinphoneChatMessage.LinphoneChatMessageListener, ContactsUpdatedListener{ +public class ChatFragment extends Fragment implements OnClickListener, ChatMessageListener, ContactsUpdatedListener{ private static final int ADD_PHOTO = 1337; private static final int MENU_DELETE_MESSAGE = 0; private static final int MENU_PICTURE_SMALL = 2; @@ -124,7 +126,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC private static final int SIZE_LARGE = 1500; private static final int SIZE_MAX = 2048; - private LinphoneChatRoom chatRoom; + private ChatRoom chatRoom; private String sipUri; private EditText message; private ImageView edit, selectAll, deselectAll, startCall, delete, sendImage, sendMessage, cancel; @@ -145,7 +147,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC private ViewTreeObserver.OnGlobalLayoutListener keyboardListener; private ChatMessageAdapter adapter; - private LinphoneCoreListenerBase mListener; + private CoreListenerStub mListener; private boolean newChatConversation = false; private String fileSharedUri, fileAlreadySharedUri; @@ -238,8 +240,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC sendImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - if (LinphoneManager.getLc().getLimeEncryption() == LinphoneCore.LinphoneLimeState.Mandatory - && (chatRoom == null || !chatRoom.islimeAvailable())){ + if (LinphoneManager.getLc().limeEnabled() == Core.LimeState.Mandatory + && (chatRoom == null || !chatRoom.limeAvailable())){ askingForLimeCall(); return; } @@ -259,10 +261,10 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC back.setOnClickListener(this); } - mListener = new LinphoneCoreListenerBase(){ + mListener = new CoreListenerStub(){ @Override - public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) { - LinphoneAddress from = cr.getPeerAddress(); + public void onMessageReceived(Core lc, ChatRoom cr, ChatMessage message) { + Address from = cr.getPeerAddress(); if (from.asStringUriOnly().equals(sipUri)) { //LinphoneService.instance().removeMessageNotification(); cr.markAsRead(); @@ -270,7 +272,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC adapter.addMessage(message); String externalBodyUrl = message.getExternalBodyUrl(); - LinphoneContent fileTransferContent = message.getFileTransferInformation(); + Content fileTransferContent = message.getFileTransferInformation(); if (externalBodyUrl != null || fileTransferContent != null) { LinphoneActivity.instance().checkAndRequestExternalStoragePermission(); } @@ -283,7 +285,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } @Override - public void isComposingReceived(LinphoneCore lc, LinphoneChatRoom room) { + public void onIsComposingReceived(Core lc, ChatRoom room) { if (chatRoom != null && room != null && chatRoom.getPeerAddress().asStringUriOnly().equals(room.getPeerAddress().asStringUriOnly())) { remoteComposing.setVisibility(chatRoom.isRemoteComposing() ? View.VISIBLE : View.GONE); } @@ -390,8 +392,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } public void initChatRoom(String sipUri) { - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); - LinphoneAddress lAddress = null; + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Address lAddress = null; if (sipUri == null) { contact = null; // Tablet rotation issue initNewChatConversation(); @@ -412,7 +414,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC searchContactField.setVisibility(View.GONE); resultContactsSearch.setVisibility(View.GONE); displayChatHeader(lAddress); - displayMessageList(); + removedList(); remoteComposing.setVisibility(chatRoom.isRemoteComposing() ? View.VISIBLE : View.GONE); } } @@ -426,7 +428,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC //messagesList.invalidateViews(); } - private void displayMessageList() { + private void removedList() { if (chatRoom != null) { if (adapter != null) { adapter.refreshHistory(); @@ -438,7 +440,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC messagesList.setVisibility(ListView.VISIBLE); } - private void displayChatHeader(LinphoneAddress address) { + private void displayChatHeader(Address address) { if (contact != null || address != null) { if (contact != null) { contactName.setText(contact.getFullName()); @@ -473,8 +475,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC menu.add(v.getId(), MENU_COPY_TEXT, 0, getString(R.string.copy_text)); } - /* LinphoneChatMessage msg = getMessageForId(v.getId()); - if (msg != null && msg.getStatus() == LinphoneChatMessage.State.NotDelivered) { + /* ChatMessage msg = getMessageForId(v.getId()); + if (msg != null && msg.getStatus() == ChatMessage.State.NotDelivered) { menu.add(v.getId(), MENU_RESEND_MESSAGE, 0, getString(R.string.retry)); } */ @@ -485,7 +487,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC switch (item.getItemId()) { case MENU_DELETE_MESSAGE: if (chatRoom != null) { - LinphoneChatMessage message = getMessageForId(item.getGroupId()); + ChatMessage message = getMessageForId(item.getGroupId()); if (message != null) { chatRoom.deleteMessage(message); if (getResources().getBoolean(R.bool.isTablet) && chatRoom.getHistorySize() <= 0) { @@ -529,7 +531,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC LinphoneService.instance().removeMessageNotification(); - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.removeListener(mListener); } @@ -564,7 +566,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC message.addTextChangedListener(textWatcher); addVirtualKeyboardVisiblityListener(); - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.addListener(mListener); } @@ -596,7 +598,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC newChatConversation = true; } - if(LinphoneManager.getLc().isIncall()){ + if(LinphoneManager.getLc().inCall()){ backToCall.setVisibility(View.VISIBLE); startCall.setVisibility(View.GONE); } else { @@ -632,7 +634,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC int size = messagesList.getAdapter().getCount(); for (int i = 0; i < size; i++) { if (messagesList.isItemChecked(i)) { - LinphoneChatMessage message = (LinphoneChatMessage) messagesList.getAdapter().getItem(i); + ChatMessage message = (ChatMessage) messagesList.getAdapter().getItem(i); chatRoom.deleteMessage(message); } } @@ -731,12 +733,12 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC (searchContactField.getVisibility() == View.VISIBLE && searchContactField.getText().toString().length() < 1)) return; - LinphoneCore.LinphoneLimeState state = LinphoneManager.getLc().getLimeEncryption(); + Core.LimeState state = LinphoneManager.getLc().limeEnabled(); - if ((state == LinphoneCore.LinphoneLimeState.Disabled - || state == LinphoneCore.LinphoneLimeState.Preferred) - || (state == LinphoneCore.LinphoneLimeState.Mandatory - && chatRoom != null && chatRoom.islimeAvailable())){ + if ((state == Core.LimeState.Disabled + || state == Core.LimeState.Preferred) + || (state == Core.LimeState.Mandatory + && chatRoom != null && chatRoom.limeAvailable())){ sendTextMessage(message.getText().toString()); message.setText(""); invalidate(); @@ -747,9 +749,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } private void sendTextMessage(String messageToSend) { - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); boolean isNetworkReachable = lc == null ? false : lc.isNetworkReachable(); - LinphoneAddress lAddress = null; + Address lAddress = null; //Start new conversation in fast chat if(newChatConversation && chatRoom == null) { @@ -759,7 +761,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } } if (chatRoom != null && messageToSend != null && messageToSend.length() > 0 && isNetworkReachable) { - LinphoneChatMessage message = chatRoom.createLinphoneChatMessage(messageToSend); + ChatMessage message = chatRoom.createMessage(messageToSend); chatRoom.sendChatMessage(message); lAddress = chatRoom.getPeerAddress(); @@ -774,7 +776,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC adapter.addMessage(message); } - Log.i("Sent message current status: " + message.getStatus()); + Log.i("Sent message current status: " + message.getState()); } else if (!isNetworkReachable && LinphoneActivity.isInstanciated()) { LinphoneActivity.instance().displayCustomToast(getString(R.string.error_network_unreachable), Toast.LENGTH_LONG); } @@ -787,7 +789,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC if(path.contains("%20")) { path = path.replace("%20", "-"); } - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); boolean isNetworkReachable = lc == null ? false : lc.isNetworkReachable(); if(newChatConversation && chatRoom == null) { String address = searchContactField.getText().toString(); @@ -826,7 +828,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC if(path.contains("%20")) { path = path.replace("%20", "-"); } - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); boolean isNetworkReachable = lc == null ? false : lc.isNetworkReachable(); if (newChatConversation && chatRoom == null) { String address = searchContactField.getText().toString(); @@ -882,14 +884,14 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC dialog.dismiss(); } }); - if(LinphoneManager.getLc().getLimeEncryption() == LinphoneCore.LinphoneLimeState.Mandatory) + if(LinphoneManager.getLc().limeEnabled() == Core.LimeState.Mandatory) dialog.show(); } - private LinphoneChatMessage getMessageForId(int id) { + private ChatMessage getMessageForId(int id) { if (adapter == null) return null; for (int i = 0; i < adapter.getCount(); i++) { - LinphoneChatMessage message = adapter.getItem(i); + ChatMessage message = adapter.getItem(i); if (message.getStorageId() == id) { return message; } @@ -907,29 +909,29 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } } - private void resendMessage(LinphoneChatMessage message) { - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); - if (message == null || message.getStatus() != State.NotDelivered || !lc.isNetworkReachable()) + private void resendMessage(ChatMessage message) { + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + if (message == null || message.getState() != State.NotDelivered || !lc.isNetworkReachable()) return; - message.reSend(); + message.resend(); invalidate(); } private void resendMessage(int id) { - LinphoneChatMessage message = getMessageForId(id); - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); - if (message == null || message.getStatus() != State.NotDelivered || !lc.isNetworkReachable()){ + ChatMessage message = getMessageForId(id); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + if (message == null || message.getState() != State.NotDelivered || !lc.isNetworkReachable()){ return; } - message.reSend(); + message.resend(); invalidate(); } private void copyTextMessageToClipboard(int id) { - LinphoneChatMessage message = null; + ChatMessage message = null; for (int i = 0; i < adapter.getCount(); i++) { - LinphoneChatMessage msg = adapter.getItem(i); + ChatMessage msg = adapter.getItem(i); if (msg.getStorageId() == id) { message = msg; break; @@ -987,12 +989,14 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC public Uri getCVSPathFromLookupUri(String content) { String contactId = LinphoneUtils.getNameFromFilePath(content); - LinphoneFriend[] friendList = LinphoneManager.getLc().getFriendList(); - for(LinphoneFriend friend : friendList){ - if(friend.getRefKey().toString().equals(contactId)) { - String contactVcard = friend.getVcardToString(); - Uri path = LinphoneUtils.createCvsFromString(contactVcard); - return path; + FriendList[] friendList = LinphoneManager.getLc().getFriendsLists(); + for (FriendList list : friendList) { + for (Friend friend : list.getFriends()) { + if (friend.getRefKey().toString().equals(contactId)) { + String contactVcard = friend.getVcard().asVcard4String(); + Uri path = LinphoneUtils.createCvsFromString(contactVcard); + return path; + } } } return null; @@ -1097,11 +1101,14 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } String fileName = path.substring(path.lastIndexOf("/") + 1); String extension = LinphoneUtils.getExtensionFromFileName(fileName); - LinphoneContent content = LinphoneCoreFactory.instance().createLinphoneContent("image", extension, result, null); + Content content = chatRoom.getCore().createContent(); // "image", extension, result, null + content.setType("image"); + content.setSubtype(extension); + content.setBuffer(result, result.length); content.setName(fileName); - LinphoneChatMessage message = chatRoom.createFileTransferMessage(content); + ChatMessage message = chatRoom.createFileTransferMessage(content); message.setListener(LinphoneManager.getInstance()); - message.setAppData(path); + message.setAppdata(path); LinphoneManager.getInstance().setUploadPendingFileMessage(message); LinphoneManager.getInstance().setUploadingImage(result); @@ -1151,12 +1158,16 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC String fileName = path.substring(path.lastIndexOf("/") + 1); String extension = LinphoneUtils.getExtensionFromFileName(fileName); - LinphoneContent content = LinphoneCoreFactory.instance().createLinphoneContent("file", extension, result, null); + Content content = chatRoom.getCore().createContent();//"file", extension, result, null + content.setType("file"); + content.setSubtype(extension); + content.setBuffer(result, result.length); + content.setName(fileName); content.setName(fileName); - LinphoneChatMessage message = chatRoom.createFileTransferMessage(content); + ChatMessage message = chatRoom.createFileTransferMessage(content); message.setListener(LinphoneManager.getInstance()); - message.setAppData(path); + message.setAppdata(path); LinphoneManager.getInstance().setUploadPendingFileMessage(message); LinphoneManager.getInstance().setUploadingImage(result); @@ -1293,7 +1304,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } class ChatMessageAdapter extends BaseAdapter { - private class ViewHolder implements LinphoneChatMessage.LinphoneChatMessageListener { + private class ViewHolder implements ChatMessageListener { public int id; public RelativeLayout bubbleLayout; public CheckBox delete; @@ -1337,32 +1348,32 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } @Override - public void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, State state) { + public void onMsgStateChanged(ChatMessage msg, State state) { } @Override - public void onLinphoneChatMessageFileTransferReceived(LinphoneChatMessage msg, LinphoneContent content, LinphoneBuffer buffer) { + public void onFileTransferRecv(ChatMessage msg, Content content, Buffer buffer) { } @Override - public void onLinphoneChatMessageFileTransferSent(LinphoneChatMessage msg, LinphoneContent content, int offset, int size, LinphoneBuffer bufferToFill) { - + public Buffer onFileTransferSend(ChatMessage message, Content content, int offset, int size) { + return null; } @Override - public void onLinphoneChatMessageFileTransferProgressChanged(LinphoneChatMessage msg, LinphoneContent content, int offset, int total) { + public void onFileTransferProgressIndication(ChatMessage msg, Content content, int offset, int total) { if (msg.getStorageId() == id) fileTransferProgressBar.setProgress(offset * 100 / total); } } - ArrayList history; + ArrayList history; Context context; public ChatMessageAdapter(Context c) { context = c; - history = new ArrayList(); + history = new ArrayList(); refreshHistory(); } @@ -1375,18 +1386,18 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC public void refreshHistory() { if (history == null || chatRoom == null) return; history.clear(); - LinphoneChatMessage[] messages = chatRoom.getHistory(); + ChatMessage[] messages = chatRoom.getHistory(0); history.addAll(Arrays.asList(messages)); notifyDataSetChanged(); } - public void addMessage(LinphoneChatMessage message) { + public void addMessage(ChatMessage message) { history.add(message); notifyDataSetChanged(); messagesList.setSelection(getCount() - 1); } - public void refreshMessageCell(LinphoneChatMessage msg){ + public void refreshMessageCell(ChatMessage msg){ } @@ -1396,7 +1407,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } @Override - public LinphoneChatMessage getItem(int position) { + public ChatMessage getItem(int position) { return history.get(position); } @@ -1407,7 +1418,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC @Override public View getView(final int position, View convertView, ViewGroup parent) { - final LinphoneChatMessage message = history.get(position); + final ChatMessage message = history.get(position); View view = null; final ViewHolder holder; boolean sameMessage = false; @@ -1426,8 +1437,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC if (holder.id == message.getStorageId()) { // Horrible workaround to not reload image on edit chat list if (holder.messageImage.getTag() != null - && (holder.messageImage.getTag().equals(message.getAppData()) - || ((String) holder.messageImage.getTag()).substring(7).equals(message.getAppData())) + && (holder.messageImage.getTag().equals(message.getAppdata()) + || ((String) holder.messageImage.getTag()).substring(7).equals(message.getAppdata())) ){ sameMessage = true; } @@ -1440,19 +1451,19 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC @Override public void onClick(View v) { if (!message.isSecured() && !message.isOutgoing() && - LinphoneManager.getLc().getLimeEncryption() == LinphoneCore.LinphoneLimeState.Mandatory) { + LinphoneManager.getLc().limeEnabled() == Core.LimeState.Mandatory) { LinphoneUtils.displayErrorAlert(getString(R.string.message_not_encrypted), LinphoneActivity.instance()); } - if(message.getStatus() == State.NotDelivered) { + if(message.getState() == State.NotDelivered) { resendMessage(message); //resendMessage(holder.id); } } }); - LinphoneChatMessage.State status = message.getStatus(); + ChatMessage.State status = message.getState(); String externalBodyUrl = message.getExternalBodyUrl(); - LinphoneContent fileTransferContent = message.getFileTransferInformation(); + Content fileTransferContent = message.getFileTransferInformation(); holder.delete.setVisibility(View.GONE); holder.messageText.setVisibility(View.GONE); @@ -1465,9 +1476,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC holder.messageStatus.setVisibility(View.INVISIBLE); holder.messageSendingInProgress.setVisibility(View.GONE); - String displayName = message.getFrom().getDisplayName(); + String displayName = message.getFromAddress().getDisplayName(); if (displayName == null) { - displayName = message.getFrom().getUserName(); + displayName = message.getFromAddress().getUsername(); } if (!message.isOutgoing()) { if (contact != null) { @@ -1487,11 +1498,11 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } holder.contactName.setText(timestampToHumanDate(context, message.getTime()) + " - " + displayName); - if (status == LinphoneChatMessage.State.InProgress) { + if (status == ChatMessage.State.InProgress) { holder.messageSendingInProgress.setVisibility(View.VISIBLE); } if (!message.isSecured() && !message.isOutgoing() && - LinphoneManager.getLc().getLimeEncryption() == LinphoneCore.LinphoneLimeState.Mandatory && status != LinphoneChatMessage.State.InProgress) { + LinphoneManager.getLc().limeEnabled() == Core.LimeState.Mandatory && status != ChatMessage.State.InProgress) { holder.messageStatus.setVisibility(View.VISIBLE); holder.messageStatus.setImageResource(R.drawable.chat_unsecure); } @@ -1520,14 +1531,14 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC if (externalBodyUrl != null || fileTransferContent != null) { - String appData = message.getAppData(); + String appData = message.getAppdata(); if (message.isOutgoing() && appData != null) { holder.messageImage.setVisibility(View.VISIBLE); if (!sameMessage) { - loadBitmap(message.getAppData(), holder.messageImage); - holder.messageImage.setTag(message.getAppData()); + loadBitmap(message.getAppdata(), holder.messageImage); + holder.messageImage.setTag(message.getAppdata()); } if (LinphoneManager.getInstance().getMessageUploadPending() != null && LinphoneManager.getInstance().getMessageUploadPending().getStorageId() == message.getStorageId()) { @@ -1560,9 +1571,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC holder.messageImage.setVisibility(View.VISIBLE); if (!sameMessage) { loadBitmap(appData, holder.messageImage); - holder.messageImage.setTag(message.getAppData()); + holder.messageImage.setTag(message.getAppdata()); } - //displayMessageList(); + //removedList(); } } } @@ -1603,7 +1614,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC String filename = message.getFileTransferInformation().getName(); String filename2 = context.getString(R.string.temp_photo_name_with_date).replace("%s", String.valueOf(System.currentTimeMillis())) ; //+ "." + extension; File file = new File(Environment.getExternalStorageDirectory(), filename); - message.setAppData(file.getPath()); + message.setAppdata(file.getPath()); LinphoneManager.getInstance().addDownloadMessagePending(message); message.setListener(LinphoneManager.getInstance()); message.setFileTransferFilepath(file.getPath()); @@ -1643,12 +1654,12 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } holder.bubbleLayout.setLayoutParams(layoutParams); - if(message.getAppData() != null && holder.fileTransferLayout.getVisibility() != View.VISIBLE){ - if(LinphoneUtils.isExtensionImage(message.getAppData())){ + if(message.getAppdata() != null && holder.fileTransferLayout.getVisibility() != View.VISIBLE){ + if(LinphoneUtils.isExtensionImage(message.getAppdata())){ holder.fileExtensionLabel.setVisibility(View.GONE); holder.fileNameLabel.setVisibility(View.GONE); }else { - String extension = (LinphoneUtils.getExtensionFromFileName(message.getAppData())); + String extension = (LinphoneUtils.getExtensionFromFileName(message.getAppdata())); if(extension != null) extension = extension.toUpperCase(); else @@ -1659,7 +1670,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC holder.fileExtensionLabel.setText(extension); holder.fileExtensionLabel.setVisibility(View.VISIBLE); - holder.fileNameLabel.setText(LinphoneUtils.getNameFromFilePath(message.getAppData())); + holder.fileNameLabel.setText(LinphoneUtils.getNameFromFilePath(message.getAppdata())); holder.fileNameLabel.setVisibility(View.VISIBLE); holder.fileExtensionLabel.setOnClickListener(new OnClickListener() { @Override @@ -2058,18 +2069,20 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } } - //LinphoneChatMessage Listener + //ChatMessage Listener @Override - public void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, State state) { + public void onMsgStateChanged(ChatMessage msg, State state) { redrawMessageList(); } @Override - public void onLinphoneChatMessageFileTransferReceived(LinphoneChatMessage msg, LinphoneContent content, LinphoneBuffer buffer) {} + public void onFileTransferRecv(ChatMessage msg, Content content, Buffer buffer) {} @Override - public void onLinphoneChatMessageFileTransferSent(LinphoneChatMessage msg, LinphoneContent content, int offset, int size, LinphoneBuffer bufferToFill) {} + public Buffer onFileTransferSend(ChatMessage msg, Content content, int offset, int size) { + return null; + } @Override - public void onLinphoneChatMessageFileTransferProgressChanged(LinphoneChatMessage msg, LinphoneContent content, int offset, int total) {} + public void onFileTransferProgressIndication(ChatMessage msg, Content content, int offset, int total) {} } diff --git a/src/android/org/linphone/ChatListFragment.java b/src/android/org/linphone/ChatListFragment.java index f388760bc..abb764964 100644 --- a/src/android/org/linphone/ChatListFragment.java +++ b/src/android/org/linphone/ChatListFragment.java @@ -43,13 +43,13 @@ import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; -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.core.Address; +import org.linphone.core.ChatMessage; +import org.linphone.core.ChatRoom; +import org.linphone.core.Core; +import org.linphone.core.CoreException; +import org.linphone.core.Factory; +import org.linphone.core.CoreListenerStub; import org.linphone.mediastream.Log; import java.util.List; @@ -64,7 +64,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; + private CoreListenerStub mListener; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, @@ -102,9 +102,9 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte delete = (ImageView) view.findViewById(R.id.delete); delete.setOnClickListener(this); - mListener = new LinphoneCoreListenerBase() { + mListener = new CoreListenerStub() { @Override - public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) { + public void onMessageReceived(Core lc, ChatRoom cr, ChatMessage message) { refresh(); } }; @@ -127,7 +127,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte if (chatList.isItemChecked(i)) { String sipUri = chatList.getAdapter().getItem(i).toString(); if (sipUri != null) { - LinphoneChatRoom chatroom = LinphoneManager.getLc().getOrCreateChatRoom(sipUri); + ChatRoom chatroom = LinphoneManager.getLc().getChatRoomFromUri(sipUri); if (chatroom != null) { chatroom.deleteHistory(); } @@ -212,7 +212,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte LinphoneActivity.instance().hideTabBar(false); } - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.addListener(mListener); } @@ -222,7 +222,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte @Override public void onPause() { - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.removeListener(mListener); } @@ -405,24 +405,19 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte view.setTag(holder); } - LinphoneAddress address; - try { - address = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri); - } catch (LinphoneCoreException e) { - Log.e("Chat view cannot parse address", e); - return view; - } + Address address; + address = Factory.instance().createAddress(sipUri); LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(address); String message = ""; Long time; - LinphoneChatRoom chatRoom = LinphoneManager.getLc().getChatRoom(address); + ChatRoom chatRoom = LinphoneManager.getLc().getChatRoom(address); int unreadMessagesCount = chatRoom.getUnreadMessagesCount(); - LinphoneChatMessage[] history = chatRoom.getHistory(1); - LinphoneChatMessage msg = history[0]; + ChatMessage[] history = chatRoom.getHistory(1); + ChatMessage msg = history[0]; - if(msg.getFileTransferInformation() != null || msg.getExternalBodyUrl() != null || msg.getAppData() != null ){ + if(msg.getFileTransferInformation() != null || msg.getExternalBodyUrl() != null || msg.getAppdata() != null ){ holder.lastMessageView.setBackgroundResource(R.drawable.chat_file_message); time = msg.getTime(); holder.date.setText(LinphoneUtils.timestampToHumanDate(getActivity(),time,getString(R.string.messages_list_date_format))); diff --git a/src/android/org/linphone/ContactDetailsFragment.java b/src/android/org/linphone/ContactDetailsFragment.java index 1018218d2..cef6bd33d 100644 --- a/src/android/org/linphone/ContactDetailsFragment.java +++ b/src/android/org/linphone/ContactDetailsFragment.java @@ -19,7 +19,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import org.linphone.core.LinphoneProxyConfig; +import org.linphone.core.ProxyConfig; import android.annotation.SuppressLint; import android.app.Dialog; @@ -136,13 +136,13 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener tv.setSelected(true); - LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig(); + ProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig(); if (lpc != null) { String username = lpc.normalizePhoneNumber(displayednumberOrAddress); value = LinphoneUtils.getFullAddressFromUsername(username); } - String contactAddress = contact.getPresenceModelForUri(noa.getValue()); + String contactAddress = contact.getPresenceModelForUriOrTel(noa.getValue()); if (contactAddress != null) { v.findViewById(R.id.friendLinphone).setVisibility(View.VISIBLE); } diff --git a/src/android/org/linphone/ContactsListFragment.java b/src/android/org/linphone/ContactsListFragment.java index 146bd6d67..7b9b987f4 100644 --- a/src/android/org/linphone/ContactsListFragment.java +++ b/src/android/org/linphone/ContactsListFragment.java @@ -542,7 +542,7 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O holder.separator.setVisibility(View.GONE); } - if (contact.isInLinphoneFriendList()) { + if (contact.isInFriendList()) { holder.linphoneFriend.setVisibility(View.VISIBLE); } else { holder.linphoneFriend.setVisibility(View.GONE); @@ -595,7 +595,7 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O holder.delete.setVisibility(View.INVISIBLE); } - /*LinphoneFriend[] friends = LinphoneManager.getLc().getFriendList(); + /*Friend[] friends = LinphoneManager.getLc().getFriendsLists(); if (!ContactsManager.getInstance().isContactPresenceDisabled() && friends != null) { holder.friendStatus.setVisibility(View.VISIBLE); PresenceActivityType presenceActivity = friends[0].getPresenceModel().getActivity().getType(); diff --git a/src/android/org/linphone/ContactsManager.java b/src/android/org/linphone/ContactsManager.java index cefe9547c..2d278cc39 100644 --- a/src/android/org/linphone/ContactsManager.java +++ b/src/android/org/linphone/ContactsManager.java @@ -36,11 +36,11 @@ import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds; import android.provider.ContactsContract.Data; -import org.linphone.core.LinphoneAddress; -import org.linphone.core.LinphoneCore; -import org.linphone.core.LinphoneFriend; -import org.linphone.core.LinphoneFriendImpl; -import org.linphone.core.LinphoneProxyConfig; +import org.linphone.core.Address; +import org.linphone.core.Core; +import org.linphone.core.Friend; +import org.linphone.core.FriendList; +import org.linphone.core.ProxyConfig; import org.linphone.mediastream.Log; import java.util.ArrayList; @@ -211,30 +211,31 @@ public class ContactsManager extends ContentObserver { initializeContactManager(context, contentResolver); } - public synchronized LinphoneContact findContactFromAddress(LinphoneAddress address) { + public synchronized LinphoneContact findContactFromAddress(Address address) { String sipUri = address.asStringUriOnly(); - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); - LinphoneFriend lf = lc.findFriendByAddress(sipUri); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Friend lf = lc.findFriend(address); if (lf != null) { - LinphoneContact contact = (LinphoneContact)((LinphoneFriendImpl)lf).getUserData(); + LinphoneContact contact = (LinphoneContact)lf.getUserData(); return contact; } return null; } public synchronized LinphoneContact findContactFromPhoneNumber(String phoneNumber) { - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); - LinphoneProxyConfig lpc = null; + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + ProxyConfig lpc = null; if (lc != null) { lpc = lc.getDefaultProxyConfig(); } if (lpc == null) return null; String normalized = lpc.normalizePhoneNumber(phoneNumber); - LinphoneAddress addr = lpc.normalizeSipUri(normalized); - LinphoneFriend lf = lc.findFriendByAddress(addr.asStringUriOnly() + ";user=phone"); // Without this, the hashmap inside liblinphone won't find it... + Address addr = lpc.normalizeSipUri(normalized); + addr.setMethodParam(";user=phone"); + Friend lf = lc.findFriend(addr); // Without this, the hashmap inside liblinphone won't find it... if (lf != null) { - LinphoneContact contact = (LinphoneContact)((LinphoneFriendImpl)lf).getUserData(); + LinphoneContact contact = (LinphoneContact)lf.getUserData(); return contact; } return null; @@ -248,8 +249,8 @@ public class ContactsManager extends ContentObserver { sipContacts = c; } - public synchronized void refreshSipContact(LinphoneFriend lf) { - LinphoneContact contact = (LinphoneContact)((LinphoneFriendImpl)lf).getUserData(); + public synchronized void refreshSipContact(Friend lf) { + LinphoneContact contact = (LinphoneContact)lf.getUserData(); if (contact != null && !sipContacts.contains(contact)) { sipContacts.add(contact); Collections.sort(sipContacts); @@ -274,29 +275,31 @@ public class ContactsManager extends ContentObserver { Date contactsTime = new Date(); androidContactsCache.clear(); - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { - for (LinphoneFriend friend : lc.getFriendList()) { - LinphoneContact contact = (LinphoneContact)((LinphoneFriendImpl)friend).getUserData(); - if (contact != null) { - contact.clearAddresses(); - contacts.add(contact); - if (contact.getAndroidId() != null) { - androidContactsCache.put(contact.getAndroidId(), contact); - } - } else { - if (friend.getRefKey() != null) { - // Friend has a refkey and but no LinphoneContact => represents a native contact stored in db from a previous version of Linphone, remove it - lc.removeFriend(friend); - } else { - // No refkey so it's a standalone contact - contact = new LinphoneContact(); - contact.setFriend(friend); - contact.refresh(); - if (contact.hasAddress()) { - sipContacts.add(contact); - } + for (FriendList list : lc.getFriendsLists()) { + for (Friend friend : list.getFriends()) { + LinphoneContact contact = (LinphoneContact) friend.getUserData(); + if (contact != null) { + contact.clearAddresses(); contacts.add(contact); + if (contact.getAndroidId() != null) { + androidContactsCache.put(contact.getAndroidId(), contact); + } + } else { + if (friend.getRefKey() != null) { + // Friend has a refkey and but no LinphoneContact => represents a native contact stored in db from a previous version of Linphone, remove it + //lc.removeFriend(friend); //TODO FIXME + } else { + // No refkey so it's a standalone contact + contact = new LinphoneContact(); + contact.setFriend(friend); + contact.refresh(); + if (contact.hasAddress()) { + sipContacts.add(contact); + } + contacts.add(contact); + } } } } @@ -356,7 +359,7 @@ public class ContactsManager extends ContentObserver { String id = contact.getAndroidId(); if (id != null && !nativeIds.contains(id)) { // Has been removed since last fetch - lc.removeFriend(contact.getLinphoneFriend()); + //lc.removeFriend(contact.getFriend()); //TODO FIXME contacts.remove(contact); } } @@ -405,8 +408,8 @@ public class ContactsManager extends ContentObserver { Log.i("[ContactsManager] Step 2 for " + contacts.size() + " contacts: " + time + " elapsed since starting"); for (LinphoneContact contact : contacts) { - // Create the LinphoneFriends matching the native contacts - contact.createOrUpdateLinphoneFriendFromNativeContact(); + // Create the Friends matching the native contacts + contact.createOrUpdateFriendFromNativeContact(); } timeElapsed = (new Date()).getTime() - contactsTime.getTime(); time = String.format("%02d:%02d", @@ -417,7 +420,7 @@ public class ContactsManager extends ContentObserver { androidContactsCache.clear(); } else { - Log.w("[Permission] Read contacts permission wasn't granted, only fetch LinphoneFriends"); + Log.w("[Permission] Read contacts permission wasn't granted, only fetch Friends"); } Collections.sort(contacts); @@ -427,9 +430,9 @@ public class ContactsManager extends ContentObserver { if (LinphonePreferences.instance() != null && LinphonePreferences.instance().isFriendlistsubscriptionEnabled()) { if (getString(R.string.rls_uri) != null) { - LinphoneManager.getLc().getFriendLists()[0].setRLSUri(getString(R.string.rls_uri)); + LinphoneManager.getLc().getFriendsLists()[0].setRlsUri(getString(R.string.rls_uri)); } - LinphoneManager.getLc().getFriendLists()[0].updateSubscriptions(); + LinphoneManager.getLc().getFriendsLists()[0].updateSubscriptions(); } for (ContactsUpdatedListener listener : contactsUpdatedListeners) { listener.onContactsUpdated(); diff --git a/src/android/org/linphone/DialerFragment.java b/src/android/org/linphone/DialerFragment.java index c7cd468ea..0ccb041ea 100644 --- a/src/android/org/linphone/DialerFragment.java +++ b/src/android/org/linphone/DialerFragment.java @@ -31,7 +31,7 @@ import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; -import org.linphone.core.LinphoneCore; +import org.linphone.core.Core; import org.linphone.mediastream.Log; import org.linphone.ui.AddressAware; import org.linphone.ui.AddressText; @@ -69,7 +69,7 @@ public class DialerFragment extends Fragment { mCall.setImageResource(R.drawable.call_add); } } else { - if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null && LinphoneManager.getLcIfManagerNotDestroyedOrNull().getVideoAutoInitiatePolicy()) { + if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null && LinphoneManager.getLcIfManagerNotDestroyedOrNull().getVideoActivationPolicy().getAutomaticallyInitiate()) { mCall.setImageResource(R.drawable.call_video_start); } else { mCall.setImageResource(R.drawable.call_audio_start); @@ -99,7 +99,7 @@ public class DialerFragment extends Fragment { transferListener = new OnClickListener() { @Override public void onClick(View v) { - LinphoneCore lc = LinphoneManager.getLc(); + Core lc = LinphoneManager.getLc(); if (lc.getCurrentCall() == null) { return; } @@ -184,7 +184,7 @@ public class DialerFragment extends Fragment { return; } isCallTransferOngoing = LinphoneActivity.instance().isCallTransfer(); - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc == null) { return; } @@ -201,7 +201,7 @@ public class DialerFragment extends Fragment { mAddContact.setImageResource(R.drawable.call_alt_back); mAddContact.setOnClickListener(cancelListener); } else { - if (LinphoneManager.getLc().getVideoAutoInitiatePolicy()) { + if (LinphoneManager.getLc().getVideoActivationPolicy().getAutomaticallyInitiate()) { mCall.setImageResource(R.drawable.call_video_start); } else { mCall.setImageResource(R.drawable.call_audio_start); diff --git a/src/android/org/linphone/DozeReceiver.java b/src/android/org/linphone/DozeReceiver.java index 67e7b2770..962a52c6d 100644 --- a/src/android/org/linphone/DozeReceiver.java +++ b/src/android/org/linphone/DozeReceiver.java @@ -19,8 +19,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import org.linphone.core.LinphoneCore; -import org.linphone.core.LinphoneCoreFactory; +import org.linphone.core.Core; +import org.linphone.core.Factory; import org.linphone.mediastream.Log; import android.content.Context; @@ -38,9 +38,9 @@ public class DozeReceiver extends android.content.BroadcastReceiver { if (!LinphoneService.isReady()) return; boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled(); - LinphoneCoreFactory.instance().enableLogCollection(isDebugEnabled); - LinphoneCoreFactory.instance().setDebugMode(isDebugEnabled, context.getString(R.string.app_name)); - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Factory.instance().enableLogCollection(isDebugEnabled); + Factory.instance().setDebugMode(isDebugEnabled, context.getString(R.string.app_name)); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc == null) return; pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); diff --git a/src/android/org/linphone/HistoryDetailFragment.java b/src/android/org/linphone/HistoryDetailFragment.java index 9bee76883..6acd7a744 100644 --- a/src/android/org/linphone/HistoryDetailFragment.java +++ b/src/android/org/linphone/HistoryDetailFragment.java @@ -29,9 +29,9 @@ import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; -import org.linphone.core.LinphoneAddress; -import org.linphone.core.LinphoneCoreException; -import org.linphone.core.LinphoneCoreFactory; +import org.linphone.core.Address; +import org.linphone.core.CoreException; +import org.linphone.core.Factory; import org.linphone.mediastream.Log; public class HistoryDetailFragment extends Fragment implements OnClickListener { @@ -103,12 +103,8 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener { Long longDate = Long.parseLong(callDate); date.setText(LinphoneUtils.timestampToHumanDate(getActivity(),longDate,getString(R.string.history_detail_date_format))); - LinphoneAddress lAddress = null; - try { - lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri); - } catch (LinphoneCoreException e) { - Log.e(e); - } + Address lAddress = null; + lAddress = Factory.instance().createAddress(sipUri); if (lAddress != null) { contactAddress.setText(lAddress.asStringUriOnly()); @@ -163,13 +159,9 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener { LinphoneActivity.instance().displayChat(sipUri, null, null); } else if (id == R.id.add_contact) { String uri = sipUri; - LinphoneAddress addr = null; - try { - addr = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri); - uri = addr.asStringUriOnly(); - } catch (LinphoneCoreException e) { - Log.e(e); - } + Address addr = null; + addr = Factory.instance().createAddress(sipUri); + uri = addr.asStringUriOnly(); if (addr != null && addr.getDisplayName() != null) LinphoneActivity.instance().displayContactsForEdition(addr.asStringUriOnly(), addr.getDisplayName()); else diff --git a/src/android/org/linphone/HistoryListFragment.java b/src/android/org/linphone/HistoryListFragment.java index 01e4ead15..3358d69b5 100644 --- a/src/android/org/linphone/HistoryListFragment.java +++ b/src/android/org/linphone/HistoryListFragment.java @@ -25,10 +25,11 @@ import java.util.Arrays; import java.util.Calendar; import java.util.List; -import org.linphone.core.CallDirection; -import org.linphone.core.LinphoneAddress; -import org.linphone.core.LinphoneCallLog; -import org.linphone.core.LinphoneCallLog.CallStatus; +import org.linphone.core.Call; +import org.linphone.core.Call.Dir; +import org.linphone.core.Address; +import org.linphone.core.CallLog; +import org.linphone.core.CallLog.CallStatus; import android.annotation.SuppressLint; import android.app.Dialog; @@ -62,7 +63,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On private View allCallsSelected, missedCallsSelected; private LinearLayout editList, topBar; private boolean onlyDisplayMissedCalls, isEditMode; - private List mLogs; + private List mLogs; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, @@ -123,11 +124,11 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On public void displayFirstLog(){ if (mLogs != null && mLogs.size() > 0) { - LinphoneCallLog log = mLogs.get(0); - if (log.getDirection() == CallDirection.Incoming) { - LinphoneActivity.instance().displayHistoryDetail(mLogs.get(0).getFrom().toString(), mLogs.get(0)); + CallLog log = mLogs.get(0); + if (log.getDir() == Call.Dir.Incoming) { + LinphoneActivity.instance().displayHistoryDetail(mLogs.get(0).getFromAddress().toString(), mLogs.get(0)); } else { - LinphoneActivity.instance().displayHistoryDetail(mLogs.get(0).getTo().toString(), mLogs.get(0)); + LinphoneActivity.instance().displayHistoryDetail(mLogs.get(0).getToAddress().toString(), mLogs.get(0)); } } else { LinphoneActivity.instance().displayEmptyFragment(); @@ -138,7 +139,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On int size = historyList.getAdapter().getCount(); for(int i=0; i missedCalls = new ArrayList(); - for (LinphoneCallLog log : mLogs) { + List missedCalls = new ArrayList(); + for (CallLog log : mLogs) { if (log.getStatus() == CallStatus.Missed) { missedCalls.add(log); } @@ -323,7 +324,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On @Override public void onItemClick(AdapterView adapter, View view, int position, long id) { if (isEditMode) { - LinphoneCallLog log = mLogs.get(position); + CallLog log = mLogs.get(position); LinphoneManager.getLc().removeCallLog(log); mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs()); } @@ -428,9 +429,9 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On if (mLogs == null || mLogs.size() < position) return view; - final LinphoneCallLog log = mLogs.get(position); - long timestamp = log.getTimestamp(); - LinphoneAddress address; + final CallLog log = mLogs.get(position); + long timestamp = log.getStartDate(); + Address address; holder.contact.setSelected(true); // For automated horizontal scrolling of long texts @@ -441,8 +442,8 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On separatorText.setText(timestampToHumanDate(logTime)); if (position > 0) { - LinphoneCallLog previousLog = mLogs.get(position-1); - long previousTimestamp = previousLog.getTimestamp(); + CallLog previousLog = mLogs.get(position-1); + long previousTimestamp = previousLog.getStartDate(); Calendar previousLogTime = Calendar.getInstance(); previousLogTime.setTimeInMillis(previousTimestamp); @@ -455,15 +456,15 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On separator.setVisibility(View.VISIBLE); } - if (log.getDirection() == CallDirection.Incoming) { - address = log.getFrom(); + if (log.getDir() == Call.Dir.Incoming) { + address = log.getFromAddress(); if (log.getStatus() == CallStatus.Missed) { holder.callDirection.setImageResource(R.drawable.call_status_missed); } else { holder.callDirection.setImageResource(R.drawable.call_status_incoming); } } else { - address = log.getTo(); + address = log.getToAddress(); holder.callDirection.setImageResource(R.drawable.call_status_outgoing); } @@ -528,12 +529,12 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On @Override public void onClick(View v) { if (LinphoneActivity.isInstanciated()) { - LinphoneCallLog log = mLogs.get(position); - LinphoneAddress address; - if (log.getDirection() == CallDirection.Incoming) { - address = log.getFrom(); + CallLog log = mLogs.get(position); + Address address; + if (log.getDir() == Call.Dir.Incoming) { + address = log.getFromAddress(); } else { - address = log.getTo(); + address = log.getToAddress(); } LinphoneActivity.instance().setAddresGoToDialerAndCall(address.asStringUriOnly(), address.getDisplayName(), null); } diff --git a/src/android/org/linphone/HookReceiver.java b/src/android/org/linphone/HookReceiver.java index 436026075..952f6ea78 100644 --- a/src/android/org/linphone/HookReceiver.java +++ b/src/android/org/linphone/HookReceiver.java @@ -36,7 +36,7 @@ public class HookReceiver extends BroadcastReceiver { if(b){ //handset on Log.i(" ======>>>>>> HookReceiver - handset ON"); - LinphoneManager.getLc().enableSpeaker(false); + LinphoneManager.getInstance().enableSpeaker(false); if(!LinphoneManager.getInstance().isHansetModeOn()) LinphoneManager.getInstance().setHandsetMode(true); @@ -44,7 +44,7 @@ public class HookReceiver extends BroadcastReceiver { }else{ //handset off Log.i(" ======>>>>>> HookReceiver - handset OFF"); - LinphoneManager.getLc().enableSpeaker(true); + LinphoneManager.getInstance().enableSpeaker(true); LinphoneManager.getInstance().setHandsetMode(false); } } diff --git a/src/android/org/linphone/KeepAliveReceiver.java b/src/android/org/linphone/KeepAliveReceiver.java index 76e1695c0..072b820c4 100644 --- a/src/android/org/linphone/KeepAliveReceiver.java +++ b/src/android/org/linphone/KeepAliveReceiver.java @@ -20,8 +20,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import org.linphone.compatibility.Compatibility; -import org.linphone.core.LinphoneCore; -import org.linphone.core.LinphoneCoreFactory; +import org.linphone.core.Core; +import org.linphone.core.Factory; import org.linphone.mediastream.Log; import android.app.AlarmManager; @@ -41,9 +41,9 @@ public class KeepAliveReceiver extends BroadcastReceiver { return; } else { boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled(); - LinphoneCoreFactory.instance().enableLogCollection(isDebugEnabled); - LinphoneCoreFactory.instance().setDebugMode(isDebugEnabled, context.getString(R.string.app_name)); - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Factory.instance().enableLogCollection(isDebugEnabled); + Factory.instance().setDebugMode(isDebugEnabled, context.getString(R.string.app_name)); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc == null) return; String action = intent.getAction(); diff --git a/src/android/org/linphone/LinphoneActivity.java b/src/android/org/linphone/LinphoneActivity.java index 151f01cc3..3abbb46a6 100644 --- a/src/android/org/linphone/LinphoneActivity.java +++ b/src/android/org/linphone/LinphoneActivity.java @@ -66,21 +66,21 @@ import org.linphone.LinphoneManager.AddressType; import org.linphone.assistant.AssistantActivity; import org.linphone.assistant.RemoteProvisioningLoginActivity; import org.linphone.compatibility.Compatibility; -import org.linphone.core.CallDirection; -import org.linphone.core.LinphoneAddress; -import org.linphone.core.LinphoneAuthInfo; -import org.linphone.core.LinphoneCall; -import org.linphone.core.LinphoneCall.State; -import org.linphone.core.LinphoneCallLog; -import org.linphone.core.LinphoneCallLog.CallStatus; -import org.linphone.core.LinphoneChatMessage; -import org.linphone.core.LinphoneChatRoom; -import org.linphone.core.LinphoneCore; -import org.linphone.core.LinphoneCore.RegistrationState; -import org.linphone.core.LinphoneCoreException; -import org.linphone.core.LinphoneCoreFactory; -import org.linphone.core.LinphoneCoreListenerBase; -import org.linphone.core.LinphoneProxyConfig; +import org.linphone.core.Call.Dir; +import org.linphone.core.Address; +import org.linphone.core.AuthInfo; +import org.linphone.core.Call; +import org.linphone.core.Call.State; +import org.linphone.core.CallLog; +import org.linphone.core.CallLog.CallStatus; +import org.linphone.core.ChatMessage; +import org.linphone.core.ChatRoom; +import org.linphone.core.Core; +import org.linphone.core.Core.RegistrationState; +import org.linphone.core.CoreException; +import org.linphone.core.Factory; +import org.linphone.core.CoreListenerStub; +import org.linphone.core.ProxyConfig; import org.linphone.core.Reason; import org.linphone.mediastream.Log; import org.linphone.purchase.InAppPurchaseActivity; @@ -130,7 +130,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick private boolean emptyFragment = false; private boolean isTrialAccount = false; private OrientationEventListener mOrientationHelper; - private LinphoneCoreListenerBase mListener; + private CoreListenerStub mListener; private LinearLayout mTabBar; private DrawerLayout sideMenu; @@ -212,16 +212,16 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick currentFragment = (FragmentsAvailable) savedInstanceState.getSerializable("currentFragment"); } - mListener = new LinphoneCoreListenerBase(){ + mListener = new CoreListenerStub(){ @Override - public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) { + public void onMessageReceived(Core lc, ChatRoom cr, ChatMessage message) { displayMissedChats(getUnreadMessageCount()); } @Override - public void registrationState(LinphoneCore lc, LinphoneProxyConfig proxy, LinphoneCore.RegistrationState state, String smessage) { - LinphoneAuthInfo authInfo = lc.findAuthInfo(proxy.getIdentity(), proxy.getRealm(), proxy.getDomain()); - if (state.equals(RegistrationState.RegistrationCleared)) { + public void onRegistrationStateChanged(Core lc, ProxyConfig proxy, Core.RegistrationState state, String smessage) { + AuthInfo authInfo = lc.findAuthInfo(proxy.getRealm(), proxy.getIdentityAddress().getUsername(), proxy.getDomain()); + if (state.equals(RegistrationState.Cleared)) { if (lc != null) { if (authInfo != null) lc.removeAuthInfo(authInfo); @@ -232,14 +232,14 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick if(getResources().getBoolean(R.bool.use_phone_number_validation) && authInfo != null && authInfo.getDomain().equals(getString(R.string.default_domain))) { - if (state.equals(RegistrationState.RegistrationOk)) { + if (state.equals(RegistrationState.Ok)) { LinphoneManager.getInstance().isAccountWithAlias(); } } - if(state.equals(RegistrationState.RegistrationFailed) && newProxyConfig) { + if(state.equals(RegistrationState.Failed) && newProxyConfig) { newProxyConfig = false; - if (proxy.getError() == Reason.BadCredentials) { + if (proxy.getError() == Reason.Forbidden) { //displayCustomToast(getString(R.string.error_bad_credentials), Toast.LENGTH_LONG); } if (proxy.getError() == Reason.Unauthorized) { @@ -252,12 +252,12 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick } @Override - public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) { + public void onCallStateChanged(Core lc, Call call, Call.State state, String message) { if (state == State.IncomingReceived) { startActivity(new Intent(LinphoneActivity.instance(), CallIncomingActivity.class)); } else if (state == State.OutgoingInit || state == State.OutgoingProgress) { startActivity(new Intent(LinphoneActivity.instance(), CallOutgoingActivity.class)); - } else if (state == State.CallEnd || state == State.Error || state == State.CallReleased) { + } else if (state == State.End || state == State.Error || state == State.Released) { resetClassicMenuLayoutAndGoBackToCallIfStillRunning(); } @@ -536,22 +536,16 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick } } - public void displayHistoryDetail(String sipUri, LinphoneCallLog log) { - LinphoneAddress lAddress; - try { - lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri); - } catch (LinphoneCoreException e) { - Log.e("Cannot display history details",e); - //TODO display error message - return; - } + public void displayHistoryDetail(String sipUri, CallLog log) { + Address lAddress; + lAddress = Factory.instance().createAddress(sipUri); LinphoneContact c = ContactsManager.getInstance().findContactFromAddress(lAddress); String displayName = c != null ? c.getFullName() : LinphoneUtils.getAddressDisplayName(sipUri); String pictureUri = c != null && c.getPhotoUri() != null ? c.getPhotoUri().toString() : null; String status; - if (log.getDirection() == CallDirection.Outgoing) { + if (log.getDir() == Call.Dir.Outgoing) { status = getString(R.string.outgoing); } else { if (log.getStatus() == CallStatus.Missed) { @@ -561,8 +555,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick } } - String callTime = secondsToDisplayableString(log.getCallDuration()); - String callDate = String.valueOf(log.getTimestamp()); + String callTime = secondsToDisplayableString(log.getDuration()); + String callDate = String.valueOf(log.getStartDate()); Fragment fragment2 = getFragmentManager().findFragmentById(R.id.fragmentContainer2); if (fragment2 != null && fragment2.isVisible() && currentFragment == FragmentsAvailable.HISTORY_DETAIL) { @@ -645,8 +639,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick public int getUnreadMessageCount() { int count = 0; - LinphoneChatRoom[] chats = LinphoneManager.getLc().getChatRooms(); - for (LinphoneChatRoom chatroom : chats) { + ChatRoom[] chats = LinphoneManager.getLc().getChatRooms(); + for (ChatRoom chatroom : chats) { count += chatroom.getUnreadMessagesCount(); } return count; @@ -661,15 +655,9 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick String thumbnailUri = null; String displayName = null; - LinphoneAddress lAddress = null; + Address lAddress = null; if(sipUri != null) { - try { - lAddress = LinphoneManager.getLc().interpretUrl(sipUri); - } catch (LinphoneCoreException e) { - //TODO display error message - Log.e("Cannot display chat", e); - return; - } + lAddress = LinphoneManager.getLc().interpretUrl(sipUri); LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(lAddress); displayName = contact != null ? contact.getFullName() : null; @@ -842,20 +830,20 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick } static class ChatRoomContainer{ - private LinphoneChatRoom mCr; + private ChatRoom mCr; long mTime; - static public ChatRoomContainer createChatroomContainer(LinphoneChatRoom chatRoom) { + static public ChatRoomContainer createChatroomContainer(ChatRoom chatRoom) { if (chatRoom.getHistorySize() <= 0) return null; return new ChatRoomContainer(chatRoom); } - public ChatRoomContainer(LinphoneChatRoom chatroom){ + public ChatRoomContainer(ChatRoom chatroom){ mCr = chatroom; - LinphoneChatMessage[] lastMsg = chatroom.getHistory(1); + ChatMessage[] lastMsg = chatroom.getHistory(1); if (lastMsg != null && lastMsg.length > 0 && lastMsg[0] != null) { mTime = lastMsg[0].getTime(); }else mTime = 0; } - LinphoneChatRoom getChatRoom(){ + ChatRoom getChatRoom(){ return mCr; } long getTime(){ @@ -865,10 +853,10 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick public List getChatList() { ArrayList chatList = new ArrayList(); - LinphoneChatRoom[] chats = LinphoneManager.getLc().getChatRooms(); + ChatRoom[] chats = LinphoneManager.getLc().getChatRooms(); List rooms = new ArrayList(); - for (LinphoneChatRoom chatroom : chats) { + for (ChatRoom chatroom : chats) { ChatRoomContainer crc = createChatroomContainer(chatroom); if (crc != null) rooms.add(crc); } @@ -898,7 +886,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick } public void removeFromChatList(String sipUri) { - LinphoneChatRoom chatroom = LinphoneManager.getLc().getOrCreateChatRoom(sipUri); + ChatRoom chatroom = LinphoneManager.getLc().getChatRoomFromUri(sipUri); chatroom.deleteHistory(); } @@ -974,7 +962,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick @Override public void onClick(View view) { String newPassword = ((EditText) dialog.findViewById(R.id.password)).getText().toString(); - LinphoneAuthInfo authInfo = LinphoneCoreFactory.instance().createAuthInfo(username, null, newPassword, null, realm, domain); + AuthInfo authInfo = Factory.instance().createAuthInfo(username, null, newPassword, null, realm, domain); LinphoneManager.getLc().addAuthInfo(authInfo); LinphoneManager.getLc().refreshRegisters(); dialog.dismiss(); @@ -1005,7 +993,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick LinphoneManager.getInstance().newOutgoingCall(address); } - public void startIncallActivity(LinphoneCall currentCall) { + public void startIncallActivity(Call currentCall) { Intent intent = new Intent(this, CallActivity.class); startOrientationSensor(); startActivityForResult(intent, CALL_ACTIVITY); @@ -1049,11 +1037,11 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick Log.d("Phone orientation changed to ", degrees); int rotation = (360 - degrees) % 360; - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.setDeviceRotation(rotation); - LinphoneCall currentCall = lc.getCurrentCall(); - if (currentCall != null && currentCall.cameraEnabled() && currentCall.getCurrentParams().getVideoEnabled()) { + Call currentCall = lc.getCurrentCall(); + if (currentCall != null && currentCall.cameraEnabled() && currentCall.getCurrentParams().videoEnabled()) { lc.updateCall(currentCall, null); } } @@ -1079,8 +1067,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick } if (LinphoneManager.isInstanciated() && LinphoneManager.getLc().getCallsNb() > 0) { - LinphoneCall call = LinphoneManager.getLc().getCalls()[0]; - if (call.getState() == LinphoneCall.State.IncomingReceived) { + Call call = LinphoneManager.getLc().getCalls()[0]; + if (call.getState() == Call.State.IncomingReceived) { startActivity(new Intent(LinphoneActivity.this, CallIncomingActivity.class)); } else { startIncallActivity(call); @@ -1166,7 +1154,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick protected void onPause() { getIntent().putExtra("PreviousActivity", 0); - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.removeListener(mListener); } @@ -1378,7 +1366,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick startService(new Intent(Intent.ACTION_MAIN).setClass(this, LinphoneService.class)); } - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.addListener(mListener); if (!LinphoneService.instance().displayServiceNotification()) { @@ -1411,12 +1399,12 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick if (getIntent().getIntExtra("PreviousActivity", 0) != CALL_ACTIVITY && !doNotGoToCallActivity) { if (LinphoneManager.getLc().getCalls().length > 0) { - LinphoneCall call = LinphoneManager.getLc().getCalls()[0]; - LinphoneCall.State callState = call.getState(); + Call call = LinphoneManager.getLc().getCalls()[0]; + Call.State onCallStateChanged = call.getState(); - if (callState == State.IncomingReceived) { + if (onCallStateChanged == State.IncomingReceived) { startActivity(new Intent(this, CallIncomingActivity.class)); - } else if (callState == State.OutgoingInit || callState == State.OutgoingProgress || callState == State.OutgoingRinging) { + } else if (onCallStateChanged == State.OutgoingInit || onCallStateChanged == State.OutgoingProgress || onCallStateChanged == State.OutgoingRinging) { startActivity(new Intent(this, CallOutgoingActivity.class)); } else { startIncallActivity(call); @@ -1496,7 +1484,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick displayInapp(); } else if (extras != null && extras.getBoolean("Notification", false)) { if (LinphoneManager.getLc().getCallsNb() > 0) { - LinphoneCall call = LinphoneManager.getLc().getCalls()[0]; + Call call = LinphoneManager.getLc().getCalls()[0]; startIncallActivity(call); } }else if (extras != null && extras.getBoolean("StartCall", false)) { @@ -1528,8 +1516,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick } if (LinphoneManager.getLc().getCalls().length > 0) { // If a call is ringing, start incomingcallactivity - Collection incoming = new ArrayList(); - incoming.add(LinphoneCall.State.IncomingReceived); + Collection incoming = new ArrayList(); + incoming.add(Call.State.IncomingReceived); if (LinphoneUtils.getCallsInState(LinphoneManager.getLc(), incoming).size() > 0) { if (CallActivity.isInstanciated()) { CallActivity.instance().startIncomingCallActivity(); @@ -1629,13 +1617,13 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick }); } - private int getStatusIconResource(LinphoneCore.RegistrationState state) { + private int getStatusIconResource(Core.RegistrationState state) { try { - if (state == RegistrationState.RegistrationOk) { + if (state == RegistrationState.Ok) { return R.drawable.led_connected; - } else if (state == RegistrationState.RegistrationProgress) { + } else if (state == RegistrationState.Progress) { return R.drawable.led_inprogress; - } else if (state == RegistrationState.RegistrationFailed) { + } else if (state == RegistrationState.Failed) { return R.drawable.led_error; } else { return R.drawable.led_disconnected; @@ -1654,7 +1642,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick TextView displayName = (TextView) defaultAccount.findViewById(R.id.main_account_display_name); - LinphoneProxyConfig proxy = LinphoneManager.getLc().getDefaultProxyConfig(); + ProxyConfig proxy = LinphoneManager.getLc().getDefaultProxyConfig(); if(proxy == null) { displayName.setText(getString(R.string.no_account)); status.setVisibility(View.GONE); @@ -1664,8 +1652,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick defaultAccount.setOnClickListener(null); } else { - address.setText(proxy.getAddress().asStringUriOnly()); - displayName.setText(LinphoneUtils.getAddressDisplayName(proxy.getAddress())); + address.setText(proxy.getIdentityAddress().asStringUriOnly()); + displayName.setText(LinphoneUtils.getAddressDisplayName(proxy.getIdentityAddress())); status.setImageResource(getStatusIconResource(proxy.getState())); status.setVisibility(View.VISIBLE); @@ -1706,16 +1694,16 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick } class AccountsListAdapter extends BaseAdapter { - List proxy_list; + List proxy_list; AccountsListAdapter() { - proxy_list = new ArrayList(); + proxy_list = new ArrayList(); refresh(); } public void refresh(){ - proxy_list = new ArrayList(); - for(LinphoneProxyConfig proxyConfig : LinphoneManager.getLc().getProxyConfigList()){ + proxy_list = new ArrayList(); + for(ProxyConfig proxyConfig : LinphoneManager.getLc().getProxyConfigList()){ if(proxyConfig != LinphoneManager.getLc().getDefaultProxyConfig()){ proxy_list.add(proxyConfig); } @@ -1740,7 +1728,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick public View getView(final int position, View convertView, ViewGroup parent) { View view = null; - LinphoneProxyConfig lpc = (LinphoneProxyConfig) getItem(position); + ProxyConfig lpc = (ProxyConfig) getItem(position); if (convertView != null) { view = convertView; } else { @@ -1749,7 +1737,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick ImageView status = (ImageView) view.findViewById(R.id.account_status); TextView address = (TextView) view.findViewById(R.id.account_address); - String sipAddress = lpc.getAddress().asStringUriOnly(); + String sipAddress = lpc.getIdentityAddress().asStringUriOnly(); address.setText(sipAddress); diff --git a/src/android/org/linphone/LinphoneContact.java b/src/android/org/linphone/LinphoneContact.java index 9f0635924..aa12ccee9 100644 --- a/src/android/org/linphone/LinphoneContact.java +++ b/src/android/org/linphone/LinphoneContact.java @@ -25,12 +25,11 @@ import java.util.Collections; import java.util.List; import java.util.Locale; -import org.linphone.core.LinphoneAddress; -import org.linphone.core.LinphoneCore; -import org.linphone.core.LinphoneCoreException; -import org.linphone.core.LinphoneFriend; -import org.linphone.core.LinphoneFriendImpl; -import org.linphone.core.LinphoneFriend.SubscribePolicy; +import org.linphone.core.Address; +import org.linphone.core.Core; +import org.linphone.core.CoreException; +import org.linphone.core.Friend; +import org.linphone.core.Friend.SubscribePolicy; import org.linphone.core.PresenceBasicStatus; import org.linphone.core.PresenceModel; import org.linphone.mediastream.Log; @@ -47,7 +46,7 @@ import android.provider.ContactsContract.CommonDataKinds; public class LinphoneContact implements Serializable, Comparable { private static final long serialVersionUID = 9015568163905205244L; - private transient LinphoneFriend friend; + private transient Friend friend; private String fullName, firstName, lastName, androidId, androidRawId, androidTagId, organization; private transient Uri photoUri, thumbnailUri; private List addresses; @@ -258,7 +257,7 @@ public class LinphoneContact implements Serializable, Comparable classToStart; - if (getResources().getBoolean(R.bool.show_tutorials_instead_of_app)) { + /*if (getResources().getBoolean(R.bool.show_tutorials_instead_of_app)) { classToStart = TutorialLauncherActivity.class; - } else if (getResources().getBoolean(R.bool.display_sms_remote_provisioning_activity) && LinphonePreferences.instance().isFirstRemoteProvisioning()) { + } else */if (getResources().getBoolean(R.bool.display_sms_remote_provisioning_activity) && LinphonePreferences.instance().isFirstRemoteProvisioning()) { classToStart = RemoteProvisioningActivity.class; } else { classToStart = LinphoneActivity.class; diff --git a/src/android/org/linphone/LinphoneManager.java b/src/android/org/linphone/LinphoneManager.java index 7aca759d8..ea3141fa7 100644 --- a/src/android/org/linphone/LinphoneManager.java +++ b/src/android/org/linphone/LinphoneManager.java @@ -73,34 +73,39 @@ import android.widget.Button; import android.widget.Toast; import org.linphone.assistant.AssistantActivity; -import org.linphone.core.CallDirection; -import org.linphone.core.LinphoneAccountCreator; -import org.linphone.core.LinphoneAddress; -import org.linphone.core.LinphoneAuthInfo; -import org.linphone.core.LinphoneBuffer; -import org.linphone.core.LinphoneCall; -import org.linphone.core.LinphoneCall.State; -import org.linphone.core.LinphoneCallParams; -import org.linphone.core.LinphoneCallStats; -import org.linphone.core.LinphoneChatMessage; -import org.linphone.core.LinphoneChatRoom; -import org.linphone.core.LinphoneContent; -import org.linphone.core.LinphoneCore; -import org.linphone.core.LinphoneCore.AuthMethod; -import org.linphone.core.LinphoneCore.EcCalibratorStatus; -import org.linphone.core.LinphoneCore.GlobalState; -import org.linphone.core.LinphoneCore.LogCollectionUploadState; -import org.linphone.core.LinphoneCore.RegistrationState; -import org.linphone.core.LinphoneCore.RemoteProvisioningState; -import org.linphone.core.LinphoneCoreException; -import org.linphone.core.LinphoneCoreFactory; -import org.linphone.core.LinphoneCoreListener; -import org.linphone.core.LinphoneEvent; -import org.linphone.core.LinphoneFriend; -import org.linphone.core.LinphoneFriendList; -import org.linphone.core.LinphoneInfoMessage; -import org.linphone.core.LinphoneProxyConfig; -import org.linphone.core.OpenH264DownloadHelperListener; +import org.linphone.core.AccountCreatorListener; +import org.linphone.core.Call.Dir; +import org.linphone.core.AccountCreator; +import org.linphone.core.Address; +import org.linphone.core.AuthInfo; +import org.linphone.core.Buffer; +import org.linphone.core.Call; +import org.linphone.core.Call.State; +import org.linphone.core.CallLog; +import org.linphone.core.CallParams; +import org.linphone.core.CallStats; +import org.linphone.core.ChatMessage; +import org.linphone.core.ChatMessageListener; +import org.linphone.core.ChatRoom; +import org.linphone.core.Content; +import org.linphone.core.Core; +import org.linphone.core.Core.AuthMethod; +import org.linphone.core.Core.EcCalibratorStatus; +import org.linphone.core.Core.GlobalState; +import org.linphone.core.Core.LogCollectionUploadState; +import org.linphone.core.Core.RegistrationState; +import org.linphone.core.Core.ConfiguringState; +import org.linphone.core.CoreException; +import org.linphone.core.Factory; +import org.linphone.core.CoreListener; +import org.linphone.core.Event; +import org.linphone.core.Friend; +import org.linphone.core.FriendList; +import org.linphone.core.InfoMessage; +import org.linphone.core.PresenceActivity; +import org.linphone.core.ProxyConfig; +import org.linphone.core.VersionUpdateCheckResult; +import org.linphone.core.tools.OpenH264DownloadHelperListener; import org.linphone.core.PayloadType; import org.linphone.core.PresenceBasicStatus; import org.linphone.core.PresenceActivityType; @@ -108,14 +113,14 @@ import org.linphone.core.PresenceModel; import org.linphone.core.PublishState; import org.linphone.core.Reason; import org.linphone.core.SubscriptionState; -import org.linphone.core.TunnelConfig; +//import org.linphone.core.TunnelConfig; import org.linphone.mediastream.Log; import org.linphone.mediastream.Version; import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration; import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration.AndroidCamera; import org.linphone.mediastream.video.capture.hwconf.Hacks; -import org.linphone.tools.H264Helper; -import org.linphone.tools.OpenH264DownloadHelper; +import org.linphone.core.tools.H264Helper; +import org.linphone.core.tools.OpenH264DownloadHelper; import java.io.File; import java.io.FileInputStream; @@ -148,7 +153,7 @@ import static android.media.AudioManager.STREAM_VOICE_CALL; * Add Service Listener to react to Linphone state changes. * */ -public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessage.LinphoneChatMessageListener, SensorEventListener, LinphoneAccountCreator.LinphoneAccountCreatorListener { +public class LinphoneManager implements CoreListener, ChatMessageListener, SensorEventListener, AccountCreatorListener { private static LinphoneManager instance; private Context mServiceContext; @@ -156,7 +161,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag private PowerManager mPowerManager; private Resources mR; private LinphonePreferences mPrefs; - private LinphoneCore mLc; + private Core mLc; private OpenH264DownloadHelper mCodecDownloader; private OpenH264DownloadHelperListener mCodecListener; private String lastLcStatusMessage; @@ -181,9 +186,9 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag private Handler mHandler = new Handler(); private WakeLock mIncallWakeLock; private WakeLock mProximityWakelock; - private LinphoneAccountCreator accountCreator; - private static List mPendingChatFileMessage; - private static LinphoneChatMessage mUploadPendingFileMessage; + private AccountCreator accountCreator; + private static List mPendingChatFileMessage; + private static ChatMessage mUploadPendingFileMessage; private boolean mAreDisplayAlertMessage = false; private SensorManager mSensorManager; private Sensor mProximity; @@ -192,13 +197,13 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag public String wizardLoginViewDomain = null; - private static List simpleListeners = new ArrayList(); - public static void addListener(LinphoneChatMessage.LinphoneChatMessageListener listener) { + private static List simpleListeners = new ArrayList(); + public static void addListener(ChatMessageListener listener) { if (!simpleListeners.contains(listener)) { simpleListeners.add(listener); } } - public static void removeListener(LinphoneChatMessage.LinphoneChatMessageListener listener) { + public static void removeListener(ChatMessageListener listener) { simpleListeners.remove(listener); } @@ -209,7 +214,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag basePath = c.getFilesDir().getAbsolutePath(); mLPConfigXsd = basePath + "/lpconfig.xsd"; mLinphoneFactoryConfigFile = basePath + "/linphonerc"; - mLinphoneConfigFile = basePath + "/.linphonerc"; + mConfigFile = basePath + "/.linphonerc"; mLinphoneRootCaFile = basePath + "/rootca.pem"; mDynamicConfigFile = basePath + "/assistant_create.rc"; mRingSoundFile = basePath + "/ringtone.mkv"; @@ -229,7 +234,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag mSensorManager = (SensorManager) c.getSystemService(Context.SENSOR_SERVICE); mProximity = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY); mR = c.getResources(); - mPendingChatFileMessage = new ArrayList(); + mPendingChatFileMessage = new ArrayList(); } private static final int LINPHONE_VOLUME_STREAM = STREAM_VOICE_CALL; @@ -239,7 +244,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag private final String mLinphoneFactoryConfigFile; private final String mLinphoneRootCaFile; private final String mDynamicConfigFile; - public final String mLinphoneConfigFile; + public final String mConfigFile; private final String mRingSoundFile; private final String mRingbackSoundFile; private final String mPauseSoundFile; @@ -255,17 +260,25 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag Log.w("Routing audio to " + (speakerOn ? "speaker" : "earpiece") + ", disabling bluetooth audio route"); BluetoothManager.getInstance().disableBluetoothSCO(); - mLc.enableSpeaker(speakerOn); + enableSpeaker(speakerOn); + } + + public boolean isSpeakerEnabled() { + return mAudioManager != null && mAudioManager.isSpeakerphoneOn(); + } + + public void enableSpeaker(boolean enable) { + mAudioManager.setSpeakerphoneOn(enable); } public void initOpenH264DownloadHelper() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) { Log.i("Android >= 5.1 we disable the download of OpenH264"); - getLc().enableDownloadOpenH264(false); + OpenH264DownloadHelper.setOpenH264DownloadEnabled(false); return; } - mCodecDownloader = LinphoneCoreFactory.instance().createOpenH264DownloadHelper(); + mCodecDownloader = Factory.instance().createOpenH264DownloadHelper(getContext()); mCodecListener = new OpenH264DownloadHelperListener() { ProgressDialog progress; int ctxt = 0; @@ -367,16 +380,16 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag return instance; } - public void addDownloadMessagePending(LinphoneChatMessage message){ + public void addDownloadMessagePending(ChatMessage message){ synchronized (mPendingChatFileMessage) { mPendingChatFileMessage.add(message); } } - public boolean isMessagePending(LinphoneChatMessage message){ + public boolean isMessagePending(ChatMessage message){ boolean messagePending = false; synchronized (mPendingChatFileMessage) { - for (LinphoneChatMessage chat : mPendingChatFileMessage) { + for (ChatMessage chat : mPendingChatFileMessage) { if (chat.getStorageId() == message.getStorageId()) { messagePending = true; break; @@ -386,9 +399,9 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag return messagePending; } - public void removePendingMessage(LinphoneChatMessage message){ + public void removePendingMessage(ChatMessage message){ synchronized (mPendingChatFileMessage) { - for (LinphoneChatMessage chat : mPendingChatFileMessage) { + for (ChatMessage chat : mPendingChatFileMessage) { if (chat.getStorageId() == message.getStorageId()) { mPendingChatFileMessage.remove(chat); } @@ -397,11 +410,11 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } } - public void setUploadPendingFileMessage(LinphoneChatMessage message){ + public void setUploadPendingFileMessage(ChatMessage message){ mUploadPendingFileMessage = message; } - public LinphoneChatMessage getMessageUploadPending(){ + public ChatMessage getMessageUploadPending(){ return mUploadPendingFileMessage; } @@ -410,8 +423,8 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } @Override - public void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, LinphoneChatMessage.State state) { - if (state == LinphoneChatMessage.State.FileTransferDone) { + public void onMsgStateChanged(ChatMessage msg, ChatMessage.State state) { + if (state == ChatMessage.State.FileTransferDone) { if (msg.isOutgoing() && mUploadingImage != null) { mUploadPendingFileMessage = null; mUploadingImage = null; @@ -421,44 +434,46 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } } - if (state == LinphoneChatMessage.State.FileTransferError) { + if (state == ChatMessage.State.FileTransferError) { LinphoneUtils.displayErrorAlert(getString(R.string.image_transfert_error), LinphoneActivity.instance()); } - for (LinphoneChatMessage.LinphoneChatMessageListener l: simpleListeners) { - l.onLinphoneChatMessageStateChanged(msg, state); + for (ChatMessageListener l: simpleListeners) { + l.onMsgStateChanged(msg, state); } } @Override - public void onLinphoneChatMessageFileTransferReceived(LinphoneChatMessage msg, LinphoneContent content, LinphoneBuffer buffer) { + public void onFileTransferRecv(ChatMessage msg, Content content, Buffer buffer) { } @Override - public void onLinphoneChatMessageFileTransferSent(LinphoneChatMessage msg, LinphoneContent content, int offset, int size, LinphoneBuffer bufferToFill) { + public Buffer onFileTransferSend(ChatMessage message, Content content, int offset, int size) { if (mUploadingImage != null && size > 0) { + Buffer bufferToFill = Factory.instance().createBuffer(); byte[] data = new byte[size]; if (offset + size <= mUploadingImage.length) { for (int i = 0; i < size; i++) { data[i] = mUploadingImage[i + offset]; } - bufferToFill.setContent(data); + bufferToFill.setContent(data, size); bufferToFill.setSize(size); } else { Log.e("Error, upload task asking for more bytes( " + (size+offset) + " ) than available (" + mUploadingImage.length + ")"); } } + return null; } @Override - public void onLinphoneChatMessageFileTransferProgressChanged(LinphoneChatMessage msg, LinphoneContent content, int offset, int total) { - for (LinphoneChatMessage.LinphoneChatMessageListener l: simpleListeners) { - l.onLinphoneChatMessageFileTransferProgressChanged(msg, content, offset, total); + public void onFileTransferProgressIndication(ChatMessage msg, Content content, int offset, int total) { + for (ChatMessageListener l: simpleListeners) { + l.onFileTransferProgressIndication(msg, content, offset, total); } } private boolean isPresenceModelActivitySet() { - LinphoneCore lc = getLcIfManagerNotDestroyedOrNull(); + Core lc = getLcIfManagerNotDestroyedOrNull(); if (isInstanciated() && lc != null) { return lc.getPresenceModel() != null && lc.getPresenceModel().getActivity() != null; } @@ -466,36 +481,38 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } public void changeStatusToOnline() { - LinphoneCore lc = getLcIfManagerNotDestroyedOrNull(); + Core lc = getLcIfManagerNotDestroyedOrNull(); if (isInstanciated() && lc != null && isPresenceModelActivitySet() && lc.getPresenceModel().getActivity().getType() != PresenceActivityType.TV) { lc.getPresenceModel().getActivity().setType(PresenceActivityType.TV); } else if (isInstanciated() && lc != null && !isPresenceModelActivitySet()) { - PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.TV, null); + PresenceModel model = lc.createPresenceModel();//PresenceActivityType.TV, null); + model = model.newWithActivity(PresenceActivityType.TV, null); lc.setPresenceModel(model); } } public void changeStatusToOnThePhone() { - LinphoneCore lc = getLcIfManagerNotDestroyedOrNull(); + Core lc = getLcIfManagerNotDestroyedOrNull(); if (isInstanciated() && isPresenceModelActivitySet() && lc.getPresenceModel().getActivity().getType() != PresenceActivityType.OnThePhone) { lc.getPresenceModel().getActivity().setType(PresenceActivityType.OnThePhone); } else if (isInstanciated() && !isPresenceModelActivitySet()) { - PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.OnThePhone, null); + PresenceModel model = lc.createPresenceModel();//PresenceActivityType.OnThePhone, null); + model = model.newWithActivity(PresenceActivityType.OnThePhone, null); lc.setPresenceModel(model); } } public void changeStatusToOffline() { - LinphoneCore lc = getLcIfManagerNotDestroyedOrNull(); + Core lc = getLcIfManagerNotDestroyedOrNull(); if (isInstanciated() && lc != null) { lc.getPresenceModel().setBasicStatus(PresenceBasicStatus.Closed); } } public void subscribeFriendList(boolean enabled){ - LinphoneCore lc = getLcIfManagerNotDestroyedOrNull(); - if(lc != null && lc.getFriendList() != null && lc.getFriendList().length > 0) { - LinphoneFriendList mFriendList = (lc.getFriendLists())[0]; + Core lc = getLcIfManagerNotDestroyedOrNull(); + if(lc != null && lc.getFriendsLists() != null && lc.getFriendsLists().length > 0) { + FriendList mFriendList = (lc.getFriendsLists())[0]; Log.i("Presence list subscription is " + (enabled ? "enabled" : "disabled")); mFriendList.enableSubscriptions(enabled); } @@ -513,7 +530,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag throw new RuntimeException("Linphone Manager should be created before accessed"); } - public static synchronized final LinphoneCore getLc() { + public static synchronized final Core getLc() { return getInstance().mLc; } @@ -527,7 +544,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } public void newOutgoingCall(String to, String displayName) { -// if (mLc.isIncall()) { +// if (mLc.inCall()) { // listenerDispatcher.tryingNewOutgoingCallButAlreadyInCall(); // return; // } @@ -537,26 +554,21 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag if (!to.startsWith("sip:") || !to.contains("@")) { LinphoneContact contact = ContactsManager.getInstance().findContactFromPhoneNumber(to); if (contact != null) { - String alias = contact.getPresenceModelForUri(to); + String alias = contact.getPresenceModelForUriOrTel(to); if (alias != null) { to = alias; } } } - LinphoneProxyConfig lpc = getLc().getDefaultProxyConfig(); + ProxyConfig lpc = getLc().getDefaultProxyConfig(); if (lpc != null) { to = lpc.normalizePhoneNumber(to); } - LinphoneAddress lAddress; - try { - lAddress = mLc.interpretUrl(to); - if (mR.getBoolean(R.bool.forbid_self_call) && lpc != null && lAddress.asStringUriOnly().equals(lpc.getIdentity())) { - return; - } - } catch (LinphoneCoreException e) { - Log.e(e); + Address lAddress; + lAddress = mLc.interpretUrl(to); + if (mR.getBoolean(R.bool.forbid_self_call) && lpc != null && lAddress.asStringUriOnly().equals(lpc.getIdentityAddress())) { return; } lAddress.setDisplayName(displayName); @@ -574,7 +586,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } - } catch (LinphoneCoreException e) { + } catch (CoreException e) { return; } } else if (LinphoneActivity.isInstanciated()) { @@ -587,13 +599,14 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag private void resetCameraFromPreferences() { boolean useFrontCam = mPrefs.useFrontCam(); - int camId = 0; + /*int camId = 0; AndroidCamera[] cameras = AndroidCameraConfiguration.retrieveCameras(); for (AndroidCamera androidCamera : cameras) { if (androidCamera.frontFacing == useFrontCam) camId = androidCamera.id; } - LinphoneManager.getLc().setVideoDevice(camId); + LinphoneManager.getLc().setVideoDevice(camId);*/ + // TODO FIXME } public static interface AddressType { @@ -611,7 +624,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } public boolean toggleEnableCamera() { - if (mLc.isIncall()) { + if (mLc.inCall()) { boolean enabled = !mLc.getCurrentCall().cameraEnabled(); enableCamera(mLc.getCurrentCall(), enabled); return enabled; @@ -619,7 +632,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag return false; } - public void enableCamera(LinphoneCall call, boolean enable) { + public void enableCamera(Call call, boolean enable) { if (call != null) { call.enableCamera(enable); if (mServiceContext.getResources().getBoolean(R.bool.enable_call_notification)) @@ -628,7 +641,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } public void sendStaticImage(boolean send) { - if (mLc.isIncall()) { + if (mLc.inCall()) { enableCamera(mLc.getCurrentCall(), !send); } } @@ -645,22 +658,22 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } public void terminateCall() { - if (mLc.isIncall()) { + if (mLc.inCall()) { mLc.terminateCall(mLc.getCurrentCall()); } } public void initTunnelFromConf() { - if (!mLc.isTunnelAvailable()) + if (!mLc.tunnelAvailable()) return; - NetworkInfo info = mConnectivityManager.getActiveNetworkInfo(); + /*NetworkInfo info = mConnectivityManager.getActiveNetworkInfo(); mLc.tunnelCleanServers(); TunnelConfig config = mPrefs.getTunnelConfig(); if (config.getHost() != null) { mLc.tunnelAddServer(config); manageTunnelServer(info); - } + }*/ // TODO FIXME } private boolean isTunnelNeeded(NetworkInfo info) { @@ -686,29 +699,29 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag private void manageTunnelServer(NetworkInfo info) { if (mLc == null) return; - if (!mLc.isTunnelAvailable()) return; + if (!mLc.tunnelAvailable()) return; - Log.i("Managing tunnel"); + /*Log.i("Managing tunnel"); if (isTunnelNeeded(info)) { Log.i("Tunnel need to be activated"); - mLc.tunnelSetMode(LinphoneCore.TunnelMode.enable); + mLc.tunnelSetMode(Core.TunnelMode.enable); } else { Log.i("Tunnel should not be used"); String pref = mPrefs.getTunnelMode(); - mLc.tunnelSetMode(LinphoneCore.TunnelMode.disable); + mLc.tunnelSetMode(Core.TunnelMode.disable); if (getString(R.string.tunnel_mode_entry_value_auto).equals(pref)) { - mLc.tunnelSetMode(LinphoneCore.TunnelMode.auto); + mLc.tunnelSetMode(Core.TunnelMode.auto); } - } + }*/ // TODO FIXME } - public synchronized final void destroyLinphoneCore() { + public synchronized final void destroyCore() { sExited = true; ContactsManagerDestroy(); BluetoothManagerDestroy(); try { mTimer.cancel(); - mLc.destroy(); + mLc = null; } catch (RuntimeException e) { Log.e(e); @@ -747,8 +760,8 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } } - public void restartLinphoneCore() { - destroyLinphoneCore(); + public void restartCore() { + destroyCore(); startLibLinphone(mServiceContext); sExited = false; } @@ -757,7 +770,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag try { copyAssetsFromPackage(); //traces alway start with traces enable to not missed first initialization - mLc = LinphoneCoreFactory.instance().createLinphoneCore(this, mLinphoneConfigFile, mLinphoneFactoryConfigFile, null, c); + mLc = Factory.instance().createCore(this, mConfigFile, mLinphoneFactoryConfigFile); TimerTask lTask = new TimerTask() { @Override public void run() { @@ -807,7 +820,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } } - private synchronized void initLiblinphone(LinphoneCore lc) throws LinphoneCoreException { + private synchronized void initLiblinphone(Core lc) throws CoreException { mLc = lc; @@ -820,7 +833,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag prefMigrator.doMigration(); } - mLc.setZrtpSecretsCache(basePath + "/zrtp_secrets"); + mLc.setZrtpSecretsFile(basePath + "/zrtp_secrets"); try { String versionName = mServiceContext.getPackageManager().getPackageInfo(mServiceContext.getPackageName(), 0).versionName; @@ -833,7 +846,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } mLc.setRingback(mRingbackSoundFile); - mLc.setRootCA(mLinphoneRootCaFile); + mLc.setRootCa(mLinphoneRootCaFile); mLc.setPlayFile(mPauseSoundFile); mLc.setChatDatabasePath(mChatDatabaseFile); mLc.setCallLogsDatabasePath(mCallLogDatabaseFile); @@ -844,9 +857,9 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag int availableCores = Runtime.getRuntime().availableProcessors(); Log.w("MediaStreamer : " + availableCores + " cores detected and configured"); - mLc.setCpuCount(availableCores); + //mLc.setCpuCount(availableCores); - mLc.migrateCallLogs(); + mLc.migrateLogsFromRcToDb(); if (mServiceContext.getResources().getBoolean(R.bool.enable_push_id)) { initPushNotificationsService(); @@ -897,18 +910,16 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag resetCameraFromPreferences(); - accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc(), LinphonePreferences.instance().getXmlrpcUrl()); + accountCreator = LinphoneManager.getLc().createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl()); accountCreator.setListener(this); callGsmON = false; } protected void setHandsetMode(Boolean on){ - if(mLc.isInComingInvitePending() && on){ + if(mLc.isIncomingInvitePending() && on){ handsetON = true; - try { - mLc.acceptCall(mLc.getCurrentCall()); - LinphoneActivity.instance().startIncallActivity(mLc.getCurrentCall()); - }catch(LinphoneCoreException e){} + mLc.acceptCall(mLc.getCurrentCall()); + LinphoneActivity.instance().startIncallActivity(mLc.getCurrentCall()); }else if(on && CallActivity.isInstanciated()){ handsetON = true; CallActivity.instance().setSpeakerEnabled(true); @@ -928,7 +939,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag copyIfNotExist(R.raw.ringback, mRingbackSoundFile); copyIfNotExist(R.raw.hold, mPauseSoundFile); copyIfNotExist(R.raw.incoming_chat, mErrorToneFile); - copyIfNotExist(R.raw.linphonerc_default, mLinphoneConfigFile); + copyIfNotExist(R.raw.linphonerc_default, mConfigFile); copyFromPackage(R.raw.linphonerc_factory, new File(mLinphoneFactoryConfigFile).getName()); copyIfNotExist(R.raw.lpconfig, mLPConfigXsd); copyFromPackage(R.raw.rootca, new File(mLinphoneRootCaFile).getName()); @@ -967,15 +978,15 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag public boolean detectVideoCodec(String mime) { - for (PayloadType videoCodec : mLc.getVideoCodecs()) { - if (mime.equals(videoCodec.getMime())) return true; + for (PayloadType videoCodec : mLc.getVideoPayloadTypes()) { + if (mime.equals(videoCodec.getMimeType())) return true; } return false; } public boolean detectAudioCodec(String mime){ - for (PayloadType audioCodec : mLc.getAudioCodecs()) { - if (mime.equals(audioCodec.getMime())) return true; + for (PayloadType audioCodec : mLc.getAudioPayloadTypes()) { + if (mime.equals(audioCodec.getMimeType())) return true; } return false; } @@ -1046,7 +1057,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag BluetoothManagerDestroy(); try { mTimer.cancel(); - mLc.destroy(); + mLc = null; } catch (RuntimeException e) { Log.e(e); @@ -1192,32 +1203,34 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag void onEcCalibrationStatus(EcCalibratorStatus status, int delayMs); } - private LinphoneCall ringingCall; + private Call ringingCall; private MediaPlayer mRingerPlayer; private Vibrator mVibrator; - public void displayWarning(LinphoneCore lc, String message) {} - public void displayMessage(LinphoneCore lc, String message) {} - public void show(LinphoneCore lc) {} - public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf, String url) {} - public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) { + public void onNewSubscriptionRequested(Core lc, Friend lf, String url) {} + public void onNotifyPresenceReceived(Core lc, Friend lf) { ContactsManager.getInstance().refreshSipContact(lf); } @Override - public void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf) { + public void onEcCalibrationAudioInit(Core lc) { + + } + + @Override + public void onDtmfReceived(Core lc, Call call, int dtmf) { Log.d("DTMF received: " + dtmf); } @Override - public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) { + public void onMessageReceived(Core lc, ChatRoom cr, ChatMessage message) { if (mServiceContext.getResources().getBoolean(R.bool.disable_chat)) { return; } - LinphoneAddress from = message.getFrom(); - String to = message.getTo().asString(); + Address from = message.getFromAddress(); + String to = message.getToAddress().asString(); String textMessage = (message.getFileTransferInformation() != null) ? getString(R.string.content_description_incoming_file) : message.getText(); @@ -1225,9 +1238,9 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(from); if (!mServiceContext.getResources().getBoolean(R.bool.disable_chat_message_notification)) { if (contact != null) { - LinphoneService.instance().displayMessageNotification(to, from.asStringUriOnly(), contact.getFullName(), textMessage); + LinphoneService.instance().removedNotification(to, from.asStringUriOnly(), contact.getFullName(), textMessage); } else { - LinphoneService.instance().displayMessageNotification(to, from.asStringUriOnly(), from.getUserName(), textMessage); + LinphoneService.instance().removedNotification(to, from.asStringUriOnly(), from.getUsername(), textMessage); } } } catch (Exception e) { @@ -1236,23 +1249,30 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } @Override - public void messageReceivedUnableToDecrypted(LinphoneCore lc, LinphoneChatRoom cr, - LinphoneChatMessage message) { + public void onEcCalibrationResult(Core lc, EcCalibratorStatus status, int delay_ms) { + ((AudioManager)getContext().getSystemService(Context.AUDIO_SERVICE)).setMode(AudioManager.MODE_NORMAL); + mAudioManager.abandonAudioFocus(null); + Log.i("Set audio mode on 'Normal'"); + } + + public void messageReceivedUnableToDecrypted(Core lc, ChatRoom cr, + ChatMessage message) { + //TODO FIXME if (mServiceContext.getResources().getBoolean(R.bool.disable_chat)) { return; } - final LinphoneAddress from = message.getFrom(); - String to = message.getTo().asString(); + final Address from = message.getFromAddress(); + String to = message.getToAddress().asString(); try { final LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(from); if (LinphoneActivity.instance().isOnBackground()) { if (!mServiceContext.getResources().getBoolean(R.bool.disable_chat_message_notification)) { if (contact != null) { - LinphoneService.instance().displayMessageNotification(to, from.asStringUriOnly(), contact.getFullName() + LinphoneService.instance().removedNotification(to, from.asStringUriOnly(), contact.getFullName() , getString(R.string.message_cant_be_decrypted_notif)); } else { - LinphoneService.instance().displayMessageNotification(to, from.asStringUriOnly(), from.getUserName() + LinphoneService.instance().removedNotification(to, from.asStringUriOnly(), from.getUsername() , getString(R.string.message_cant_be_decrypted_notif)); } } @@ -1260,7 +1280,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag mAreDisplayAlertMessage = true; final Dialog dialog = LinphoneActivity.instance().displayDialog( getString(R.string.message_cant_be_decrypted).replace("%s" - , (contact != null) ? contact.getFullName() : from.getUserName())); + , (contact != null) ? contact.getFullName() : from.getUsername())); Button delete = (Button) dialog.findViewById(R.id.delete_button); delete.setText(getString(R.string.call)); Button cancel = (Button) dialog.findViewById(R.id.cancel); @@ -1270,7 +1290,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag @Override public void onClick(View view) { LinphoneManager.getInstance().newOutgoingCall(from.asStringUriOnly() - , (contact != null) ? contact.getFullName() : from.getUserName()); + , (contact != null) ? contact.getFullName() : from.getUsername()); dialog.dismiss(); LinphoneManager.getInstance().setAreDisplayAlertMessage(false); } @@ -1283,7 +1303,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag LinphoneManager.getInstance().setAreDisplayAlertMessage(false); } }); - if(LinphoneManager.getLc().getLimeEncryption() == LinphoneCore.LinphoneLimeState.Mandatory) + if(LinphoneManager.getLc().limeEnabled() == Core.LimeState.Mandatory) dialog.show(); } } catch (Exception e) { @@ -1299,27 +1319,27 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag return lastLcStatusMessage; } - public void displayStatus(final LinphoneCore lc, final String message) { + public void removed(final Core lc, final String message) { Log.i(message); lastLcStatusMessage=message; } - public void globalState(final LinphoneCore lc, final GlobalState state, final String message) { + public void onGlobalStateChanged(final Core lc, final GlobalState state, final String message) { Log.i("New global state [",state,"]"); - if (state == GlobalState.GlobalOn){ + if (state == Core.GlobalState.On){ try { - Log.e("LinphoneManager"," globalState ON"); + Log.e("LinphoneManager"," onGlobalStateChanged ON"); initLiblinphone(lc); }catch(IllegalArgumentException iae){ Log.e(iae); - } catch (LinphoneCoreException e) { + } catch (CoreException e) { Log.e(e); } } } - public void registrationState(final LinphoneCore lc, final LinphoneProxyConfig proxy,final RegistrationState state,final String message) { + public void onRegistrationStateChanged(final Core lc, final ProxyConfig proxy,final RegistrationState state,final String message) { Log.i("New registration state ["+state+"]"); if(LinphoneManager.getLc().getDefaultProxyConfig() == null){ subscribeFriendList(false); @@ -1382,7 +1402,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } @SuppressLint("Wakelock") - public void callState(final LinphoneCore lc,final LinphoneCall call, final State state, final String message) { + public void onCallStateChanged(final Core lc,final Call call, final State state, final String message) { Log.i("New call state [",state,"]"); if (state == State.IncomingReceived && !call.equals(lc.getCurrentCall())) { if (call.getReplacedCall()!=null){ @@ -1401,21 +1421,17 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag @Override public void run() { if (mLc != null) { - try { - if (mLc.getCallsNb() > 0) { - mLc.acceptCall(call); - LinphoneManager.getInstance().routeAudioToReceiver(); - LinphoneActivity.instance().startIncallActivity(call); - } - } catch (LinphoneCoreException e) { - Log.e(e); + if (mLc.getCallsNb() > 0) { + mLc.acceptCall(call); + LinphoneManager.getInstance().routeAudioToReceiver(); + LinphoneActivity.instance().startIncallActivity(call); } } } }; mTimer = new Timer("Auto answer"); mTimer.schedule(lTask, mPrefs.getAutoAnswerTime()); - } else if (state == State.IncomingReceived || (state == State.CallIncomingEarlyMedia && mR.getBoolean(R.bool.allow_ringing_while_early_media))) { + } else if (state == State.IncomingReceived || (state == State.IncomingEarlyMedia && mR.getBoolean(R.bool.allow_ringing_while_early_media))) { // Brighten screen for at least 10 seconds if (mLc.getCallsNb() == 1) { requestAudioFocus(STREAM_RING); @@ -1433,7 +1449,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag if (mLc.getCallsNb() == 1) { //It is for incoming calls, because outgoing calls enter MODE_IN_COMMUNICATION immediately when they start. //However, incoming call first use the MODE_RINGING to play the local ring. - if(call.getDirection() == CallDirection.Incoming) { + if(call.getDir() == Call.Dir.Incoming) { setAudioManagerInCallMode(); //mAudioManager.abandonAudioFocus(null); requestAudioFocus(STREAM_VOICE_CALL); @@ -1446,7 +1462,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } } - if (state == State.CallEnd || state == State.Error) { + if (state == State.End || state == State.Error) { if (mLc.getCallsNb() == 0) { //Disabling proximity sensor enableProximitySensing(false); @@ -1473,17 +1489,13 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } } } - if (state == State.CallUpdatedByRemote) { + if (state == State.UpdatedByRemote) { // If the correspondent proposes video while audio call - boolean remoteVideo = call.getRemoteParams().getVideoEnabled(); - boolean localVideo = call.getCurrentParams().getVideoEnabled(); + boolean remoteVideo = call.getRemoteParams().videoEnabled(); + boolean localVideo = call.getCurrentParams().videoEnabled(); boolean autoAcceptCameraPolicy = LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests(); - if (remoteVideo && !localVideo && !autoAcceptCameraPolicy && !LinphoneManager.getLc().isInConference()) { - try { - LinphoneManager.getLc().deferCallUpdate(call); - } catch (LinphoneCoreException e) { - Log.e(e); - } + if (remoteVideo && !localVideo && !autoAcceptCameraPolicy && !(LinphoneManager.getLc().getConference() != null)) { + LinphoneManager.getLc().deferCallUpdate(call); } } if (state == State.OutgoingInit) { @@ -1515,13 +1527,13 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } } - public void callStatsUpdated(final LinphoneCore lc, final LinphoneCall call, final LinphoneCallStats stats) {} + public void onCallStatsUpdated(final Core lc, final Call call, final CallStats stats) {} - public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call, + public void onCallEncryptionChanged(Core lc, Call call, boolean encrypted, String authenticationToken) { } - public void startEcCalibration(LinphoneCoreListener l) throws LinphoneCoreException { + public void startEcCalibration(CoreListener l) throws CoreException { routeAudioToSpeaker(); setAudioManagerInCallMode(); Log.i("Set audio mode on 'Voice Communication'"); @@ -1529,11 +1541,11 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag int oldVolume = mAudioManager.getStreamVolume(STREAM_VOICE_CALL); int maxVolume = mAudioManager.getStreamMaxVolume(STREAM_VOICE_CALL); mAudioManager.setStreamVolume(STREAM_VOICE_CALL, maxVolume, 0); - mLc.startEchoCalibration(l); + mLc.startEchoCancellerCalibration(); mAudioManager.setStreamVolume(STREAM_VOICE_CALL, oldVolume, 0); } - public int startEchoTester() throws LinphoneCoreException { + public int startEchoTester() throws CoreException { routeAudioToSpeaker(); setAudioManagerInCallMode(); Log.i("Set audio mode on 'Voice Communication'"); @@ -1546,26 +1558,27 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag String sampleRateProperty = mAudioManager.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE); sampleRate = Integer.parseInt(sampleRateProperty); } - int status = mLc.startEchoTester(sampleRate); - if (status > 0) + /*int status = */mLc.startEchoTester(sampleRate); + /*if (status > 0)*/ echoTesterIsRunning = true; - else { + /*else { echoTesterIsRunning = false; routeAudioToReceiver(); mAudioManager.setStreamVolume(STREAM_VOICE_CALL, oldVolume, 0); ((AudioManager)getContext().getSystemService(Context.AUDIO_SERVICE)).setMode(AudioManager.MODE_NORMAL); Log.i("Set audio mode on 'Normal'"); - } - return status; + }*/ + return 1; + //return status; } - public int stopEchoTester() throws LinphoneCoreException { + public int stopEchoTester() throws CoreException { echoTesterIsRunning = false; - int status = mLc.stopEchoTester(); + /*int status = */mLc.stopEchoTester(); routeAudioToReceiver(); ((AudioManager)getContext().getSystemService(Context.AUDIO_SERVICE)).setMode(AudioManager.MODE_NORMAL); Log.i("Set audio mode on 'Normal'"); - return status; + return 1;//status; } public boolean getEchoTesterStatus() { @@ -1666,14 +1679,14 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } - public static String extractADisplayName(Resources r, LinphoneAddress address) { + public static String extractADisplayName(Resources r, Address address) { if (address == null) return r.getString(R.string.unknown_incoming_call_name); final String displayName = address.getDisplayName(); if (displayName!=null) { return displayName; - } else if (address.getUserName() != null){ - return address.getUserName(); + } else if (address.getUsername() != null){ + return address.getUsername(); } else { String rms = address.toString(); if (rms != null && rms.length() > 1) @@ -1692,40 +1705,30 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag * @return false if already in video call. */ public boolean addVideo() { - LinphoneCall call = mLc.getCurrentCall(); + Call call = mLc.getCurrentCall(); enableCamera(call, true); return reinviteWithVideo(); } - public boolean acceptCallIfIncomingPending() throws LinphoneCoreException { - if (mLc.isInComingInvitePending()) { + public boolean acceptCallIfIncomingPending() throws CoreException { + if (mLc.isIncomingInvitePending()) { mLc.acceptCall(mLc.getCurrentCall()); return true; } return false; } - public boolean acceptCall(LinphoneCall call) { - try { - mLc.acceptCall(call); - return true; - } catch (LinphoneCoreException e) { - Log.i(e, "Accept call failed"); - } - return false; + public boolean acceptCall(Call call) { + mLc.acceptCall(call); + return true; } - public boolean acceptCallWithParams(LinphoneCall call, LinphoneCallParams params) { - try { - mLc.acceptCallWithParams(call, params); - return true; - } catch (LinphoneCoreException e) { - Log.i(e, "Accept call failed"); - } - return false; + public boolean acceptCallWithParams(Call call, CallParams params) { + mLc.acceptCallWithParams(call, params); + return true; } - public static String extractIncomingRemoteName(Resources r, LinphoneAddress linphoneAddress) { + public static String extractIncomingRemoteName(Resources r, Address linphoneAddress) { return extractADisplayName(r, linphoneAddress); } @@ -1738,13 +1741,13 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag if (nextVolume > maxVolume) nextVolume = maxVolume; if (nextVolume < 0) nextVolume = 0; - mLc.setPlaybackGain((nextVolume - maxVolume)* dbStep); + mLc.setPlaybackGainDb((nextVolume - maxVolume)* dbStep); } else // starting from ICS, volume must be adjusted by the application, at least for STREAM_VOICE_CALL volume stream mAudioManager.adjustStreamVolume(LINPHONE_VOLUME_STREAM, i < 0 ? AudioManager.ADJUST_LOWER : AudioManager.ADJUST_RAISE, AudioManager.FLAG_SHOW_UI); } - public static synchronized LinphoneCore getLcIfManagerNotDestroyedOrNull() { + public static synchronized Core getLcIfManagerNotDestroyedOrNull() { if (sExited || instance == null) { // Can occur if the UI thread play a posted event but in the meantime the LinphoneManager was destroyed // Ex: stop call and quickly terminate application. @@ -1757,13 +1760,13 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag return instance != null; } - public synchronized LinphoneCall getPendingIncomingCall() { - LinphoneCall currentCall = mLc.getCurrentCall(); + public synchronized Call getPendingIncomingCall() { + Call currentCall = mLc.getCurrentCall(); if (currentCall == null) return null; - LinphoneCall.State state = currentCall.getState(); - boolean incomingPending = currentCall.getDirection() == CallDirection.Incoming - && (state == State.IncomingReceived || state == State.CallIncomingEarlyMedia); + Call.State state = currentCall.getState(); + boolean incomingPending = currentCall.getDir() == Call.Dir.Incoming + && (state == State.IncomingReceived || state == State.IncomingEarlyMedia); return incomingPending ? currentCall : null; } @@ -1779,7 +1782,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag if (LinphonePreferences.instance().getLinkPopupTime() == null || Long.parseLong(LinphonePreferences.instance().getLinkPopupTime()) < now) { accountCreator.setUsername(LinphonePreferences.instance().getAccountUsername(LinphonePreferences.instance().getDefaultAccountIndex())); - accountCreator.isAccountUsed(); + accountCreator.isAccountExist(); } } else { LinphonePreferences.instance().setLinkPopupTime(null); @@ -1793,7 +1796,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag LinphonePreferences.instance().setLinkPopupTime(String.valueOf(newDate)); - final Dialog dialog = LinphoneActivity.instance().displayDialog(String.format(getString(R.string.link_account_popup), LinphoneManager.getLc().getDefaultProxyConfig().getAddress().asStringUriOnly())); + final Dialog dialog = LinphoneActivity.instance().displayDialog(String.format(getString(R.string.link_account_popup), LinphoneManager.getLc().getDefaultProxyConfig().getIdentityAddress().asStringUriOnly())); Button delete = (Button) dialog.findViewById(R.id.delete_button); delete.setText(getString(R.string.link)); Button cancel = (Button) dialog.findViewById(R.id.cancel); @@ -1859,186 +1862,199 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } @SuppressWarnings("serial") - public static class LinphoneConfigException extends LinphoneException { + public static class ConfigException extends LinphoneException { - public LinphoneConfigException() { + public ConfigException() { super(); } - public LinphoneConfigException(String detailMessage, Throwable throwable) { + public ConfigException(String detailMessage, Throwable throwable) { super(detailMessage, throwable); } - public LinphoneConfigException(String detailMessage) { + public ConfigException(String detailMessage) { super(detailMessage); } - public LinphoneConfigException(Throwable throwable) { + public ConfigException(Throwable throwable) { super(throwable); } } @Override - public void notifyReceived(LinphoneCore lc, LinphoneCall call, - LinphoneAddress from, byte[] event) { + public void removed(Core lc, Call call, + Address from, byte[] event) { } @Override - public void transferState(LinphoneCore lc, LinphoneCall call, + public void onTransferStateChanged(Core lc, Call call, State new_call_state) { } + @Override - public void infoReceived(LinphoneCore lc, LinphoneCall call, LinphoneInfoMessage info) { + public void onChatRoomInstantiated(Core lc, ChatRoom cr) { + + } + + @Override + public void onInfoReceived(Core lc, Call call, InfoMessage info) { Log.d("Info message received from "+call.getRemoteAddress().asString()); - LinphoneContent ct=info.getContent(); + Content ct=info.getContent(); if (ct!=null){ - Log.d("Info received with body with mime type "+ct.getType()+"/"+ct.getSubtype()+" and data ["+ct.getDataAsString()+"]"); + Log.d("Info received with body with mime type "+ct.getType()+"/"+ct.getSubtype()+" and data ["+ct.getStringBuffer()+"]"); } } @Override - public void subscriptionStateChanged(LinphoneCore lc, LinphoneEvent ev, + public void onSubscriptionStateChanged(Core lc, Event ev, SubscriptionState state) { - Log.d("Subscription state changed to "+state+" event name is "+ev.getEventName()); + Log.d("Subscription state changed to "+state+" event name is "+ev.getName()); } @Override - public void notifyReceived(LinphoneCore lc, LinphoneEvent ev, - String eventName, LinphoneContent content) { + public void onCallLogUpdated(Core lc, CallLog newcl) { + + } + + @Override + public void onNotifyReceived(Core lc, Event ev, + String eventName, Content content) { Log.d("Notify received for event "+eventName); - if (content!=null) Log.d("with content "+content.getType()+"/"+content.getSubtype()+" data:"+content.getDataAsString()); + if (content!=null) Log.d("with content "+content.getType()+"/"+content.getSubtype()+" data:"+content.getStringBuffer()); } @Override - public void publishStateChanged(LinphoneCore lc, LinphoneEvent ev, + public void onPublishStateChanged(Core lc, Event ev, PublishState state) { - Log.d("Publish state changed to " + state + " for event name " + ev.getEventName()); + Log.d("Publish state changed to " + state + " for event name " + ev.getName()); } @Override - public void isComposingReceived(LinphoneCore lc, LinphoneChatRoom cr) { + public void onIsComposingReceived(Core lc, ChatRoom cr) { Log.d("Composing received for chatroom " + cr.getPeerAddress().asStringUriOnly()); } @Override - public void configuringStatus(LinphoneCore lc, - RemoteProvisioningState state, String message) { + public void onMessageReceivedUnableDecrypt(Core lc, ChatRoom room, ChatMessage message) { + + } + + @Override + public void onConfiguringStatus(Core lc, + ConfiguringState state, String message) { Log.d("Remote provisioning status = " + state.toString() + " (" + message + ")"); - if (state == RemoteProvisioningState.ConfiguringSuccessful) { + if (state == ConfiguringState.Successful) { if (LinphonePreferences.instance().isProvisioningLoginViewEnabled()) { - LinphoneProxyConfig proxyConfig = lc.createProxyConfig(); - try { - LinphoneAddress addr = LinphoneCoreFactory.instance().createLinphoneAddress(proxyConfig.getIdentity()); - wizardLoginViewDomain = addr.getDomain(); - } catch (LinphoneCoreException e) { - wizardLoginViewDomain = null; - } + ProxyConfig proxyConfig = lc.createProxyConfig(); + Address addr = proxyConfig.getIdentityAddress(); + wizardLoginViewDomain = addr.getDomain(); } } } - @Override - public void fileTransferProgressIndication(LinphoneCore lc, - LinphoneChatMessage message, LinphoneContent content, int progress) { - } @Override - public void fileTransferRecv(LinphoneCore lc, LinphoneChatMessage message, - LinphoneContent content, byte[] buffer, int size) { + public void onCallCreated(Core lc, Call call) { } - @Override - public int fileTransferSend(LinphoneCore lc, LinphoneChatMessage message, - LinphoneContent content, ByteBuffer buffer, int size) { - return 0; - } @Override - public void uploadProgressIndication(LinphoneCore linphoneCore, int offset, int total) { + public void onLogCollectionUploadProgressIndication(Core linphoneCore, int offset, int total) { if(total > 0) Log.d("Log upload progress: currently uploaded = " + offset + " , total = " + total + ", % = " + String.valueOf((offset * 100) / total)); } @Override - public void uploadStateChanged(LinphoneCore linphoneCore, LogCollectionUploadState state, String info) { + public void onVersionUpdateCheckResultReceived(Core lc, VersionUpdateCheckResult result, String version, String url) { + + } + + @Override + public void onEcCalibrationAudioUninit(Core lc) { + + } + + @Override + public void onLogCollectionUploadStateChanged(Core linphoneCore, LogCollectionUploadState state, String info) { Log.d("Log upload state: " + state.toString() + ", info = " + info); } @Override - public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status, - int delay_ms, Object data) { - ((AudioManager)getContext().getSystemService(Context.AUDIO_SERVICE)).setMode(AudioManager.MODE_NORMAL); - mAudioManager.abandonAudioFocus(null); - Log.i("Set audio mode on 'Normal'"); - } - - @Override - public void friendListCreated(LinphoneCore lc, LinphoneFriendList list) { + public void onFriendListCreated(Core lc, FriendList list) { // TODO Auto-generated method stub } @Override - public void friendListRemoved(LinphoneCore lc, LinphoneFriendList list) { + public void onFriendListRemoved(Core lc, FriendList list) { // TODO Auto-generated method stub } @Override - public void networkReachableChanged(LinphoneCore lc, boolean enable) { + public void onReferReceived(Core lc, String refer_to) { } @Override - public void authInfoRequested(LinphoneCore lc, String realm, - String username, String domain) { - // TODO Auto-generated method stub + public void onNetworkReachable(Core lc, boolean enable) { } + @Override - public void authenticationRequested(LinphoneCore lc, - LinphoneAuthInfo authInfo, AuthMethod method) { + public void onAuthenticationRequested(Core lc, + AuthInfo authInfo, AuthMethod method) { // TODO Auto-generated method stub } @Override - public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { - if (status.equals(LinphoneAccountCreator.RequestStatus.AccountExist)) { + public void onNotifyPresenceReceivedForUriOrTel(Core lc, Friend lf, String uri_or_tel, PresenceModel presence_model) { + + } + + @Override + public void onBuddyInfoUpdated(Core lc, Friend lf) { + + } + + @Override + public void onIsAccountExist(AccountCreator accountCreator, AccountCreator.Status status, String resp) { + if (status.equals(AccountCreator.Status.AccountExist)) { accountCreator.isAccountLinked(); } } @Override - public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {} + public void onCreateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {} @Override - public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {} + public void onActivateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {} @Override - public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { - if (status.equals(LinphoneAccountCreator.RequestStatus.AccountNotLinked)) { + public void onLinkAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) { + if (status.equals(AccountCreator.Status.AccountNotLinked)) { askLinkWithPhoneNumber(); } } @Override - public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {} + public void onActivateAlias(AccountCreator accountCreator, AccountCreator.Status status, String resp) {} @Override - public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {} + public void onIsAccountActivated(AccountCreator accountCreator, AccountCreator.Status status, String resp) {} @Override - public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {} + public void onRecoverAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {} @Override - public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { - if (status.equals(LinphoneAccountCreator.RequestStatus.AccountNotLinked)) { + public void onIsAccountLinked(AccountCreator accountCreator, AccountCreator.Status status, String resp) { + if (status.equals(AccountCreator.Status.AccountNotLinked)) { askLinkWithPhoneNumber(); } } @Override - public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {} + public void onIsAliasUsed(AccountCreator accountCreator, AccountCreator.Status status, String resp) {} @Override - public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onUpdateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } } diff --git a/src/android/org/linphone/LinphonePreferences.java b/src/android/org/linphone/LinphonePreferences.java index 17061f1d4..6de5ebfb4 100644 --- a/src/android/org/linphone/LinphonePreferences.java +++ b/src/android/org/linphone/LinphonePreferences.java @@ -24,20 +24,21 @@ import android.content.Context; import android.content.pm.PackageManager; import android.os.Build; -import org.linphone.core.LinphoneAddress; -import org.linphone.core.LinphoneAddress.TransportType; -import org.linphone.core.LinphoneAuthInfo; -import org.linphone.core.LinphoneCore; -import org.linphone.core.LinphoneCore.AdaptiveRateAlgorithm; -import org.linphone.core.LinphoneCore.LinphoneLimeState; -import org.linphone.core.LinphoneCore.MediaEncryption; -import org.linphone.core.LinphoneCore.Transports; -import org.linphone.core.LinphoneCoreException; -import org.linphone.core.LinphoneCoreFactory; -import org.linphone.core.LinphoneNatPolicy; -import org.linphone.core.LinphoneProxyConfig; -import org.linphone.core.LpConfig; -import org.linphone.core.TunnelConfig; +import org.linphone.core.AVPFMode; +import org.linphone.core.Address; +import org.linphone.core.Address.TransportType; +import org.linphone.core.AuthInfo; +import org.linphone.core.Core; +import org.linphone.core.Core.LimeState; +import org.linphone.core.Core.MediaEncryption; +import org.linphone.core.Transports; +import org.linphone.core.CoreException; +import org.linphone.core.Factory; +import org.linphone.core.NatPolicy; +import org.linphone.core.ProxyConfig; +import org.linphone.core.Config; +//import org.linphone.core.TunnelConfig; +import org.linphone.core.VideoActivationPolicy; import org.linphone.mediastream.Log; import org.linphone.purchase.Purchasable; @@ -78,15 +79,15 @@ public class LinphonePreferences { return mContext.getString(key); } - private LinphoneCore getLc() { + private Core getLc() { if (!LinphoneManager.isInstanciated()) return null; return LinphoneManager.getLcIfManagerNotDestroyedOrNull(); } - public LpConfig getConfig() { - LinphoneCore lc = getLc(); + public Config getConfig() { + Core lc = getLc(); if (lc != null) { return lc.getConfig(); } @@ -94,7 +95,7 @@ public class LinphonePreferences { if (!LinphoneManager.isInstanciated()) { File linphonerc = new File(basePath + "/.linphonerc"); if (linphonerc.exists()) { - return LinphoneCoreFactory.instance().createLpConfig(linphonerc.getAbsolutePath()); + return Factory.instance().createConfig(linphonerc.getAbsolutePath()); } else if (mContext != null) { InputStream inputStream = mContext.getResources().openRawResource(R.raw.linphonerc_default); InputStreamReader inputreader = new InputStreamReader(inputStream); @@ -109,10 +110,10 @@ public class LinphonePreferences { } catch (IOException ioe) { Log.e(ioe); } - return LinphoneCoreFactory.instance().createLpConfigFromString(text.toString()); + return Factory.instance().createConfigFromString(text.toString()); } } else { - return LinphoneCoreFactory.instance().createLpConfig(LinphoneManager.getInstance().mLinphoneConfigFile); + return Factory.instance().createConfig(LinphoneManager.getInstance().mConfigFile); } return null; } @@ -148,37 +149,31 @@ public class LinphonePreferences { // End of app settings // Accounts settings - private LinphoneProxyConfig getProxyConfig(int n) { - LinphoneProxyConfig[] prxCfgs = getLc().getProxyConfigList(); + private ProxyConfig getProxyConfig(int n) { + ProxyConfig[] prxCfgs = getLc().getProxyConfigList(); if (n < 0 || n >= prxCfgs.length) return null; return prxCfgs[n]; } - private LinphoneAuthInfo getAuthInfo(int n) { - LinphoneProxyConfig prxCfg = getProxyConfig(n); + private AuthInfo getAuthInfo(int n) { + ProxyConfig prxCfg = getProxyConfig(n); if (prxCfg == null) return null; - try { - LinphoneAddress addr = LinphoneCoreFactory.instance().createLinphoneAddress(prxCfg.getIdentity()); - LinphoneAuthInfo authInfo = getLc().findAuthInfo(addr.getUserName(), null, addr.getDomain()); - return authInfo; - } catch (LinphoneCoreException e) { - Log.e(e); - } - - return null; + Address addr = prxCfg.getIdentityAddress(); + AuthInfo authInfo = getLc().findAuthInfo(addr.getUsername(), null, addr.getDomain()); + return authInfo; } /** * Removes a authInfo from the core and returns a copy of it. * Useful to edit a authInfo (you should call saveAuthInfo after the modifications to save them). */ - private LinphoneAuthInfo getClonedAuthInfo(int n) { - LinphoneAuthInfo authInfo = getAuthInfo(n); + private AuthInfo getClonedAuthInfo(int n) { + AuthInfo authInfo = getAuthInfo(n); if (authInfo == null) return null; - LinphoneAuthInfo cloneAuthInfo = authInfo.clone(); + AuthInfo cloneAuthInfo = authInfo.clone(); getLc().removeAuthInfo(authInfo); return cloneAuthInfo; } @@ -187,12 +182,12 @@ public class LinphonePreferences { * Saves a authInfo into the core. * Useful to save the changes made to a cloned authInfo. */ - private void saveAuthInfo(LinphoneAuthInfo authInfo) { + private void saveAuthInfo(AuthInfo authInfo) { getLc().addAuthInfo(authInfo); } public static class AccountBuilder { - private LinphoneCore lc; + private Core lc; private String tempUsername; private String tempDisplayName; private String tempUserId; @@ -215,7 +210,7 @@ public class LinphonePreferences { private boolean tempNoDefault = false; - public AccountBuilder(LinphoneCore lc) { + public AccountBuilder(Core lc) { this.lc = lc; } @@ -249,7 +244,7 @@ public class LinphonePreferences { return this; } - public AccountBuilder setProxy(String proxy) { + public AccountBuilder setServerAddr(String proxy) { tempProxy = proxy; return this; } @@ -269,7 +264,7 @@ public class LinphonePreferences { return this; } - public AccountBuilder setUserId(String userId) { + public AccountBuilder setUserid(String userId) { tempUserId = userId; return this; } @@ -279,7 +274,7 @@ public class LinphonePreferences { return this; } - public AccountBuilder setAvpfRRInterval(int interval) { + public AccountBuilder setAvpfRrInterval(int interval) { tempAvpfRRInterval = interval; return this; } @@ -321,9 +316,9 @@ public class LinphonePreferences { /** * Creates a new account - * @throws LinphoneCoreException + * @throws CoreException */ - public void saveNewAccount() throws LinphoneCoreException { + public void saveNewAccount() throws CoreException { if (tempUsername == null || tempUsername.length() < 1 || tempDomain == null || tempDomain.length() < 1) { Log.w("Skipping account save: username or domain not provided"); @@ -342,8 +337,8 @@ public class LinphonePreferences { proxy = tempProxy; } } - LinphoneAddress proxyAddr = LinphoneCoreFactory.instance().createLinphoneAddress(proxy); - LinphoneAddress identityAddr = LinphoneCoreFactory.instance().createLinphoneAddress(identity); + Address proxyAddr = Factory.instance().createAddress(proxy); + Address identityAddr = Factory.instance().createAddress(identity); if (tempDisplayName != null) { identityAddr.setDisplayName(tempDisplayName); @@ -355,7 +350,11 @@ public class LinphonePreferences { String route = tempOutboundProxy ? proxyAddr.asStringUriOnly() : null; - LinphoneProxyConfig prxCfg = lc.createProxyConfig(identityAddr.asString(), proxyAddr.asStringUriOnly(), route, tempEnabled); + ProxyConfig prxCfg = lc.createProxyConfig(); + prxCfg.setIdentityAddress(identityAddr); + prxCfg.setServerAddr(proxyAddr.asStringUriOnly()); + prxCfg.setRoute(route); + prxCfg.enableRegister(tempEnabled); if (tempContactsParams != null) prxCfg.setContactUriParameters(tempContactsParams); @@ -365,8 +364,8 @@ public class LinphonePreferences { } catch (NumberFormatException nfe) { } } - prxCfg.enableAvpf(tempAvpfEnabled); - prxCfg.setAvpfRRInterval(tempAvpfRRInterval); + prxCfg.setAvpfMode(AVPFMode.Enabled); + prxCfg.setAvpfRrInterval(tempAvpfRRInterval); prxCfg.enableQualityReporting(tempQualityReportingEnabled); prxCfg.setQualityReportingCollector(tempQualityReportingCollector); prxCfg.setQualityReportingInterval(tempQualityReportingInterval); @@ -379,7 +378,7 @@ public class LinphonePreferences { if(tempRealm != null) prxCfg.setRealm(tempRealm); - LinphoneAuthInfo authInfo = LinphoneCoreFactory.instance().createAuthInfo(tempUsername, tempUserId, tempPassword, tempHa1, tempRealm, tempDomain); + AuthInfo authInfo = Factory.instance().createAuthInfo(tempUsername, tempUserId, tempPassword, tempHa1, tempRealm, tempDomain); lc.addProxyConfig(prxCfg); lc.addAuthInfo(authInfo); @@ -390,56 +389,48 @@ public class LinphonePreferences { } public void setAccountTransport(int n, String transport) { - LinphoneProxyConfig proxyConfig = getProxyConfig(n); + ProxyConfig proxyConfig = getProxyConfig(n); if (proxyConfig != null && transport != null) { - LinphoneAddress proxyAddr; - try { - proxyAddr = LinphoneCoreFactory.instance().createLinphoneAddress(proxyConfig.getProxy()); - int port = 0; - if (transport.equals(getString(R.string.pref_transport_udp_key))) { - proxyAddr.setTransport(TransportType.LinphoneTransportUdp); - } else if (transport.equals(getString(R.string.pref_transport_tcp_key))) { - proxyAddr.setTransport(TransportType.LinphoneTransportTcp); - } else if (transport.equals(getString(R.string.pref_transport_tls_key))) { - proxyAddr.setTransport(TransportType.LinphoneTransportTls); - port = 5223; - } + Address proxyAddr; + proxyAddr = Factory.instance().createAddress(proxyConfig.getServerAddr()); + int port = 0; + if (transport.equals(getString(R.string.pref_transport_udp_key))) { + proxyAddr.setTransport(TransportType.Udp); + } else if (transport.equals(getString(R.string.pref_transport_tcp_key))) { + proxyAddr.setTransport(TransportType.Tcp); + } else if (transport.equals(getString(R.string.pref_transport_tls_key))) { + proxyAddr.setTransport(TransportType.Tls); + port = 5223; + } /* 3G mobile firewall might block random TLS port, so we force use of 5223. * However we must NOT use this port when changing to TCP/UDP because otherwise * REGISTER (and everything actually) will fail... * */ - if ("sip.linphone.org".equals(proxyConfig.getDomain())) { - proxyAddr.setPort(port); - } + if ("sip.linphone.org".equals(proxyConfig.getDomain())) { + proxyAddr.setPort(port); + } - LinphoneProxyConfig prxCfg = getProxyConfig(n); - prxCfg.edit(); - prxCfg.setProxy(proxyAddr.asStringUriOnly()); - prxCfg.done(); + ProxyConfig prxCfg = getProxyConfig(n); + prxCfg.edit(); + prxCfg.setServerAddr(proxyAddr.asStringUriOnly()); + prxCfg.done(); - if (isAccountOutboundProxySet(n)) { - setAccountOutboundProxyEnabled(n, true); - } - } catch (LinphoneCoreException e) { - Log.e(e); + if (isAccountOutboundProxySet(n)) { + setAccountOutboundProxyEnabled(n, true); } } } public TransportType getAccountTransport(int n) { TransportType transport = null; - LinphoneProxyConfig proxyConfig = getProxyConfig(n); + ProxyConfig proxyConfig = getProxyConfig(n); if (proxyConfig != null) { - LinphoneAddress proxyAddr; - try { - proxyAddr = LinphoneCoreFactory.instance().createLinphoneAddress(proxyConfig.getProxy()); - transport = proxyAddr.getTransport(); - } catch (LinphoneCoreException e) { - Log.e(e); - } + Address proxyAddr; + proxyAddr = Factory.instance().createAddress(proxyConfig.getServerAddr()); + transport = proxyAddr.getTransport(); } return transport; @@ -449,9 +440,9 @@ public class LinphonePreferences { TransportType transport = getAccountTransport(n); String key = getString(R.string.pref_transport_udp_key); - if (transport != null && transport == TransportType.LinphoneTransportTcp) + if (transport != null && transport == TransportType.Tcp) key = getString(R.string.pref_transport_tcp_key); - else if (transport != null && transport == TransportType.LinphoneTransportTls) + else if (transport != null && transport == TransportType.Tls) key = getString(R.string.pref_transport_tls_key); return key; @@ -460,9 +451,9 @@ public class LinphonePreferences { public String getAccountTransportString(int n) { TransportType transport = getAccountTransport(n); - if (transport != null && transport == TransportType.LinphoneTransportTcp) + if (transport != null && transport == TransportType.Tcp) return getString(R.string.pref_transport_tcp); - else if (transport != null && transport == TransportType.LinphoneTransportTls) + else if (transport != null && transport == TransportType.Tls) return getString(R.string.pref_transport_tls); return getString(R.string.pref_transport_udp); @@ -470,42 +461,38 @@ public class LinphonePreferences { public void setAccountUsername(int n, String username) { String identity = "sip:" + username + "@" + getAccountDomain(n); - LinphoneAuthInfo old_info = getAuthInfo(n); - try { - LinphoneProxyConfig prxCfg = getProxyConfig(n); - if (prxCfg == null) { - Log.e("Error, no proxy config at index " + n); - return; - } - prxCfg.edit(); - prxCfg.setIdentity(identity); - prxCfg.enableRegister(true); - prxCfg.done(); + AuthInfo old_info = getAuthInfo(n); + ProxyConfig prxCfg = getProxyConfig(n); + if (prxCfg == null) { + Log.e("Error, no proxy config at index " + n); + return; + } + prxCfg.edit(); + prxCfg.setIdentityAddress(Factory.instance().createAddress(identity)); + prxCfg.enableRegister(true); + prxCfg.done(); - if (old_info != null) { - // We have to remove the previous auth info after otherwise we can't unregister the previous proxy config - LinphoneAuthInfo new_info = old_info.clone(); - getLc().removeAuthInfo(old_info); - new_info.setUsername(username); - saveAuthInfo(new_info); - } - } catch (LinphoneCoreException e) { - Log.e(e); + if (old_info != null) { + // We have to remove the previous auth info after otherwise we can't unregister the previous proxy config + AuthInfo new_info = old_info.clone(); + getLc().removeAuthInfo(old_info); + new_info.setUsername(username); + saveAuthInfo(new_info); } } public String getAccountUsername(int n) { - LinphoneAuthInfo authInfo = getAuthInfo(n); + AuthInfo authInfo = getAuthInfo(n); return authInfo == null ? null : authInfo.getUsername(); } public void setAccountDisplayName(int n, String displayName) { try { - LinphoneProxyConfig prxCfg = getProxyConfig(n); - LinphoneAddress addr = LinphoneCoreFactory.instance().createLinphoneAddress(prxCfg.getIdentity()); + ProxyConfig prxCfg = getProxyConfig(n); + Address addr = prxCfg.getIdentityAddress(); addr.setDisplayName(displayName); prxCfg.edit(); - prxCfg.setIdentity(addr.asString()); + prxCfg.setIdentityAddress(addr); prxCfg.done(); } catch (Exception e) { Log.e(e); @@ -513,25 +500,25 @@ public class LinphonePreferences { } public String getAccountDisplayName(int n) { - if (getProxyConfig(n) == null || getProxyConfig(n).getAddress() == null) return null; - return getProxyConfig(n).getAddress().getDisplayName(); + if (getProxyConfig(n) == null || getProxyConfig(n).getIdentityAddress() == null) return null; + return getProxyConfig(n).getIdentityAddress().getDisplayName(); } public void setAccountUserId(int n, String userId) { - LinphoneAuthInfo info = getClonedAuthInfo(n); + AuthInfo info = getClonedAuthInfo(n); if(info != null) { - info.setUserId(userId); + info.setUserid(userId); saveAuthInfo(info); } } public String getAccountUserId(int n) { - LinphoneAuthInfo authInfo = getAuthInfo(n); - return authInfo == null ? null : authInfo.getUserId(); + AuthInfo authInfo = getAuthInfo(n); + return authInfo == null ? null : authInfo.getUserid(); } public String getAccountRealm(int n) { - LinphoneAuthInfo authInfo = getAuthInfo(n); + AuthInfo authInfo = getAuthInfo(n); return authInfo == null ? null : authInfo.getRealm(); } @@ -549,30 +536,30 @@ public class LinphonePreferences { String userid = null; String realm = null; if(user != null && domain != null) { - if (LinphoneManager.getLc().getAuthInfosList().length >= n && LinphoneManager.getLc().getAuthInfosList()[n] != null) { + if (LinphoneManager.getLc().getAuthInfoList().length >= n && LinphoneManager.getLc().getAuthInfoList()[n] != null) { userid = getAccountUserId(n); realm = getAccountRealm(n); - LinphoneManager.getLc().removeAuthInfo(LinphoneManager.getLc().getAuthInfosList()[n]); + LinphoneManager.getLc().removeAuthInfo(LinphoneManager.getLc().getAuthInfoList()[n]); } - LinphoneAuthInfo authInfo = LinphoneCoreFactory.instance().createAuthInfo( + AuthInfo authInfo = Factory.instance().createAuthInfo( user, userid, password, ha1, realm, domain); LinphoneManager.getLc().addAuthInfo(authInfo); } } public String getAccountPassword(int n) { - LinphoneAuthInfo authInfo = getAuthInfo(n); + AuthInfo authInfo = getAuthInfo(n); return authInfo == null ? null : authInfo.getPassword(); } public String getAccountHa1(int n) { - LinphoneAuthInfo authInfo = getAuthInfo(n); + AuthInfo authInfo = getAuthInfo(n); return authInfo == null ? null : authInfo.getHa1(); } public void setAccountIce(int n, boolean ice) { try { - LinphoneProxyConfig prxCfg = getProxyConfig(n); + ProxyConfig prxCfg = getProxyConfig(n); prxCfg.edit(); prxCfg.getNatPolicy().enableIce(ice); prxCfg.done(); @@ -588,9 +575,9 @@ public class LinphonePreferences { public void setAccountStunServer(int n, String stun) { try { - LinphoneProxyConfig prxCfg = getProxyConfig(n); + ProxyConfig prxCfg = getProxyConfig(n); prxCfg.edit(); - LinphoneNatPolicy np = prxCfg.getNatPolicy(); + NatPolicy np = prxCfg.getNatPolicy(); np.setStunServer(stun); np.enableStun(stun!=null); prxCfg.done(); @@ -606,28 +593,24 @@ public class LinphonePreferences { public void setAccountDomain(int n, String domain) { String identity = "sip:" + getAccountUsername(n) + "@" + domain; - LinphoneAuthInfo old_info = getAuthInfo(n); - try { - LinphoneProxyConfig prxCfg = getProxyConfig(n); - prxCfg.edit(); - prxCfg.setIdentity(identity); - prxCfg.enableRegister(true); - prxCfg.done(); + AuthInfo old_info = getAuthInfo(n); + ProxyConfig prxCfg = getProxyConfig(n); + prxCfg.edit(); + prxCfg.setIdentityAddress(Factory.instance().createAddress(identity)); + prxCfg.enableRegister(true); + prxCfg.done(); - if (old_info != null) { - // We have to remove the previous auth info after otherwise we can't unregister the previous proxy config - LinphoneAuthInfo new_info = old_info.clone(); - getLc().removeAuthInfo(old_info); - new_info.setDomain(domain); - saveAuthInfo(new_info); - } - } catch (LinphoneCoreException e) { - Log.e(e); + if (old_info != null) { + // We have to remove the previous auth info after otherwise we can't unregister the previous proxy config + AuthInfo new_info = old_info.clone(); + getLc().removeAuthInfo(old_info); + new_info.setDomain(domain); + saveAuthInfo(new_info); } } public String getAccountDomain(int n) { - LinphoneProxyConfig proxyConf = getProxyConfig(n); + ProxyConfig proxyConf = getProxyConfig(n); return (proxyConf != null) ? proxyConf.getDomain() : ""; } @@ -640,45 +623,37 @@ public class LinphonePreferences { proxy = "sip:" + proxy; } - try { - LinphoneAddress proxyAddr = LinphoneCoreFactory.instance().createLinphoneAddress(proxy); - if (!proxy.contains("transport=")) { - proxyAddr.setTransport(getAccountTransport(n)); - } + Address proxyAddr = Factory.instance().createAddress(proxy); + if (!proxy.contains("transport=")) { + proxyAddr.setTransport(getAccountTransport(n)); + } - LinphoneProxyConfig prxCfg = getProxyConfig(n); - prxCfg.edit(); - prxCfg.setProxy(proxyAddr.asStringUriOnly()); - prxCfg.done(); + ProxyConfig prxCfg = getProxyConfig(n); + prxCfg.edit(); + prxCfg.setServerAddr(proxyAddr.asStringUriOnly()); + prxCfg.done(); - if (isAccountOutboundProxySet(n)) { - setAccountOutboundProxyEnabled(n, true); - } - } catch (LinphoneCoreException e) { - Log.e(e); + if (isAccountOutboundProxySet(n)) { + setAccountOutboundProxyEnabled(n, true); } } public String getAccountProxy(int n) { - String proxy = getProxyConfig(n).getProxy(); + String proxy = getProxyConfig(n).getServerAddr(); return proxy; } public void setAccountOutboundProxyEnabled(int n, boolean enabled) { - try { - LinphoneProxyConfig prxCfg = getProxyConfig(n); - prxCfg.edit(); - if (enabled) { - String route = prxCfg.getProxy(); - prxCfg.setRoute(route); - } else { - prxCfg.setRoute(null); - } - prxCfg.done(); - } catch (LinphoneCoreException e) { - Log.e(e); + ProxyConfig prxCfg = getProxyConfig(n); + prxCfg.edit(); + if (enabled) { + String route = prxCfg.getServerAddr(); + prxCfg.setRoute(route); + } else { + prxCfg.setRoute(null); } + prxCfg.done(); } public boolean isAccountOutboundProxySet(int n) { @@ -686,7 +661,7 @@ public class LinphonePreferences { } public void setAccountContactParameters(int n, String contactParams) { - LinphoneProxyConfig prxCfg = getProxyConfig(n); + ProxyConfig prxCfg = getProxyConfig(n); prxCfg.edit(); prxCfg.setContactUriParameters(contactParams); prxCfg.done(); @@ -698,7 +673,7 @@ public class LinphonePreferences { public void setExpires(int n, String expire) { try { - LinphoneProxyConfig prxCfg = getProxyConfig(n); + ProxyConfig prxCfg = getProxyConfig(n); prxCfg.edit(); prxCfg.setExpires(Integer.parseInt(expire)); prxCfg.done(); @@ -710,7 +685,7 @@ public class LinphonePreferences { } public void setPrefix(int n, String prefix) { - LinphoneProxyConfig prxCfg = getProxyConfig(n); + ProxyConfig prxCfg = getProxyConfig(n); prxCfg.edit(); prxCfg.setDialPrefix(prefix); prxCfg.done(); @@ -720,22 +695,22 @@ public class LinphonePreferences { return getProxyConfig(n).avpfEnabled(); } - public void enableAvpf(int n, boolean enable) { - LinphoneProxyConfig prxCfg = getProxyConfig(n); + public void setAvpfMode(int n, boolean enable) { + ProxyConfig prxCfg = getProxyConfig(n); prxCfg.edit(); - prxCfg.enableAvpf(enable); + prxCfg.setAvpfMode(enable ? AVPFMode.Enabled : AVPFMode.Disabled); prxCfg.done(); } - public String getAvpfRRInterval(int n) { - return String.valueOf(getProxyConfig(n).getAvpfRRInterval()); + public String getAvpfRrInterval(int n) { + return String.valueOf(getProxyConfig(n).getAvpfRrInterval()); } - public void setAvpfRRInterval(int n, String interval) { + public void setAvpfRrInterval(int n, String interval) { try { - LinphoneProxyConfig prxCfg = getProxyConfig(n); + ProxyConfig prxCfg = getProxyConfig(n); prxCfg.edit(); - prxCfg.setAvpfRRInterval(Integer.parseInt(interval)); + prxCfg.setAvpfRrInterval(Integer.parseInt(interval)); prxCfg.done(); } catch (NumberFormatException nfe) { } } @@ -745,7 +720,7 @@ public class LinphonePreferences { } public void setReplacePlusByZeroZero(int n, boolean replace) { - LinphoneProxyConfig prxCfg = getProxyConfig(n); + ProxyConfig prxCfg = getProxyConfig(n); prxCfg.edit(); prxCfg.setDialEscapePlus(replace); prxCfg.done(); @@ -761,7 +736,7 @@ public class LinphonePreferences { } public void setDefaultAccount(int accountIndex) { - LinphoneProxyConfig[] prxCfgs = getLc().getProxyConfigList(); + ProxyConfig[] prxCfgs = getLc().getProxyConfigList(); if (accountIndex >= 0 && accountIndex < prxCfgs.length) getLc().setDefaultProxyConfig(prxCfgs[accountIndex]); } @@ -769,13 +744,13 @@ public class LinphonePreferences { public int getDefaultAccountIndex() { if (getLc() == null) return -1; - LinphoneProxyConfig defaultPrxCfg = getLc().getDefaultProxyConfig(); + ProxyConfig defaultPrxCfg = getLc().getDefaultProxyConfig(); if (defaultPrxCfg == null) return -1; - LinphoneProxyConfig[] prxCfgs = getLc().getProxyConfigList(); + ProxyConfig[] prxCfgs = getLc().getProxyConfigList(); for (int i = 0; i < prxCfgs.length; i++) { - if (defaultPrxCfg.getIdentity().equals(prxCfgs[i].getIdentity())) { + if (defaultPrxCfg.getIdentityAddress().equals(prxCfgs[i].getIdentityAddress())) { return i; } } @@ -790,7 +765,7 @@ public class LinphonePreferences { } public void setAccountEnabled(int n, boolean enabled) { - LinphoneProxyConfig prxCfg = getProxyConfig(n); + ProxyConfig prxCfg = getProxyConfig(n); if (prxCfg == null) { LinphoneUtils.displayErrorAlert(getString(R.string.error), mContext); return; @@ -800,7 +775,7 @@ public class LinphonePreferences { prxCfg.done(); // If default proxy config is disabled, try to set another one as default proxy - if (!enabled && getLc().getDefaultProxyConfig().getIdentity().equals(prxCfg.getIdentity())) { + if (!enabled && getLc().getDefaultProxyConfig().getIdentityAddress().equals(prxCfg.getIdentityAddress())) { int count = getLc().getProxyConfigList().length; if (count > 1) { for (int i = 0; i < count; i++) { @@ -832,7 +807,7 @@ public class LinphonePreferences { } public void deleteAccount(int n) { - LinphoneProxyConfig proxyCfg = getProxyConfig(n); + ProxyConfig proxyCfg = getProxyConfig(n); if (proxyCfg != null) getLc().removeProxyConfig(proxyCfg); if (getLc().getProxyConfigList().length != 0) { @@ -841,7 +816,7 @@ public class LinphonePreferences { getLc().setDefaultProxyConfig(null); } - LinphoneAuthInfo authInfo = getAuthInfo(n); + AuthInfo authInfo = getAuthInfo(n); if (authInfo != null) { getLc().removeAuthInfo(authInfo); } @@ -855,8 +830,8 @@ public class LinphonePreferences { getLc().enableEchoCancellation(enable); } - public boolean isEchoCancellationEnabled() { - return getLc().isEchoCancellationEnabled(); + public boolean echoCancellationEnabled() { + return getLc().echoCancellationEnabled(); } public int getEchoCalibration() { @@ -882,27 +857,33 @@ public class LinphonePreferences { } public boolean isVideoEnabled() { - return getLc().isVideoSupported() && getLc().isVideoEnabled(); + return getLc().videoSupported() && getLc().videoEnabled(); } public void enableVideo(boolean enable) { - getLc().enableVideo(enable, enable); + getLc().enableVideoCapture(enable); + getLc().enableVideoDisplay(enable); } public boolean shouldInitiateVideoCall() { - return getLc().getVideoAutoInitiatePolicy(); + return getLc().getVideoActivationPolicy().getAutomaticallyInitiate(); } public void setInitiateVideoCall(boolean initiate) { - getLc().setVideoPolicy(initiate, shouldAutomaticallyAcceptVideoRequests()); + VideoActivationPolicy vap = getLc().getVideoActivationPolicy(); + vap.setAutomaticallyInitiate(initiate); + getLc().setVideoActivationPolicy(vap); } public boolean shouldAutomaticallyAcceptVideoRequests() { - return getLc().getVideoAutoAcceptPolicy(); + VideoActivationPolicy vap = getLc().getVideoActivationPolicy(); + return vap.getAutomaticallyAccept(); } public void setAutomaticallyAcceptVideoRequests(boolean accept) { - getLc().setVideoPolicy(shouldInitiateVideoCall(), accept); + VideoActivationPolicy vap = getLc().getVideoActivationPolicy(); + vap.setAutomaticallyAccept(accept); + getLc().setVideoActivationPolicy(vap); } public String getVideoPreset() { @@ -922,7 +903,7 @@ public class LinphonePreferences { } public String getPreferredVideoSize() { - //LinphoneCore can only return video size (width and height), not the name + //Core can only return video size (width and height), not the name return getConfig().getString("video", "size", "qvga"); } @@ -950,27 +931,27 @@ public class LinphonePreferences { // Call settings public boolean useRfc2833Dtmfs() { - return getLc().getUseRfc2833ForDtmfs(); + return getLc().getUseRfc2833ForDtmf(); } public void sendDtmfsAsRfc2833(boolean use) { - getLc().setUseRfc2833ForDtmfs(use); + getLc().setUseRfc2833ForDtmf(use); } public boolean useSipInfoDtmfs() { - return getLc().getUseSipInfoForDtmfs(); + return getLc().getUseInfoForDtmf(); } public void sendDTMFsAsSipInfo(boolean use) { - getLc().setUseSipInfoForDtmfs(use); + getLc().setUseInfoForDtmf(use); } public int getIncTimeout() { - return getLc().getIncomingTimeout(); + return getLc().getIncTimeout(); } public void setIncTimeout(int timeout) { - getLc().setIncomingTimeout(timeout); + getLc().setIncTimeout(timeout); } public int getInCallTimeout() { @@ -1027,25 +1008,25 @@ public class LinphonePreferences { } public String getSipPort() { - Transports transports = getLc().getSignalingTransportPorts(); + Transports transports = getLc().getTransports(); int port; - if (transports.udp > 0) - port = transports.udp; + if (transports.getUdpPort() > 0) + port = transports.getUdpPort(); else - port = transports.tcp; + port = transports.getTcpPort(); return String.valueOf(port); } public void setSipPort(int port) { - Transports transports = getLc().getSignalingTransportPorts(); - transports.udp = port; - transports.tcp = port; - transports.tls = LINPHONE_CORE_RANDOM_PORT; - getLc().setSignalingTransportPorts(transports); + Transports transports = getLc().getTransports(); + transports.setUdpPort(port); + transports.setTcpPort(port); + transports.setTlsPort(LINPHONE_CORE_RANDOM_PORT); + getLc().setTransports(transports); } - private LinphoneNatPolicy getOrCreateNatPolicy() { - LinphoneNatPolicy nat = getLc().getNatPolicy(); + private NatPolicy getOrCreateNatPolicy() { + NatPolicy nat = getLc().getNatPolicy(); if (nat == null) { nat = getLc().createNatPolicy(); } @@ -1053,12 +1034,12 @@ public class LinphonePreferences { } public String getStunServer() { - LinphoneNatPolicy nat = getOrCreateNatPolicy(); + NatPolicy nat = getOrCreateNatPolicy(); return nat.getStunServer(); } public void setStunServer(String stun) { - LinphoneNatPolicy nat = getOrCreateNatPolicy(); + NatPolicy nat = getOrCreateNatPolicy(); nat.setStunServer(stun); if (stun != null && !stun.isEmpty()) { @@ -1068,55 +1049,55 @@ public class LinphonePreferences { } public void setIceEnabled(boolean enabled) { - LinphoneNatPolicy nat = getOrCreateNatPolicy(); + NatPolicy nat = getOrCreateNatPolicy(); nat.enableIce(enabled); getLc().setNatPolicy(nat); } public void setTurnEnabled(boolean enabled) { - LinphoneNatPolicy nat = getOrCreateNatPolicy(); + NatPolicy nat = getOrCreateNatPolicy(); nat.enableTurn(enabled); getLc().setNatPolicy(nat); } public void setUpnpEnabled(boolean enabled) { - LinphoneNatPolicy nat = getOrCreateNatPolicy(); + NatPolicy nat = getOrCreateNatPolicy(); nat.enableUpnp(enabled); getLc().setNatPolicy(nat); } public boolean isUpnpEnabled() { - LinphoneNatPolicy nat = getOrCreateNatPolicy(); + NatPolicy nat = getOrCreateNatPolicy(); return nat.upnpEnabled(); } public boolean isIceEnabled() { - LinphoneNatPolicy nat = getOrCreateNatPolicy(); + NatPolicy nat = getOrCreateNatPolicy(); return nat.iceEnabled(); } public boolean isTurnEnabled() { - LinphoneNatPolicy nat = getOrCreateNatPolicy(); + NatPolicy nat = getOrCreateNatPolicy(); return nat.turnEnabled(); } public String getTurnUsername() { - LinphoneNatPolicy nat = getOrCreateNatPolicy(); + NatPolicy nat = getOrCreateNatPolicy(); return nat.getStunServerUsername(); } public void setTurnUsername(String username) { - LinphoneNatPolicy nat = getOrCreateNatPolicy(); - LinphoneAuthInfo authInfo = getLc().findAuthInfo(nat.getStunServerUsername(), null, null); + NatPolicy nat = getOrCreateNatPolicy(); + AuthInfo authInfo = getLc().findAuthInfo(nat.getStunServerUsername(), null, null); if (authInfo != null) { - LinphoneAuthInfo cloneAuthInfo = authInfo.clone(); + AuthInfo cloneAuthInfo = authInfo.clone(); getLc().removeAuthInfo(authInfo); cloneAuthInfo.setUsername(username); - cloneAuthInfo.setUserId(username); + cloneAuthInfo.setUserid(username); getLc().addAuthInfo(cloneAuthInfo); } else { - authInfo = LinphoneCoreFactory.instance().createAuthInfo(username, username, null, null, null, null); + authInfo = Factory.instance().createAuthInfo(username, username, null, null, null, null); getLc().addAuthInfo(authInfo); } nat.setStunServerUsername(username); @@ -1124,16 +1105,16 @@ public class LinphonePreferences { } public void setTurnPassword(String password) { - LinphoneNatPolicy nat = getOrCreateNatPolicy(); - LinphoneAuthInfo authInfo = getLc().findAuthInfo(nat.getStunServerUsername(), null, null); + NatPolicy nat = getOrCreateNatPolicy(); + AuthInfo authInfo = getLc().findAuthInfo(nat.getStunServerUsername(), null, null); if (authInfo != null) { - LinphoneAuthInfo cloneAuthInfo = authInfo.clone(); + AuthInfo cloneAuthInfo = authInfo.clone(); getLc().removeAuthInfo(authInfo); cloneAuthInfo.setPassword(password); getLc().addAuthInfo(cloneAuthInfo); } else { - authInfo = LinphoneCoreFactory.instance().createAuthInfo(nat.getStunServerUsername(), nat.getStunServerUsername(), password, null, null, null); + authInfo = Factory.instance().createAuthInfo(nat.getStunServerUsername(), nat.getStunServerUsername(), password, null, null, null); getLc().addAuthInfo(authInfo); } } @@ -1152,7 +1133,7 @@ public class LinphonePreferences { public void setPushNotificationEnabled(boolean enable) { getConfig().setBool("app", "push_notification", enable); - LinphoneCore lc = getLc(); + Core lc = getLc(); if (lc == null) { return; } @@ -1162,22 +1143,22 @@ public class LinphonePreferences { String regId = getPushNotificationRegistrationID(); String appId = getString(R.string.push_sender_id); if (regId != null && lc.getProxyConfigList().length > 0) { - for (LinphoneProxyConfig lpc : lc.getProxyConfigList()) { + for (ProxyConfig lpc : lc.getProxyConfigList()) { String contactInfos = "app-id=" + appId + ";pn-type=" + getString(R.string.push_type) + ";pn-tok=" + regId + ";pn-silent=1"; lpc.edit(); lpc.setContactUriParameters(contactInfos); lpc.done(); - Log.d("Push notif infos added to proxy config " + lpc.getAddress().asStringUriOnly()); + Log.d("Push notif infos added to proxy config " + lpc.getIdentityAddress().asStringUriOnly()); } lc.refreshRegisters(); } } else { if (lc.getProxyConfigList().length > 0) { - for (LinphoneProxyConfig lpc : lc.getProxyConfigList()) { + for (ProxyConfig lpc : lc.getProxyConfigList()) { lpc.edit(); lpc.setContactUriParameters(null); lpc.done(); - Log.d("Push notif infos removed from proxy config " + lpc.getAddress().asStringUriOnly()); + Log.d("Push notif infos removed from proxy config " + lpc.getIdentityAddress().asStringUriOnly()); } lc.refreshRegisters(); } @@ -1203,15 +1184,15 @@ public class LinphonePreferences { } public boolean isUsingIpv6() { - return getLc().isIpv6Enabled(); + return getLc().ipv6Enabled(); } // End of network settings // Advanced settings public void setDebugEnabled(boolean enabled) { getConfig().setBool("app", "debug", enabled); - LinphoneCoreFactory.instance().enableLogCollection(enabled); - LinphoneCoreFactory.instance().setDebugMode(enabled, getString(R.string.app_name)); + Factory.instance().enableLogCollection(enabled); + Factory.instance().setDebugMode(enabled, getString(R.string.app_name)); } public boolean isDebugEnabled() { @@ -1254,33 +1235,33 @@ public class LinphonePreferences { } public void setDefaultDisplayName(String displayName) { - getLc().setPrimaryContact(displayName, getDefaultUsername()); + //getLc().setPrimaryContact(displayName, getDefaultUsername()); //TODO FIXME } public String getDefaultDisplayName() { - return getLc().getPrimaryContactDisplayName(); + return getLc().getPrimaryContactParsed().getDisplayName(); } public void setDefaultUsername(String username) { - getLc().setPrimaryContact(getDefaultDisplayName(), username); + //getLc().setPrimaryContact(getDefaultDisplayName(), username); // TODO FIXME } public String getDefaultUsername() { - return getLc().getPrimaryContactUsername(); + return getLc().getPrimaryContactParsed().getUsername(); } // End of advanced settings // Tunnel settings - private TunnelConfig tunnelConfig = null; + /*private TunnelConfig tunnelConfig = null; public TunnelConfig getTunnelConfig() { - if(getLc().isTunnelAvailable()) { + if(getLc().tunnelAvailable()) { if(tunnelConfig == null) { TunnelConfig servers[] = getLc().tunnelGetServers(); if(servers.length > 0) { tunnelConfig = servers[0]; } else { - tunnelConfig = LinphoneCoreFactory.instance().createTunnelConfig(); + tunnelConfig = Factory.instance().createTunnelConfig(); } } return tunnelConfig; @@ -1330,7 +1311,7 @@ public class LinphonePreferences { public void setTunnelMode(String mode) { getConfig().setString("app", "tunnel", mode); LinphoneManager.getInstance().initTunnelFromConf(); - } + }*/ // End of tunnel settings public boolean isProvisioningLoginViewEnabled() { @@ -1354,22 +1335,14 @@ public class LinphonePreferences { return getConfig().getBool("app", "first_remote_provisioning", true); } - public boolean isAdaptiveRateControlEnabled() { - return getLc().isAdaptiveRateControlEnabled(); + public boolean adaptiveRateControlEnabled() { + return getLc().adaptiveRateControlEnabled(); } public void enableAdaptiveRateControl(boolean enabled) { getLc().enableAdaptiveRateControl(enabled); } - public AdaptiveRateAlgorithm getAdaptiveRateAlgorithm() { - return getLc().getAdaptiveRateAlgorithm(); - } - - public void setAdaptiveRateAlgorithm(AdaptiveRateAlgorithm alg) { - getLc().setAdaptiveRateAlgorithm(alg); - } - public int getCodecBitrateLimit() { return getConfig().getInt("audio", "codec_bitrate_limit", 36); } @@ -1479,12 +1452,12 @@ public class LinphonePreferences { getConfig().setBool("app", "display_overlay", enable); } - public LinphoneLimeState getLimeEncryption() { - return getLc().getLimeEncryption(); + public LimeState limeEnabled() { + return getLc().limeEnabled(); } - public void setLimeEncryption(LinphoneLimeState lime) { - getLc().setLimeEncryption(lime); + public void enableLime(LimeState lime) { + getLc().enableLime(lime); } public boolean firstTimeAskingForPermission(String permission) { diff --git a/src/android/org/linphone/LinphoneService.java b/src/android/org/linphone/LinphoneService.java index 67b86a5ff..6c13de01b 100644 --- a/src/android/org/linphone/LinphoneService.java +++ b/src/android/org/linphone/LinphoneService.java @@ -24,17 +24,17 @@ import java.lang.reflect.Method; import java.util.ArrayList; import org.linphone.compatibility.Compatibility; -import org.linphone.core.LinphoneAddress; -import org.linphone.core.LinphoneCall; -import org.linphone.core.LinphoneCall.State; -import org.linphone.core.LinphoneCallLog.CallStatus; -import org.linphone.core.LinphoneCore; -import org.linphone.core.LinphoneCore.GlobalState; -import org.linphone.core.LinphoneCore.RegistrationState; -import org.linphone.core.LinphoneCoreException; -import org.linphone.core.LinphoneCoreFactory; -import org.linphone.core.LinphoneCoreListenerBase; -import org.linphone.core.LinphoneProxyConfig; +import org.linphone.core.Address; +import org.linphone.core.Call; +import org.linphone.core.Call.State; +import org.linphone.core.CallLog.CallStatus; +import org.linphone.core.Core; +import org.linphone.core.Core.GlobalState; +import org.linphone.core.Core.RegistrationState; +import org.linphone.core.CoreException; +import org.linphone.core.Factory; +import org.linphone.core.CoreListenerStub; +import org.linphone.core.ProxyConfig; import org.linphone.mediastream.Log; import org.linphone.mediastream.Version; import org.linphone.ui.LinphoneOverlay; @@ -119,7 +119,7 @@ public final class LinphoneService extends Service { private PendingIntent mNotifContentIntent; private String mNotificationTitle; private boolean mDisableRegistrationStatus; - private LinphoneCoreListenerBase mListener; + private CoreListenerStub mListener; public static int notifcationsPriority = (Version.sdkAboveOrEqual(Version.API16_JELLY_BEAN_41) ? Notification.PRIORITY_MIN : 0); private WindowManager mWindowManager; private LinphoneOverlay mOverlay; @@ -268,11 +268,11 @@ public final class LinphoneService extends Service { public void showServiceNotification() { startForegroundCompat(NOTIF_ID, mNotif); - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc == null) return; - LinphoneProxyConfig lpc = lc.getDefaultProxyConfig(); + ProxyConfig lpc = lc.getDefaultProxyConfig(); if (lpc != null) { - if (lpc.isRegistered()) { + if (lpc.getState() == RegistrationState.Ok) { sendNotification(IC_LEVEL_ORANGE, R.string.notification_registered); } else { sendNotification(IC_LEVEL_ORANGE, R.string.notification_register_failure); @@ -297,10 +297,10 @@ public final class LinphoneService extends Service { // Needed in order for the two next calls to succeed, libraries must have been loaded first LinphonePreferences.instance().setContext(getBaseContext()); - LinphoneCoreFactory.instance().setLogCollectionPath(getFilesDir().getAbsolutePath()); + Factory.instance().setLogCollectionPath(getFilesDir().getAbsolutePath()); boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled(); - LinphoneCoreFactory.instance().enableLogCollection(isDebugEnabled); - LinphoneCoreFactory.instance().setDebugMode(isDebugEnabled, getString(R.string.app_name)); + Factory.instance().enableLogCollection(isDebugEnabled); + Factory.instance().setDebugMode(isDebugEnabled, getString(R.string.app_name)); // Dump some debugging information to the logs Log.i(START_LINPHONE_LOGS); @@ -336,20 +336,20 @@ public final class LinphoneService extends Service { Log.e(e); } - LinphoneManager.getLc().addListener(mListener = new LinphoneCoreListenerBase() { + LinphoneManager.getLc().addListener(mListener = new CoreListenerStub() { @Override - public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) { + public void onCallStateChanged(Core lc, Call call, Call.State state, String message) { if (instance == null) { Log.i("Service not ready, discarding call state change to ",state.toString()); return; } - if (state == LinphoneCall.State.IncomingReceived) { + if (state == Call.State.IncomingReceived) { if(! LinphoneManager.getInstance().getCallGsmON()) onIncomingReceived(); } - if (state == State.CallEnd || state == State.CallReleased || state == State.Error) { + if (state == State.End || state == State.Released || state == State.Error) { if (LinphoneManager.isInstanciated() && LinphoneManager.getLc() != null && LinphoneManager.getLc().getCallsNb() == 0) { if (LinphoneActivity.isInstanciated() && LinphoneActivity.instance().getStatusFragment() != null) { removeSasNotification(); @@ -359,13 +359,13 @@ public final class LinphoneService extends Service { destroyOverlay(); } - if (state == State.CallEnd && call.getCallLog().getStatus() == CallStatus.Missed) { + if (state == State.End && call.getCallLog().getStatus() == CallStatus.Missed) { int missedCallCount = LinphoneManager.getLcIfManagerNotDestroyedOrNull().getMissedCallsCount(); String body; if (missedCallCount > 1) { body = getString(R.string.missed_calls_notif_body).replace("%i", String.valueOf(missedCallCount)); } else { - LinphoneAddress address = call.getRemoteAddress(); + Address address = call.getRemoteAddress(); LinphoneContact c = ContactsManager.getInstance().findContactFromAddress(address); if (c != null) { body = c.getFullName(); @@ -396,28 +396,28 @@ public final class LinphoneService extends Service { } @Override - public void globalState(LinphoneCore lc,LinphoneCore.GlobalState state, String message) { - if (state == GlobalState.GlobalOn && displayServiceNotification()) { + public void onGlobalStateChanged(Core lc,Core.GlobalState state, String message) { + if (state == Core.GlobalState.On && displayServiceNotification()) { sendNotification(IC_LEVEL_ORANGE, R.string.notification_started); } } @Override - public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, LinphoneCore.RegistrationState state, String smessage) { + public void onRegistrationStateChanged(Core lc, ProxyConfig cfg, Core.RegistrationState state, String smessage) { // if (instance == null) { // Log.i("Service not ready, discarding registration state change to ",state.toString()); // return; // } if (!mDisableRegistrationStatus) { - if (displayServiceNotification() && state == RegistrationState.RegistrationOk && LinphoneManager.getLc().getDefaultProxyConfig() != null && LinphoneManager.getLc().getDefaultProxyConfig().isRegistered()) { + if (displayServiceNotification() && state == RegistrationState.Ok && LinphoneManager.getLc().getDefaultProxyConfig() != null && LinphoneManager.getLc().getDefaultProxyConfig().getState() == RegistrationState.Ok) { sendNotification(IC_LEVEL_ORANGE, R.string.notification_registered); } - if (displayServiceNotification() && (state == RegistrationState.RegistrationFailed || state == RegistrationState.RegistrationCleared) && (LinphoneManager.getLc().getDefaultProxyConfig() == null || !LinphoneManager.getLc().getDefaultProxyConfig().isRegistered())) { + if (displayServiceNotification() && (state == RegistrationState.Failed || state == RegistrationState.Cleared) && (LinphoneManager.getLc().getDefaultProxyConfig() == null || !(LinphoneManager.getLc().getDefaultProxyConfig().getState() == RegistrationState.Ok))) { sendNotification(IC_LEVEL_ORANGE, R.string.notification_register_failure); } - if (displayServiceNotification() && state == RegistrationState.RegistrationNone) { + if (displayServiceNotification() && state == RegistrationState.None) { sendNotification(IC_LEVEL_ORANGE, R.string.notification_started); } } @@ -462,8 +462,8 @@ public final class LinphoneService extends Service { public void createOverlay() { if (mOverlay != null) destroyOverlay(); - LinphoneCall call = LinphoneManager.getLc().getCurrentCall(); - if (call == null || !call.getCurrentParams().getVideoEnabled()) return; + Call call = LinphoneManager.getLc().getCurrentCall(); + if (call == null || !call.getCurrentParams().videoEnabled()) return; mOverlay = new LinphoneOverlay(this); WindowManager.LayoutParams params = mOverlay.getWindowManagerLayoutParams(); @@ -517,11 +517,11 @@ public final class LinphoneService extends Service { return; } - LinphoneCall call = LinphoneManager.getLc().getCalls()[0]; - String userName = call.getRemoteAddress().getUserName(); + Call call = LinphoneManager.getLc().getCalls()[0]; + String userName = call.getRemoteAddress().getUsername(); String domain = call.getRemoteAddress().getDomain(); String displayName = call.getRemoteAddress().getDisplayName(); - LinphoneAddress address = LinphoneCoreFactory.instance().createLinphoneAddress(userName,domain,null); + Address address = Factory.instance().createAddress(userName + "@" + domain); address.setDisplayName(displayName); LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(address); @@ -532,7 +532,7 @@ public final class LinphoneService extends Service { } catch (Exception e) { bm = BitmapFactory.decodeResource(getResources(), R.drawable.avatar); } - String name = address.getDisplayName() == null ? address.getUserName() : address.getDisplayName(); + String name = address.getDisplayName() == null ? address.getUsername() : address.getDisplayName(); Intent notifIntent = new Intent(this, incomingReceivedActivity); notifIntent.putExtra("Notification", true); mNotifContentIntent = PendingIntent.getActivity(this, 0, notifIntent, PendingIntent.FLAG_UPDATE_CURRENT); @@ -545,10 +545,10 @@ public final class LinphoneService extends Service { } } - public void refreshIncallIcon(LinphoneCall currentCall) { - LinphoneCore lc = LinphoneManager.getLc(); + public void refreshIncallIcon(Call currentCall) { + Core lc = LinphoneManager.getLc(); if (currentCall != null) { - if (currentCall.getCurrentParams().getVideoEnabled() && currentCall.cameraEnabled()) { + if (currentCall.getCurrentParams().videoEnabled() && currentCall.cameraEnabled()) { // checking first current params is mandatory setIncallIcon(IncallIconState.VIDEO); } else { @@ -556,7 +556,7 @@ public final class LinphoneService extends Service { } } else if (lc.getCallsNb() == 0) { setIncallIcon(IncallIconState.IDLE); - } else if (lc.isInConference()) { + } else if (lc.getConference() != null) { setIncallIcon(IncallIconState.INCALL); } else { setIncallIcon(IncallIconState.PAUSE); @@ -590,7 +590,7 @@ public final class LinphoneService extends Service { resetIntentLaunchedOnNotificationClick(); } - public void displayMessageNotification(String to, String fromSipUri, String fromName, String message) { + public void removedNotification(String to, String fromSipUri, String fromName, String message) { Intent notifIntent = new Intent(this, LinphoneActivity.class); notifIntent.putExtra("GoToChat", true); notifIntent.putExtra("ChatContactSipUri", fromSipUri); @@ -608,13 +608,9 @@ public final class LinphoneService extends Service { } Uri pictureUri = null; - try { - LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(LinphoneCoreFactory.instance().createLinphoneAddress(fromSipUri)); - if (contact != null) - pictureUri = contact.getThumbnailUri(); - } catch (LinphoneCoreException e1) { - Log.e("Cannot parse from address ", e1); - } + LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(Factory.instance().createAddress(fromSipUri)); + if (contact != null) + pictureUri = contact.getThumbnailUri(); Bitmap bm = null; if (pictureUri != null) { @@ -764,8 +760,8 @@ public final class LinphoneService extends Service { String text = getString(textId); if (text.contains("%s") && LinphoneManager.getLc() != null) { // Test for null lc is to avoid a NPE when Android mess up badly with the String resources. - LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig(); - String id = lpc != null ? lpc.getIdentity() : ""; + ProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig(); + String id = lpc != null ? lpc.getIdentityAddress().asString() : ""; text = String.format(text, id); } @@ -805,7 +801,7 @@ public final class LinphoneService extends Service { // If push is enabled, don't unregister account, otherwise do unregister if (LinphonePreferences.instance().isPushNotificationEnabled()) { - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) lc.setNetworkReachable(false); } stopSelf(); @@ -822,7 +818,7 @@ public final class LinphoneService extends Service { } destroyOverlay(); - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.removeListener(mListener); } @@ -877,7 +873,7 @@ public final class LinphoneService extends Service { public void tryingNewOutgoingCallButWrongDestinationAddress() { } - public void onCallEncryptionChanged(final LinphoneCall call, final boolean encrypted, + public void onCallEncryptionChanged(final Call call, final boolean encrypted, final String authenticationToken) { } } diff --git a/src/android/org/linphone/LinphoneUtils.java b/src/android/org/linphone/LinphoneUtils.java index aa7b39f07..a66f3ed75 100644 --- a/src/android/org/linphone/LinphoneUtils.java +++ b/src/android/org/linphone/LinphoneUtils.java @@ -52,15 +52,15 @@ import android.widget.TextView; import android.widget.Toast; import org.linphone.core.DialPlan; -import org.linphone.core.LinphoneAccountCreator; -import org.linphone.core.LinphoneAddress; -import org.linphone.core.LinphoneCall; -import org.linphone.core.LinphoneCall.State; -import org.linphone.core.LinphoneChatMessage; -import org.linphone.core.LinphoneCore; -import org.linphone.core.LinphoneCoreException; -import org.linphone.core.LinphoneCoreFactory; -import org.linphone.core.LinphoneProxyConfig; +import org.linphone.core.AccountCreator; +import org.linphone.core.Address; +import org.linphone.core.Call; +import org.linphone.core.Call.State; +import org.linphone.core.ChatMessage; +import org.linphone.core.Core; +import org.linphone.core.CoreException; +import org.linphone.core.Factory; +import org.linphone.core.ProxyConfig; import org.linphone.mediastream.Log; import org.linphone.mediastream.video.capture.hwconf.Hacks; @@ -104,16 +104,12 @@ public final class LinphoneUtils { //private static final String strictSipAddressRegExp = "^sip:(\\+)?[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\\.-][a-z0-9]+)*)+\\.[a-z]{2,}$"; public static boolean isSipAddress(String numberOrAddress) { - try { - LinphoneCoreFactory.instance().createLinphoneAddress(numberOrAddress); - return true; - } catch (LinphoneCoreException e) { - return false; - } + Factory.instance().createAddress(numberOrAddress); + return true; } public static boolean isNumberAddress(String numberOrAddress) { - LinphoneProxyConfig proxy = LinphoneManager.getLc().createProxyConfig(); + ProxyConfig proxy = LinphoneManager.getLc().createProxyConfig(); return proxy.normalizePhoneNumber(numberOrAddress) != null; } @@ -122,21 +118,17 @@ public final class LinphoneUtils { } public static String getAddressDisplayName(String uri){ - LinphoneAddress lAddress; - try { - lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(uri); - return getAddressDisplayName(lAddress); - } catch (LinphoneCoreException e) { - return null; - } + Address lAddress; + lAddress = Factory.instance().createAddress(uri); + return getAddressDisplayName(lAddress); } - public static String getAddressDisplayName(LinphoneAddress address){ + public static String getAddressDisplayName(Address address){ if(address.getDisplayName() != null) { return address.getDisplayName(); } else { - if(address.getUserName() != null){ - return address.getUserName(); + if(address.getUsername() != null){ + return address.getUsername(); } else { return address.asStringUriOnly(); } @@ -289,33 +281,33 @@ public final class LinphoneUtils { } } - public static final List getLinphoneCallsNotInConf(LinphoneCore lc) { - List l=new ArrayList(); - for(LinphoneCall c : lc.getCalls()){ - if (!c.isInConference()){ + public static final List getCallsNotInConf(Core lc) { + List l=new ArrayList(); + for(Call c : lc.getCalls()){ + if (!(c.getConference() != null)){ l.add(c); } } return l; } - public static final List getLinphoneCallsInConf(LinphoneCore lc) { - List l=new ArrayList(); - for(LinphoneCall c : lc.getCalls()){ - if (c.isInConference()){ + public static final List getCallsInConf(Core lc) { + List l=new ArrayList(); + for(Call c : lc.getCalls()){ + if ((c.getConference() != null)){ l.add(c); } } return l; } - public static final List getLinphoneCalls(LinphoneCore lc) { + public static final List getCalls(Core lc) { // return a modifiable list - return new ArrayList(Arrays.asList(lc.getCalls())); + return new ArrayList(Arrays.asList(lc.getCalls())); } - public static final boolean hasExistingResumeableCall(LinphoneCore lc) { - for (LinphoneCall c : getLinphoneCalls(lc)) { + public static final boolean hasExistingResumeableCall(Core lc) { + for (Call c : getCalls(lc)) { if (c.getState() == State.Paused) { return true; } @@ -323,32 +315,32 @@ public final class LinphoneUtils { return false; } - public static final List getCallsInState(LinphoneCore lc, Collection states) { - List foundCalls = new ArrayList(); - for (LinphoneCall call : getLinphoneCalls(lc)) { + public static final List getCallsInState(Core lc, Collection states) { + List foundCalls = new ArrayList(); + for (Call call : getCalls(lc)) { if (states.contains(call.getState())) { foundCalls.add(call); } } return foundCalls; } - public static final List getRunningOrPausedCalls(LinphoneCore lc) { + public static final List getRunningOrPausedCalls(Core lc) { return getCallsInState(lc, Arrays.asList( State.Paused, State.PausedByRemote, State.StreamsRunning)); } - public static final int countConferenceCalls(LinphoneCore lc) { + public static final int countConferenceCalls(Core lc) { int count = lc.getConferenceSize(); - if (lc.isInConference()) count--; + if ((lc.getConference() != null)) count--; return count; } - public static int countVirtualCalls(LinphoneCore lc) { + public static int countVirtualCalls(Core lc) { return lc.getCallsNb() - countConferenceCalls(lc); } - public static int countNonConferenceCalls(LinphoneCore lc) { + public static int countNonConferenceCalls(Core lc) { return lc.getCallsNb() - countConferenceCalls(lc); } @@ -368,32 +360,32 @@ public final class LinphoneUtils { return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, (float) pixels, res.getDisplayMetrics()); } - public static boolean isCallRunning(LinphoneCall call) + public static boolean isCallRunning(Call call) { if (call == null) { return false; } - LinphoneCall.State state = call.getState(); + Call.State state = call.getState(); - return state == LinphoneCall.State.Connected || - state == LinphoneCall.State.CallUpdating || - state == LinphoneCall.State.CallUpdatedByRemote || - state == LinphoneCall.State.StreamsRunning || - state == LinphoneCall.State.Resuming; + return state == Call.State.Connected || + state == Call.State.Updating || + state == Call.State.UpdatedByRemote || + state == Call.State.StreamsRunning || + state == Call.State.Resuming; } - public static boolean isCallEstablished(LinphoneCall call) { + public static boolean isCallEstablished(Call call) { if (call == null) { return false; } - LinphoneCall.State state = call.getState(); + Call.State state = call.getState(); return isCallRunning(call) || - state == LinphoneCall.State.Paused || - state == LinphoneCall.State.PausedByRemote || - state == LinphoneCall.State.Pausing; + state == Call.State.Paused || + state == Call.State.PausedByRemote || + state == Call.State.Pausing; } public static boolean isHighBandwidthConnection(Context context){ @@ -523,7 +515,7 @@ public final class LinphoneUtils { public static String getDisplayableUsernameFromAddress(String sipAddress) { String username = sipAddress; - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc == null) return username; if (username.startsWith("sip:")) { @@ -532,7 +524,7 @@ public final class LinphoneUtils { if (username.contains("@")) { String domain = username.split("@")[1]; - LinphoneProxyConfig lpc = lc.getDefaultProxyConfig(); + ProxyConfig lpc = lc.getDefaultProxyConfig(); if (lpc != null) { if (domain.equals(lpc.getDomain())) { return username.split("@")[0]; @@ -548,7 +540,7 @@ public final class LinphoneUtils { public static String getFullAddressFromUsername(String username) { String sipAddress = username; - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc == null) return sipAddress; if (!sipAddress.startsWith("sip:")) { @@ -556,7 +548,7 @@ public final class LinphoneUtils { } if (!sipAddress.contains("@")) { - LinphoneProxyConfig lpc = lc.getDefaultProxyConfig(); + ProxyConfig lpc = lc.getDefaultProxyConfig(); if (lpc != null) { sipAddress = sipAddress + "@" + lpc.getDomain(); } else { @@ -566,9 +558,9 @@ public final class LinphoneUtils { return sipAddress; } - public static void storeImage(Context context, LinphoneChatMessage msg) { - if (msg == null || msg.getFileTransferInformation() == null || msg.getAppData() == null) return; - File file = new File(Environment.getExternalStorageDirectory(), msg.getAppData()); + public static void storeImage(Context context, ChatMessage msg) { + if (msg == null || msg.getFileTransferInformation() == null || msg.getAppdata() == null) return; + File file = new File(Environment.getExternalStorageDirectory(), msg.getAppdata()); Bitmap bm = BitmapFactory.decodeFile(file.getPath()); if (bm == null) return; @@ -592,7 +584,7 @@ public final class LinphoneUtils { file.delete(); bm.recycle(); - msg.setAppData(path.toString()); + msg.setAppdata(path.toString()); } catch (FileNotFoundException e) { Log.e(e); } catch (IOException e) { @@ -619,83 +611,83 @@ public final class LinphoneUtils { public static String errorForPhoneNumberStatus(int status) { Context ctxt = getContext(); if (ctxt != null) { - if (LinphoneAccountCreator.PhoneNumberCheck.CountryCodeInvalid.value() - == (status & LinphoneAccountCreator.PhoneNumberCheck.CountryCodeInvalid.value())) + if (AccountCreator.PhoneNumberStatus.InvalidCountryCode.toInt() + == (status & AccountCreator.PhoneNumberStatus.InvalidCountryCode.toInt())) return ctxt.getString(R.string.country_code_invalid); - if (LinphoneAccountCreator.PhoneNumberCheck.TooShort.value() - == (status & LinphoneAccountCreator.PhoneNumberCheck.TooShort.value())) + if (AccountCreator.PhoneNumberStatus.TooShort.toInt() + == (status & AccountCreator.PhoneNumberStatus.TooShort.toInt())) return ctxt.getString(R.string.phone_number_too_short); - if (LinphoneAccountCreator.PhoneNumberCheck.TooLong.value() - == (status & LinphoneAccountCreator.PhoneNumberCheck.TooLong.value())) + if (AccountCreator.PhoneNumberStatus.TooLong.toInt() + == (status & AccountCreator.PhoneNumberStatus.TooLong.toInt())) return ctxt.getString(R.string.phone_number_too_long); - if (LinphoneAccountCreator.PhoneNumberCheck.Invalid.value() - == (status & LinphoneAccountCreator.PhoneNumberCheck.Invalid.value())) + if (AccountCreator.PhoneNumberStatus.Invalid.toInt() + == (status & AccountCreator.PhoneNumberStatus.Invalid.toInt())) return ctxt.getString(R.string.phone_number_invalid); } return null; } - public static String errorForEmailStatus(LinphoneAccountCreator.EmailCheck status) { + public static String errorForEmailStatus(AccountCreator.EmailStatus status) { Context ctxt = getContext(); if (ctxt != null) { - if (status.equals(LinphoneAccountCreator.EmailCheck.InvalidCharacters) - || status.equals(LinphoneAccountCreator.EmailCheck.Malformed)) + if (status.equals(AccountCreator.EmailStatus.InvalidCharacters) + || status.equals(AccountCreator.EmailStatus.Malformed)) return ctxt.getString(R.string.invalid_email); } return null; } - public static String errorForUsernameStatus(LinphoneAccountCreator.UsernameCheck status) { + public static String errorForUsernameStatus(AccountCreator.UsernameStatus status) { Context ctxt = getContext(); if (ctxt != null) { - if (status.equals(LinphoneAccountCreator.UsernameCheck.InvalidCharacters)) + if (status.equals(AccountCreator.UsernameStatus.InvalidCharacters)) return ctxt.getString(R.string.invalid_username); - if (status.equals(LinphoneAccountCreator.UsernameCheck.TooShort)) + if (status.equals(AccountCreator.UsernameStatus.TooShort)) return ctxt.getString(R.string.username_too_short); - if (status.equals(LinphoneAccountCreator.UsernameCheck.TooLong)) + if (status.equals(AccountCreator.UsernameStatus.TooLong)) return ctxt.getString(R.string.username_too_long); - if (status.equals(LinphoneAccountCreator.UsernameCheck.Invalid)) + if (status.equals(AccountCreator.UsernameStatus.Invalid)) return ctxt.getString(R.string.username_invalid_size); - if (status.equals(LinphoneAccountCreator.UsernameCheck.InvalidCharacters)) + if (status.equals(AccountCreator.UsernameStatus.InvalidCharacters)) return ctxt.getString(R.string.invalid_display_name); } return null; } - public static String errorForPasswordStatus(LinphoneAccountCreator.PasswordCheck status) { + public static String errorForPasswordStatus(AccountCreator.PasswordStatus status) { Context ctxt = getContext(); if (ctxt != null) { - if (status.equals(LinphoneAccountCreator.PasswordCheck.TooShort)) + if (status.equals(AccountCreator.PasswordStatus.TooShort)) return ctxt.getString(R.string.password_too_short); - if (status.equals(LinphoneAccountCreator.PasswordCheck.TooLong)) + if (status.equals(AccountCreator.PasswordStatus.TooLong)) return ctxt.getString(R.string.password_too_long); } return null; } - public static String errorForRequestStatus(LinphoneAccountCreator.RequestStatus status) { + public static String errorForStatus(AccountCreator.Status status) { Context ctxt = getContext(); if (ctxt != null) { - if (status.equals(LinphoneAccountCreator.RequestStatus.Failed)) + if (status.equals(AccountCreator.Status.RequestFailed)) return ctxt.getString(R.string.request_failed); - if (status.equals(LinphoneAccountCreator.RequestStatus.ErrorServer)) + if (status.equals(AccountCreator.Status.ServerError)) return ctxt.getString(R.string.wizard_failed); - if (status.equals(LinphoneAccountCreator.RequestStatus.AccountExist) - || status.equals(LinphoneAccountCreator.RequestStatus.AccountExistWithAlias)) + if (status.equals(AccountCreator.Status.AccountExist) + || status.equals(AccountCreator.Status.AccountExistWithAlias)) return ctxt.getString(R.string.account_already_exist); - if (status.equals(LinphoneAccountCreator.RequestStatus.AliasIsAccount) - || status.equals(LinphoneAccountCreator.RequestStatus.AliasExist)) + if (status.equals(AccountCreator.Status.AliasIsAccount) + || status.equals(AccountCreator.Status.AliasExist)) return ctxt.getString(R.string.assistant_phone_number_unavailable); - if (status.equals(LinphoneAccountCreator.RequestStatus.AccountNotExist)) + if (status.equals(AccountCreator.Status.AccountNotExist)) return ctxt.getString(R.string.assistant_error_bad_credentials); - if (status.equals(LinphoneAccountCreator.RequestStatus.AliasNotExist)) + if (status.equals(AccountCreator.Status.AliasNotExist)) return ctxt.getString(R.string.phone_number_not_exist); - if (status.equals(LinphoneAccountCreator.RequestStatus.AliasNotExist) - || status.equals(LinphoneAccountCreator.RequestStatus.AccountNotActivated) - || status.equals(LinphoneAccountCreator.RequestStatus.AccountAlreadyActivated) - || status.equals(LinphoneAccountCreator.RequestStatus.AccountActivated) - || status.equals(LinphoneAccountCreator.RequestStatus.AccountNotCreated) - || status.equals(LinphoneAccountCreator.RequestStatus.Ok)) + if (status.equals(AccountCreator.Status.AliasNotExist) + || status.equals(AccountCreator.Status.AccountNotActivated) + || status.equals(AccountCreator.Status.AccountAlreadyActivated) + || status.equals(AccountCreator.Status.AccountActivated) + || status.equals(AccountCreator.Status.AccountNotCreated) + || status.equals(AccountCreator.Status.RequestOk)) return ""; } return null; @@ -714,8 +706,8 @@ public final class LinphoneUtils { public static void setCountry(DialPlan c, EditText dialCode, Button selectCountry, int countryCode) { if( c != null && dialCode != null && selectCountry != null) { - dialCode.setText(c.getCountryCode()); - selectCountry.setText(c.getCountryName()); + dialCode.setText(c.getCountryCallingCode()); + selectCountry.setText(c.getCountry()); } else { if(countryCode != -1){ dialCode.setText("+" + countryCode); @@ -798,7 +790,7 @@ public final class LinphoneUtils { } } - public static String getTimestamp() { + public static String getStartDate() { try { return new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.ROOT).format(new Date()); } catch (RuntimeException e) { @@ -808,7 +800,7 @@ public final class LinphoneUtils { public static File createFile(Context context, String imageFileName, String type) throws IOException { if (TextUtils.isEmpty(imageFileName)) - imageFileName = getTimestamp()+"."+type; // make random filename if you want. + imageFileName = getStartDate()+"."+type; // make random filename if you want. final File root; imageFileName = imageFileName; diff --git a/src/android/org/linphone/PreferencesMigrator.java b/src/android/org/linphone/PreferencesMigrator.java index cc42dee3a..507b6fa88 100644 --- a/src/android/org/linphone/PreferencesMigrator.java +++ b/src/android/org/linphone/PreferencesMigrator.java @@ -20,10 +20,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import org.linphone.LinphonePreferences.AccountBuilder; -import org.linphone.core.LinphoneCore; -import org.linphone.core.LinphoneCoreException; -import org.linphone.core.LinphoneProxyConfig; -import org.linphone.core.LpConfig; +import org.linphone.core.Core; +import org.linphone.core.CoreException; +import org.linphone.core.ProxyConfig; +import org.linphone.core.Config; import org.linphone.mediastream.Log; import android.content.Context; @@ -44,7 +44,7 @@ public class PreferencesMigrator { } public boolean isEchoMigratioNeeded() { - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc == null) { return false; } @@ -53,7 +53,7 @@ public class PreferencesMigrator { return false; } - return (!lc.needsEchoCalibration() && mNewPrefs.isEchoCancellationEnabled()); + return (!lc.isEchoCancellerCalibrationRequired() && mNewPrefs.echoCancellationEnabled()); } public boolean isMigrationNeeded() { @@ -99,9 +99,9 @@ public class PreferencesMigrator { } private void doAccountsMigration() { - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); - lc.clearAuthInfos(); - lc.clearProxyConfigs(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + lc.clearAllAuthInfo(); + lc.clearProxyConfig(); for (int i = 0; i < mOldPrefs.getInt(getString(R.string.pref_extra_accounts), 1); i++) { doAccountMigration(i, i == getPrefInt(R.string.pref_default_account_key, 0)); @@ -121,10 +121,10 @@ public class PreferencesMigrator { AccountBuilder builder = new AccountBuilder(LinphoneManager.getLc()) .setUsername(username) - .setUserId(userid) + .setUserid(userid) .setDomain(domain) .setPassword(password) - .setProxy(proxy) + .setServerAddr(proxy) .setExpires(expire); if (getPrefBoolean(getString(R.string.pref_enable_outbound_proxy_key) + key, false)) { @@ -141,7 +141,7 @@ public class PreferencesMigrator { try { builder.saveNewAccount(); - } catch (LinphoneCoreException e) { + } catch (CoreException e) { Log.e(e); } @@ -152,10 +152,10 @@ public class PreferencesMigrator { } public void doPresenceMigrationIfNeeded() { - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); - LpConfig cfg = lc.getConfig(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Config cfg = lc.getConfig(); if (cfg.getString("app", "friendlist_subscription_enabled", null) == null){ - LinphoneProxyConfig proxy = lc.getDefaultProxyConfig(); + ProxyConfig proxy = lc.getDefaultProxyConfig(); if (proxy != null) { String domain = proxy.getDomain(); if (domain!=null && domain.equals(getString(R.string.default_domain))) { diff --git a/src/android/org/linphone/SettingsFragment.java b/src/android/org/linphone/SettingsFragment.java index 55a86fb94..368dc1c59 100644 --- a/src/android/org/linphone/SettingsFragment.java +++ b/src/android/org/linphone/SettingsFragment.java @@ -23,19 +23,21 @@ import java.io.File; import java.util.ArrayList; import java.util.List; -import org.linphone.core.LinphoneAddress; -import org.linphone.core.LinphoneCore; -import org.linphone.core.LinphoneCore.EcCalibratorStatus; -import org.linphone.core.LinphoneCore.LinphoneLimeState; -import org.linphone.core.LinphoneCore.MediaEncryption; -import org.linphone.core.LinphoneCoreException; -import org.linphone.core.LinphoneCoreListenerBase; -import org.linphone.core.LinphoneProxyConfig; +import org.linphone.core.Address; +import org.linphone.core.Core; +import org.linphone.core.Core.EcCalibratorStatus; +import org.linphone.core.Core.LimeState; +import org.linphone.core.Core.MediaEncryption; +import org.linphone.core.CoreException; +import org.linphone.core.CoreListenerStub; +import org.linphone.core.Factory; +import org.linphone.core.ProxyConfig; import org.linphone.core.PayloadType; +import org.linphone.core.VideoDefinition; import org.linphone.mediastream.Log; import org.linphone.mediastream.Version; import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration; -import org.linphone.tools.OpenH264DownloadHelper; +import org.linphone.core.tools.OpenH264DownloadHelper; import org.linphone.ui.LedPreference; import org.linphone.ui.PreferencesListFragment; @@ -64,7 +66,7 @@ import android.provider.Settings; public class SettingsFragment extends PreferencesListFragment { private LinphonePreferences mPrefs; private Handler mHandler = new Handler(); - private LinphoneCoreListenerBase mListener; + private CoreListenerStub mListener; private PreferenceScreen currentPreferenceScreen; private Preference.OnPreferenceClickListener prefClickListener = new Preference.OnPreferenceClickListener() { @Override @@ -92,9 +94,9 @@ public class SettingsFragment extends PreferencesListFragment { mPrefs = LinphonePreferences.instance(); removePreviousPreferencesFile(); // Required when updating the preferences order - mListener = new LinphoneCoreListenerBase() { + mListener = new CoreListenerStub() { @Override - public void ecCalibrationStatus(LinphoneCore lc, final EcCalibratorStatus status, final int delayMs, Object data) { + public void onEcCalibrationResult(Core lc, Core.EcCalibratorStatus status, int delayMs) { LinphoneManager.getInstance().routeAudioToReceiver(); CheckBoxPreference echoCancellation = (CheckBoxPreference) findPreference(getString(R.string.pref_echo_cancellation_key)); @@ -107,7 +109,7 @@ public class SettingsFragment extends PreferencesListFragment { ((AudioManager)getActivity().getSystemService(Context.AUDIO_SERVICE)).setMode(AudioManager.MODE_NORMAL); Log.i("Set audio mode on 'Normal'"); } else if (status == EcCalibratorStatus.Done) { - echoCancellerCalibration.setSummary(String.format(getString(R.string.ec_calibrated), delayMs)); + echoCancellerCalibration.setSummary(String.format(getString(R.string.ec_calibrated), String.valueOf(delayMs))); echoCancellation.setChecked(true); LinphonePreferences.instance().setEchoCancellation(true); ((AudioManager)getActivity().getSystemService(Context.AUDIO_SERVICE)).setMode(AudioManager.MODE_NORMAL); @@ -194,7 +196,7 @@ public class SettingsFragment extends PreferencesListFragment { hidePreference(R.string.pref_push_notification_key); } - if (!Version.isVideoCapable() || !LinphoneManager.getLcIfManagerNotDestroyedOrNull().isVideoSupported()) { + if (!Version.isVideoCapable() || !LinphoneManager.getLcIfManagerNotDestroyedOrNull().videoSupported()) { emptyAndHidePreference(R.string.pref_video_key); } else { if (!AndroidCameraConfiguration.hasFrontCamera()) { @@ -202,7 +204,7 @@ public class SettingsFragment extends PreferencesListFragment { } } - if (!LinphoneManager.getLc().isTunnelAvailable()) { + if (!LinphoneManager.getLc().tunnelAvailable()) { emptyAndHidePreference(R.string.pref_tunnel_key); } @@ -276,20 +278,20 @@ public class SettingsFragment extends PreferencesListFragment { } private void initTunnelSettings() { - if (!LinphoneManager.isInstanciated() || !LinphoneManager.getLc().isTunnelAvailable()) { + if (!LinphoneManager.isInstanciated() || !LinphoneManager.getLc().tunnelAvailable()) { return; } - setPreferenceDefaultValueAndSummary(R.string.pref_tunnel_host_key, mPrefs.getTunnelHost()); + /*setPreferenceDefaultValueAndSummary(R.string.pref_tunnel_host_key, mPrefs.getTunnelHost()); setPreferenceDefaultValueAndSummary(R.string.pref_tunnel_port_key, String.valueOf(mPrefs.getTunnelPort())); ListPreference tunnelModePref = (ListPreference) findPreference(getString(R.string.pref_tunnel_mode_key)); String tunnelMode = mPrefs.getTunnelMode(); tunnelModePref.setSummary(tunnelMode); - tunnelModePref.setValue(tunnelMode); + tunnelModePref.setValue(tunnelMode);*/ } private void setTunnelPreferencesListener() { - findPreference(getString(R.string.pref_tunnel_host_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() { + /*findPreference(getString(R.string.pref_tunnel_host_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { String host = newValue.toString(); @@ -319,7 +321,7 @@ public class SettingsFragment extends PreferencesListFragment { preference.setSummary(mode); return true; } - }); + });*/ } private void initAccounts() { @@ -366,14 +368,14 @@ public class SettingsFragment extends PreferencesListFragment { } if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) { - for (LinphoneProxyConfig lpc : LinphoneManager.getLc().getProxyConfigList()) { - LinphoneAddress addr = lpc.getAddress(); - if (addr.getUserName().equals(username) && addr.getDomain().equals(domain)) { - if (lpc.getState() == LinphoneCore.RegistrationState.RegistrationOk) { + for (ProxyConfig lpc : LinphoneManager.getLc().getProxyConfigList()) { + Address addr = lpc.getIdentityAddress(); + if (addr.getUsername().equals(username) && addr.getDomain().equals(domain)) { + if (lpc.getState() == Core.RegistrationState.Ok) { me.setLed(R.drawable.led_connected); - } else if (lpc.getState() == LinphoneCore.RegistrationState.RegistrationFailed) { + } else if (lpc.getState() == Core.RegistrationState.Failed) { me.setLed(R.drawable.led_error); - } else if (lpc.getState() == LinphoneCore.RegistrationState.RegistrationProgress) { + } else if (lpc.getState() == Core.RegistrationState.Progress) { me.setLed(R.drawable.led_inprogress); mHandler.postDelayed(new Runnable() { @Override @@ -396,7 +398,7 @@ public class SettingsFragment extends PreferencesListFragment { entries.add(getString(R.string.pref_none)); values.add(getString(R.string.pref_media_encryption_key_none)); - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc == null || getResources().getBoolean(R.bool.disable_all_security_features_for_markets)) { setListPreferenceValues(pref, entries, values); return; @@ -441,9 +443,9 @@ public class SettingsFragment extends PreferencesListFragment { private void initializePreferredVideoSizePreferences(ListPreference pref) { List entries = new ArrayList(); List values = new ArrayList(); - for (String name : LinphoneManager.getLc().getSupportedVideoSizes()) { - entries.add(name); - values.add(name); + for (VideoDefinition vd : Factory.instance().getSupportedVideoDefinitions()) { + entries.add(vd.getName()); + values.add(vd.getName()); } setListPreferenceValues(pref, entries, values); @@ -476,27 +478,27 @@ public class SettingsFragment extends PreferencesListFragment { List entries = new ArrayList(); List values = new ArrayList(); entries.add(getString(R.string.lime_encryption_entry_disabled)); - values.add(LinphoneLimeState.Disabled.toString()); + values.add(LimeState.Disabled.toString()); - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); - if (lc == null || !lc.isLimeEncryptionAvailable()) { + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + if (lc == null || !lc.limeAvailable()) { setListPreferenceValues(pref, entries, values); pref.setEnabled(false); return; } entries.add(getString(R.string.lime_encryption_entry_mandatory)); - values.add(LinphoneLimeState.Mandatory.toString()); + values.add(LimeState.Mandatory.toString()); entries.add(getString(R.string.lime_encryption_entry_preferred)); - values.add(LinphoneLimeState.Preferred.toString()); + values.add(LimeState.Preferred.toString()); setListPreferenceValues(pref, entries, values); - LinphoneLimeState lime = mPrefs.getLimeEncryption(); - if (lime == LinphoneLimeState.Disabled) { + LimeState lime = mPrefs.limeEnabled(); + if (lime == LimeState.Disabled) { pref.setSummary(getString(R.string.lime_encryption_entry_disabled)); - } else if (lime == LinphoneLimeState.Mandatory) { + } else if (lime == LimeState.Mandatory) { pref.setSummary(getString(R.string.lime_encryption_entry_mandatory)); - } else if (lime == LinphoneLimeState.Preferred) { + } else if (lime == LimeState.Preferred) { pref.setSummary(getString(R.string.lime_encryption_entry_preferred)); } pref.setValue(lime.toString()); @@ -515,37 +517,29 @@ public class SettingsFragment extends PreferencesListFragment { PreferenceCategory codecs = (PreferenceCategory) findPreference(getString(R.string.pref_codecs_key)); codecs.removeAll(); - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); - for (final PayloadType pt : lc.getAudioCodecs()) { + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + for (final PayloadType pt : lc.getAudioPayloadTypes()) { CheckBoxPreference codec = new CheckBoxPreference(getActivity()); - codec.setTitle(pt.getMime()); + codec.setTitle(pt.getMimeType()); /* Special case */ - if (pt.getMime().equals("mpeg4-generic")) { + if (pt.getMimeType().equals("mpeg4-generic")) { if (android.os.Build.VERSION.SDK_INT < 16) { /* Make sure AAC is disabled */ - try { - lc.enablePayloadType(pt, false); - } catch (LinphoneCoreException e) { - Log.e(e); - } + pt.enable(false); continue; } else { codec.setTitle("AAC-ELD"); } } - codec.setSummary(pt.getRate() + " Hz"); - codec.setChecked(lc.isPayloadTypeEnabled(pt)); + codec.setSummary(pt.getClockRate() + " Hz"); + codec.setChecked(pt.enabled()); codec.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { boolean enable = (Boolean) newValue; - try { - LinphoneManager.getLcIfManagerNotDestroyedOrNull().enablePayloadType(pt, enable); - } catch (LinphoneCoreException e) { - Log.e(e); - } + pt.enable(enable); return true; } }); @@ -554,15 +548,15 @@ public class SettingsFragment extends PreferencesListFragment { } CheckBoxPreference echoCancellation = (CheckBoxPreference) findPreference(getString(R.string.pref_echo_cancellation_key)); - echoCancellation.setChecked(mPrefs.isEchoCancellationEnabled()); + echoCancellation.setChecked(mPrefs.echoCancellationEnabled()); - if (mPrefs.isEchoCancellationEnabled()) { + if (mPrefs.echoCancellationEnabled()) { Preference echoCalibration = findPreference(getString(R.string.pref_echo_canceller_calibration_key)); - echoCalibration.setSummary(String.format(getString(R.string.ec_calibrated), mPrefs.getEchoCalibration())); + echoCalibration.setSummary(String.format(getString(R.string.ec_calibrated), String.valueOf(mPrefs.getEchoCalibration()))); } CheckBoxPreference adaptiveRateControl = (CheckBoxPreference) findPreference(getString(R.string.pref_adaptive_rate_control_key)); - adaptiveRateControl.setChecked(mPrefs.isAdaptiveRateControlEnabled()); + adaptiveRateControl.setChecked(mPrefs.adaptiveRateControlEnabled()); ListPreference bitrateLimit = (ListPreference) findPreference(getString(R.string.pref_codec_bitrate_limit_key)); bitrateLimit.setSummary(String.valueOf(mPrefs.getCodecBitrateLimit())); @@ -592,12 +586,12 @@ public class SettingsFragment extends PreferencesListFragment { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { mPrefs.setCodecBitrateLimit(Integer.parseInt(newValue.toString())); - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); int bitrate = Integer.parseInt(newValue.toString()); - for (final PayloadType pt : lc.getAudioCodecs()) { - if (lc.payloadTypeIsVbr(pt)) { - lc.setPayloadTypeBitrate(pt, bitrate); + for (final PayloadType pt : lc.getAudioPayloadTypes()) { + if (pt.isVbr()) { + pt.setNormalBitrate(bitrate); } } @@ -648,7 +642,7 @@ public class SettingsFragment extends PreferencesListFragment { if (LinphoneManager.getInstance().startEchoTester() > 0) { preference.setSummary("Is running"); } - } catch (LinphoneCoreException e) { + } catch (CoreException e) { e.printStackTrace(); } } @@ -659,7 +653,7 @@ public class SettingsFragment extends PreferencesListFragment { if (LinphoneManager.getInstance().stopEchoTester() > 0) { preference.setSummary("Is stopped"); } - } catch (LinphoneCoreException e) { + } catch (CoreException e) { e.printStackTrace(); } } @@ -669,7 +663,7 @@ public class SettingsFragment extends PreferencesListFragment { if (LinphoneManager.getInstance().getEchoTesterStatus()) stopEchoTester(); LinphoneManager.getInstance().startEcCalibration(mListener); - } catch (LinphoneCoreException e) { + } catch (CoreException e) { Log.e(e); } } @@ -694,19 +688,19 @@ public class SettingsFragment extends PreferencesListFragment { PreferenceCategory codecs = (PreferenceCategory) findPreference(getString(R.string.pref_video_codecs_key)); codecs.removeAll(); - final LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + final Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); final OpenH264DownloadHelper mCodecDownloader = LinphoneManager.getInstance().getOpenH264DownloadHelper(); - for (final PayloadType pt : lc.getVideoCodecs()) { + for (final PayloadType pt : lc.getVideoPayloadTypes()) { final CheckBoxPreference codec = new CheckBoxPreference(getActivity()); - codec.setTitle(pt.getMime()); + codec.setTitle(pt.getMimeType()); - if (!pt.getMime().equals("VP8")) { + if (!pt.getMimeType().equals("VP8")) { if (getResources().getBoolean(R.bool.disable_all_patented_codecs_for_markets)) { continue; } else { - if (!Version.hasFastCpuWithAsmOptim() && pt.getMime().equals("H264")) + if (!Version.hasFastCpuWithAsmOptim() && pt.getMimeType().equals("H264")) { // Android without neon doesn't support H264 Log.w("CPU does not have asm optimisations available, disabling H264"); @@ -714,49 +708,45 @@ public class SettingsFragment extends PreferencesListFragment { } } } - if (lc.downloadOpenH264Enabled()) { - if (pt.getMime().equals("H264") && mCodecDownloader.isCodecFound()) { + if (OpenH264DownloadHelper.isOpenH264DownloadEnabled()) { + if (pt.getMimeType().equals("H264") && mCodecDownloader.isCodecFound()) { codec.setSummary(mCodecDownloader.getLicenseMessage()); codec.setTitle("OpenH264"); } } - codec.setChecked(lc.isPayloadTypeEnabled(pt)); + codec.setChecked(pt.enabled()); codec.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { boolean enable = (Boolean) newValue; - try { - if (lc.downloadOpenH264Enabled()) { - if (enable && Version.getCpuAbis().contains("armeabi-v7a") && !Version.getCpuAbis().contains("x86") - && pt.getMime().equals("H264") && !mCodecDownloader.isCodecFound()) { - mCodecDownloader.setOpenH264HelperListener(LinphoneManager.getInstance().getOpenH264HelperListener()); - mCodecDownloader.setUserData(0, LinphoneManager.getInstance().getContext()); - mCodecDownloader.setUserData(1, codec); + if (OpenH264DownloadHelper.isOpenH264DownloadEnabled()) { + if (enable && Version.getCpuAbis().contains("armeabi-v7a") && !Version.getCpuAbis().contains("x86") + && pt.getMimeType().equals("H264") && !mCodecDownloader.isCodecFound()) { + mCodecDownloader.setOpenH264HelperListener(LinphoneManager.getInstance().getOpenH264HelperListener()); + mCodecDownloader.setUserData(0, LinphoneManager.getInstance().getContext()); + mCodecDownloader.setUserData(1, codec); - AlertDialog.Builder builder = new AlertDialog.Builder(LinphoneManager.getInstance().getContext()); - builder.setCancelable(false); - builder.setMessage("Do you agree to download " + mCodecDownloader.getLicenseMessage()).setPositiveButton("Yes", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - if (which == DialogInterface.BUTTON_POSITIVE) - mCodecDownloader.downloadCodec(); + AlertDialog.Builder builder = new AlertDialog.Builder(LinphoneManager.getInstance().getContext()); + builder.setCancelable(false); + builder.setMessage("Do you agree to download " + mCodecDownloader.getLicenseMessage()).setPositiveButton("Yes", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + if (which == DialogInterface.BUTTON_POSITIVE) + mCodecDownloader.downloadCodec(); + } + }); + builder.setNegativeButton("No", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + if (which == DialogInterface.BUTTON_NEGATIVE) { + // Disable H264 } - }); - builder.setNegativeButton("No", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - if (which == DialogInterface.BUTTON_NEGATIVE) { - // Disable H264 - } - } - }).show(); - } + } + }).show(); } - LinphoneManager.getLcIfManagerNotDestroyedOrNull().enablePayloadType(pt, enable); - } catch (LinphoneCoreException e) { - Log.e(e); } + pt.enable(enable); return true; } }); @@ -1053,20 +1043,20 @@ public class SettingsFragment extends PreferencesListFragment { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { String value = newValue.toString(); - LinphoneLimeState lime = LinphoneLimeState.Disabled; - if (value.equals(LinphoneLimeState.Mandatory.toString())) - lime = LinphoneLimeState.Mandatory; - else if (value.equals(LinphoneLimeState.Preferred.toString())) - lime = LinphoneLimeState.Preferred; - mPrefs.setLimeEncryption(lime); + LimeState lime = LimeState.Disabled; + if (value.equals(LimeState.Mandatory.toString())) + lime = LimeState.Mandatory; + else if (value.equals(LimeState.Preferred.toString())) + lime = LimeState.Preferred; + mPrefs.enableLime(lime); - lime = mPrefs.getLimeEncryption(); - if (lime == LinphoneLimeState.Disabled) { + lime = mPrefs.limeEnabled(); + if (lime == LimeState.Disabled) { preference.setSummary(getString(R.string.lime_encryption_entry_disabled)); - } else if (lime == LinphoneLimeState.Mandatory) { + } else if (lime == LimeState.Mandatory) { setEncryptionZrtp(); preference.setSummary(getString(R.string.lime_encryption_entry_mandatory)); - } else if (lime == LinphoneLimeState.Preferred) { + } else if (lime == LimeState.Preferred) { setEncryptionZrtp(); preference.setSummary(getString(R.string.lime_encryption_entry_preferred)); } diff --git a/src/android/org/linphone/StatusFragment.java b/src/android/org/linphone/StatusFragment.java index c5845aa86..0d1df0b4e 100644 --- a/src/android/org/linphone/StatusFragment.java +++ b/src/android/org/linphone/StatusFragment.java @@ -18,15 +18,15 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import org.linphone.assistant.AssistantActivity; -import org.linphone.core.CallDirection; -import org.linphone.core.LinphoneCall; -import org.linphone.core.LinphoneContent; -import org.linphone.core.LinphoneCore; -import org.linphone.core.LinphoneCore.MediaEncryption; -import org.linphone.core.LinphoneCore.RegistrationState; -import org.linphone.core.LinphoneCoreListenerBase; -import org.linphone.core.LinphoneEvent; -import org.linphone.core.LinphoneProxyConfig; +import org.linphone.core.Call.Dir; +import org.linphone.core.Call; +import org.linphone.core.Content; +import org.linphone.core.Core; +import org.linphone.core.Core.MediaEncryption; +import org.linphone.core.Core.RegistrationState; +import org.linphone.core.CoreListenerStub; +import org.linphone.core.Event; +import org.linphone.core.ProxyConfig; import org.linphone.mediastream.Log; import android.app.Activity; @@ -54,7 +54,7 @@ public class StatusFragment extends Fragment { private ImageView statusLed, callQuality, encryption, menu, voicemail; private Runnable mCallQualityUpdater; private boolean isInCall, isAttached = false, isZrtpAsk; - private LinphoneCoreListenerBase mListener; + private CoreListenerStub mListener; private Dialog ZRTPdialog = null; private int mDisplayedQuality = -1; @@ -74,9 +74,9 @@ public class StatusFragment extends Fragment { // We create it once to not delay the first display populateSliderContent(); - mListener = new LinphoneCoreListenerBase(){ + mListener = new CoreListenerStub(){ @Override - public void registrationState(final LinphoneCore lc, final LinphoneProxyConfig proxy, final LinphoneCore.RegistrationState state, String smessage) { + public void onRegistrationStateChanged(final Core lc, final ProxyConfig proxy, final Core.RegistrationState state, String smessage) { if (!isAttached || !LinphoneService.isReady()) { return; } @@ -107,15 +107,15 @@ public class StatusFragment extends Fragment { } @Override - public void notifyReceived(LinphoneCore lc, LinphoneEvent ev, String eventName, LinphoneContent content) { + public void onNotifyReceived(Core lc, Event ev, String eventName, Content content) { if(!content.getType().equals("application")) return; if(!content.getSubtype().equals("simple-message-summary")) return; - if (content.getData() == null) return; + if (content.getSize() == 0) return; int unreadCount = -1; - String data = content.getDataAsString(); + String data = content.getStringBuffer(); String[] voiceMail = data.split("voice-message: "); final String[] intToParse = voiceMail[1].split("/",0); @@ -149,14 +149,14 @@ public class StatusFragment extends Fragment { return view; } - public void setLinphoneCoreListener() { - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + public void setCoreListener() { + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.addListener(mListener); - LinphoneProxyConfig lpc = lc.getDefaultProxyConfig(); + ProxyConfig lpc = lc.getDefaultProxyConfig(); if (lpc != null) { - mListener.registrationState(lc, lpc, lpc.getState(), null); + mListener.onRegistrationStateChanged(lc, lpc, lpc.getState(), null); } } } @@ -174,7 +174,7 @@ public class StatusFragment extends Fragment { voicemailCount.setVisibility(View.GONE); if (isInCall && isAttached) { - //LinphoneCall call = LinphoneManager.getLc().getCurrentCall(); + //Call call = LinphoneManager.getLc().getCurrentCall(); //initCallStatsRefresher(call, callStats); } else if (!isInCall) { voicemailCount.setVisibility(View.VISIBLE); @@ -198,15 +198,15 @@ public class StatusFragment extends Fragment { menu.setEnabled(enabled); } - private int getStatusIconResource(LinphoneCore.RegistrationState state, boolean isDefaultAccount) { + private int getStatusIconResource(Core.RegistrationState state, boolean isDefaultAccount) { try { - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); - boolean defaultAccountConnected = (isDefaultAccount && lc != null && lc.getDefaultProxyConfig() != null && lc.getDefaultProxyConfig().isRegistered()) || !isDefaultAccount; - if (state == RegistrationState.RegistrationOk && defaultAccountConnected) { + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + boolean defaultAccountConnected = (isDefaultAccount && lc != null && lc.getDefaultProxyConfig() != null && lc.getDefaultProxyConfig().getState() == RegistrationState.Ok) || !isDefaultAccount; + if (state == RegistrationState.Ok && defaultAccountConnected) { return R.drawable.led_connected; - } else if (state == RegistrationState.RegistrationProgress) { + } else if (state == RegistrationState.Progress) { return R.drawable.led_inprogress; - } else if (state == RegistrationState.RegistrationFailed) { + } else if (state == RegistrationState.Failed) { return R.drawable.led_error; } else { return R.drawable.led_disconnected; @@ -218,7 +218,7 @@ public class StatusFragment extends Fragment { return R.drawable.led_disconnected; } - private String getStatusIconText(LinphoneCore.RegistrationState state) { + private String getStatusIconText(Core.RegistrationState state) { Context context = getActivity(); if (!isAttached && LinphoneActivity.isInstanciated()) context = LinphoneActivity.instance(); @@ -226,11 +226,11 @@ public class StatusFragment extends Fragment { context = LinphoneService.instance(); try { - if (state == RegistrationState.RegistrationOk && LinphoneManager.getLcIfManagerNotDestroyedOrNull().getDefaultProxyConfig().isRegistered()) { + if (state == RegistrationState.Ok && LinphoneManager.getLcIfManagerNotDestroyedOrNull().getDefaultProxyConfig().getState() == RegistrationState.Ok) { return context.getString(R.string.status_connected); - } else if (state == RegistrationState.RegistrationProgress) { + } else if (state == RegistrationState.Progress) { return context.getString(R.string.status_in_progress); - } else if (state == RegistrationState.RegistrationFailed) { + } else if (state == RegistrationState.Failed) { return context.getString(R.string.status_error); } else { return context.getString(R.string.status_not_connected); @@ -246,7 +246,7 @@ public class StatusFragment extends Fragment { private void startCallQuality() { callQuality.setVisibility(View.VISIBLE); refreshHandler.postDelayed(mCallQualityUpdater = new Runnable() { - LinphoneCall mCurrentCall = LinphoneManager.getLc() + Call mCurrentCall = LinphoneManager.getLc() .getCurrentCall(); public void run() { @@ -297,19 +297,19 @@ public class StatusFragment extends Fragment { public void onResume() { super.onResume(); - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.addListener(mListener); - LinphoneProxyConfig lpc = lc.getDefaultProxyConfig(); + ProxyConfig lpc = lc.getDefaultProxyConfig(); if (lpc != null) { - mListener.registrationState(lc, lpc, lpc.getState(), null); + mListener.onRegistrationStateChanged(lc, lpc, lpc.getState(), null); } - LinphoneCall call = lc.getCurrentCall(); + Call call = lc.getCurrentCall(); if (isInCall && (call != null || lc.getConferenceSize() > 1 || lc.getCallsNb() > 0)) { if (call != null) { startCallQuality(); - refreshStatusItems(call, call.getCurrentParams().getVideoEnabled()); + refreshStatusItems(call, call.getCurrentParams().videoEnabled()); } menu.setVisibility(View.INVISIBLE); encryption.setVisibility(View.VISIBLE); @@ -334,7 +334,7 @@ public class StatusFragment extends Fragment { public void onPause() { super.onPause(); - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.removeListener(mListener); } @@ -345,7 +345,7 @@ public class StatusFragment extends Fragment { } } - public void refreshStatusItems(final LinphoneCall call, boolean isVideoEnabled) { + public void refreshStatusItems(final Call call, boolean isVideoEnabled) { if (call != null) { voicemailCount.setVisibility(View.GONE); MediaEncryption mediaEncryption = call.getCurrentParams().getMediaEncryption(); @@ -356,9 +356,9 @@ public class StatusFragment extends Fragment { //background.setVisibility(View.VISIBLE); } - if (mediaEncryption == MediaEncryption.SRTP || (mediaEncryption == MediaEncryption.ZRTP && call.isAuthenticationTokenVerified()) || mediaEncryption == MediaEncryption.DTLS) { + if (mediaEncryption == MediaEncryption.SRTP || (mediaEncryption == MediaEncryption.ZRTP && call.getAuthenticationTokenVerified()) || mediaEncryption == MediaEncryption.DTLS) { encryption.setImageResource(R.drawable.security_ok); - } else if (mediaEncryption == MediaEncryption.ZRTP && !call.isAuthenticationTokenVerified()) { + } else if (mediaEncryption == MediaEncryption.ZRTP && !call.getAuthenticationTokenVerified()) { encryption.setImageResource(R.drawable.security_pending); } else { encryption.setImageResource(R.drawable.security_ko); @@ -377,7 +377,7 @@ public class StatusFragment extends Fragment { } } - public void showZRTPDialog(final LinphoneCall call) { + public void showZRTPDialog(final Call call) { if (getActivity() == null) { Log.w("Can't display ZRTP popup, no Activity"); return; @@ -405,7 +405,7 @@ public class StatusFragment extends Fragment { String zrtpToRead, zrtpToListen; isZrtpAsk = true; - if (call.getDirection().equals(CallDirection.Incoming)) { + if (call.getDir().equals(Call.Dir.Incoming)) { zrtpToRead = token.substring(0,2); zrtpToListen = token.substring(2); } else { diff --git a/src/android/org/linphone/assistant/AssistantActivity.java b/src/android/org/linphone/assistant/AssistantActivity.java index d32ad79a2..3040b2ab9 100644 --- a/src/android/org/linphone/assistant/AssistantActivity.java +++ b/src/android/org/linphone/assistant/AssistantActivity.java @@ -32,20 +32,21 @@ import org.linphone.LinphoneService; import org.linphone.LinphoneUtils; import org.linphone.R; import org.linphone.StatusFragment; +import org.linphone.core.AccountCreatorListener; import org.linphone.core.DialPlan; -import org.linphone.core.LinphoneAccountCreator; -import org.linphone.core.LinphoneAddress; -import org.linphone.core.LinphoneAddress.TransportType; -import org.linphone.core.LinphoneAuthInfo; -import org.linphone.core.LinphoneCore; -import org.linphone.core.LinphoneCore.RegistrationState; -import org.linphone.core.LinphoneCoreException; -import org.linphone.core.LinphoneCoreFactory; -import org.linphone.core.LinphoneCoreListenerBase; -import org.linphone.core.LinphoneProxyConfig; +import org.linphone.core.AccountCreator; +import org.linphone.core.Address; +import org.linphone.core.Address.TransportType; +import org.linphone.core.AuthInfo; +import org.linphone.core.Core; +import org.linphone.core.Core.RegistrationState; +import org.linphone.core.CoreException; +import org.linphone.core.Factory; +import org.linphone.core.CoreListenerStub; +import org.linphone.core.ProxyConfig; import org.linphone.mediastream.Log; import org.linphone.mediastream.Version; -import org.linphone.tools.OpenH264DownloadHelper; +import org.linphone.core.tools.OpenH264DownloadHelper; import android.Manifest; import android.app.Activity; @@ -81,7 +82,7 @@ import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; -public class AssistantActivity extends Activity implements OnClickListener, ActivityCompat.OnRequestPermissionsResultCallback, LinphoneAccountCreator.LinphoneAccountCreatorListener { +public class AssistantActivity extends Activity implements OnClickListener, ActivityCompat.OnRequestPermissionsResultCallback, AccountCreatorListener { private static AssistantActivity instance; private ImageView back, cancel; private AssistantFragmentsEnum currentFragment; @@ -90,15 +91,15 @@ private static AssistantActivity instance; private Fragment fragment; private LinphonePreferences mPrefs; private boolean accountCreated = false, newAccount = false, isLink = false, fromPref = false; - private LinphoneCoreListenerBase mListener; - private LinphoneAddress address; + private CoreListenerStub mListener; + private Address address; private StatusFragment status; private ProgressDialog progress; private Dialog dialog; private boolean remoteProvisioningInProgress; private boolean echoCancellerAlreadyDone; private static final int PERMISSIONS_REQUEST_RECORD_AUDIO = 201; - private LinphoneAccountCreator accountCreator; + private AccountCreator accountCreator; private CountryListAdapter countryListAdapter; public DialPlan country; @@ -138,49 +139,49 @@ private static AssistantActivity instance; mPrefs = LinphonePreferences.instance(); status.enableSideMenu(false); - accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc(), LinphonePreferences.instance().getXmlrpcUrl()); + accountCreator = LinphoneManager.getLc().createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl()); accountCreator.setListener(this); countryListAdapter = new CountryListAdapter(getApplicationContext()); - mListener = new LinphoneCoreListenerBase() { + mListener = new CoreListenerStub() { @Override - public void configuringStatus(LinphoneCore lc, final LinphoneCore.RemoteProvisioningState state, String message) { + public void onConfiguringStatus(Core lc, final Core.ConfiguringState state, String message) { if (progress != null) progress.dismiss(); - if (state == LinphoneCore.RemoteProvisioningState.ConfiguringSuccessful) { + if (state == Core.ConfiguringState.Successful) { goToLinphoneActivity(); - } else if (state == LinphoneCore.RemoteProvisioningState.ConfiguringFailed) { + } else if (state == Core.ConfiguringState.Failed) { Toast.makeText(AssistantActivity.instance(), getString(R.string.remote_provisioning_failure), Toast.LENGTH_LONG).show(); } } @Override - public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, RegistrationState state, String smessage) { + public void onRegistrationStateChanged(Core lc, ProxyConfig cfg, RegistrationState state, String smessage) { if (remoteProvisioningInProgress) { if (progress != null) progress.dismiss(); - if (state == RegistrationState.RegistrationOk) { + if (state == RegistrationState.Ok) { remoteProvisioningInProgress = false; success(); } } else if (accountCreated && !newAccount){ - if (address != null && address.asString().equals(cfg.getAddress().asString()) ) { - if (state == RegistrationState.RegistrationOk) { + if (address != null && address.asString().equals(cfg.getIdentityAddress().asString()) ) { + if (state == RegistrationState.Ok) { if (progress != null) progress.dismiss(); if (getResources().getBoolean(R.bool.use_phone_number_validation) && cfg.getDomain().equals(getString(R.string.default_domain)) && LinphoneManager.getLc().getDefaultProxyConfig() != null) { - accountCreator.isAccountUsed(); + accountCreator.isAccountExist(); } else { success(); } - } else if (state == RegistrationState.RegistrationFailed) { + } else if (state == RegistrationState.Failed) { if (progress != null) progress.dismiss(); if (dialog == null || !dialog.isShowing()) { dialog = createErrorDialog(cfg, smessage); dialog.setCancelable(false); dialog.show(); } - } else if(!(state == RegistrationState.RegistrationProgress)) { + } else if(!(state == RegistrationState.Progress)) { if (progress != null) progress.dismiss(); } } @@ -194,7 +195,7 @@ private static AssistantActivity instance; protected void onResume() { super.onResume(); - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.addListener(mListener); } @@ -202,7 +203,7 @@ private static AssistantActivity instance; @Override protected void onPause() { - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.removeListener(mListener); } @@ -344,70 +345,66 @@ private static AssistantActivity instance; } } - public void configureLinphoneProxyConfig(LinphoneAccountCreator accountCreator) { - LinphoneCore lc = LinphoneManager.getLc(); - LinphoneProxyConfig proxyConfig = lc.createProxyConfig(); - LinphoneAddress addr; - LinphoneAuthInfo authInfo; + public void configureProxyConfig(AccountCreator accountCreator) { + Core lc = LinphoneManager.getLc(); + ProxyConfig proxyConfig = lc.createProxyConfig(); + Address addr; + AuthInfo authInfo; - try { - String identity = proxyConfig.getIdentity(); - if (identity == null || accountCreator.getUsername() == null) { - LinphoneUtils.displayErrorAlert(getString(R.string.error), this); - return; - } - identity = identity.replace("?", accountCreator.getUsername()); - addr = LinphoneCoreFactory.instance().createLinphoneAddress(identity); - addr.setDisplayName(accountCreator.getUsername()); - address = addr; - proxyConfig.edit(); - - - proxyConfig.setIdentity(addr.asString()); - - if (LinphonePreferences.instance() != null) - proxyConfig.setContactUriParameters(LinphonePreferences.instance().getPushNotificationRegistrationID()); - - if (accountCreator.getPhoneNumber() != null && accountCreator.getPhoneNumber().length() > 0) - proxyConfig.setDialPrefix(accountCreator.getPrefix(accountCreator.getPhoneNumber())); - - proxyConfig.done(); - - authInfo = LinphoneCoreFactory.instance().createAuthInfo( - accountCreator.getUsername(), - null, - accountCreator.getPassword(), - accountCreator.getHa1(), - proxyConfig.getRealm(), - proxyConfig.getDomain()); - - - lc.addProxyConfig(proxyConfig); - - lc.addAuthInfo(authInfo); - - lc.setDefaultProxyConfig(proxyConfig); - - if (ContactsManager.getInstance() != null) - ContactsManager.getInstance().fetchContactsAsync(); - - if (LinphonePreferences.instance() != null) - mPrefs.enabledFriendlistSubscription(getResources().getBoolean(R.bool.use_friendlist_subscription)); - - LinphoneManager.getInstance().subscribeFriendList(getResources().getBoolean(R.bool.use_friendlist_subscription)); - - if (!newAccount) { - displayRegistrationInProgressDialog(); - } - accountCreated = true; - } catch (LinphoneCoreException e) { - Log.e("Can't configure proxy config ", e); + String identity = proxyConfig.getIdentityAddress().asStringUriOnly(); + if (identity == null || accountCreator.getUsername() == null) { + LinphoneUtils.displayErrorAlert(getString(R.string.error), this); + return; } + identity = identity.replace("?", accountCreator.getUsername()); + addr = Factory.instance().createAddress(identity); + addr.setDisplayName(accountCreator.getUsername()); + address = addr; + proxyConfig.edit(); + + + proxyConfig.setIdentityAddress(addr); + + if (LinphonePreferences.instance() != null) + proxyConfig.setContactUriParameters(LinphonePreferences.instance().getPushNotificationRegistrationID()); + + if (accountCreator.getPhoneNumber() != null && accountCreator.getPhoneNumber().length() > 0) + proxyConfig.setDialPrefix(org.linphone.core.Utils.getPrefixFromE164(accountCreator.getPhoneNumber())); + + proxyConfig.done(); + + authInfo = Factory.instance().createAuthInfo( + accountCreator.getUsername(), + null, + accountCreator.getPassword(), + accountCreator.getHa1(), + proxyConfig.getRealm(), + proxyConfig.getDomain()); + + + lc.addProxyConfig(proxyConfig); + + lc.addAuthInfo(authInfo); + + lc.setDefaultProxyConfig(proxyConfig); + + if (ContactsManager.getInstance() != null) + ContactsManager.getInstance().fetchContactsAsync(); + + if (LinphonePreferences.instance() != null) + mPrefs.enabledFriendlistSubscription(getResources().getBoolean(R.bool.use_friendlist_subscription)); + + LinphoneManager.getInstance().subscribeFriendList(getResources().getBoolean(R.bool.use_friendlist_subscription)); + + if (!newAccount) { + displayRegistrationInProgressDialog(); + } + accountCreated = true; } - public void linphoneLogIn(LinphoneAccountCreator accountCreator) { - LinphoneManager.getLc().getConfig().loadXmlFile(LinphoneManager.getInstance().getmDynamicConfigFile()); - configureLinphoneProxyConfig(accountCreator); + public void linphoneLogIn(AccountCreator accountCreator) { + LinphoneManager.getLc().getConfig().loadFromXmlFile(LinphoneManager.getInstance().getmDynamicConfigFile()); + configureProxyConfig(accountCreator); } public void genericLogIn(String username, String userid, String password, String prefix, String domain, TransportType transport) { @@ -482,8 +479,8 @@ private static AssistantActivity instance; } private void launchDownloadCodec() { - if (LinphoneManager.getLc().downloadOpenH264Enabled()) { - OpenH264DownloadHelper downloadHelper = LinphoneCoreFactory.instance().createOpenH264DownloadHelper(); + if (OpenH264DownloadHelper.isOpenH264DownloadEnabled()) { + OpenH264DownloadHelper downloadHelper = Factory.instance().createOpenH264DownloadHelper(this); if (Version.getCpuAbis().contains("armeabi-v7a") && !Version.getCpuAbis().contains("x86") && !downloadHelper.isCodecFound()) { CodecDownloaderFragment codecFragment = new CodecDownloaderFragment(); changeFragment(codecFragment); @@ -503,7 +500,7 @@ private static AssistantActivity instance; public String getPhoneWithCountry() { if(country == null || phone_number == null) return ""; - String phoneNumberWithCountry = country.getCountryCode() + phone_number.replace("\\D", ""); + String phoneNumberWithCountry = country.getCountryCallingCode() + phone_number.replace("\\D", ""); return phoneNumberWithCountry; } @@ -513,17 +510,13 @@ private static AssistantActivity instance; domain = LinphoneUtils.getDisplayableUsernameFromAddress(domain); String identity = "sip:" + username + "@" + domain; - try { - address = LinphoneCoreFactory.instance().createLinphoneAddress(identity); - } catch (LinphoneCoreException e) { - Log.e(e); - } + address = Factory.instance().createAddress(identity); AccountBuilder builder = new AccountBuilder(LinphoneManager.getLc()) .setUsername(username) .setDomain(domain) .setHa1(ha1) - .setUserId(userid) + .setUserid(userid) .setPassword(password); if (prefix != null) { @@ -532,9 +525,9 @@ private static AssistantActivity instance; String forcedProxy = ""; if (!TextUtils.isEmpty(forcedProxy)) { - builder.setProxy(forcedProxy) + builder.setServerAddr(forcedProxy) .setOutboundProxyEnabled(true) - .setAvpfRRInterval(5); + .setAvpfRrInterval(5); } if (transport != null) { builder.setTransport(transport); @@ -546,7 +539,7 @@ private static AssistantActivity instance; displayRegistrationInProgressDialog(); } accountCreated = true; - } catch (LinphoneCoreException e) { + } catch (CoreException e) { Log.e(e); } } @@ -628,7 +621,7 @@ private static AssistantActivity instance; launchDownloadCodec(); } - public Dialog createErrorDialog(LinphoneProxyConfig proxy, String message){ + public Dialog createErrorDialog(ProxyConfig proxy, String message){ AlertDialog.Builder builder = new AlertDialog.Builder(this); if(message.equals("Forbidden")) { message = getString(R.string.assistant_error_bad_credentials); @@ -652,7 +645,7 @@ private static AssistantActivity instance; } public void success() { - boolean needsEchoCalibration = LinphoneManager.getLc().needsEchoCalibration(); + boolean needsEchoCalibration = LinphoneManager.getLc().isEchoCancellerCalibrationRequired(); if (needsEchoCalibration && mPrefs.isFirstLaunch()) { launchEchoCancellerCalibration(true); } else { @@ -666,13 +659,13 @@ private static AssistantActivity instance; finish(); } - public void setLinphoneCoreListener() { - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + public void setCoreListener() { + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.addListener(mListener); } if (status != null) { - status.setLinphoneCoreListener(); + status.setCoreListener(); } } @@ -692,8 +685,8 @@ private static AssistantActivity instance; } @Override - public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { - if(status.equals(LinphoneAccountCreator.RequestStatus.AccountExistWithAlias)){ + public void onIsAccountExist(AccountCreator accountCreator, AccountCreator.Status status, String resp) { + if(status.equals(AccountCreator.Status.AccountExistWithAlias)){ success(); } else { isLink = true; @@ -703,47 +696,47 @@ private static AssistantActivity instance; } @Override - public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onCreateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onActivateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onLinkAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onActivateAlias(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onIsAccountActivated(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onRecoverAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onIsAccountLinked(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onIsAliasUsed(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onUpdateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @@ -764,7 +757,7 @@ private static AssistantActivity instance; public CountryListAdapter(Context ctx) { context = ctx; - allCountries = LinphoneCoreFactory.instance().getAllDialPlan(); + allCountries = Factory.instance().getDialPlans(); filteredCountries = new ArrayList(Arrays.asList(allCountries)); } @@ -810,7 +803,7 @@ private static AssistantActivity instance; DialPlan c = filteredCountries.get(position); TextView name = (TextView) view.findViewById(R.id.country_name); - name.setText(c.getCountryName()); + name.setText(c.getCountry()); TextView dial_code = (TextView) view.findViewById(R.id.country_prefix); if (context != null) @@ -827,7 +820,7 @@ private static AssistantActivity instance; protected FilterResults performFiltering(CharSequence constraint) { ArrayList filteredCountries = new ArrayList(); for (DialPlan c : allCountries) { - if (c.getCountryName().toLowerCase().contains(constraint) + if (c.getCountry().toLowerCase().contains(constraint) || c.getCountryCallingCode().contains(constraint)) { filteredCountries.add(c); } diff --git a/src/android/org/linphone/assistant/CodecDownloaderFragment.java b/src/android/org/linphone/assistant/CodecDownloaderFragment.java index 0937347f2..e34d5a192 100644 --- a/src/android/org/linphone/assistant/CodecDownloaderFragment.java +++ b/src/android/org/linphone/assistant/CodecDownloaderFragment.java @@ -21,10 +21,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. import org.linphone.LinphoneManager; import org.linphone.R; -import org.linphone.core.LinphoneCoreException; -import org.linphone.core.OpenH264DownloadHelperListener; +import org.linphone.core.CoreException; +import org.linphone.core.tools.OpenH264DownloadHelperListener; import org.linphone.core.PayloadType; -import org.linphone.tools.OpenH264DownloadHelper; +import org.linphone.core.tools.OpenH264DownloadHelper; import android.app.Fragment; import android.os.Build; @@ -195,14 +195,14 @@ public class CodecDownloaderFragment extends Fragment { private void enabledH264(boolean enable) { PayloadType h264 = null; - for (PayloadType pt : LinphoneManager.getLc().getVideoCodecs()) { - if (pt.getMime().equals("H264")) h264 = pt; + for (PayloadType pt : LinphoneManager.getLc().getVideoPayloadTypes()) { + if (pt.getMimeType().equals("H264")) h264 = pt; } if (h264 != null) { try { LinphoneManager.getLc().enablePayloadType(h264, enable); - } catch (LinphoneCoreException e) { + } catch (CoreException e) { e.printStackTrace(); } } diff --git a/src/android/org/linphone/assistant/CreateAccountActivationFragment.java b/src/android/org/linphone/assistant/CreateAccountActivationFragment.java index 8a2a086e7..081ea93d6 100644 --- a/src/android/org/linphone/assistant/CreateAccountActivationFragment.java +++ b/src/android/org/linphone/assistant/CreateAccountActivationFragment.java @@ -30,23 +30,22 @@ import android.widget.Toast; import org.linphone.LinphoneManager; import org.linphone.LinphonePreferences; import org.linphone.R; -import org.linphone.core.LinphoneAccountCreator; -import org.linphone.core.LinphoneAccountCreator.LinphoneAccountCreatorListener; -import org.linphone.core.LinphoneCoreFactory; +import org.linphone.core.AccountCreator; +import org.linphone.core.AccountCreatorListener; +import org.linphone.core.Factory; -public class CreateAccountActivationFragment extends Fragment implements OnClickListener, LinphoneAccountCreatorListener { +public class CreateAccountActivationFragment extends Fragment implements OnClickListener, AccountCreatorListener { private String username, password; private Button checkAccount; private TextView email; - private LinphoneAccountCreator accountCreator; + private AccountCreator accountCreator; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.assistant_account_creation_email_activation, container, false); - accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc() - , LinphonePreferences.instance().getXmlrpcUrl()); + accountCreator = LinphoneManager.getLc().createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl()); accountCreator.setListener(this); username = getArguments().getString("Username"); @@ -73,33 +72,33 @@ public class CreateAccountActivationFragment extends Fragment implements OnClick } @Override - public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onIsAccountExist(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onCreateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onActivateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onLinkAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onActivateAlias(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onIsAccountActivated(AccountCreator accountCreator, AccountCreator.Status status, String resp) { if (AssistantActivity.instance() == null) { return; } - if (status.equals(LinphoneAccountCreator.RequestStatus.AccountNotActivated)) { + if (status.equals(AccountCreator.Status.AccountNotActivated)) { Toast.makeText(getActivity(), getString(R.string.assistant_account_not_validated), Toast.LENGTH_LONG).show(); - } else if (status.equals(LinphoneAccountCreator.RequestStatus.AccountActivated)) { + } else if (status.equals(AccountCreator.Status.AccountActivated)) { AssistantActivity.instance().linphoneLogIn(accountCreator); AssistantActivity.instance().isAccountVerified(username); } else { @@ -109,19 +108,19 @@ public class CreateAccountActivationFragment extends Fragment implements OnClick } @Override - public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onRecoverAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onIsAccountLinked(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onIsAliasUsed(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onUpdateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } } diff --git a/src/android/org/linphone/assistant/CreateAccountCodeActivationFragment.java b/src/android/org/linphone/assistant/CreateAccountCodeActivationFragment.java index 382494f69..dec3380c4 100644 --- a/src/android/org/linphone/assistant/CreateAccountCodeActivationFragment.java +++ b/src/android/org/linphone/assistant/CreateAccountCodeActivationFragment.java @@ -21,9 +21,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. import org.linphone.LinphoneManager; import org.linphone.LinphonePreferences; import org.linphone.R; -import org.linphone.core.LinphoneAccountCreator; -import org.linphone.core.LinphoneAccountCreator.LinphoneAccountCreatorListener; -import org.linphone.core.LinphoneCoreFactory; +import org.linphone.core.AccountCreator; +import org.linphone.core.AccountCreatorListener; +import org.linphone.core.Factory; import android.app.Fragment; import android.os.Bundle; @@ -39,7 +39,7 @@ import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; -public class CreateAccountCodeActivationFragment extends Fragment implements LinphoneAccountCreatorListener { +public class CreateAccountCodeActivationFragment extends Fragment implements AccountCreatorListener { private String username, phone, dialcode; private TextView title, phonenumber; private EditText code; @@ -47,7 +47,7 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin private int code_length, accountNumber; private ImageView back; private Button checkAccount; - private LinphoneAccountCreator accountCreator; + private AccountCreator accountCreator; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, @@ -62,7 +62,7 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin accountNumber = getArguments().getInt("AccountNumber"); code_length = LinphonePreferences.instance().getCodeLength(); - accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc(), LinphonePreferences.instance().getXmlrpcUrl()); + accountCreator = LinphoneManager.getLc().createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl()); accountCreator.setListener(this); accountCreator.setUsername(username); accountCreator.setPhoneNumber(phone, dialcode); @@ -121,7 +121,7 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin private void linkAccount(){ accountCreator.setUsername(LinphonePreferences.instance().getAccountUsername(accountNumber)); accountCreator.setHa1(LinphonePreferences.instance().getAccountHa1(accountNumber)); - accountCreator.activatePhoneNumberLink(); + accountCreator.activateAlias(); } private void activateAccount() { @@ -132,19 +132,19 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin } @Override - public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onIsAccountExist(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onCreateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onActivateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) { if (AssistantActivity.instance() == null) { return; } - if (status.equals(LinphoneAccountCreator.RequestStatus.AccountActivated)) { + if (status.equals(AccountCreator.Status.AccountActivated)) { checkAccount.setEnabled(true); if (accountCreator.getUsername() != null) { AssistantActivity.instance().linphoneLogIn(accountCreator); @@ -161,7 +161,7 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin AssistantActivity.instance().success(); } } - } else if (status.equals(LinphoneAccountCreator.RequestStatus.Failed)) { + } else if (status.equals(AccountCreator.Status.RequestFailed)) { Toast.makeText(getActivity(), getString(R.string.wizard_server_unavailable), Toast.LENGTH_LONG).show(); } else { Toast.makeText(getActivity(), getString(R.string.assistant_error_confirmation_code), Toast.LENGTH_LONG).show(); @@ -170,17 +170,17 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin } @Override - public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onLinkAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onActivateAlias(AccountCreator accountCreator, AccountCreator.Status status, String resp) { if (AssistantActivity.instance() == null) { return; } - if(status.equals(LinphoneAccountCreator.RequestStatus.AccountActivated)){ - LinphonePreferences.instance().setPrefix(accountNumber, accountCreator.getPrefix(accountCreator.getPhoneNumber())); + if(status.equals(AccountCreator.Status.AccountActivated)){ + LinphonePreferences.instance().setPrefix(accountNumber, org.linphone.core.Utils.getPrefixFromE164(accountCreator.getPhoneNumber())); LinphonePreferences.instance().setLinkPopupTime(""); AssistantActivity.instance().hideKeyboard(); AssistantActivity.instance().success(); @@ -188,26 +188,26 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin } @Override - public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onIsAccountActivated(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onRecoverAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onIsAccountLinked(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onIsAliasUsed(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onUpdateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } } diff --git a/src/android/org/linphone/assistant/CreateAccountFragment.java b/src/android/org/linphone/assistant/CreateAccountFragment.java index 592a37cd8..2c7dd3a05 100644 --- a/src/android/org/linphone/assistant/CreateAccountFragment.java +++ b/src/android/org/linphone/assistant/CreateAccountFragment.java @@ -28,11 +28,11 @@ import org.linphone.LinphonePreferences; import org.linphone.LinphoneUtils; import org.linphone.R; import org.linphone.core.DialPlan; -import org.linphone.core.LinphoneAccountCreator; -import org.linphone.core.LinphoneAccountCreator.LinphoneAccountCreatorListener; -import org.linphone.core.LinphoneAccountCreator.RequestStatus; -import org.linphone.core.LinphoneCoreFactory; -import org.linphone.core.LinphoneProxyConfig; +import org.linphone.core.AccountCreator; +import org.linphone.core.AccountCreatorListener; +import org.linphone.core.AccountCreator.Status; +import org.linphone.core.Factory; +import org.linphone.core.ProxyConfig; import android.accounts.Account; import android.accounts.AccountManager; @@ -59,7 +59,7 @@ import android.widget.LinearLayout; import android.widget.TextView; public class CreateAccountFragment extends Fragment implements CompoundButton.OnCheckedChangeListener - , OnClickListener, LinphoneAccountCreatorListener { + , OnClickListener, AccountCreatorListener { private EditText phoneNumberEdit, usernameEdit, passwordEdit, passwordConfirmEdit , emailEdit, dialCode; private TextView phoneNumberError, passwordError, passwordConfirmError @@ -76,15 +76,14 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On private int countryCode; private LinearLayout phoneNumberLayout, usernameLayout, emailLayout, passwordLayout, passwordConfirmLayout; private final Pattern UPPER_CASE_REGEX = Pattern.compile("[A-Z]"); - private LinphoneAccountCreator accountCreator; + private AccountCreator accountCreator; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.assistant_account_creation, container, false); //Initialize accountCreator - accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc() - , LinphonePreferences.instance().getXmlrpcUrl()); + accountCreator = LinphoneManager.getLc().createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl()); accountCreator.setListener(this); instruction = (TextView) view.findViewById(R.id.message_create_account); @@ -131,8 +130,8 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On (TelephonyManager) getActivity().getApplicationContext().getSystemService( Context.TELEPHONY_SERVICE); String countryIso = tm.getNetworkCountryIso(); - LinphoneProxyConfig proxyConfig = LinphoneManager.getLc().createProxyConfig(); - countryCode = proxyConfig.lookupCCCFromIso(countryIso.toUpperCase()); + ProxyConfig proxyConfig = LinphoneManager.getLc().createProxyConfig(); + countryCode = org.linphone.core.Utils.getCccFromIso(countryIso.toUpperCase()); phoneNumberLayout.setVisibility(View.VISIBLE); @@ -145,14 +144,14 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On } DialPlan c = AssistantActivity.instance().country; if (c != null) { - selectCountry.setText(c.getCountryName()); + selectCountry.setText(c.getCountry()); dialCode.setText(c.getCountryCallingCode().contains("+") ? c.getCountryCallingCode() : "+" + c.getCountryCallingCode()); } else { c = AssistantActivity.instance().getCountryListAdapter() .getCountryFromCountryCode(String.valueOf(countryCode)); if (c != null) { - selectCountry.setText(c.getCountryName()); + selectCountry.setText(c.getCountry()); dialCode.setText(c.getCountryCallingCode().contains("+") ? c.getCountryCallingCode() : "+" + c.getCountryCallingCode()); } @@ -325,9 +324,9 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On } else { if (useEmail.isChecked()) accountCreator.setPhoneNumber(null, null); if (!getResources().getBoolean(R.bool.isTablet) || getUsername().length() > 0) { - accountCreator.isAccountUsed(); + accountCreator.isAccountExist(); } else { - LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForUsernameStatus(LinphoneAccountCreator.UsernameCheck.TooShort) + LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForUsernameStatus(AccountCreator.UsernameStatus.TooShort) , AssistantActivity.instance()); createAccount.setEnabled(true); } @@ -350,9 +349,9 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On ); int status = accountCreator.setPhoneNumber( phoneNumberEdit.getText().toString(), LinphoneUtils.getCountryCode(dialCode)); - boolean isOk = status == LinphoneAccountCreator.PhoneNumberCheck.Ok.value(); + boolean isOk = status == AccountCreator.PhoneNumberStatus.Ok.toInt(); if (isOk) { - accountCreator.linkPhoneNumberWithAccount(); + accountCreator.linkAccount(); } else { createAccount.setEnabled(true); LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForPhoneNumberStatus(status), AssistantActivity.instance()); @@ -363,8 +362,8 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On private void createAccount() { if ((getResources().getBoolean(R.bool.isTablet) || !getResources().getBoolean(R.bool.use_phone_number_validation)) && useEmail.isChecked()) { - LinphoneAccountCreator.EmailCheck emailStatus; - LinphoneAccountCreator.PasswordCheck passwordStatus; + AccountCreator.EmailStatus emailStatus; + AccountCreator.PasswordStatus passwordStatus; passwordStatus = accountCreator.setPassword(passwordEdit.getText().toString()); emailStatus = accountCreator.setEmail(emailEdit.getText().toString()); @@ -395,7 +394,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On boolean isOk; phoneStatus = accountCreator.setPhoneNumber( phoneNumberEdit.getText().toString(), LinphoneUtils.getCountryCode(dialCode)); - isOk = phoneStatus == LinphoneAccountCreator.PhoneNumberCheck.Ok.value(); + isOk = phoneStatus == AccountCreator.PhoneNumberStatus.Ok.toInt(); if (!useUsername.isChecked() && accountCreator.getUsername() == null) { accountCreator.setUsername(accountCreator.getPhoneNumber()); } else { @@ -432,7 +431,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On if (!useEmail.isChecked() && getResources().getBoolean(R.bool.use_phone_number_validation)) { int status = getPhoneNumberStatus(); - boolean isOk = (status == LinphoneAccountCreator.PhoneNumberCheck.Ok.value()); + boolean isOk = (status == AccountCreator.PhoneNumberStatus.Ok.toInt()); LinphoneUtils.displayError(isOk, phoneNumberError, LinphoneUtils.errorForPhoneNumberStatus(status)); // Username or phone number @@ -441,7 +440,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On } if (!isOk) { - if (status == LinphoneAccountCreator.PhoneNumberCheck.CountryCodeInvalid.value()) { + if (status == AccountCreator.PhoneNumberStatus.InvalidCountryCode.toInt()) { dialCode.setBackgroundResource(R.drawable.resizable_textfield_error); phoneNumberEdit.setBackgroundResource(R.drawable.resizable_textfield); } else { @@ -475,7 +474,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On .getCountryFromCountryCode(dialCode.getText().toString()); if (c != null) { AssistantActivity.instance().country = c; - selectCountry.setText(c.getCountryName()); + selectCountry.setText(c.getCountry()); } else { selectCountry.setText(R.string.select_your_country); } @@ -513,8 +512,8 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On field.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable s) { emailOk = false; - LinphoneAccountCreator.EmailCheck status = accountCreator.setEmail(field.getText().toString()); - if (status.equals(LinphoneAccountCreator.EmailCheck.Ok)) { + AccountCreator.EmailStatus status = accountCreator.setEmail(field.getText().toString()); + if (status.equals(AccountCreator.EmailStatus.Ok)) { emailOk = true; LinphoneUtils.displayError(emailOk, emailError, ""); } @@ -536,7 +535,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On TextWatcher passwordListener = new TextWatcher() { public void afterTextChanged(Editable s) { passwordOk = false; - LinphoneAccountCreator.PasswordCheck status = accountCreator.setPassword(field1.getText().toString()); + AccountCreator.PasswordStatus status = accountCreator.setPassword(field1.getText().toString()); if (isPasswordCorrect(field1.getText().toString())) { passwordOk = true; LinphoneUtils.displayError(passwordOk, passwordError, ""); @@ -584,14 +583,14 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On } @Override - public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, final RequestStatus status) { - if (status.equals(RequestStatus.AccountExist) || status.equals(RequestStatus.AccountExistWithAlias)) { + public void onIsAccountExist(AccountCreator accountCreator, final Status status, String resp) { + if (status.equals(Status.AccountExist) || status.equals(Status.AccountExistWithAlias)) { if (useEmail.isChecked()) { createAccount.setEnabled(true); - LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status) + LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status) , AssistantActivity.instance()); } else { - accountCreator.isPhoneNumberUsed(); + accountCreator.isAliasUsed(); } } else { createAccount(); @@ -599,8 +598,8 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On } @Override - public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, RequestStatus status) { - if (status.equals(RequestStatus.AccountCreated)) { + public void onCreateAccount(AccountCreator accountCreator, Status status, String resp) { + if (status.equals(Status.AccountCreated)) { if (useEmail.isChecked() || !getResources().getBoolean(R.bool.use_phone_number_validation)) { AssistantActivity.instance().displayAssistantConfirm(getUsername() , passwordEdit.getText().toString(), emailEdit.getText().toString()); @@ -611,21 +610,21 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On } } else { createAccount.setEnabled(true); - LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status) + LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status) , AssistantActivity.instance()); } } @Override - public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, RequestStatus status) { + public void onActivateAccount(AccountCreator accountCreator, Status status, String resp) { } @Override - public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, RequestStatus status) { + public void onLinkAccount(AccountCreator accountCreator, Status status, String resp) { if (AssistantActivity.instance() == null) { return; } - if (status.equals(RequestStatus.Ok)) { + if (status.equals(Status.RequestOk)) { AssistantActivity.instance().displayAssistantCodeConfirm(getUsername() , phoneNumberEdit.getText().toString() , LinphoneUtils.getCountryCode(dialCode), false); @@ -633,11 +632,11 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On } @Override - public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, RequestStatus status) { + public void onActivateAlias(AccountCreator accountCreator, Status status, String resp) { if (AssistantActivity.instance() == null) { return; } - if (status.equals(RequestStatus.Ok)) { + if (status.equals(Status.RequestOk)) { AssistantActivity.instance().displayAssistantCodeConfirm(getUsername() , phoneNumberEdit.getText().toString() , LinphoneUtils.getCountryCode(dialCode), false); @@ -645,30 +644,30 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On } @Override - public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, RequestStatus status) { + public void onIsAccountActivated(AccountCreator accountCreator, Status status, String resp) { if (AssistantActivity.instance() == null) { return; } - if (status.equals(RequestStatus.AccountNotActivated)) { + if (status.equals(Status.AccountNotActivated)) { if (getResources().getBoolean(R.bool.isTablet) || !getResources().getBoolean(R.bool.use_phone_number_validation)) { //accountCreator.activateAccount(); // Resend email TODO } else { - accountCreator.recoverPhoneAccount(); // Resend SMS + accountCreator.recoverAccount(); // Resend SMS } } else { createAccount.setEnabled(true); - LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status) + LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status) , AssistantActivity.instance()); } } @Override - public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, RequestStatus status) { + public void onRecoverAccount(AccountCreator accountCreator, Status status, String resp) { if (AssistantActivity.instance() == null) { return; } - if (status.equals(RequestStatus.Ok)) { + if (status.equals(Status.RequestOk)) { AssistantActivity.instance().displayAssistantCodeConfirm(getUsername() , phoneNumberEdit.getText().toString(), dialCode.getText().toString(), false); } else { @@ -680,21 +679,21 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On } @Override - public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, RequestStatus status) { + public void onIsAccountLinked(AccountCreator accountCreator, Status status, String resp) { } @Override - public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator ac, RequestStatus status) { + public void onIsAliasUsed(AccountCreator ac, Status status, String resp) { if (AssistantActivity.instance() == null) { return; } - if (status.equals(RequestStatus.AliasIsAccount) || status.equals(RequestStatus.AliasExist)) { + if (status.equals(Status.AliasIsAccount) || status.equals(Status.AliasExist)) { if (accountCreator.getPhoneNumber() != null && accountCreator.getUsername() != null && accountCreator.getPhoneNumber().compareTo(accountCreator.getUsername()) == 0) { accountCreator.isAccountActivated(); } else { createAccount.setEnabled(true); - LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status) + LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status) , AssistantActivity.instance()); } } else { @@ -703,7 +702,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On } @Override - public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, RequestStatus status) { + public void onUpdateAccount(AccountCreator accountCreator, Status status, String resp) { } } diff --git a/src/android/org/linphone/assistant/EchoCancellerCalibrationFragment.java b/src/android/org/linphone/assistant/EchoCancellerCalibrationFragment.java index 94d3986d2..2350cb51f 100644 --- a/src/android/org/linphone/assistant/EchoCancellerCalibrationFragment.java +++ b/src/android/org/linphone/assistant/EchoCancellerCalibrationFragment.java @@ -22,15 +22,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. import org.linphone.LinphoneManager; import org.linphone.LinphonePreferences; import org.linphone.R; -import org.linphone.core.LinphoneCore; -import org.linphone.core.LinphoneCore.EcCalibratorStatus; -import org.linphone.core.LinphoneCoreException; -import org.linphone.core.LinphoneCoreListenerBase; -import org.linphone.core.LinphoneXmlRpcRequest; -import org.linphone.core.LinphoneXmlRpcRequest.LinphoneXmlRpcRequestListener; -import org.linphone.core.LinphoneXmlRpcRequestImpl; -import org.linphone.core.LinphoneXmlRpcSession; -import org.linphone.core.LinphoneXmlRpcSessionImpl; +import org.linphone.core.Core; +import org.linphone.core.Core.EcCalibratorStatus; +import org.linphone.core.CoreException; +import org.linphone.core.CoreListenerStub; +import org.linphone.core.XmlRpcRequest; +import org.linphone.core.XmlRpcRequestListener; +//import org.linphone.core.XmlRpcRequestImpl; +import org.linphone.core.XmlRpcSession; +//import org.linphone.core.XmlRpcSessionImpl; import org.linphone.mediastream.Log; import android.app.Fragment; @@ -41,12 +41,12 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -public class EchoCancellerCalibrationFragment extends Fragment implements LinphoneXmlRpcRequestListener { +public class EchoCancellerCalibrationFragment extends Fragment implements XmlRpcRequestListener { private Handler mHandler = new Handler(); private boolean mSendEcCalibrationResult = false; - private LinphoneCoreListenerBase mListener; - private LinphoneXmlRpcSession xmlRpcSession; - private LinphoneXmlRpcRequest xmlRpcRequest; + private CoreListenerStub mListener; + private XmlRpcSession xmlRpcSession; + private XmlRpcRequest xmlRpcRequest; private Runnable runFinished; @Override @@ -54,9 +54,9 @@ public class EchoCancellerCalibrationFragment extends Fragment implements Linpho Bundle savedInstanceState) { View view = inflater.inflate(R.layout.assistant_ec_calibration, container, false); - mListener = new LinphoneCoreListenerBase(){ + mListener = new CoreListenerStub(){ @Override - public void ecCalibrationStatus(LinphoneCore lc, LinphoneCore.EcCalibratorStatus status, int delay_ms, Object data) { + public void onEcCalibrationResult(Core lc, Core.EcCalibratorStatus status, int delay_ms, Object data) { LinphoneManager.getInstance().routeAudioToReceiver(); if (mSendEcCalibrationResult) { sendEcCalibrationResult(status, delay_ms); @@ -71,13 +71,13 @@ public class EchoCancellerCalibrationFragment extends Fragment implements Linpho } }; - xmlRpcSession = new LinphoneXmlRpcSessionImpl(LinphoneManager.getLcIfManagerNotDestroyedOrNull(), LinphonePreferences.instance().getXmlrpcUrl()); - xmlRpcRequest = new LinphoneXmlRpcRequestImpl("add_ec_calibration_result", LinphoneXmlRpcRequest.ArgType.None); + xmlRpcSession = LinphoneManager.getLcIfManagerNotDestroyedOrNull().createXmlRpcSession(LinphonePreferences.instance().getXmlrpcUrl()); + xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.None, "add_ec_calibration_result"); xmlRpcRequest.setListener(this); try { LinphoneManager.getInstance().startEcCalibration(mListener); - } catch (LinphoneCoreException e) { + } catch (CoreException e) { Log.e(e, "Unable to calibrate EC"); AssistantActivity.instance().isEchoCalibrationFinished(); } @@ -89,12 +89,12 @@ public class EchoCancellerCalibrationFragment extends Fragment implements Linpho } @Override - public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) { + public void onResponse(XmlRpcRequest request) { mHandler.post(runFinished); } private void sendEcCalibrationResult(EcCalibratorStatus status, int delayMs) { - Boolean hasBuiltInEchoCanceler = LinphoneManager.getLc().hasBuiltInEchoCanceler(); + Boolean hasBuiltInEchoCanceler = LinphoneManager.getLc().hasBuiltinEchoCanceller(); Log.i("Add echo canceller calibration result: manufacturer=" + Build.MANUFACTURER + " model=" + Build.MODEL + " status=" + status + " delay=" + delayMs + "ms" + " hasBuiltInEchoCanceler " + hasBuiltInEchoCanceler); xmlRpcRequest.addStringArg(Build.MANUFACTURER); xmlRpcRequest.addStringArg(Build.MODEL); diff --git a/src/android/org/linphone/assistant/LinphoneLoginFragment.java b/src/android/org/linphone/assistant/LinphoneLoginFragment.java index 3fe9b8ec5..0b0222993 100644 --- a/src/android/org/linphone/assistant/LinphoneLoginFragment.java +++ b/src/android/org/linphone/assistant/LinphoneLoginFragment.java @@ -24,10 +24,11 @@ import org.linphone.LinphonePreferences; import org.linphone.LinphoneUtils; import org.linphone.R; import org.linphone.compatibility.Compatibility; +import org.linphone.core.AccountCreatorListener; import org.linphone.core.DialPlan; -import org.linphone.core.LinphoneAccountCreator; -import org.linphone.core.LinphoneCoreFactory; -import org.linphone.core.LinphoneProxyConfig; +import org.linphone.core.AccountCreator; +import org.linphone.core.Factory; +import org.linphone.core.ProxyConfig; import android.app.AlertDialog; import android.app.Fragment; @@ -50,14 +51,14 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; -public class LinphoneLoginFragment extends Fragment implements CompoundButton.OnCheckedChangeListener, OnClickListener, TextWatcher, LinphoneAccountCreator.LinphoneAccountCreatorListener { +public class LinphoneLoginFragment extends Fragment implements CompoundButton.OnCheckedChangeListener, OnClickListener, TextWatcher, AccountCreatorListener { private EditText login, password, phoneNumberEdit, dialCode; private Button apply, selectCountry; private CheckBox useUsername; private LinearLayout phoneNumberLayout, usernameLayout, passwordLayout; private TextView forgotPassword, messagePhoneNumber, phoneNumberError; private Boolean recoverAccount; - private LinphoneAccountCreator accountCreator; + private AccountCreator accountCreator; private int countryCode; private String phone, dialcode, username, pwd; private ImageView phoneNumberInfo; @@ -67,7 +68,7 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On Bundle savedInstanceState) { View view = inflater.inflate(R.layout.assistant_linphone_login, container, false); - accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc(), LinphonePreferences.instance().getXmlrpcUrl()); + accountCreator = LinphoneManager.getLc().createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl()); accountCreator.setListener(this); String url = "http://linphone.org/free-sip-service.html&action=recover"; @@ -110,20 +111,20 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On (TelephonyManager) getActivity().getApplicationContext().getSystemService( Context.TELEPHONY_SERVICE); String countryIso = tm.getNetworkCountryIso(); - LinphoneProxyConfig proxyConfig = LinphoneManager.getLc().createProxyConfig(); - countryCode = proxyConfig.lookupCCCFromIso(countryIso.toUpperCase()); + ProxyConfig proxyConfig = LinphoneManager.getLc().createProxyConfig(); + countryCode = org.linphone.core.Utils.getCccFromIso(countryIso.toUpperCase()); DialPlan c = AssistantActivity.instance().country; if (c != null) { - selectCountry.setText(c.getCountryName()); + selectCountry.setText(c.getCountry()); dialCode.setText(c.getCountryCallingCode().contains("+") ? c.getCountryCallingCode() : "+" + c.getCountryCallingCode()); } else { c = AssistantActivity.instance().getCountryListAdapter() .getCountryFromCountryCode(String.valueOf(countryCode)); if (c != null) { - selectCountry.setText(c.getCountryName()); + selectCountry.setText(c.getCountry()); dialCode.setText(c.getCountryCallingCode().contains("+") ? c.getCountryCallingCode() : "+" + c.getCountryCallingCode()); } @@ -195,7 +196,7 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On } accountCreator.setUsername(login.getText().toString()); accountCreator.setPassword(password.getText().toString()); - accountCreator.isAccountUsed(); + accountCreator.isAccountExist(); } private int getPhoneNumberStatus() { @@ -209,7 +210,7 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On DialPlan c = AssistantActivity.instance().getCountryListAdapter().getCountryFromCountryCode(dialCode.getText().toString()); if (c != null) { AssistantActivity.instance().country = c; - selectCountry.setText(c.getCountryName()); + selectCountry.setText(c.getCountry()); } else { selectCountry.setText(R.string.select_your_country); } @@ -260,10 +261,10 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On private void recoverAccount() { if (phoneNumberEdit.length() > 0 || dialCode.length() > 1) { int status = getPhoneNumberStatus(); - boolean isOk = status == LinphoneAccountCreator.PhoneNumberCheck.Ok.value(); + boolean isOk = status == AccountCreator.PhoneNumberStatus.Ok.toInt(); if (isOk) { - LinphoneManager.getLc().getConfig().loadXmlFile(LinphoneManager.getInstance().getmDynamicConfigFile()); - accountCreator.isPhoneNumberUsed(); + LinphoneManager.getLc().getConfig().loadFromXmlFile(LinphoneManager.getInstance().getmDynamicConfigFile()); + accountCreator.isAliasUsed(); } else { apply.setEnabled(true); LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForPhoneNumberStatus(status), @@ -282,10 +283,10 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On public void onTextChanged2() { int status = getPhoneNumberStatus(); - boolean isOk = status == LinphoneAccountCreator.PhoneNumberCheck.Ok.value(); + boolean isOk = status == AccountCreator.PhoneNumberStatus.Ok.toInt(); LinphoneUtils.displayError(isOk, phoneNumberError, LinphoneUtils.errorForPhoneNumberStatus(status)); if (!isOk) { - if ((1 == (status & LinphoneAccountCreator.PhoneNumberCheck.CountryCodeInvalid.value()))) { + if ((1 == (status & AccountCreator.PhoneNumberStatus.InvalidCountryCode.toInt()))) { dialCode.setBackgroundResource(R.drawable.resizable_textfield_error); phoneNumberEdit.setBackgroundResource(R.drawable.resizable_textfield); } else { @@ -329,47 +330,47 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On } @Override - public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onIsAccountExist(AccountCreator accountCreator, AccountCreator.Status status, String resp) { if (AssistantActivity.instance() == null) { apply.setEnabled(true); return; } - if (status.equals(LinphoneAccountCreator.RequestStatus.AccountExist) || status.equals(LinphoneAccountCreator.RequestStatus.AccountExistWithAlias)) { + if (status.equals(AccountCreator.Status.AccountExist) || status.equals(AccountCreator.Status.AccountExistWithAlias)) { AssistantActivity.instance().linphoneLogIn(accountCreator); } else { - LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status), AssistantActivity.instance()); + LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status), AssistantActivity.instance()); } apply.setEnabled(true); } @Override - public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onCreateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onActivateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onLinkAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onActivateAlias(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onIsAccountActivated(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onRecoverAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) { if (AssistantActivity.instance() == null) { apply.setEnabled(true); return; } - if (status.equals(LinphoneAccountCreator.RequestStatus.ErrorServer)) { - LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(LinphoneAccountCreator.RequestStatus.Failed), AssistantActivity.instance()); + if (status.equals(AccountCreator.Status.ServerError)) { + LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(AccountCreator.Status.RequestFailed), AssistantActivity.instance()); apply.setEnabled(true); } else { AssistantActivity.instance().displayAssistantCodeConfirm(accountCreator.getUsername(), phoneNumberEdit.getText().toString(), LinphoneUtils.getCountryCode(dialCode), true); @@ -377,25 +378,25 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On } @Override - public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onIsAccountLinked(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } @Override - public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onIsAliasUsed(AccountCreator accountCreator, AccountCreator.Status status, String resp) { if (AssistantActivity.instance() == null) { apply.setEnabled(true); return; } - if (status.equals(LinphoneAccountCreator.RequestStatus.AliasIsAccount) || status.equals(LinphoneAccountCreator.RequestStatus.AliasExist)) { - accountCreator.recoverPhoneAccount(); + if (status.equals(AccountCreator.Status.AliasIsAccount) || status.equals(AccountCreator.Status.AliasExist)) { + accountCreator.recoverAccount(); } else { apply.setEnabled(true); - LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status), AssistantActivity.instance()); + LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status), AssistantActivity.instance()); } } @Override - public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { + public void onUpdateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) { } } diff --git a/src/android/org/linphone/assistant/LoginFragment.java b/src/android/org/linphone/assistant/LoginFragment.java index 4842bbc39..a85e6c550 100644 --- a/src/android/org/linphone/assistant/LoginFragment.java +++ b/src/android/org/linphone/assistant/LoginFragment.java @@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import org.linphone.R; -import org.linphone.core.LinphoneAddress.TransportType; +import org.linphone.core.Address.TransportType; import android.app.Fragment; import android.os.Bundle; @@ -71,12 +71,12 @@ public class LoginFragment extends Fragment implements OnClickListener, TextWatc TransportType transport; if(transports.getCheckedRadioButtonId() == R.id.transport_udp){ - transport = TransportType.LinphoneTransportUdp; + transport = TransportType.Udp; } else { if(transports.getCheckedRadioButtonId() == R.id.transport_tcp){ - transport = TransportType.LinphoneTransportTcp; + transport = TransportType.Tcp; } else { - transport = TransportType.LinphoneTransportTls; + transport = TransportType.Tls; } } diff --git a/src/android/org/linphone/assistant/RemoteProvisioningActivity.java b/src/android/org/linphone/assistant/RemoteProvisioningActivity.java index cfc104955..9421c52b3 100644 --- a/src/android/org/linphone/assistant/RemoteProvisioningActivity.java +++ b/src/android/org/linphone/assistant/RemoteProvisioningActivity.java @@ -27,9 +27,9 @@ import org.linphone.LinphoneManager; import org.linphone.LinphonePreferences; import org.linphone.LinphoneService; import org.linphone.R; -import org.linphone.core.LinphoneCore; -import org.linphone.core.LinphoneCore.RemoteProvisioningState; -import org.linphone.core.LinphoneCoreListenerBase; +import org.linphone.core.Core; +import org.linphone.core.Core.ConfiguringState; +import org.linphone.core.CoreListenerStub; import org.linphone.mediastream.Log; import android.app.Activity; @@ -47,7 +47,7 @@ public class RemoteProvisioningActivity extends Activity { private Handler mHandler = new Handler(); private String configUriParam = null; private ProgressBar spinner; - private LinphoneCoreListenerBase mListener; + private CoreListenerStub mListener; @Override protected void onCreate(Bundle savedInstanceState) { @@ -55,13 +55,13 @@ public class RemoteProvisioningActivity extends Activity { setContentView(R.layout.remote_provisioning); spinner = (ProgressBar) findViewById(R.id.spinner); - mListener = new LinphoneCoreListenerBase(){ + mListener = new CoreListenerStub(){ @Override - public void configuringStatus(LinphoneCore lc, final RemoteProvisioningState state, String message) { + public void onConfiguringStatus(Core lc, final ConfiguringState state, String message) { if (spinner != null) spinner.setVisibility(View.GONE); - if (state == RemoteProvisioningState.ConfiguringSuccessful) { + if (state == ConfiguringState.Successful) { goToLinphoneActivity(); - } else if (state == RemoteProvisioningState.ConfiguringFailed) { + } else if (state == ConfiguringState.Failed) { Toast.makeText(RemoteProvisioningActivity.this, R.string.remote_provisioning_failure, Toast.LENGTH_LONG).show(); } } @@ -71,7 +71,7 @@ public class RemoteProvisioningActivity extends Activity { @Override protected void onResume() { super.onResume(); - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.addListener(mListener); } @@ -82,7 +82,7 @@ public class RemoteProvisioningActivity extends Activity { @Override protected void onPause() { - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.removeListener(mListener); } @@ -182,7 +182,7 @@ public class RemoteProvisioningActivity extends Activity { mHandler.postDelayed(new Runnable() { @Override public void run() { - LinphoneManager.getInstance().restartLinphoneCore(); + LinphoneManager.getInstance().restartCore(); } }, 1000); } diff --git a/src/android/org/linphone/assistant/RemoteProvisioningFragment.java b/src/android/org/linphone/assistant/RemoteProvisioningFragment.java index d547cbb55..c02587003 100644 --- a/src/android/org/linphone/assistant/RemoteProvisioningFragment.java +++ b/src/android/org/linphone/assistant/RemoteProvisioningFragment.java @@ -60,8 +60,8 @@ public class RemoteProvisioningFragment extends Fragment implements OnClickListe String url = remoteProvisioningUrl.getText().toString(); AssistantActivity.instance().displayRemoteProvisioningInProgressDialog(); LinphonePreferences.instance().setRemoteProvisioningUrl(url); - LinphoneManager.getInstance().restartLinphoneCore(); - AssistantActivity.instance().setLinphoneCoreListener(); + LinphoneManager.getInstance().restartCore(); + AssistantActivity.instance().setCoreListener(); } } diff --git a/src/android/org/linphone/assistant/RemoteProvisioningLoginActivity.java b/src/android/org/linphone/assistant/RemoteProvisioningLoginActivity.java index 80cf0dda4..11ac6981e 100644 --- a/src/android/org/linphone/assistant/RemoteProvisioningLoginActivity.java +++ b/src/android/org/linphone/assistant/RemoteProvisioningLoginActivity.java @@ -21,8 +21,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. import org.linphone.LinphoneManager; import org.linphone.LinphonePreferences; import org.linphone.R; -import org.linphone.core.LinphoneCore; -import org.linphone.core.LinphoneCoreListenerBase; +import org.linphone.core.Core; +import org.linphone.core.CoreListenerStub; import org.linphone.xmlrpc.XmlRpcHelper; import org.linphone.xmlrpc.XmlRpcListenerBase; @@ -37,7 +37,7 @@ import android.widget.Toast; public class RemoteProvisioningLoginActivity extends Activity implements OnClickListener { private EditText login, password, domain; private Button connect; - private LinphoneCoreListenerBase mListener; + private CoreListenerStub mListener; @Override public void onCreate(Bundle savedInstanceState) { @@ -57,12 +57,12 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick domain.setEnabled(false); } - mListener = new LinphoneCoreListenerBase(){ + mListener = new CoreListenerStub(){ @Override - public void configuringStatus(LinphoneCore lc, final LinphoneCore.RemoteProvisioningState state, String message) { - if (state == LinphoneCore.RemoteProvisioningState.ConfiguringSuccessful) { + public void onConfiguringStatus(Core lc, final Core.ConfiguringState state, String message) { + if (state == Core.ConfiguringState.Successful) { //TODO - } else if (state == LinphoneCore.RemoteProvisioningState.ConfiguringFailed) { + } else if (state == Core.ConfiguringState.Failed) { Toast.makeText(RemoteProvisioningLoginActivity.this, R.string.remote_provisioning_failure, Toast.LENGTH_LONG).show(); } } @@ -83,7 +83,7 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick @Override public void onRemoteProvisioningFilenameSent(String result) { LinphonePreferences.instance().setRemoteProvisioningUrl(result); - LinphoneManager.getInstance().restartLinphoneCore(); + LinphoneManager.getInstance().restartCore(); } }, username.toString(), password.toString(), domain.toString()); @@ -91,16 +91,16 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick setResult(Activity.RESULT_OK); finish(); /*String identity = "sip:" + username + "@" + domain; - LinphoneProxyConfig prxCfg = lc.createProxyConfig(); + ProxyConfig prxCfg = lc.createProxyConfig(); try { - prxCfg.setIdentity(identity); + prxCfg.setIdentityAddress(identity); lc.addProxyConfig(prxCfg); - } catch (LinphoneCoreException e) { + } catch (CoreException e) { Log.e(e); return false; } - LinphoneAuthInfo authInfo = LinphoneCoreFactory.instance().createAuthInfo(username, null, password, null, null, domain); + AuthInfo authInfo = Factory.instance().createAuthInfo(username, null, password, null, null, domain); lc.addAuthInfo(authInfo); if (LinphonePreferences.instance().getAccountCount() == 1) @@ -112,7 +112,7 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick @Override protected void onResume() { super.onResume(); - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.addListener(mListener); } @@ -120,7 +120,7 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick @Override protected void onPause() { - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.removeListener(mListener); } diff --git a/src/android/org/linphone/gcm/GCMService.java b/src/android/org/linphone/gcm/GCMService.java index 00b6abb09..9862f7caa 100644 --- a/src/android/org/linphone/gcm/GCMService.java +++ b/src/android/org/linphone/gcm/GCMService.java @@ -25,7 +25,7 @@ import org.linphone.LinphonePreferences; import org.linphone.LinphoneService; import org.linphone.R; import org.linphone.UIThreadDispatcher; -import org.linphone.core.LinphoneCoreFactory; +import org.linphone.core.Factory; import org.linphone.mediastream.Log; import android.content.Context; @@ -43,8 +43,8 @@ public class GCMService extends GCMBaseIntentService { private void initLogger(Context context) { LinphonePreferences.instance().setContext(context); boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled(); - LinphoneCoreFactory.instance().enableLogCollection(isDebugEnabled); - LinphoneCoreFactory.instance().setDebugMode(isDebugEnabled, context.getString(R.string.app_name)); + Factory.instance().enableLogCollection(isDebugEnabled); + Factory.instance().setDebugMode(isDebugEnabled, context.getString(R.string.app_name)); } @Override @@ -59,7 +59,7 @@ public class GCMService extends GCMBaseIntentService { Log.d("[Push Notification] Received"); if (!LinphoneService.isReady()) { - startService(new Intent(ACTION_MAIN).setClass(this, LinphoneService.class)); + context.startService(new Intent(ACTION_MAIN).setClass(context, LinphoneService.class)); } else if (LinphoneManager.isInstanciated() && LinphoneManager.getLc().getCallsNb() == 0) { UIThreadDispatcher.dispatch(new Runnable(){ @Override diff --git a/src/android/org/linphone/purchase/InAppPurchaseFragment.java b/src/android/org/linphone/purchase/InAppPurchaseFragment.java index 083095e30..9dd40ce54 100644 --- a/src/android/org/linphone/purchase/InAppPurchaseFragment.java +++ b/src/android/org/linphone/purchase/InAppPurchaseFragment.java @@ -23,7 +23,7 @@ import java.util.Locale; import org.linphone.LinphoneManager; import org.linphone.LinphonePreferences; import org.linphone.R; -import org.linphone.core.LinphoneProxyConfig; +import org.linphone.core.ProxyConfig; import android.app.Fragment; import android.os.Bundle; @@ -116,7 +116,7 @@ public class InAppPurchaseFragment extends Fragment implements View.OnClickListe } private boolean isUsernameCorrect(String username) { - LinphoneProxyConfig lpc = LinphoneManager.getLc().createProxyConfig(); + ProxyConfig lpc = LinphoneManager.getLc().createProxyConfig(); return lpc.isPhoneNumber(username); } @@ -139,7 +139,7 @@ public class InAppPurchaseFragment extends Fragment implements View.OnClickListe private String getUsername() { String username = this.username.getText().toString(); - LinphoneProxyConfig lpc = LinphoneManager.getLc().createProxyConfig(); + ProxyConfig lpc = LinphoneManager.getLc().createProxyConfig(); username = lpc.normalizePhoneNumber(username); return username.toLowerCase(Locale.getDefault()); } diff --git a/src/android/org/linphone/ui/CallButton.java b/src/android/org/linphone/ui/CallButton.java index b5d9b58ae..ef2071500 100644 --- a/src/android/org/linphone/ui/CallButton.java +++ b/src/android/org/linphone/ui/CallButton.java @@ -22,10 +22,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. import org.linphone.LinphoneManager; import org.linphone.LinphonePreferences; import org.linphone.R; -import org.linphone.core.CallDirection; -import org.linphone.core.LinphoneCallLog; -import org.linphone.core.LinphoneCoreException; -import org.linphone.core.LinphoneProxyConfig; +import org.linphone.core.Call; +import org.linphone.core.Call.Dir; +import org.linphone.core.CallLog; +import org.linphone.core.CoreException; +import org.linphone.core.ProxyConfig; import android.content.Context; import android.util.AttributeSet; @@ -54,10 +55,10 @@ public class CallButton extends ImageView implements OnClickListener, AddressAwa LinphoneManager.getInstance().newOutgoingCall(mAddress); } else { if (LinphonePreferences.instance().isBisFeatureEnabled()) { - LinphoneCallLog[] logs = LinphoneManager.getLc().getCallLogs(); - LinphoneCallLog log = null; - for (LinphoneCallLog l : logs) { - if (l.getDirection() == CallDirection.Outgoing) { + CallLog[] logs = LinphoneManager.getLc().getCallLogs(); + CallLog log = null; + for (CallLog l : logs) { + if (l.getDir() == Call.Dir.Outgoing) { log = l; break; } @@ -66,18 +67,18 @@ public class CallButton extends ImageView implements OnClickListener, AddressAwa return; } - LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig(); - if (lpc != null && log.getTo().getDomain().equals(lpc.getDomain())) { - mAddress.setText(log.getTo().getUserName()); + ProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig(); + if (lpc != null && log.getToAddress().getDomain().equals(lpc.getDomain())) { + mAddress.setText(log.getToAddress().getUsername()); } else { - mAddress.setText(log.getTo().asStringUriOnly()); + mAddress.setText(log.getToAddress().asStringUriOnly()); } mAddress.setSelection(mAddress.getText().toString().length()); - mAddress.setDisplayedName(log.getTo().getDisplayName()); + mAddress.setDisplayedName(log.getToAddress().getDisplayName()); } } } - } catch (LinphoneCoreException e) { + } catch (CoreException e) { LinphoneManager.getInstance().terminateCall(); onWrongDestinationAddress(); } diff --git a/src/android/org/linphone/ui/Digit.java b/src/android/org/linphone/ui/Digit.java index 5581266ce..31e773981 100644 --- a/src/android/org/linphone/ui/Digit.java +++ b/src/android/org/linphone/ui/Digit.java @@ -24,8 +24,8 @@ import org.linphone.LinphoneManager; import org.linphone.LinphonePreferences; import org.linphone.LinphoneService; import org.linphone.R; -import org.linphone.core.LinphoneCore; -import org.linphone.core.LinphoneCoreFactory; +import org.linphone.core.Core; +import org.linphone.core.Factory; import org.linphone.mediastream.Log; import android.app.AlertDialog; @@ -106,11 +106,11 @@ public class Digit extends Button implements AddressAware { public void onClick(View v) { if (mPlayDtmf) { if (!linphoneServiceReady()) return; - LinphoneCore lc = LinphoneManager.getLc(); + Core lc = LinphoneManager.getLc(); lc.stopDtmf(); mIsDtmfStarted =false; - if (lc.isIncall()) { - lc.sendDtmf(mKeyCode); + if (lc.inCall()) { + lc.getCurrentCall().sendDtmf(mKeyCode); } } @@ -138,10 +138,10 @@ public class Digit extends Button implements AddressAware { public void onClick(DialogInterface dialog, int which) { if(which == 0){ LinphonePreferences.instance().setDebugEnabled(false); - LinphoneCoreFactory.instance().enableLogCollection(false); + Factory.instance().enableLogCollection(false); } if(which == 1) { - LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); + Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { lc.uploadLogCollection(); } @@ -154,7 +154,7 @@ public class Digit extends Button implements AddressAware { public void onClick(DialogInterface dialog, int which) { if(which == 0) { LinphonePreferences.instance().setDebugEnabled(true); - LinphoneCoreFactory.instance().enableLogCollection(true); + Factory.instance().enableLogCollection(true); } } }); @@ -171,7 +171,7 @@ public class Digit extends Button implements AddressAware { CallActivity.instance().resetControlsHidingCallBack(); } - LinphoneCore lc = LinphoneManager.getLc(); + Core lc = LinphoneManager.getLc(); if (event.getAction() == MotionEvent.ACTION_DOWN && !mIsDtmfStarted) { LinphoneManager.getInstance().playDtmf(getContext().getContentResolver(), mKeyCode); mIsDtmfStarted = true; @@ -186,7 +186,7 @@ public class Digit extends Button implements AddressAware { public boolean onLongClick(View v) { int id = v.getId(); - LinphoneCore lc = LinphoneManager.getLc(); + Core lc = LinphoneManager.getLc(); if (mPlayDtmf) { if (!linphoneServiceReady()) return true; diff --git a/src/android/org/linphone/ui/LinphoneOverlay.java b/src/android/org/linphone/ui/LinphoneOverlay.java index 9924a6ded..ea726fbd8 100644 --- a/src/android/org/linphone/ui/LinphoneOverlay.java +++ b/src/android/org/linphone/ui/LinphoneOverlay.java @@ -22,8 +22,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. import org.linphone.LinphoneActivity; import org.linphone.LinphoneManager; import org.linphone.LinphoneService; -import org.linphone.core.LinphoneCall; -import org.linphone.core.LinphoneCallParams; +import org.linphone.core.Call; +import org.linphone.core.CallParams; import org.linphone.mediastream.video.AndroidVideoWindowImpl; import android.content.Context; @@ -63,7 +63,7 @@ public class LinphoneOverlay extends org.linphone.mediastream.video.display.GL2J androidVideoWindowImpl = new AndroidVideoWindowImpl(this, null, new AndroidVideoWindowImpl.VideoWindowListener() { public void onVideoRenderingSurfaceReady(AndroidVideoWindowImpl vw, SurfaceView surface) { - LinphoneManager.getLc().setVideoWindow(vw); + LinphoneManager.getLc().setNativeVideoWindowId(vw); } public void onVideoRenderingSurfaceDestroyed(AndroidVideoWindowImpl vw) { @@ -77,11 +77,11 @@ public class LinphoneOverlay extends org.linphone.mediastream.video.display.GL2J } }); - LinphoneCall call = LinphoneManager.getLc().getCurrentCall(); - LinphoneCallParams callParams = call.getCurrentParams(); - params.width = callParams.getReceivedVideoSize().width; - params.height = callParams.getReceivedVideoSize().height; - LinphoneManager.getLc().setVideoWindow(androidVideoWindowImpl); + Call call = LinphoneManager.getLc().getCurrentCall(); + CallParams callParams = call.getCurrentParams(); + params.width = callParams.getReceivedVideoDefinition().width; + params.height = callParams.getReceivedVideoDefinition().height; + LinphoneManager.getLc().setNativeVideoWindowId(androidVideoWindowImpl); setOnClickListener(new OnClickListener() { @Override diff --git a/src/android/org/linphone/ui/SlidingDrawer.java b/src/android/org/linphone/ui/SlidingDrawer.java index f14139343..054f47341 100644 --- a/src/android/org/linphone/ui/SlidingDrawer.java +++ b/src/android/org/linphone/ui/SlidingDrawer.java @@ -218,6 +218,7 @@ public class SlidingDrawer extends ViewGroup { @Override protected void onFinishInflate() { + super.onFinishInflate(); mHandle = findViewById(mHandleId); if (mHandle == null) { throw new IllegalArgumentException( diff --git a/src/android/org/linphone/xmlrpc/XmlRpcHelper.java b/src/android/org/linphone/xmlrpc/XmlRpcHelper.java index 0ed15a41e..4d89d16c1 100644 --- a/src/android/org/linphone/xmlrpc/XmlRpcHelper.java +++ b/src/android/org/linphone/xmlrpc/XmlRpcHelper.java @@ -21,11 +21,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. import org.linphone.LinphoneManager; import org.linphone.LinphonePreferences; -import org.linphone.core.LinphoneXmlRpcRequest; -import org.linphone.core.LinphoneXmlRpcRequest.LinphoneXmlRpcRequestListener; -import org.linphone.core.LinphoneXmlRpcRequestImpl; -import org.linphone.core.LinphoneXmlRpcSession; -import org.linphone.core.LinphoneXmlRpcSessionImpl; +import org.linphone.core.XmlRpcRequest; +import org.linphone.core.XmlRpcRequestListener; +//import org.linphone.core.XmlRpcRequestImpl; +import org.linphone.core.XmlRpcSession; +//import org.linphone.core.XmlRpcSessionImpl; import org.linphone.mediastream.Log; public class XmlRpcHelper { @@ -43,26 +43,26 @@ public class XmlRpcHelper { public static final String CLIENT_ERROR_INVALID_SERVER_URL = "INVALID_SERVER_URL"; public static final String CLIENT_ERROR_SERVER_NOT_REACHABLE = "SERVER_NOT_REACHABLE"; - private LinphoneXmlRpcSession xmlRpcSession; + private XmlRpcSession xmlRpcSession; public XmlRpcHelper() { - xmlRpcSession = new LinphoneXmlRpcSessionImpl(LinphoneManager.getLcIfManagerNotDestroyedOrNull(), LinphonePreferences.instance().getInAppPurchaseValidatingServerUrl()); + xmlRpcSession = LinphoneManager.getLcIfManagerNotDestroyedOrNull().createXmlRpcSession(LinphonePreferences.instance().getInAppPurchaseValidatingServerUrl()); } public void createAccountAsync(final XmlRpcListener listener, String username, String email, String password) { - LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("create_account", LinphoneXmlRpcRequest.ArgType.String); - xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { + XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "create_account"); + xmlRpcRequest.setListener(new XmlRpcRequestListener() { @Override - public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) { + public void onResponse(XmlRpcRequest request) { String result = request.getStringResponse(); - if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) { + if (request.getStatus() == XmlRpcRequest.Status.Ok) { if (result.startsWith("ERROR_")) { Log.e(result); listener.onError(result); return; } listener.onAccountCreated(result); - } else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) { + } else if (request.getStatus() == XmlRpcRequest.Status.Failed) { Log.e(result); listener.onError(result); } @@ -75,19 +75,19 @@ public class XmlRpcHelper { } public void getAccountExpireAsync(final XmlRpcListener listener, String username, String password) { - LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("get_account_expiration", LinphoneXmlRpcRequest.ArgType.String); - xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { + XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "get_account_expiration"); + xmlRpcRequest.setListener(new XmlRpcRequestListener() { @Override - public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) { + public void onResponse(XmlRpcRequest request) { String result = request.getStringResponse(); - if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) { + if (request.getStatus() == XmlRpcRequest.Status.Ok) { if (result.startsWith("ERROR_")) { Log.e(result); listener.onError(result); return; } listener.onAccountExpireFetched(result); - } else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) { + } else if (request.getStatus() == XmlRpcRequest.Status.Failed) { Log.e(result); listener.onError(result); } @@ -99,19 +99,19 @@ public class XmlRpcHelper { } public void updateAccountExpireAsync(final XmlRpcListener listener, String username, String password, String domain, String payload, String signature) { - LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("update_expiration_date", LinphoneXmlRpcRequest.ArgType.String); - xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { + XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "update_expiration_date"); + xmlRpcRequest.setListener(new XmlRpcRequestListener() { @Override - public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) { + public void onResponse(XmlRpcRequest request) { String result = request.getStringResponse(); - if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) { + if (request.getStatus() == XmlRpcRequest.Status.Ok) { if (result.startsWith("ERROR_")) { Log.e(result); listener.onError(result); return; } listener.onAccountExpireUpdated(result); - } else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) { + } else if (request.getStatus() == XmlRpcRequest.Status.Failed) { Log.e(result); listener.onError(result); } @@ -126,19 +126,19 @@ public class XmlRpcHelper { } public void activateAccountAsync(final XmlRpcListener listener, String username, String password) { - LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("activate_account", LinphoneXmlRpcRequest.ArgType.String); - xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { + XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "activate_account"); + xmlRpcRequest.setListener(new XmlRpcRequestListener() { @Override - public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) { + public void onResponse(XmlRpcRequest request) { String result = request.getStringResponse(); - if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) { + if (request.getStatus() == XmlRpcRequest.Status.Ok) { if (result.startsWith("ERROR_")) { Log.e(result); listener.onError(result); return; } listener.onAccountActivated(result); - } else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) { + } else if (request.getStatus() == XmlRpcRequest.Status.Failed) { Log.e(result); listener.onError(result); } @@ -150,12 +150,12 @@ public class XmlRpcHelper { } public void isAccountActivatedAsync(final XmlRpcListener listener, String username) { - LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("check_account_activated", LinphoneXmlRpcRequest.ArgType.String); - xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { + XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "check_account_activated"); + xmlRpcRequest.setListener(new XmlRpcRequestListener() { @Override - public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) { + public void onResponse(XmlRpcRequest request) { String result = request.getStringResponse(); - if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) { + if (request.getStatus() == XmlRpcRequest.Status.Ok) { if ("OK".equals(result)) { listener.onAccountActivatedFetched(true); return; @@ -164,7 +164,7 @@ public class XmlRpcHelper { listener.onError(result); } listener.onAccountActivatedFetched(false); - } else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) { + } else if (request.getStatus() == XmlRpcRequest.Status.Failed) { Log.e(result); listener.onError(result); } @@ -175,17 +175,17 @@ public class XmlRpcHelper { } public void isTrialAccountAsync(final XmlRpcListener listener, String username, String password) { - LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("is_account_trial", LinphoneXmlRpcRequest.ArgType.String); - xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { + XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "is_account_trial"); + xmlRpcRequest.setListener(new XmlRpcRequestListener() { @Override - public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) { + public void onResponse(XmlRpcRequest request) { String result = request.getStringResponse(); - if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) { + if (request.getStatus() == XmlRpcRequest.Status.Ok) { if (!"NOK".equals(result) && !"OK".equals(result)) { listener.onError(result); } listener.onTrialAccountFetched("OK".equals(result)); - } else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) { + } else if (request.getStatus() == XmlRpcRequest.Status.Failed) { Log.e(result); listener.onError(result); } @@ -197,12 +197,12 @@ public class XmlRpcHelper { } public void isAccountAsync(final XmlRpcListener listener, String username) { - LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("check_account_activated", LinphoneXmlRpcRequest.ArgType.String); - xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { + XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "check_account_activated"); + xmlRpcRequest.setListener(new XmlRpcRequestListener() { @Override - public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) { + public void onResponse(XmlRpcRequest request) { String result = request.getStringResponse(); - if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) { + if (request.getStatus() == XmlRpcRequest.Status.Ok) { if ("OK".equals(result)) { listener.onAccountFetched(true); return; @@ -211,7 +211,7 @@ public class XmlRpcHelper { listener.onError(result); } listener.onAccountFetched(false); - } else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) { + } else if (request.getStatus() == XmlRpcRequest.Status.Failed) { Log.e(result); listener.onError(result); } @@ -222,12 +222,12 @@ public class XmlRpcHelper { } public void changeAccountEmailAsync(final XmlRpcListener listener, String username, String password, String newEmail) { - LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("change_email", LinphoneXmlRpcRequest.ArgType.String); - xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { + XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "change_email"); + xmlRpcRequest.setListener(new XmlRpcRequestListener() { @Override - public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) { + public void onResponse(XmlRpcRequest request) { String result = request.getStringResponse(); - if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) { + if (request.getStatus() == XmlRpcRequest.Status.Ok) { if (result.startsWith("ERROR_")) { Log.e(result); listener.onError(result); @@ -235,7 +235,7 @@ public class XmlRpcHelper { } listener.onAccountEmailChanged(result); - } else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) { + } else if (request.getStatus() == XmlRpcRequest.Status.Failed) { Log.e(result); listener.onError(result); } @@ -248,12 +248,12 @@ public class XmlRpcHelper { } public void changeAccountPasswordAsync(final XmlRpcListener listener, String username, String oldPassword, String newPassword) { - LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("change_password", LinphoneXmlRpcRequest.ArgType.String); - xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { + XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "change_password"); + xmlRpcRequest.setListener(new XmlRpcRequestListener() { @Override - public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) { + public void onResponse(XmlRpcRequest request) { String result = request.getStringResponse(); - if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) { + if (request.getStatus() == XmlRpcRequest.Status.Ok) { if (result.startsWith("ERROR_")) { Log.e(result); listener.onError(result); @@ -261,7 +261,7 @@ public class XmlRpcHelper { } listener.onAccountPasswordChanged(result); - } else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) { + } else if (request.getStatus() == XmlRpcRequest.Status.Failed) { Log.e(result); listener.onError(result); } @@ -274,12 +274,12 @@ public class XmlRpcHelper { } public void changeAccountHashPasswordAsync(final XmlRpcListener listener, String username, String oldPassword, String newPassword) { - LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("change_hash", LinphoneXmlRpcRequest.ArgType.String); - xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { + XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "change_hash"); + xmlRpcRequest.setListener(new XmlRpcRequestListener() { @Override - public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) { + public void onResponse(XmlRpcRequest request) { String result = request.getStringResponse(); - if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) { + if (request.getStatus() == XmlRpcRequest.Status.Ok) { if (result.startsWith("ERROR_")) { Log.e(result); listener.onError(result); @@ -287,7 +287,7 @@ public class XmlRpcHelper { } listener.onAccountPasswordChanged(result); - } else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) { + } else if (request.getStatus() == XmlRpcRequest.Status.Failed) { Log.e(result); listener.onError(result); } @@ -300,12 +300,12 @@ public class XmlRpcHelper { } public void sendRecoverPasswordLinkByEmailAsync(final XmlRpcListener listener, String usernameOrEmail) { - LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("send_reset_account_password_email", LinphoneXmlRpcRequest.ArgType.String); - xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { + XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "send_reset_account_password_email"); + xmlRpcRequest.setListener(new XmlRpcRequestListener() { @Override - public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) { + public void onResponse(XmlRpcRequest request) { String result = request.getStringResponse(); - if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) { + if (request.getStatus() == XmlRpcRequest.Status.Ok) { if (result.startsWith("ERROR_")) { Log.e(result); listener.onError(result); @@ -313,7 +313,7 @@ public class XmlRpcHelper { } listener.onRecoverPasswordLinkSent(result); - } else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) { + } else if (request.getStatus() == XmlRpcRequest.Status.Failed) { Log.e(result); listener.onError(result); } @@ -324,12 +324,12 @@ public class XmlRpcHelper { } public void sendActivateAccountLinkByEmailAsync(final XmlRpcListener listener, String usernameOrEmail) { - LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("resend_activation_email", LinphoneXmlRpcRequest.ArgType.String); - xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { + XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "resend_activation_email"); + xmlRpcRequest.setListener(new XmlRpcRequestListener() { @Override - public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) { + public void onResponse(XmlRpcRequest request) { String result = request.getStringResponse(); - if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) { + if (request.getStatus() == XmlRpcRequest.Status.Ok) { if (result.startsWith("ERROR_")) { Log.e(result); listener.onError(result); @@ -337,7 +337,7 @@ public class XmlRpcHelper { } listener.onActivateAccountLinkSent(result); - } else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) { + } else if (request.getStatus() == XmlRpcRequest.Status.Failed) { Log.e(result); listener.onError(result); } @@ -348,12 +348,12 @@ public class XmlRpcHelper { } public void sendUsernameByEmailAsync(final XmlRpcListener listener, String email) { - LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("recover_username_from_email", LinphoneXmlRpcRequest.ArgType.String); - xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { + XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "recover_username_from_email"); + xmlRpcRequest.setListener(new XmlRpcRequestListener() { @Override - public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) { + public void onResponse(XmlRpcRequest request) { String result = request.getStringResponse(); - if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) { + if (request.getStatus() == XmlRpcRequest.Status.Ok) { if (result.startsWith("ERROR_")) { Log.e(result); listener.onError(result); @@ -361,7 +361,7 @@ public class XmlRpcHelper { } listener.onUsernameSent(result); - } else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) { + } else if (request.getStatus() == XmlRpcRequest.Status.Failed) { Log.e(result); listener.onError(result); } @@ -372,12 +372,12 @@ public class XmlRpcHelper { } public void verifySignatureAsync(final XmlRpcListener listener, String payload, String signature) { - LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("check_payload_signature", LinphoneXmlRpcRequest.ArgType.String); - xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { + XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "check_payload_signature"); + xmlRpcRequest.setListener(new XmlRpcRequestListener() { @Override - public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) { + public void onResponse(XmlRpcRequest request) { String result = request.getStringResponse(); - if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) { + if (request.getStatus() == XmlRpcRequest.Status.Ok) { Log.w(result); if (result.startsWith("ERROR_")) { Log.e(result); @@ -386,7 +386,7 @@ public class XmlRpcHelper { } listener.onSignatureVerified("OK".equals(result)); - } else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) { + } else if (request.getStatus() == XmlRpcRequest.Status.Failed) { Log.e(result); listener.onError(result); } @@ -398,12 +398,12 @@ public class XmlRpcHelper { } public void getRemoteProvisioningFilenameAsync(final XmlRpcListener listener,String username, String domain, String password) { - LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("get_remote_provisioning_filename", LinphoneXmlRpcRequest.ArgType.String); - xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() { + XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "get_remote_provisioning_filename"); + xmlRpcRequest.setListener(new XmlRpcRequestListener() { @Override - public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) { + public void onResponse(XmlRpcRequest request) { String result = request.getStringResponse(); - if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) { + if (request.getStatus() == XmlRpcRequest.Status.Ok) { if (result.startsWith("ERROR_")) { Log.e(result); listener.onError(result); @@ -411,7 +411,7 @@ public class XmlRpcHelper { } listener.onRemoteProvisioningFilenameSent(result); - } else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) { + } else if (request.getStatus() == XmlRpcRequest.Status.Failed) { Log.e(result); listener.onError(result); } diff --git a/submodules/linphone b/submodules/linphone index e10297ba6..2a9d4afef 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit e10297ba6df500b3154f539b11e4c44ded4a227a +Subproject commit 2a9d4afef2530dac32a07dd60180ef3f929e39b1 diff --git a/src/android/org/linphone/tutorials/AndroidTutorialNotifier.java b/tutorials/AndroidTutorialNotifier.java similarity index 100% rename from src/android/org/linphone/tutorials/AndroidTutorialNotifier.java rename to tutorials/AndroidTutorialNotifier.java index c5b55a720..a5d1ce735 100644 --- a/src/android/org/linphone/tutorials/AndroidTutorialNotifier.java +++ b/tutorials/AndroidTutorialNotifier.java @@ -19,11 +19,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import org.linphone.core.tutorials.TutorialNotifier; - import android.os.Handler; import android.widget.TextView; +import org.linphone.core.tutorials.TutorialNotifier; + /** * Write notifications to a TextView widget. * This is an helper class, not a test activity. diff --git a/src/android/org/linphone/tutorials/TutorialBuddyStatusActivity.java b/tutorials/TutorialBuddyStatusActivity.java similarity index 97% rename from src/android/org/linphone/tutorials/TutorialBuddyStatusActivity.java rename to tutorials/TutorialBuddyStatusActivity.java index 101150e7e..5f6323560 100644 --- a/src/android/org/linphone/tutorials/TutorialBuddyStatusActivity.java +++ b/tutorials/TutorialBuddyStatusActivity.java @@ -18,12 +18,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.linphone.tutorials; -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; import android.os.Handler; @@ -31,6 +25,12 @@ import android.view.View; import android.widget.Button; import android.widget.TextView; +import org.linphone.R; +import org.linphone.core.CoreException; +import org.linphone.core.tutorials.TutorialBuddyStatus; +import org.linphone.core.tutorials.TutorialNotifier; +import org.linphone.mediastream.Log; + /** * Activity for displaying and starting the BuddyStatus example on Android phone. * @@ -104,7 +104,7 @@ public class TutorialBuddyStatusActivity extends Activity { buttonCall.setEnabled(true); } }); - } catch (LinphoneCoreException e) { + } catch (CoreException e) { Log.e(e); } } diff --git a/src/android/org/linphone/tutorials/TutorialCardDavSync.java b/tutorials/TutorialCardDavSync.java similarity index 55% rename from src/android/org/linphone/tutorials/TutorialCardDavSync.java rename to tutorials/TutorialCardDavSync.java index 3474b5fbb..5f401ef95 100644 --- a/src/android/org/linphone/tutorials/TutorialCardDavSync.java +++ b/tutorials/TutorialCardDavSync.java @@ -19,40 +19,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import java.nio.ByteBuffer; -import java.util.Timer; -import java.util.TimerTask; - -import org.linphone.R; -import org.linphone.UIThreadDispatcher; -import org.linphone.core.LinphoneAddress; -import org.linphone.core.LinphoneAuthInfo; -import org.linphone.core.LinphoneCall; -import org.linphone.core.LinphoneCall.State; -import org.linphone.core.LinphoneCallStats; -import org.linphone.core.LinphoneChatMessage; -import org.linphone.core.LinphoneChatRoom; -import org.linphone.core.LinphoneContent; -import org.linphone.core.LinphoneCore; -import org.linphone.core.LinphoneCore.AuthMethod; -import org.linphone.core.LinphoneCore.EcCalibratorStatus; -import org.linphone.core.LinphoneCore.GlobalState; -import org.linphone.core.LinphoneCore.LogCollectionUploadState; -import org.linphone.core.LinphoneCore.RegistrationState; -import org.linphone.core.LinphoneCore.RemoteProvisioningState; -import org.linphone.core.LinphoneCoreException; -import org.linphone.core.LinphoneCoreFactory; -import org.linphone.core.LinphoneCoreListener; -import org.linphone.core.LinphoneEvent; -import org.linphone.core.LinphoneFriend; -import org.linphone.core.LinphoneFriendList; -import org.linphone.core.LinphoneFriendList.LinphoneFriendListListener; -import org.linphone.core.LinphoneInfoMessage; -import org.linphone.core.LinphoneProxyConfig; -import org.linphone.core.PublishState; -import org.linphone.core.SubscriptionState; -import org.linphone.mediastream.Log; - import android.app.Activity; import android.os.Bundle; import android.view.View; @@ -61,15 +27,49 @@ import android.widget.Button; import android.widget.EditText; import android.widget.TextView; -public class TutorialCardDavSync extends Activity implements OnClickListener, LinphoneCoreListener, LinphoneFriendListListener { +import org.linphone.R; +import org.linphone.UIThreadDispatcher; +import org.linphone.core.Address; +import org.linphone.core.AuthInfo; +import org.linphone.core.Call; +import org.linphone.core.Call.State; +import org.linphone.core.CallStats; +import org.linphone.core.ChatMessage; +import org.linphone.core.ChatRoom; +import org.linphone.core.Content; +import org.linphone.core.Core; +import org.linphone.core.Core.AuthMethod; +import org.linphone.core.Core.ConfiguringState; +import org.linphone.core.Core.EcCalibratorStatus; +import org.linphone.core.Core.GlobalState; +import org.linphone.core.Core.LogCollectionUploadState; +import org.linphone.core.Core.RegistrationState; +import org.linphone.core.CoreException; +import org.linphone.core.CoreListener; +import org.linphone.core.Event; +import org.linphone.core.Factory; +import org.linphone.core.Friend; +import org.linphone.core.FriendList; +import org.linphone.core.FriendList.FriendListListener; +import org.linphone.core.InfoMessage; +import org.linphone.core.ProxyConfig; +import org.linphone.core.PublishState; +import org.linphone.core.SubscriptionState; +import org.linphone.mediastream.Log; + +import java.nio.ByteBuffer; +import java.util.Timer; +import java.util.TimerTask; + +public class TutorialCardDavSync extends Activity implements OnClickListener, CoreListener, FriendListListener { private EditText username, password, ha1, server; private Button synchronize; private TextView logs; private Timer timer; - private LinphoneCore lc; - private LinphoneFriendList lfl; + private Core lc; + private FriendList lfl; @Override protected void onCreate(Bundle savedInstanceState) { @@ -85,9 +85,9 @@ public class TutorialCardDavSync extends Activity implements OnClickListener, Li synchronize = (Button) findViewById(R.id.carddav_synchronize); synchronize.setOnClickListener(this); - LinphoneCoreFactory.instance().setDebugMode(true, "CardDAV sync tutorial"); + Factory.instance().setDebugMode(true, "CardDAV sync tutorial"); try { - lc = LinphoneCoreFactory.instance().createLinphoneCore(this, this); + lc = Factory.instance().createCore(this, this); TimerTask lTask = new TimerTask() { @Override public void run() { @@ -104,13 +104,13 @@ public class TutorialCardDavSync extends Activity implements OnClickListener, Li timer = new Timer("Linphone scheduler"); timer.schedule(lTask, 0, 20); - lfl = lc.createLinphoneFriendList(); + lfl = lc.createFriendList(); lc.addFriendList(lfl); - LinphoneFriend lf = lc.createFriendWithAddress("sip:ghislain@sip.linphone.org"); + Friend lf = lc.createFriendWithAddress("sip:ghislain@sip.linphone.org"); lf.setName("Ghislain"); lfl.addLocalFriend(lf); // This is a local friend, it won't be sent to the CardDAV server and will be removed at the next synchronization - } catch (LinphoneCoreException e) { + } catch (CoreException e) { Log.e(e); } } @@ -119,7 +119,7 @@ public class TutorialCardDavSync extends Activity implements OnClickListener, Li protected void onDestroy() { try { lc.removeFriendList(lfl); - } catch (LinphoneCoreException e) { + } catch (CoreException e) { Log.e(e); } timer.cancel(); @@ -131,7 +131,7 @@ public class TutorialCardDavSync extends Activity implements OnClickListener, Li public void onClick(View v) { String serverUrl = server.getText().toString(); String serverDomain = serverUrl.replace("http://", "").replace("https://", "").split("/")[0]; // We just want the domain name - LinphoneAuthInfo authInfo = LinphoneCoreFactory.instance().createAuthInfo(username.getText().toString(), null, password.getText().toString(), ha1.getText().toString(), "SabreDAV", serverDomain); + AuthInfo authInfo = Factory.instance().createAuthInfo(username.getText().toString(), null, password.getText().toString(), ha1.getText().toString(), "SabreDAV", serverDomain); lc.addAuthInfo(authInfo); lfl.setUri(serverUrl); @@ -146,273 +146,273 @@ public class TutorialCardDavSync extends Activity implements OnClickListener, Li } @Override - public void onLinphoneFriendCreated(LinphoneFriendList list, - LinphoneFriend lf) { + public void onContactCreated(FriendList list, + Friend lf) { // TODO Auto-generated method stub String msg = "Friend created " + lf.getAddress(); myLog(msg); - LinphoneFriend[] friends = list.getFriendList(); + Friend[] friends = list.getFriendsLists(); String msg2 = "There are " + friends.length + (friends.length > 1 ? " friends" : " friend") + " in the list"; myLog(msg2); } @Override - public void onLinphoneFriendUpdated(LinphoneFriendList list, - LinphoneFriend newFriend, LinphoneFriend oldFriend) { + public void onContactUpdated(FriendList list, + Friend newFriend, Friend oldFriend) { // TODO Auto-generated method stub String msg = "Friend updated " + newFriend.getAddress(); myLog(msg); - LinphoneFriend[] friends = list.getFriendList(); + Friend[] friends = list.getFriendsLists(); String msg2 = "There are " + friends.length + (friends.length > 1 ? " friends" : " friend") + " in the list"; myLog(msg2); } @Override - public void onLinphoneFriendDeleted(LinphoneFriendList list, - LinphoneFriend lf) { + public void onContactDeleted(FriendList list, + Friend lf) { // TODO Auto-generated method stub String msg = "Friend removed " + lf.getAddress(); myLog(msg); - LinphoneFriend[] friends = list.getFriendList(); + Friend[] friends = list.getFriendsLists(); String msg2 = "There are " + friends.length + (friends.length > 1 ? " friends" : " friend") + " in the list"; myLog(msg2); } @Override - public void onLinphoneFriendSyncStatusChanged(LinphoneFriendList list, LinphoneFriendList.State status, String message) { + public void onSyncStatusChanged(FriendList list, FriendList.State status, String message) { // TODO Auto-generated method stub String msg = "Sync status changed: " + status.toString() + " (" + message + ")"; myLog(msg); - if (status != LinphoneFriendList.State.SyncStarted) { + if (status != FriendList.State.SyncStarted) { synchronize.setEnabled(true); } } @Override - public void friendListCreated(LinphoneCore lc, LinphoneFriendList list) { + public void onFriendListCreated(Core lc, FriendList list) { // TODO Auto-generated method stub String msg = "Friend List added"; myLog(msg); - LinphoneFriendList[] lists = lc.getFriendLists(); + FriendList[] lists = lc.getFriendsLists(); String msg2 = "There are " + lists.length + (lists.length > 1 ? " lists" : " list") + " in the core"; myLog(msg2); } @Override - public void friendListRemoved(LinphoneCore lc, LinphoneFriendList list) { + public void onFriendListRemoved(Core lc, FriendList list) { // TODO Auto-generated method stub String msg = "Friend List removed"; myLog(msg); - LinphoneFriendList[] lists = lc.getFriendLists(); + FriendList[] lists = lc.getFriendsLists(); String msg2 = "There are " + lists.length + (lists.length > 1 ? " lists" : " list") + " in the core"; myLog(msg2); } @Override - public void networkReachableChanged(LinphoneCore lc, boolean enable) { + public void onNetworkReachable(Core lc, boolean enable) { } @Override - public void callStatsUpdated(LinphoneCore lc, LinphoneCall call, - LinphoneCallStats stats) { + public void onCallStatsUpdated(Core lc, Call call, + CallStats stats) { // TODO Auto-generated method stub } @Override - public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf, + public void onNewSubscriptionRequested(Core lc, Friend lf, String url) { // TODO Auto-generated method stub } @Override - public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) { + public void onNotifyPresenceReceived(Core lc, Friend lf) { // TODO Auto-generated method stub } @Override - public void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf) { + public void onDtmfReceived(Core lc, Call call, int dtmf) { // TODO Auto-generated method stub } @Override - public void notifyReceived(LinphoneCore lc, LinphoneCall call, - LinphoneAddress from, byte[] event) { + public void removed(Core lc, Call call, + Address from, byte[] event) { // TODO Auto-generated method stub } @Override - public void transferState(LinphoneCore lc, LinphoneCall call, + public void onTransferStateChanged(Core lc, Call call, State new_call_state) { // TODO Auto-generated method stub } @Override - public void infoReceived(LinphoneCore lc, LinphoneCall call, - LinphoneInfoMessage info) { + public void onInfoReceived(Core lc, Call call, + InfoMessage info) { // TODO Auto-generated method stub } @Override - public void subscriptionStateChanged(LinphoneCore lc, LinphoneEvent ev, + public void onSubscriptionStateChanged(Core lc, Event ev, SubscriptionState state) { // TODO Auto-generated method stub } @Override - public void publishStateChanged(LinphoneCore lc, LinphoneEvent ev, + public void onPublishStateChanged(Core lc, Event ev, PublishState state) { // TODO Auto-generated method stub } @Override - public void show(LinphoneCore lc) { + public void removed( lc) { // TODO Auto-generated method stub } @Override - public void displayStatus(LinphoneCore lc, String message) { + public void removed(Core lc, String message) { // TODO Auto-generated method stub } @Override - public void displayMessage(LinphoneCore lc, String message) { + public void removed(Core lc, String message) { // TODO Auto-generated method stub } @Override - public void displayWarning(LinphoneCore lc, String message) { + public void removed(Core lc, String message) { // TODO Auto-generated method stub } @Override - public void fileTransferProgressIndication(LinphoneCore lc, - LinphoneChatMessage message, LinphoneContent content, int progress) { + public void removed(Core lc, + ChatMessage message, Content content, int progress) { // TODO Auto-generated method stub } @Override - public void fileTransferRecv(LinphoneCore lc, LinphoneChatMessage message, - LinphoneContent content, byte[] buffer, int size) { + public void removed(Core lc, ChatMessage message, + Content content, byte[] buffer, int size) { // TODO Auto-generated method stub } @Override - public int fileTransferSend(LinphoneCore lc, LinphoneChatMessage message, - LinphoneContent content, ByteBuffer buffer, int size) { + public int removed(Core lc, ChatMessage message, + Content content, ByteBuffer buffer, int size) { // TODO Auto-generated method stub return 0; } @Override - public void globalState(LinphoneCore lc, GlobalState state, String message) { + public void onGlobalStateChanged(Core lc, GlobalState state, String message) { // TODO Auto-generated method stub } @Override - public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, + public void onRegistrationStateChanged(Core lc, ProxyConfig cfg, RegistrationState state, String smessage) { // TODO Auto-generated method stub } @Override - public void configuringStatus(LinphoneCore lc, - RemoteProvisioningState state, String message) { + public void onConfiguringStatus(Core lc, + ConfiguringState state, String message) { // TODO Auto-generated method stub } @Override - public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, - LinphoneChatMessage message) { + public void onMessageReceived(Core lc, ChatRoom cr, + ChatMessage message) { // TODO Auto-generated method stub } @Override - public void messageReceivedUnableToDecrypted(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) { + public void removed(Core lc, ChatRoom cr, ChatMessage message) { } @Override - public void callState(LinphoneCore lc, LinphoneCall call, State state, + public void onCallStateChanged(Core lc, Call call, State state, String message) { // TODO Auto-generated method stub } @Override - public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call, + public void onCallEncryptionChanged(Core lc, Call call, boolean encrypted, String authenticationToken) { // TODO Auto-generated method stub } @Override - public void notifyReceived(LinphoneCore lc, LinphoneEvent ev, - String eventName, LinphoneContent content) { + public void onNotifyReceived(Core lc, Event ev, + String eventName, Content content) { // TODO Auto-generated method stub } @Override - public void isComposingReceived(LinphoneCore lc, LinphoneChatRoom cr) { + public void onIsComposingReceived(Core lc, ChatRoom cr) { // TODO Auto-generated method stub } @Override - public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status, + public void onEcCalibrationResult(Core lc, EcCalibratorStatus status, int delay_ms, Object data) { // TODO Auto-generated method stub } @Override - public void uploadProgressIndication(LinphoneCore lc, int offset, int total) { + public void onLogCollectionUploadProgressIndication(Core lc, int offset, int total) { // TODO Auto-generated method stub } @Override - public void uploadStateChanged(LinphoneCore lc, + public void onLogCollectionUploadStateChanged(Core lc, LogCollectionUploadState state, String info) { // TODO Auto-generated method stub } @Override - public void authInfoRequested(LinphoneCore lc, String realm, + public void removed(Core lc, String realm, String username, String domain) { // TODO Auto-generated method stub } @Override - public void authenticationRequested(LinphoneCore lc, - LinphoneAuthInfo authInfo, AuthMethod method) { + public void onAuthenticationRequested(Core lc, + AuthInfo authInfo, AuthMethod method) { // TODO Auto-generated method stub } diff --git a/src/android/org/linphone/tutorials/TutorialChatRoomActivity.java b/tutorials/TutorialChatRoomActivity.java similarity index 97% rename from src/android/org/linphone/tutorials/TutorialChatRoomActivity.java rename to tutorials/TutorialChatRoomActivity.java index c93e2cd0a..8db381c02 100644 --- a/src/android/org/linphone/tutorials/TutorialChatRoomActivity.java +++ b/tutorials/TutorialChatRoomActivity.java @@ -19,12 +19,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -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; import android.os.Handler; @@ -32,6 +26,12 @@ import android.view.View; import android.widget.Button; import android.widget.TextView; +import org.linphone.R; +import org.linphone.core.CoreException; +import org.linphone.core.tutorials.TutorialChatRoom; +import org.linphone.core.tutorials.TutorialNotifier; +import org.linphone.mediastream.Log; + /** * Activity for displaying and starting the chatroom example on Android phone. * @@ -92,7 +92,7 @@ public class TutorialChatRoomActivity extends Activity { buttonCall.setEnabled(true); } }); - } catch (LinphoneCoreException e) { + } catch (CoreException e) { Log.e(e); } } diff --git a/src/android/org/linphone/tutorials/TutorialHelloWorldActivity.java b/tutorials/TutorialHelloWorldActivity.java similarity index 97% rename from src/android/org/linphone/tutorials/TutorialHelloWorldActivity.java rename to tutorials/TutorialHelloWorldActivity.java index 3562bac29..82bb8dda9 100644 --- a/src/android/org/linphone/tutorials/TutorialHelloWorldActivity.java +++ b/tutorials/TutorialHelloWorldActivity.java @@ -18,12 +18,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.linphone.tutorials; -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; import android.os.Handler; @@ -31,6 +25,12 @@ import android.view.View; import android.widget.Button; import android.widget.TextView; +import org.linphone.R; +import org.linphone.core.CoreException; +import org.linphone.core.tutorials.TutorialHelloWorld; +import org.linphone.core.tutorials.TutorialNotifier; +import org.linphone.mediastream.Log; + /** * Activity for displaying and starting the HelloWorld example on Android phone. * @@ -93,7 +93,7 @@ public class TutorialHelloWorldActivity extends Activity { buttonCall.setEnabled(true); } }); - } catch (LinphoneCoreException e) { + } catch (CoreException e) { Log.e(e); } } diff --git a/src/android/org/linphone/tutorials/TutorialLauncherActivity.java b/tutorials/TutorialLauncherActivity.java similarity index 100% rename from src/android/org/linphone/tutorials/TutorialLauncherActivity.java rename to tutorials/TutorialLauncherActivity.java index 1323ec529..18b02de91 100644 --- a/src/android/org/linphone/tutorials/TutorialLauncherActivity.java +++ b/tutorials/TutorialLauncherActivity.java @@ -18,13 +18,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import org.linphone.R; - import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; +import org.linphone.R; + public class TutorialLauncherActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { diff --git a/src/android/org/linphone/tutorials/TutorialRegistrationActivity.java b/tutorials/TutorialRegistrationActivity.java similarity index 97% rename from src/android/org/linphone/tutorials/TutorialRegistrationActivity.java rename to tutorials/TutorialRegistrationActivity.java index a781bc624..211761758 100644 --- a/src/android/org/linphone/tutorials/TutorialRegistrationActivity.java +++ b/tutorials/TutorialRegistrationActivity.java @@ -19,18 +19,18 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -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; import android.view.View; import android.widget.Button; import android.widget.TextView; +import org.linphone.R; +import org.linphone.core.CoreException; +import org.linphone.core.tutorials.TutorialNotifier; +import org.linphone.core.tutorials.TutorialRegistration; +import org.linphone.mediastream.Log; + /** * Activity for displaying and starting the registration example on Android phone. * @@ -96,7 +96,7 @@ public class TutorialRegistrationActivity extends TutorialHelloWorldActivity { tutorial.launchTutorial( sipAddressWidget.getText().toString(), sipPasswordWidget.getText().toString()); - } catch (LinphoneCoreException e) { + } catch (CoreException e) { Log.e(e); outputText.setText(e.getMessage() +"\n"+outputText.getText()); } From 809a29c8fe07395d073e2c99de1591791ad4bd52 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 18 Oct 2017 09:39:11 +0200 Subject: [PATCH 58/72] Fixes and improvements on previous migration --- .../org/linphone/CallVideoFragment.java | 15 +- src/android/org/linphone/ChatFragment.java | 2 +- src/android/org/linphone/ContactsManager.java | 6 +- src/android/org/linphone/LinphoneContact.java | 8 +- src/android/org/linphone/LinphoneManager.java | 163 ++++++++++-------- .../org/linphone/LinphonePreferences.java | 8 +- .../assistant/CodecDownloaderFragment.java | 6 +- .../EchoCancellerCalibrationFragment.java | 2 +- .../org/linphone/ui/LinphoneOverlay.java | 4 +- 9 files changed, 127 insertions(+), 87 deletions(-) diff --git a/src/android/org/linphone/CallVideoFragment.java b/src/android/org/linphone/CallVideoFragment.java index 957b60f0e..2adf658be 100644 --- a/src/android/org/linphone/CallVideoFragment.java +++ b/src/android/org/linphone/CallVideoFragment.java @@ -147,10 +147,17 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On public void switchCamera() { try { - /*int videoDeviceId = LinphoneManager.getLc().getVideoDevice(); - videoDeviceId = (videoDeviceId + 1) % AndroidCameraConfiguration.retrieveCameras().length; - LinphoneManager.getLc().setVideoDevice(videoDeviceId);*/ - Log.e("TODO FIXME switchCamera"); + String currentDevice = LinphoneManager.getLc().getVideoDevice(); + String[] devices = LinphoneManager.getLc().getVideoDevicesList(); + int index = 0; + for (String d : devices) { + if (d == currentDevice) { + break; + } + index++; + } + String newDevice = devices[(index + 1) % devices.length]; + LinphoneManager.getLc().setVideoDevice(newDevice); CallManager.getInstance().updateCall(); diff --git a/src/android/org/linphone/ChatFragment.java b/src/android/org/linphone/ChatFragment.java index 76178bec5..cd1e68dbf 100644 --- a/src/android/org/linphone/ChatFragment.java +++ b/src/android/org/linphone/ChatFragment.java @@ -112,7 +112,7 @@ interface ChatUpdatedListener { void onChatUpdated(); } -public class ChatFragment extends Fragment implements OnClickListener, ChatMessageListener, ContactsUpdatedListener{ +public class ChatFragment extends Fragment implements OnClickListener, ChatMessageListener, ContactsUpdatedListener { private static final int ADD_PHOTO = 1337; private static final int MENU_DELETE_MESSAGE = 0; private static final int MENU_PICTURE_SMALL = 2; diff --git a/src/android/org/linphone/ContactsManager.java b/src/android/org/linphone/ContactsManager.java index 2d278cc39..9f1feb780 100644 --- a/src/android/org/linphone/ContactsManager.java +++ b/src/android/org/linphone/ContactsManager.java @@ -289,7 +289,7 @@ public class ContactsManager extends ContentObserver { } else { if (friend.getRefKey() != null) { // Friend has a refkey and but no LinphoneContact => represents a native contact stored in db from a previous version of Linphone, remove it - //lc.removeFriend(friend); //TODO FIXME + list.removeFriend(friend); } else { // No refkey so it's a standalone contact contact = new LinphoneContact(); @@ -359,7 +359,9 @@ public class ContactsManager extends ContentObserver { String id = contact.getAndroidId(); if (id != null && !nativeIds.contains(id)) { // Has been removed since last fetch - //lc.removeFriend(contact.getFriend()); //TODO FIXME + for (FriendList list : lc.getFriendsLists()) { + list.removeFriend(contact.getFriend()); + } contacts.remove(contact); } } diff --git a/src/android/org/linphone/LinphoneContact.java b/src/android/org/linphone/LinphoneContact.java index aa12ccee9..82d848e0e 100644 --- a/src/android/org/linphone/LinphoneContact.java +++ b/src/android/org/linphone/LinphoneContact.java @@ -30,6 +30,7 @@ import org.linphone.core.Core; import org.linphone.core.CoreException; import org.linphone.core.Friend; import org.linphone.core.Friend.SubscribePolicy; +import org.linphone.core.FriendList; import org.linphone.core.PresenceBasicStatus; import org.linphone.core.PresenceModel; import org.linphone.mediastream.Log; @@ -486,8 +487,11 @@ public class LinphoneContact implements Serializable, Comparable Date: Wed, 18 Oct 2017 10:55:50 +0200 Subject: [PATCH 59/72] Compilation of Android app is fixed --- src/android/org/linphone/DozeReceiver.java | 3 ++- .../org/linphone/KeepAliveReceiver.java | 3 ++- src/android/org/linphone/LinphoneManager.java | 26 ++----------------- .../org/linphone/LinphonePreferences.java | 3 ++- src/android/org/linphone/LinphoneService.java | 3 ++- src/android/org/linphone/ui/Digit.java | 5 ++-- submodules/linphone | 2 +- 7 files changed, 14 insertions(+), 31 deletions(-) diff --git a/src/android/org/linphone/DozeReceiver.java b/src/android/org/linphone/DozeReceiver.java index 962a52c6d..e66a41ccd 100644 --- a/src/android/org/linphone/DozeReceiver.java +++ b/src/android/org/linphone/DozeReceiver.java @@ -21,6 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. import org.linphone.core.Core; import org.linphone.core.Factory; +import org.linphone.core.LogCollectionState; import org.linphone.mediastream.Log; import android.content.Context; @@ -38,7 +39,7 @@ public class DozeReceiver extends android.content.BroadcastReceiver { if (!LinphoneService.isReady()) return; boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled(); - Factory.instance().enableLogCollection(isDebugEnabled); + Factory.instance().enableLogCollection(isDebugEnabled ? LogCollectionState.Enabled : LogCollectionState.Disabled); Factory.instance().setDebugMode(isDebugEnabled, context.getString(R.string.app_name)); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc == null) return; diff --git a/src/android/org/linphone/KeepAliveReceiver.java b/src/android/org/linphone/KeepAliveReceiver.java index 072b820c4..172c12e6a 100644 --- a/src/android/org/linphone/KeepAliveReceiver.java +++ b/src/android/org/linphone/KeepAliveReceiver.java @@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. import org.linphone.compatibility.Compatibility; import org.linphone.core.Core; import org.linphone.core.Factory; +import org.linphone.core.LogCollectionState; import org.linphone.mediastream.Log; import android.app.AlarmManager; @@ -41,7 +42,7 @@ public class KeepAliveReceiver extends BroadcastReceiver { return; } else { boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled(); - Factory.instance().enableLogCollection(isDebugEnabled); + Factory.instance().enableLogCollection(isDebugEnabled ? LogCollectionState.Enabled : LogCollectionState.Disabled); Factory.instance().setDebugMode(isDebugEnabled, context.getString(R.string.app_name)); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc == null) return; diff --git a/src/android/org/linphone/LinphoneManager.java b/src/android/org/linphone/LinphoneManager.java index 05439897e..b155d1b33 100644 --- a/src/android/org/linphone/LinphoneManager.java +++ b/src/android/org/linphone/LinphoneManager.java @@ -487,8 +487,7 @@ public class LinphoneManager implements CoreListener, ChatMessageListener, Senso if (isInstanciated() && lc != null && isPresenceModelActivitySet() && lc.getPresenceModel().getActivity().getType() != PresenceActivityType.TV) { lc.getPresenceModel().getActivity().setType(PresenceActivityType.TV); } else if (isInstanciated() && lc != null && !isPresenceModelActivitySet()) { - PresenceModel model = lc.createPresenceModel();//PresenceActivityType.TV, null); - model = model.newWithActivity(PresenceActivityType.TV, null); + PresenceModel model = lc.createPresenceModelWithActivity(PresenceActivityType.TV, null); lc.setPresenceModel(model); } } @@ -498,8 +497,7 @@ public class LinphoneManager implements CoreListener, ChatMessageListener, Senso if (isInstanciated() && isPresenceModelActivitySet() && lc.getPresenceModel().getActivity().getType() != PresenceActivityType.OnThePhone) { lc.getPresenceModel().getActivity().setType(PresenceActivityType.OnThePhone); } else if (isInstanciated() && !isPresenceModelActivitySet()) { - PresenceModel model = lc.createPresenceModel();//PresenceActivityType.OnThePhone, null); - model = model.newWithActivity(PresenceActivityType.OnThePhone, null); + PresenceModel model = lc.createPresenceModelWithActivity(PresenceActivityType.OnThePhone, null); lc.setPresenceModel(model); } } @@ -666,16 +664,6 @@ public class LinphoneManager implements CoreListener, ChatMessageListener, Senso } } - @Override - public void onParticipantAdded(ChatRoom cr, Participant participant) { - - } - - @Override - public void onSubjectChanged(ChatRoom cr, String subject) { - - } - @Override public void onMessageReceived(ChatRoom cr, ChatMessage msg) { @@ -686,16 +674,6 @@ public class LinphoneManager implements CoreListener, ChatMessageListener, Senso } - @Override - public void onParticipantAdminStatusChanged(ChatRoom cr, Participant participant, boolean isAdmin) { - - } - - @Override - public void onParticipantRemoved(ChatRoom cr, Participant participant) { - - } - public static interface AddressType { void setText(CharSequence s); CharSequence getText(); diff --git a/src/android/org/linphone/LinphonePreferences.java b/src/android/org/linphone/LinphonePreferences.java index 82cc44d5d..197da2e87 100644 --- a/src/android/org/linphone/LinphonePreferences.java +++ b/src/android/org/linphone/LinphonePreferences.java @@ -31,6 +31,7 @@ import org.linphone.core.AuthInfo; import org.linphone.core.Core; import org.linphone.core.Core.LimeState; import org.linphone.core.Core.MediaEncryption; +import org.linphone.core.LogCollectionState; import org.linphone.core.Transports; import org.linphone.core.CoreException; import org.linphone.core.Factory; @@ -1191,7 +1192,7 @@ public class LinphonePreferences { // Advanced settings public void setDebugEnabled(boolean enabled) { getConfig().setBool("app", "debug", enabled); - Factory.instance().enableLogCollection(enabled); + Factory.instance().enableLogCollection(LogCollectionState.Enabled); Factory.instance().setDebugMode(enabled, getString(R.string.app_name)); } diff --git a/src/android/org/linphone/LinphoneService.java b/src/android/org/linphone/LinphoneService.java index 6c13de01b..c77c2e1d6 100644 --- a/src/android/org/linphone/LinphoneService.java +++ b/src/android/org/linphone/LinphoneService.java @@ -34,6 +34,7 @@ import org.linphone.core.Core.RegistrationState; import org.linphone.core.CoreException; import org.linphone.core.Factory; import org.linphone.core.CoreListenerStub; +import org.linphone.core.LogCollectionState; import org.linphone.core.ProxyConfig; import org.linphone.mediastream.Log; import org.linphone.mediastream.Version; @@ -299,7 +300,7 @@ public final class LinphoneService extends Service { LinphonePreferences.instance().setContext(getBaseContext()); Factory.instance().setLogCollectionPath(getFilesDir().getAbsolutePath()); boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled(); - Factory.instance().enableLogCollection(isDebugEnabled); + Factory.instance().enableLogCollection(LogCollectionState.Enabled); Factory.instance().setDebugMode(isDebugEnabled, getString(R.string.app_name)); // Dump some debugging information to the logs diff --git a/src/android/org/linphone/ui/Digit.java b/src/android/org/linphone/ui/Digit.java index 31e773981..7733b02b2 100644 --- a/src/android/org/linphone/ui/Digit.java +++ b/src/android/org/linphone/ui/Digit.java @@ -26,6 +26,7 @@ import org.linphone.LinphoneService; import org.linphone.R; import org.linphone.core.Core; import org.linphone.core.Factory; +import org.linphone.core.LogCollectionState; import org.linphone.mediastream.Log; import android.app.AlertDialog; @@ -138,7 +139,7 @@ public class Digit extends Button implements AddressAware { public void onClick(DialogInterface dialog, int which) { if(which == 0){ LinphonePreferences.instance().setDebugEnabled(false); - Factory.instance().enableLogCollection(false); + Factory.instance().enableLogCollection(LogCollectionState.Disabled); } if(which == 1) { Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); @@ -154,7 +155,7 @@ public class Digit extends Button implements AddressAware { public void onClick(DialogInterface dialog, int which) { if(which == 0) { LinphonePreferences.instance().setDebugEnabled(true); - Factory.instance().enableLogCollection(true); + Factory.instance().enableLogCollection(LogCollectionState.Enabled); } } }); diff --git a/submodules/linphone b/submodules/linphone index 2a9d4afef..e21f193a5 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 2a9d4afef2530dac32a07dd60180ef3f929e39b1 +Subproject commit e21f193a574ac6616e6c275534a002781293e60c From e2bbbd7702ab105492570eee10e5c6ddd8d47036 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 18 Oct 2017 11:23:51 +0200 Subject: [PATCH 60/72] Updated linphone --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index e21f193a5..9f98fa5f6 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit e21f193a574ac6616e6c275534a002781293e60c +Subproject commit 9f98fa5f6c73f482e2b089fc2e3012d4275db549 From 90271b558b578e1c6dd7e288eb3d72f06298dc7d Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 18 Oct 2017 13:17:41 +0200 Subject: [PATCH 61/72] Updated liblinphone --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index 9f98fa5f6..12e1ccfe5 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 9f98fa5f6c73f482e2b089fc2e3012d4275db549 +Subproject commit 12e1ccfe58eb0b59410199bb4a111f390e8eb6ad From bc64f13563278b297180e9cee3edf39ee8267430 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 18 Oct 2017 13:35:48 +0200 Subject: [PATCH 62/72] Updated submodules --- submodules/bctoolbox | 2 +- submodules/linphone | 2 +- submodules/mediastreamer2 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/submodules/bctoolbox b/submodules/bctoolbox index f479ecd07..2adc98d22 160000 --- a/submodules/bctoolbox +++ b/submodules/bctoolbox @@ -1 +1 @@ -Subproject commit f479ecd07f5ed8577afec2c36bb9efbdbe0317be +Subproject commit 2adc98d22e70e9ca74631a04854cfe1e289e18fb diff --git a/submodules/linphone b/submodules/linphone index 12e1ccfe5..f1e0a4440 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 12e1ccfe58eb0b59410199bb4a111f390e8eb6ad +Subproject commit f1e0a444018a655088057e84f078dc9ac90f4211 diff --git a/submodules/mediastreamer2 b/submodules/mediastreamer2 index 7666b7580..b7e4901fb 160000 --- a/submodules/mediastreamer2 +++ b/submodules/mediastreamer2 @@ -1 +1 @@ -Subproject commit 7666b75803e8aa3df88183a40ec4f6b8a04f2018 +Subproject commit b7e4901fb8bc4b1095b5dcddd691ae288cd86d0e From ff69d006123b36aaa94702ae47b89459330c6350 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 18 Oct 2017 14:28:50 +0200 Subject: [PATCH 63/72] Fixed echo canceller calibration --- src/android/org/linphone/LinphoneManager.java | 2 +- src/android/org/linphone/SettingsFragment.java | 7 ++++++- .../assistant/EchoCancellerCalibrationFragment.java | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/android/org/linphone/LinphoneManager.java b/src/android/org/linphone/LinphoneManager.java index b155d1b33..beb784a0f 100644 --- a/src/android/org/linphone/LinphoneManager.java +++ b/src/android/org/linphone/LinphoneManager.java @@ -1542,7 +1542,7 @@ public class LinphoneManager implements CoreListener, ChatMessageListener, Senso boolean encrypted, String authenticationToken) { } - public void startEcCalibration(CoreListener l) throws CoreException { + public void startEcCalibration() throws CoreException { routeAudioToSpeaker(); setAudioManagerInCallMode(); Log.i("Set audio mode on 'Voice Communication'"); diff --git a/src/android/org/linphone/SettingsFragment.java b/src/android/org/linphone/SettingsFragment.java index 368dc1c59..8f6f91b53 100644 --- a/src/android/org/linphone/SettingsFragment.java +++ b/src/android/org/linphone/SettingsFragment.java @@ -50,6 +50,7 @@ import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.media.AudioManager; import android.net.Uri; +import android.net.wifi.WifiManager; import android.os.Build; import android.os.Bundle; import android.os.Handler; @@ -97,6 +98,7 @@ public class SettingsFragment extends PreferencesListFragment { mListener = new CoreListenerStub() { @Override public void onEcCalibrationResult(Core lc, Core.EcCalibratorStatus status, int delayMs) { + lc.removeListener(mListener); LinphoneManager.getInstance().routeAudioToReceiver(); CheckBoxPreference echoCancellation = (CheckBoxPreference) findPreference(getString(R.string.pref_echo_cancellation_key)); @@ -540,6 +542,7 @@ public class SettingsFragment extends PreferencesListFragment { public boolean onPreferenceChange(Preference preference, Object newValue) { boolean enable = (Boolean) newValue; pt.enable(enable); + ((CheckBoxPreference)preference).setChecked(enable); return true; } }); @@ -662,7 +665,8 @@ public class SettingsFragment extends PreferencesListFragment { try { if (LinphoneManager.getInstance().getEchoTesterStatus()) stopEchoTester(); - LinphoneManager.getInstance().startEcCalibration(mListener); + LinphoneManager.getLc().addListener(mListener); + LinphoneManager.getInstance().startEcCalibration(); } catch (CoreException e) { Log.e(e); } @@ -747,6 +751,7 @@ public class SettingsFragment extends PreferencesListFragment { } } pt.enable(enable); + ((CheckBoxPreference)preference).setChecked(enable); return true; } }); diff --git a/src/android/org/linphone/assistant/EchoCancellerCalibrationFragment.java b/src/android/org/linphone/assistant/EchoCancellerCalibrationFragment.java index 8f9e49b6f..aa85c34d2 100644 --- a/src/android/org/linphone/assistant/EchoCancellerCalibrationFragment.java +++ b/src/android/org/linphone/assistant/EchoCancellerCalibrationFragment.java @@ -57,6 +57,7 @@ public class EchoCancellerCalibrationFragment extends Fragment implements XmlRpc mListener = new CoreListenerStub(){ @Override public void onEcCalibrationResult(Core lc, Core.EcCalibratorStatus status, int delay_ms) { + lc.removeListener(mListener); LinphoneManager.getInstance().routeAudioToReceiver(); if (mSendEcCalibrationResult) { sendEcCalibrationResult(status, delay_ms); @@ -76,7 +77,8 @@ public class EchoCancellerCalibrationFragment extends Fragment implements XmlRpc xmlRpcRequest.setListener(this); try { - LinphoneManager.getInstance().startEcCalibration(mListener); + LinphoneManager.getLc().addListener(mListener); + LinphoneManager.getInstance().startEcCalibration(); } catch (CoreException e) { Log.e(e, "Unable to calibrate EC"); AssistantActivity.instance().isEchoCalibrationFinished(); From c87d93611d2f8dedebe3939f64083284ff6efe19 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 18 Oct 2017 14:39:42 +0200 Subject: [PATCH 64/72] Fixed findAuthInfo calls --- src/android/org/linphone/LinphonePreferences.java | 6 +++--- src/android/org/linphone/SettingsFragment.java | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/android/org/linphone/LinphonePreferences.java b/src/android/org/linphone/LinphonePreferences.java index 197da2e87..45e10524b 100644 --- a/src/android/org/linphone/LinphonePreferences.java +++ b/src/android/org/linphone/LinphonePreferences.java @@ -161,7 +161,7 @@ public class LinphonePreferences { ProxyConfig prxCfg = getProxyConfig(n); if (prxCfg == null) return null; Address addr = prxCfg.getIdentityAddress(); - AuthInfo authInfo = getLc().findAuthInfo(addr.getUsername(), null, addr.getDomain()); + AuthInfo authInfo = getLc().findAuthInfo(null, addr.getUsername(), addr.getDomain()); return authInfo; } @@ -1089,7 +1089,7 @@ public class LinphonePreferences { public void setTurnUsername(String username) { NatPolicy nat = getOrCreateNatPolicy(); - AuthInfo authInfo = getLc().findAuthInfo(nat.getStunServerUsername(), null, null); + AuthInfo authInfo = getLc().findAuthInfo(null, nat.getStunServerUsername(), null); if (authInfo != null) { AuthInfo cloneAuthInfo = authInfo.clone(); @@ -1107,7 +1107,7 @@ public class LinphonePreferences { public void setTurnPassword(String password) { NatPolicy nat = getOrCreateNatPolicy(); - AuthInfo authInfo = getLc().findAuthInfo(nat.getStunServerUsername(), null, null); + AuthInfo authInfo = getLc().findAuthInfo(null, nat.getStunServerUsername(), null); if (authInfo != null) { AuthInfo cloneAuthInfo = authInfo.clone(); diff --git a/src/android/org/linphone/SettingsFragment.java b/src/android/org/linphone/SettingsFragment.java index 8f6f91b53..7774d8727 100644 --- a/src/android/org/linphone/SettingsFragment.java +++ b/src/android/org/linphone/SettingsFragment.java @@ -751,7 +751,6 @@ public class SettingsFragment extends PreferencesListFragment { } } pt.enable(enable); - ((CheckBoxPreference)preference).setChecked(enable); return true; } }); From a408e61437c370d623a659e62ae46835d791b8bd Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 18 Oct 2017 15:27:43 +0200 Subject: [PATCH 65/72] Fixed outgoing file transfer --- src/android/org/linphone/ChatFragment.java | 4 ++-- src/android/org/linphone/LinphoneManager.java | 1 + submodules/linphone | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/android/org/linphone/ChatFragment.java b/src/android/org/linphone/ChatFragment.java index cd1e68dbf..5b802c950 100644 --- a/src/android/org/linphone/ChatFragment.java +++ b/src/android/org/linphone/ChatFragment.java @@ -1101,7 +1101,7 @@ public class ChatFragment extends Fragment implements OnClickListener, ChatMessa } String fileName = path.substring(path.lastIndexOf("/") + 1); String extension = LinphoneUtils.getExtensionFromFileName(fileName); - Content content = chatRoom.getCore().createContent(); // "image", extension, result, null + Content content = Factory.instance().createContent(); // "image", extension, result, null content.setType("image"); content.setSubtype(extension); content.setBuffer(result, result.length); @@ -1158,7 +1158,7 @@ public class ChatFragment extends Fragment implements OnClickListener, ChatMessa String fileName = path.substring(path.lastIndexOf("/") + 1); String extension = LinphoneUtils.getExtensionFromFileName(fileName); - Content content = chatRoom.getCore().createContent();//"file", extension, result, null + Content content = Factory.instance().createContent();//"file", extension, result, null content.setType("file"); content.setSubtype(extension); content.setBuffer(result, result.length); diff --git a/src/android/org/linphone/LinphoneManager.java b/src/android/org/linphone/LinphoneManager.java index beb784a0f..1fd1d3528 100644 --- a/src/android/org/linphone/LinphoneManager.java +++ b/src/android/org/linphone/LinphoneManager.java @@ -460,6 +460,7 @@ public class LinphoneManager implements CoreListener, ChatMessageListener, Senso } bufferToFill.setContent(data, size); bufferToFill.setSize(size); + return bufferToFill; } else { Log.e("Error, upload task asking for more bytes( " + (size+offset) + " ) than available (" + mUploadingImage.length + ")"); } diff --git a/submodules/linphone b/submodules/linphone index f1e0a4440..a9e3caf17 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit f1e0a444018a655088057e84f078dc9ac90f4211 +Subproject commit a9e3caf17f8c233f5ab9a517a1382c6fd3453a24 From 0590ef5846be242c26d0b59b34320a3aaa3d7a6f Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 18 Oct 2017 15:45:58 +0200 Subject: [PATCH 66/72] Fixed issues related to phone numbers --- src/android/org/linphone/LinphoneUtils.java | 2 +- submodules/linphone | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/android/org/linphone/LinphoneUtils.java b/src/android/org/linphone/LinphoneUtils.java index a66f3ed75..171c9cae2 100644 --- a/src/android/org/linphone/LinphoneUtils.java +++ b/src/android/org/linphone/LinphoneUtils.java @@ -541,7 +541,7 @@ public final class LinphoneUtils { public static String getFullAddressFromUsername(String username) { String sipAddress = username; Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); - if (lc == null) return sipAddress; + if (lc == null || username == null) return sipAddress; if (!sipAddress.startsWith("sip:")) { sipAddress = "sip:" + sipAddress; diff --git a/submodules/linphone b/submodules/linphone index a9e3caf17..aaf0eac9c 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit a9e3caf17f8c233f5ab9a517a1382c6fd3453a24 +Subproject commit aaf0eac9c79b8f69abba752a29c6b12ce18ed957 From 31feeb9ff338229daefdf3fb50232483196229a4 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 18 Oct 2017 16:04:37 +0200 Subject: [PATCH 67/72] Check if result of interpret url is null or not to prevent crash (previously handled by exception) --- src/android/org/linphone/ChatFragment.java | 1 + src/android/org/linphone/LinphoneActivity.java | 1 + src/android/org/linphone/LinphoneManager.java | 1 + submodules/linphone | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/android/org/linphone/ChatFragment.java b/src/android/org/linphone/ChatFragment.java index 5b802c950..203162f43 100644 --- a/src/android/org/linphone/ChatFragment.java +++ b/src/android/org/linphone/ChatFragment.java @@ -400,6 +400,7 @@ public class ChatFragment extends Fragment implements OnClickListener, ChatMessa } else { try { lAddress = lc.interpretUrl(sipUri); + if (lAddress == null) LinphoneActivity.instance().goToDialerFragment(); } catch (Exception e) { //TODO Error popup LinphoneActivity.instance().goToDialerFragment(); diff --git a/src/android/org/linphone/LinphoneActivity.java b/src/android/org/linphone/LinphoneActivity.java index 3abbb46a6..35500965c 100644 --- a/src/android/org/linphone/LinphoneActivity.java +++ b/src/android/org/linphone/LinphoneActivity.java @@ -658,6 +658,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick Address lAddress = null; if(sipUri != null) { lAddress = LinphoneManager.getLc().interpretUrl(sipUri); + if (lAddress == null) return; LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(lAddress); displayName = contact != null ? contact.getFullName() : null; diff --git a/src/android/org/linphone/LinphoneManager.java b/src/android/org/linphone/LinphoneManager.java index 1fd1d3528..201336b16 100644 --- a/src/android/org/linphone/LinphoneManager.java +++ b/src/android/org/linphone/LinphoneManager.java @@ -569,6 +569,7 @@ public class LinphoneManager implements CoreListener, ChatMessageListener, Senso Address lAddress; lAddress = mLc.interpretUrl(to); + if (lAddress == null) return; if (mR.getBoolean(R.bool.forbid_self_call) && lpc != null && lAddress.asStringUriOnly().equals(lpc.getIdentityAddress())) { return; } diff --git a/submodules/linphone b/submodules/linphone index aaf0eac9c..c0a2fcd05 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit aaf0eac9c79b8f69abba752a29c6b12ce18ed957 +Subproject commit c0a2fcd05dd46f1202cee980127dd96db82f1855 From e57c9947a621891a762cccec2f8dc6b65211d065 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 18 Oct 2017 17:08:45 +0200 Subject: [PATCH 68/72] Removed code added not necessary --- src/android/org/linphone/SettingsFragment.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/android/org/linphone/SettingsFragment.java b/src/android/org/linphone/SettingsFragment.java index 7774d8727..a071b281f 100644 --- a/src/android/org/linphone/SettingsFragment.java +++ b/src/android/org/linphone/SettingsFragment.java @@ -542,7 +542,7 @@ public class SettingsFragment extends PreferencesListFragment { public boolean onPreferenceChange(Preference preference, Object newValue) { boolean enable = (Boolean) newValue; pt.enable(enable); - ((CheckBoxPreference)preference).setChecked(enable); + //((CheckBoxPreference)preference).setChecked(enable); return true; } }); @@ -751,6 +751,7 @@ public class SettingsFragment extends PreferencesListFragment { } } pt.enable(enable); + //((CheckBoxPreference)preference).setChecked(enable); return true; } }); From 38c65f61c36f1cc0a82d627a5754f4ecfaafbcfc Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 18 Oct 2017 17:36:49 +0200 Subject: [PATCH 69/72] Removed useless comments --- src/android/org/linphone/SettingsFragment.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/android/org/linphone/SettingsFragment.java b/src/android/org/linphone/SettingsFragment.java index a071b281f..cb1e866d5 100644 --- a/src/android/org/linphone/SettingsFragment.java +++ b/src/android/org/linphone/SettingsFragment.java @@ -542,7 +542,6 @@ public class SettingsFragment extends PreferencesListFragment { public boolean onPreferenceChange(Preference preference, Object newValue) { boolean enable = (Boolean) newValue; pt.enable(enable); - //((CheckBoxPreference)preference).setChecked(enable); return true; } }); @@ -751,7 +750,6 @@ public class SettingsFragment extends PreferencesListFragment { } } pt.enable(enable); - //((CheckBoxPreference)preference).setChecked(enable); return true; } }); From c8bb4e98b972bdbd8f9e315134f07ca48006a3fc Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 18 Oct 2017 18:07:33 +0200 Subject: [PATCH 70/72] Workaround for unability to uncheck any checked payload type in UI (problem appeared in this branch, master is fine, and when debugger is running it doesn't happen)... --- src/android/org/linphone/SettingsFragment.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/android/org/linphone/SettingsFragment.java b/src/android/org/linphone/SettingsFragment.java index cb1e866d5..1c93146d2 100644 --- a/src/android/org/linphone/SettingsFragment.java +++ b/src/android/org/linphone/SettingsFragment.java @@ -535,7 +535,7 @@ public class SettingsFragment extends PreferencesListFragment { } codec.setSummary(pt.getClockRate() + " Hz"); - codec.setChecked(pt.enabled()); + codec.setDefaultValue(pt.enabled()); codec.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { @Override @@ -717,7 +717,7 @@ public class SettingsFragment extends PreferencesListFragment { codec.setTitle("OpenH264"); } } - codec.setChecked(pt.enabled()); + codec.setDefaultValue(pt.enabled()); codec.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { @Override From c7eee910f979c8d4c75284561cfedb34156fd73d Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 19 Oct 2017 11:41:39 +0200 Subject: [PATCH 71/72] Updated linphone + use new Core constructor --- src/android/org/linphone/LinphoneManager.java | 2 +- submodules/linphone | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/android/org/linphone/LinphoneManager.java b/src/android/org/linphone/LinphoneManager.java index 201336b16..ed6bb86d7 100644 --- a/src/android/org/linphone/LinphoneManager.java +++ b/src/android/org/linphone/LinphoneManager.java @@ -837,7 +837,7 @@ public class LinphoneManager implements CoreListener, ChatMessageListener, Senso try { copyAssetsFromPackage(); //traces alway start with traces enable to not missed first initialization - mLc = Factory.instance().createCore(this, mConfigFile, mLinphoneFactoryConfigFile); + mLc = Factory.instance().createCore(this, mConfigFile, mLinphoneFactoryConfigFile, c); TimerTask lTask = new TimerTask() { @Override public void run() { diff --git a/submodules/linphone b/submodules/linphone index c0a2fcd05..d5e59ae6e 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit c0a2fcd05dd46f1202cee980127dd96db82f1855 +Subproject commit d5e59ae6eef31be6600fa4ce875bfcea70f1d85e From 9995de67309f10d62e3470b7e777908401d07018 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 19 Oct 2017 11:55:09 +0200 Subject: [PATCH 72/72] Updated linphone to fix crash --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index d5e59ae6e..a44cbae88 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit d5e59ae6eef31be6600fa4ce875bfcea70f1d85e +Subproject commit a44cbae88d82d5f26e5ab11a0361fdcd61630492