This should prevent contactFetcherTask to run when LinphoneService is not running
This commit is contained in:
parent
f015c0330f
commit
8c6b34303e
2 changed files with 29 additions and 26 deletions
|
@ -247,34 +247,37 @@ public class ContactsManager extends ContentObserver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (LinphoneFriend friend : LinphoneManager.getLc().getFriendList()) {
|
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
String refkey = friend.getRefKey();
|
if (lc != null) {
|
||||||
if (refkey != null) {
|
for (LinphoneFriend friend : lc.getFriendList()) {
|
||||||
boolean found = false;
|
String refkey = friend.getRefKey();
|
||||||
for (LinphoneContact contact : contacts) {
|
if (refkey != null) {
|
||||||
if (refkey.equals(contact.getAndroidId())) {
|
boolean found = false;
|
||||||
// Native matching contact found, link the friend to it
|
for (LinphoneContact contact : contacts) {
|
||||||
contact.setFriend(friend);
|
if (refkey.equals(contact.getAndroidId())) {
|
||||||
found = true;
|
// Native matching contact found, link the friend to it
|
||||||
break;
|
contact.setFriend(friend);
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if (!found) {
|
||||||
if (!found) {
|
if (hasContactAccess) {
|
||||||
if (hasContactAccess) {
|
// If refkey != null and hasContactAccess but there isn't a native contact with this value, then this contact has been deleted. Let's do the same with the LinphoneFriend
|
||||||
// If refkey != null and hasContactAccess but there isn't a native contact with this value, then this contact has been deleted. Let's do the same with the LinphoneFriend
|
lc.removeFriend(friend);
|
||||||
LinphoneManager.getLc().removeFriend(friend);
|
} else {
|
||||||
} else {
|
// Refkey not null but no contact access => can't link it to native contact so display it on is own
|
||||||
// Refkey not null but no contact access => can't link it to native contact so display it on is own
|
LinphoneContact contact = new LinphoneContact();
|
||||||
LinphoneContact contact = new LinphoneContact();
|
contact.setFriend(friend);
|
||||||
contact.setFriend(friend);
|
contacts.add(contact);
|
||||||
contacts.add(contact);
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// No refkey so it's a standalone contact
|
||||||
|
LinphoneContact contact = new LinphoneContact();
|
||||||
|
contact.setFriend(friend);
|
||||||
|
contacts.add(contact);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// No refkey so it's a standalone contact
|
|
||||||
LinphoneContact contact = new LinphoneContact();
|
|
||||||
contact.setFriend(friend);
|
|
||||||
contacts.add(contact);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -622,6 +622,7 @@ public final class LinphoneService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
instance = null;
|
instance = null;
|
||||||
|
getContentResolver().unregisterContentObserver(ContactsManager.getInstance());
|
||||||
LinphoneManager.destroy();
|
LinphoneManager.destroy();
|
||||||
|
|
||||||
// Make sure our notification is gone.
|
// Make sure our notification is gone.
|
||||||
|
@ -630,7 +631,6 @@ public final class LinphoneService extends Service {
|
||||||
mNM.cancel(MESSAGE_NOTIF_ID);
|
mNM.cancel(MESSAGE_NOTIF_ID);
|
||||||
|
|
||||||
((AlarmManager) this.getSystemService(Context.ALARM_SERVICE)).cancel(mkeepAlivePendingIntent);
|
((AlarmManager) this.getSystemService(Context.ALARM_SERVICE)).cancel(mkeepAlivePendingIntent);
|
||||||
getContentResolver().unregisterContentObserver(ContactsManager.getInstance());
|
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue