Fix set/remove OnUpdateBlocklistListener

This commit is contained in:
Andreas Straub 2015-07-20 14:12:24 +02:00
parent dd964077b9
commit e9d7d7e12a

View file

@ -1347,17 +1347,17 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
switchToForeground();
}
this.mOnUpdateBlocklist = listener;
if (this.newKeysAvailableListenerCount < 2) {
this.newKeysAvailableListenerCount++;
if (this.updateBlocklistListenerCount < 2) {
this.updateBlocklistListenerCount++;
}
}
}
public void removeOnUpdateBlocklistListener() {
synchronized (this) {
this.newKeysAvailableListenerCount--;
if (this.newKeysAvailableListenerCount <= 0) {
this.newKeysAvailableListenerCount = 0;
this.updateBlocklistListenerCount--;
if (this.updateBlocklistListenerCount <= 0) {
this.updateBlocklistListenerCount = 0;
this.mOnUpdateBlocklist = null;
if (checkListeners()) {
switchToBackground();