From d7e93e18e5577541430b4a0019974a0195d73699 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 15 Apr 2020 21:08:49 +0200 Subject: [PATCH] add a couple of todos to RtpSessionActivity --- .../conversations/ui/RtpSessionActivity.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java index 4c4a35d0c..a920dfa51 100644 --- a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java @@ -124,6 +124,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe @SuppressLint("WakelockTimeout") private void putScreenInCallMode() { + //TODO for video calls we actually do want to keep the screen on getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); final JingleRtpConnection rtpConnection = rtpConnectionReference != null ? rtpConnectionReference.get() : null; final AppRTCAudioManager audioManager = rtpConnection == null ? null : rtpConnection.getAudioManager(); @@ -209,13 +210,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe resetIntent(intent.getExtras()); } } else if (asList(ACTION_MAKE_VIDEO_CALL, ACTION_MAKE_VOICE_CALL).contains(action)) { - final Set media; - if (ACTION_MAKE_VIDEO_CALL.equals(action)) { - media = ImmutableSet.of(Media.AUDIO, Media.VIDEO); - } else { - media = ImmutableSet.of(Media.AUDIO); - } - proposeJingleRtpSession(account, with, media); + proposeJingleRtpSession(account, with, actionToMedia(action)); binding.with.setText(account.getRoster().getContact(with).getDisplayName()); } else if (Intent.ACTION_VIEW.equals(action)) { final String extraLastState = intent.getStringExtra(EXTRA_LAST_REPORTED_STATE); @@ -229,6 +224,14 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe } } + private static Set actionToMedia(final String action) { + if (ACTION_MAKE_VIDEO_CALL.equals(action)) { + return ImmutableSet.of(Media.AUDIO, Media.VIDEO); + } else { + return ImmutableSet.of(Media.AUDIO); + } + } + private void proposeJingleRtpSession(final Account account, final Jid with, final Set media) { xmppConnectionService.getJingleConnectionManager().proposeJingleRtpSession(account, with, media); //TODO maybe we don’t want to acquire a wake lock just yet and wait for audio manager to discover what speaker we are using @@ -586,11 +589,13 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe finish(); return; } else if (asList(RtpEndUserState.APPLICATION_ERROR, RtpEndUserState.DECLINED_OR_BUSY, RtpEndUserState.CONNECTIVITY_ERROR).contains(state)) { + //todo remember if we were video resetIntent(account, with, state); } runOnUiThread(() -> { updateStateDisplay(state); updateButtonConfiguration(state); + //TODO kill video when in final or error stages updateVideoViews(); }); } else {