when using onNewIntent make sure to store intent otherwise onBackground might just overwrite it again

Daniel Gultsch created

Change summary

src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java | 9 ++
1 file changed, 8 insertions(+), 1 deletion(-)

Detailed changes

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();
         }