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,7 +247,9 @@ public class ContactsManager extends ContentObserver {
|
|||
}
|
||||
}
|
||||
|
||||
for (LinphoneFriend friend : LinphoneManager.getLc().getFriendList()) {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
for (LinphoneFriend friend : lc.getFriendList()) {
|
||||
String refkey = friend.getRefKey();
|
||||
if (refkey != null) {
|
||||
boolean found = false;
|
||||
|
@ -262,7 +264,7 @@ public class ContactsManager extends ContentObserver {
|
|||
if (!found) {
|
||||
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
|
||||
LinphoneManager.getLc().removeFriend(friend);
|
||||
lc.removeFriend(friend);
|
||||
} else {
|
||||
// Refkey not null but no contact access => can't link it to native contact so display it on is own
|
||||
LinphoneContact contact = new LinphoneContact();
|
||||
|
@ -277,6 +279,7 @@ public class ContactsManager extends ContentObserver {
|
|||
contacts.add(contact);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (LinphoneContact contact : contacts) {
|
||||
// This will only get name & picture informations to be able to quickly display contacts list
|
||||
|
|
|
@ -622,6 +622,7 @@ public final class LinphoneService extends Service {
|
|||
}
|
||||
|
||||
instance = null;
|
||||
getContentResolver().unregisterContentObserver(ContactsManager.getInstance());
|
||||
LinphoneManager.destroy();
|
||||
|
||||
// Make sure our notification is gone.
|
||||
|
@ -630,7 +631,6 @@ public final class LinphoneService extends Service {
|
|||
mNM.cancel(MESSAGE_NOTIF_ID);
|
||||
|
||||
((AlarmManager) this.getSystemService(Context.ALARM_SERVICE)).cancel(mkeepAlivePendingIntent);
|
||||
getContentResolver().unregisterContentObserver(ContactsManager.getInstance());
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue