From cefb48ef60059ef159395b43cb3e9f2d6f59a56d Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Thu, 21 Apr 2016 15:01:02 +0200 Subject: [PATCH] [Presence] presence completed --- res/drawable-xhdpi/presence_online.png | Bin 1601 -> 1018 bytes res/layout/avatar_with_presence.xml | 2 +- res/raw/linphonerc_factory | 256 ++---------------- src/org/linphone/ContactDetailsFragment.java | 4 +- src/org/linphone/ContactsListFragment.java | 9 - src/org/linphone/LinphoneActivity.java | 16 +- src/org/linphone/LinphoneContact.java | 2 +- src/org/linphone/LinphoneManager.java | 29 +- .../linphone/ui/AvatarWithPresenceImage.java | 3 +- submodules/linphone | 2 +- 10 files changed, 40 insertions(+), 283 deletions(-) diff --git a/res/drawable-xhdpi/presence_online.png b/res/drawable-xhdpi/presence_online.png index 79fc3098d0c980cb3d6e66ff900aa6c9b578b8db..2f14a08081a1e2b8571790266a7726a9dccc301e 100644 GIT binary patch delta 984 zcmV;}11J2!4EhHliBL{Q4GJ0x0000DNk~Le0000Z0000Z2nGNE03O-1S&<DlB%StP^GRC z3Dhi#qQsN3s03_~N)W6;JTguIu|h(kJESfM67j^OEfSm3MyRMsJPwZ{o+_j`5Bsw4 zOk!gvU}KNOzq^`yXTCZ2oO92)e~^dzLSn(^y;oP$cXM;j?^SY{Y?uOFvu4Lf)9E@T5(6xvIQ~_)PJ^^Zh)qoe60-gd9UD8KZEeQR6lhcQgCFif|E&h5#qk&=DDehRD2iG=*w zFvT)mvj~Q&=ZC4hy3yI5f8D@g3NHyX0H*;0jnV8d$9~;FNAn2ApjZbSqd0PWbeCa@ zT~456z$}S*9QJNt6~&bb>^DqNmYPIoVLHATZuqbDpXNS^;_nd~-1J)<@1@ zr=3yV(8oYCKvz>_4o2DZ!kMtuPVH{#Gs6@$8Qato603j>xU2O*e{}|oqOcOEa2cio zSeY%)c!9+(!<47Gh5AOgskkpS8%zwCbQxsE{%!`$GvK+)FwgDpro%jA={?|q%P{{U zxt9TRP#c!OE!%W%X-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@i45eS&j9@ab^K&;ReWPo zAP;qKeKVNdT34J8G|0crn04Vl&#w;6J^$szMD`HJ3>#}-kRIOi9v1?~aAw^Ie zy)|q1;L00yRq>aGKA-wXZAJVy^>iW7lU;^<)uU4HYer4v!jWy^tJIUVK;}QX6=JUO z%IeF%fBV5-hfg3i74i2~S(*jK_y?G){URn@kw+_YOL(D*ypoBPDX>RGuSoRNm82aG z(zGQ!S43KXQ5iHVel4E4yr#M{;l^o_^^@wV;_FqJ1N@X3m8e@?N2`*7nAD0qlEx3u zm?$}+*9GRJsi6z{U`=Iw<>6=dq$MOkOAF4vf62x5s4gcZC-V7U-WX46YN|W8q+qU1 zU7l~7a=O!Ro$R7IHg~+3)PCV(!dDGi_Q`EFlpBJ`<&-0M`QLZ26&i*Ut$~-5( z`L^FRZXQq&sCLD&{Ck_KfdAtF@z5B_)?M2 zJy$j_nZ0{N-<(UEQ=k7W&D+A`y diff --git a/res/raw/linphonerc_factory b/res/raw/linphonerc_factory index 9368b2186..785851bef 100644 --- a/res/raw/linphonerc_factory +++ b/res/raw/linphonerc_factory @@ -1,57 +1,24 @@ + +# +#This file shall not contain path referencing package name, in order to be portable when app is renamed. +#Paths to resources must be set from LinphoneManager, after creating LinphoneCore. [net] -download_bw=380 -upload_bw=380 mtu=1300 -firewall_policy=ice -stun_server=85.233.205.218 + +[app] +animations=0 +show_login_view=1 +debug_popup_magic=#1234 +debug=1 +server_url=http://85.233.205.218:443/xmlrpc [sip] -contact="Linphone Android" -use_info=0 -use_ipv6=0 -keepalive_period=30000 guess_hostname=1 inc_timeout=15 register_only_when_network_is_up=1 auto_net_state_mon=0 auto_answer_replacing_calls=1 ping_with_options=0 -root_ca=/data/user/0/org.linphone/files/rootca.pem -verify_server_certs=1 -verify_server_cn=1 -media_encryption=zrtp -multi_transport_migration_done=1 -in_call_timeout=0 -delayed_timeout=4 -register_only_when_upnp_is_ok=1 -media_encryption_mandatory=1 -sip_port=-1 -sip_tcp_port=-1 -sip_tls_port=-1 -srtp_crypto_suites=AES_CM_256_HMAC_SHA1_80 -default_proxy=0 -rls_uri=sip:rls@sip.example.org -use_rls_presence=1 - -[video] -size=qvga -device=Android1 -display=1 -capture=1 - -[app] -sharing_server=https://www.linphone.org:444/lft.php -tunnel=disabled -push_notification=1 -animations=0 -show_login_view=1 -debug_popup_magic=#1234 -debug=1 -server_url=http://85.233.205.218:443/xmlrpc -first_launch=0 - -[tunnel] -port=443 [rtp] audio_rtp_port=7076 @@ -60,204 +27,17 @@ audio_jitt_comp=60 video_jitt_comp=60 nortp_timeout=30 disable_upnp=1 -text_rtp_port=11078 -audio_adaptive_jitt_comp_enabled=1 -video_adaptive_jitt_comp_enabled=1 [sound] +playback_dev_id= +ringer_dev_id= +capture_dev_id= dtmf_player_amp=0.1 -ec_calibrator_cool_tones=1 -local_ring=/data/user/0/org.linphone/files/oldphone_mono.wav -remote_ring=/data/user/0/org.linphone/files/ringback.wav -playback_gain_db=0.000000 -mic_gain_db=0.000000 + #remove this property for any application that is not Linphone public version itself +ec_calibrator_cool_tones=1 + [misc] max_calls=10 -log_collection_upload_server_url=https://www.linphone.org:444/lft.php -uuid=3ac65678-272f-47d9-8aff-19950c565687 -friends_migration_done=1 -user_certificates_path=/data/user/0/org.linphone/files -file_transfer_server_url=https://www.linphone.org:444/lft.php -config-uri=https://85.233.205.218/xmlrpc?username=margaux&password=cotcot&domain=sip.orangecyberdefense.com - -[audio_codec_0] -mime=opus -rate=48000 -channels=2 -enabled=1 - -[audio_codec_1] -mime=SILK -rate=16000 -channels=1 -enabled=1 - -[audio_codec_2] -mime=speex -rate=16000 -channels=1 -enabled=1 - -[audio_codec_3] -mime=speex -rate=8000 -channels=1 -enabled=1 - -[audio_codec_4] -mime=PCMU -rate=8000 -channels=1 -enabled=1 - -[audio_codec_5] -mime=PCMA -rate=8000 -channels=1 -enabled=1 - -[audio_codec_6] -mime=GSM -rate=8000 -channels=1 -enabled=0 - -[audio_codec_7] -mime=G722 -rate=8000 -channels=1 -enabled=0 - -[audio_codec_8] -mime=iLBC -rate=8000 -channels=1 -enabled=0 - -[audio_codec_9] -mime=mpeg4-generic -rate=16000 -channels=1 -enabled=0 - -[audio_codec_10] -mime=mpeg4-generic -rate=22050 -channels=1 -enabled=0 - -[audio_codec_11] -mime=mpeg4-generic -rate=32000 -channels=1 -enabled=0 - -[audio_codec_12] -mime=mpeg4-generic -rate=44100 -channels=1 -enabled=0 - -[audio_codec_13] -mime=mpeg4-generic -rate=48000 -channels=1 -enabled=0 - -[audio_codec_14] -mime=iSAC -rate=16000 -channels=1 -enabled=0 - -[audio_codec_15] -mime=speex -rate=32000 -channels=1 -enabled=0 - -[audio_codec_16] -mime=SILK -rate=8000 -channels=1 -enabled=0 - -[audio_codec_17] -mime=SILK -rate=12000 -channels=1 -enabled=0 - -[audio_codec_18] -mime=SILK -rate=24000 -channels=1 -enabled=0 - -[audio_codec_19] -mime=L16 -rate=44100 -channels=2 -enabled=0 - -[audio_codec_20] -mime=L16 -rate=44100 -channels=1 -enabled=0 - -[video_codec_0] -mime=VP8 -rate=90000 -enabled=1 - -[video_codec_1] -mime=H264 -rate=90000 -enabled=1 -recv_fmtp=profile-level-id=42801F - -[friend_1] -url="Sylvain Berfini" - -[friend_0] -url="Margaux Clerc" - -[friend_2] -url="Jehan Monnier" - -[friend_3] -url="Marielle Rellier" - -[friend_4] -url="Simon Morlat" - -[friend_5] -url="François Grisez" - -[friend_5] -url="L'ami invisible'" - -[proxy_0] -reg_proxy= -reg_route= -reg_identity=sip:testios@sip.linphone.org -quality_reporting_enabled=0 -quality_reporting_interval=0 -reg_expires=3600 -reg_sendregister=1 -publish=1 -avpf=-1 -avpf_rr_interval=5 -dial_escape_plus=0 -privacy=32768 -refkey=push_notification -publish_expires=600 - -[auth_info_0] -username=testios -passwd=testtest -realm=sip.linphone.org -domain=sip.linphone.org +log_collection_upload_server_url=https://www.linphone.org:444/lft.php \ No newline at end of file diff --git a/src/org/linphone/ContactDetailsFragment.java b/src/org/linphone/ContactDetailsFragment.java index b554bd5ed..6c3e7d8bf 100644 --- a/src/org/linphone/ContactDetailsFragment.java +++ b/src/org/linphone/ContactDetailsFragment.java @@ -260,9 +260,9 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener }); dialog.show(); } - if (id == R.id.back) { + */ if (id == R.id.back) { LinphoneActivity.instance().displayContacts(false); } - */ + } } diff --git a/src/org/linphone/ContactsListFragment.java b/src/org/linphone/ContactsListFragment.java index 89fe69659..0be52ce8d 100644 --- a/src/org/linphone/ContactsListFragment.java +++ b/src/org/linphone/ContactsListFragment.java @@ -433,15 +433,6 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O separatorText.setVisibility(View.VISIBLE); } - /* ImageView icon = (ImageView) view.findViewById(R.id.contact_picture); - if (contact.hasPhoto()) { - LinphoneUtils.setImagePictureFromUri(getActivity(), icon, contact.getPhotoUri(), contact.getThumbnailUri()); - } else if (contact.getPhotoUri() != null) { - icon.setImageURI(contact.getPhotoUri()); - } else { - icon.setImageResource(R.drawable.avatar); - } - */ AvatarWithPresenceImage avatarWithPresenceImage = (AvatarWithPresenceImage) view.findViewById(R.id.avatar_with_presence); avatarWithPresenceImage.setFormatAvatarImage(AvatarWithPresenceImage.AVATAR_SMALL); if(contact != null && contact.isLinphoneFriend()) { diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java index 3b764770d..4ea064840 100644 --- a/src/org/linphone/LinphoneActivity.java +++ b/src/org/linphone/LinphoneActivity.java @@ -283,13 +283,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta @Override public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) { - Log.e("===>> LinphoneActivity : notifyPresenceReceived 1 : "+lf.getName().toString()); - /* for(AvatarWithPresenceImage listener : listeners){ - Log.e("===>> LinphoneActivity : notifyPresenceReceived 2 : "+lf.getName().toString()); - if(listener.isThisFriend(lf)){ - listener.updatePresenceIcon(lc, lf); - } - }*/ + } }; @@ -751,7 +745,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta } public void displayChat(String sipUri) { - Log.e("===>>> displayChat"); if (getResources().getBoolean(R.bool.disable_chat)) { return; } @@ -1293,8 +1286,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta @Override protected void onPause() { - Log.e("LinphoneActivity - onPause"); - //LinphoneManager.getInstance().enableProxyPublish(false); + LinphoneManager.getInstance().enableProxyPublish(false); getIntent().putExtra("PreviousActivity", 0); super.onPause(); @@ -1348,7 +1340,8 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta refreshAccounts(); displayMissedCalls(LinphoneManager.getLc().getMissedCallsCount()); - LinphoneManager.getInstance().changeStatusToOnline(); + //LinphoneManager.getInstance().changeStatusToOnline(); + LinphoneManager.getInstance().enableProxyPublish(true); if (getIntent().getIntExtra("PreviousActivity", 0) != CALL_ACTIVITY){ if (LinphoneManager.getLc().getCalls().length > 0) { @@ -1375,6 +1368,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta } } } + } @Override diff --git a/src/org/linphone/LinphoneContact.java b/src/org/linphone/LinphoneContact.java index 4ff84769c..8e25244ab 100644 --- a/src/org/linphone/LinphoneContact.java +++ b/src/org/linphone/LinphoneContact.java @@ -374,7 +374,7 @@ public class LinphoneContact implements Serializable, Comparable> enableProxyPublish : "+enabled); LinphoneCore lc = getLcIfManagerNotDestroyedOrNull(); if(lc != null ) { LinphoneProxyConfig[] proxyList = lc.getProxyConfigList(); - Log.e("==>> enableProxyPublish : LC not null : "+proxyList.length); + if(!enabled) + changeStatusToOffline(); for (LinphoneProxyConfig proxyConfig : proxyList) { - Log.e("==>> enableProxyPublish : proxyList"); proxyConfig.edit(); proxyConfig.enablePublish(enabled); proxyConfig.done(); } + if(enabled) + changeStatusToOnline(); } } public void changeStatusToOnline() { + LinphoneCore lc = getLcIfManagerNotDestroyedOrNull(); - if (isInstanciated() && lc != null && isPresenceModelActivitySet() && lc.getPresenceModel().getActivity().getType() != PresenceActivityType.Online) { - lc.getPresenceModel().getActivity().setType(PresenceActivityType.Online); - } else if (isInstanciated() && lc != null && !isPresenceModelActivitySet()) { - PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.Online, null); + if (isInstanciated() && lc != null ){ + PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.TV, null); lc.setPresenceModel(model); } } public void changeStatusToOnThePhone() { LinphoneCore lc = getLcIfManagerNotDestroyedOrNull(); - if (isInstanciated() && isPresenceModelActivitySet() && lc.getPresenceModel().getActivity().getType() != PresenceActivityType.OnThePhone) { - lc.getPresenceModel().getActivity().setType(PresenceActivityType.OnThePhone); - } else if (isInstanciated() && !isPresenceModelActivitySet()) { + if (isInstanciated() && lc != null) { PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.OnThePhone, null); lc.setPresenceModel(model); } @@ -389,10 +386,8 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag public void changeStatusToOffline() { LinphoneCore lc = getLcIfManagerNotDestroyedOrNull(); - if (isInstanciated() && isPresenceModelActivitySet() && lc.getPresenceModel().getActivity().getType() != PresenceActivityType.Offline) { - lc.getPresenceModel().getActivity().setType(PresenceActivityType.Offline); - } else if (isInstanciated() && !isPresenceModelActivitySet()) { - PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.Offline, null); + if (isInstanciated() && lc != null) { + PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.Away, null); lc.setPresenceModel(model); } } @@ -827,7 +822,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } public static synchronized void destroy() { - instance.enableProxyPublish(false); if (instance == null) return; getInstance().changeStatusToOffline(); sExited = true; @@ -870,10 +864,9 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) { - Log.e("===>> LinphoneManager - notifyPresenceReceived : "+lf.getName()); for(AvatarWithPresenceImage listener : listeners){ if(listener.isThisFriend(lf)){ - Log.e("===>> LinphoneManager : notifyPresenceReceived 2 : "+lf.getName().toString()); + Log.e("===>> LinphoneManager : notifyPresenceReceived : "+lf.getName().toString()+" - "+lf.getPresenceModel().getActivity().getType()); listener.updatePresenceIcon(lc, lf); } } diff --git a/src/org/linphone/ui/AvatarWithPresenceImage.java b/src/org/linphone/ui/AvatarWithPresenceImage.java index b61fbc92d..4d7fc35f7 100644 --- a/src/org/linphone/ui/AvatarWithPresenceImage.java +++ b/src/org/linphone/ui/AvatarWithPresenceImage.java @@ -92,11 +92,10 @@ public class AvatarWithPresenceImage extends RelativeLayout implements onPresenc friendStatusBig = (ImageView) this.findViewById(R.id.friend_status_big); PresenceModel presenceModel = contact.getFriendPresenceModel(); PresenceBasicStatus basicStatus = presenceModel.getBasicStatus(); - Log.e("===>>> updateAvatarPresence basicStatus = "+ presenceModel.getBasicStatus().toString()+" - "+ presenceModel.getActivity().getType().toString()); if (basicStatus == PresenceBasicStatus.Closed) { friendStatusSmall.setImageResource(R.drawable.presence_unregistered); friendStatusBig.setImageResource(R.drawable.presence_unregistered); - } else if (presenceModel.getActivity().getType() == PresenceActivityType.TV ) { + } else if ((presenceModel.getActivity().getType() == PresenceActivityType.TV ) || (presenceModel.getActivity().getType() == PresenceActivityType.Online)) { friendStatusSmall.setImageResource(R.drawable.presence_online); friendStatusBig.setImageResource(R.drawable.presence_online); } else { diff --git a/submodules/linphone b/submodules/linphone index 465559dd6..6a02a5701 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 465559dd662d8e1c2a05dea873154c1d2dbdd241 +Subproject commit 6a02a570180eaedf0377317758481ec82cbc791f