Revert "offline presences aborts session proposals. fixes #3943"

This reverts commit f23016c967.
This commit is contained in:
Daniel Gultsch 2021-01-06 09:03:42 +01:00
parent 17c697eed9
commit 372ddbfb49
2 changed files with 27 additions and 49 deletions

View File

@ -206,26 +206,23 @@ public class XmppConnectionService extends Service {
}
};
public DatabaseBackend databaseBackend;
private final ReplacingSerialSingleThreadExecutor mContactMergerExecutor = new ReplacingSerialSingleThreadExecutor("ContactMerger");
private ReplacingSerialSingleThreadExecutor mContactMergerExecutor = new ReplacingSerialSingleThreadExecutor("ContactMerger");
private long mLastActivity = 0;
private final FileBackend fileBackend = new FileBackend(this);
private FileBackend fileBackend = new FileBackend(this);
private MemorizingTrustManager mMemorizingTrustManager;
private final NotificationService mNotificationService = new NotificationService(this);
private final ChannelDiscoveryService mChannelDiscoveryService = new ChannelDiscoveryService(this);
private final ShortcutService mShortcutService = new ShortcutService(this);
private final AtomicBoolean mInitialAddressbookSyncCompleted = new AtomicBoolean(false);
private final AtomicBoolean mForceForegroundService = new AtomicBoolean(false);
private final AtomicBoolean mForceDuringOnCreate = new AtomicBoolean(false);
private final AtomicReference<OngoingCall> ongoingCall = new AtomicReference<>();
private final OnMessagePacketReceived mMessageParser = new MessageParser(this);
private final OnPresencePacketReceived mPresenceParser = new PresenceParser(this);
private final IqParser mIqParser = new IqParser(this);
private final MessageGenerator mMessageGenerator = new MessageGenerator(this);
private NotificationService mNotificationService = new NotificationService(this);
private ChannelDiscoveryService mChannelDiscoveryService = new ChannelDiscoveryService(this);
private ShortcutService mShortcutService = new ShortcutService(this);
private AtomicBoolean mInitialAddressbookSyncCompleted = new AtomicBoolean(false);
private AtomicBoolean mForceForegroundService = new AtomicBoolean(false);
private AtomicBoolean mForceDuringOnCreate = new AtomicBoolean(false);
private AtomicReference<OngoingCall> ongoingCall = new AtomicReference<>();
private OnMessagePacketReceived mMessageParser = new MessageParser(this);
private OnPresencePacketReceived mPresenceParser = new PresenceParser(this);
private IqParser mIqParser = new IqParser(this);
private MessageGenerator mMessageGenerator = new MessageGenerator(this);
public OnContactStatusChanged onContactStatusChanged = (contact, online) -> {
if (!online) {
getJingleConnectionManager().failProposedSessions(contact.getAccount(), contact.getJid().asBareJid());
}
final Conversation conversation = find(getConversations(), contact);
Conversation conversation = find(getConversations(), contact);
if (conversation != null) {
if (online) {
if (contact.getPresences().size() == 1) {
@ -234,14 +231,14 @@ public class XmppConnectionService extends Service {
}
}
};
private final PresenceGenerator mPresenceGenerator = new PresenceGenerator(this);
private PresenceGenerator mPresenceGenerator = new PresenceGenerator(this);
private List<Account> accounts;
private final JingleConnectionManager mJingleConnectionManager = new JingleConnectionManager(this);
private final HttpConnectionManager mHttpConnectionManager = new HttpConnectionManager(this);
private final AvatarService mAvatarService = new AvatarService(this);
private final MessageArchiveService mMessageArchiveService = new MessageArchiveService(this);
private final PushManagementService mPushManagementService = new PushManagementService(this);
private final QuickConversationsService mQuickConversationsService = new QuickConversationsService(this);
private JingleConnectionManager mJingleConnectionManager = new JingleConnectionManager(this);
private HttpConnectionManager mHttpConnectionManager = new HttpConnectionManager(this);
private AvatarService mAvatarService = new AvatarService(this);
private MessageArchiveService mMessageArchiveService = new MessageArchiveService(this);
private PushManagementService mPushManagementService = new PushManagementService(this);
private QuickConversationsService mQuickConversationsService = new QuickConversationsService(this);
private final ConversationsFileObserver fileObserver = new ConversationsFileObserver(
Environment.getExternalStorageDirectory().getAbsolutePath()
) {

View File

@ -681,30 +681,11 @@ public class JingleConnectionManager extends AbstractConnectionManager {
Log.d(Config.LOGTAG, "session proposal already at discovered. not going to fall back");
return;
}
updateProposedSessionDiscovered(sessionProposal, target);
}
}
public void updateProposedSessionDiscovered(RtpSessionProposal sessionProposal, final DeviceDiscoveryState target) {
this.rtpSessionProposals.put(sessionProposal, target);
final RtpEndUserState endUserState = target.toEndUserState();
toneManager.transition(endUserState, sessionProposal.media);
mXmppConnectionService.notifyJingleRtpConnectionUpdate(sessionProposal.account, sessionProposal.with, sessionProposal.sessionId, endUserState);
Log.d(Config.LOGTAG, sessionProposal.account.getJid().asBareJid() + ": flagging session " + sessionProposal.sessionId + " as " + target);
}
public void failProposedSessions(final Account account, Jid from) {
synchronized (this.rtpSessionProposals) {
for (Map.Entry<RtpSessionProposal, DeviceDiscoveryState> entry : rtpSessionProposals.entrySet()) {
final RtpSessionProposal rtpSessionProposal = entry.getKey();
final DeviceDiscoveryState state = entry.getValue();
if (state != DeviceDiscoveryState.DISCOVERED) {
continue;
}
if (rtpSessionProposal.with.equals(from) && rtpSessionProposal.account.getJid().equals(account.getJid())) {
updateProposedSessionDiscovered(rtpSessionProposal, JingleConnectionManager.DeviceDiscoveryState.FAILED);
}
}
mXmppConnectionService.notifyJingleRtpConnectionUpdate(account, sessionProposal.with, sessionProposal.sessionId, endUserState);
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": flagging session " + sessionId + " as " + target);
}
}