From deaa76b5ca46d07a967ebfc9945f4659bbc8509f Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 11 Apr 2020 20:51:37 +0200 Subject: [PATCH] when using onNewIntent make sure to store intent otherwise onBackground might just overwrite it again --- .../eu/siacs/conversations/ui/RtpSessionActivity.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java index 73c066eec..fb4de0e95 100644 --- a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java @@ -141,7 +141,11 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe @Override public void onNewIntent(final Intent intent) { super.onNewIntent(intent); - //TODO. deal with 'pending intent' in case background service isn’t here yet. + setIntent(intent); + if (xmppConnectionService == null) { + Log.d(Config.LOGTAG,"RtpSessionActivity: background service wasn't bound in onNewIntent()"); + return; + } final Account account = extractAccount(intent); final Jid with = Jid.of(intent.getStringExtra(EXTRA_WITH)); final String sessionId = intent.getStringExtra(EXTRA_SESSION_ID); @@ -239,6 +243,9 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe finish(); return; } + if (currentState == RtpEndUserState.INCOMING_CALL) { + getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + } if (JingleRtpConnection.STATES_SHOWING_ONGOING_CALL.contains(requireRtpConnection().getState())) { putScreenInCallMode(); }