add a couple of todos to RtpSessionActivity

This commit is contained in:
Daniel Gultsch 2020-04-15 21:08:49 +02:00
parent f995965dea
commit d7e93e18e5
1 changed files with 12 additions and 7 deletions

View File

@ -124,6 +124,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
@SuppressLint("WakelockTimeout") @SuppressLint("WakelockTimeout")
private void putScreenInCallMode() { private void putScreenInCallMode() {
//TODO for video calls we actually do want to keep the screen on
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
final JingleRtpConnection rtpConnection = rtpConnectionReference != null ? rtpConnectionReference.get() : null; final JingleRtpConnection rtpConnection = rtpConnectionReference != null ? rtpConnectionReference.get() : null;
final AppRTCAudioManager audioManager = rtpConnection == null ? null : rtpConnection.getAudioManager(); final AppRTCAudioManager audioManager = rtpConnection == null ? null : rtpConnection.getAudioManager();
@ -209,13 +210,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
resetIntent(intent.getExtras()); resetIntent(intent.getExtras());
} }
} else if (asList(ACTION_MAKE_VIDEO_CALL, ACTION_MAKE_VOICE_CALL).contains(action)) { } else if (asList(ACTION_MAKE_VIDEO_CALL, ACTION_MAKE_VOICE_CALL).contains(action)) {
final Set<Media> media; proposeJingleRtpSession(account, with, actionToMedia(action));
if (ACTION_MAKE_VIDEO_CALL.equals(action)) {
media = ImmutableSet.of(Media.AUDIO, Media.VIDEO);
} else {
media = ImmutableSet.of(Media.AUDIO);
}
proposeJingleRtpSession(account, with, media);
binding.with.setText(account.getRoster().getContact(with).getDisplayName()); binding.with.setText(account.getRoster().getContact(with).getDisplayName());
} else if (Intent.ACTION_VIEW.equals(action)) { } else if (Intent.ACTION_VIEW.equals(action)) {
final String extraLastState = intent.getStringExtra(EXTRA_LAST_REPORTED_STATE); final String extraLastState = intent.getStringExtra(EXTRA_LAST_REPORTED_STATE);
@ -229,6 +224,14 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
} }
} }
private static Set<Media> 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> media) { private void proposeJingleRtpSession(final Account account, final Jid with, final Set<Media> media) {
xmppConnectionService.getJingleConnectionManager().proposeJingleRtpSession(account, with, media); xmppConnectionService.getJingleConnectionManager().proposeJingleRtpSession(account, with, media);
//TODO maybe we dont want to acquire a wake lock just yet and wait for audio manager to discover what speaker we are using //TODO maybe we dont 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(); finish();
return; return;
} else if (asList(RtpEndUserState.APPLICATION_ERROR, RtpEndUserState.DECLINED_OR_BUSY, RtpEndUserState.CONNECTIVITY_ERROR).contains(state)) { } 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); resetIntent(account, with, state);
} }
runOnUiThread(() -> { runOnUiThread(() -> {
updateStateDisplay(state); updateStateDisplay(state);
updateButtonConfiguration(state); updateButtonConfiguration(state);
//TODO kill video when in final or error stages
updateVideoViews(); updateVideoViews();
}); });
} else { } else {