do not continue to accept call if reinit() caused activity to finish
This commit is contained in:
parent
cfb9368edb
commit
d7a8519ad6
|
@ -220,7 +220,9 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
|
||||||
final String sessionId = intent.getStringExtra(EXTRA_SESSION_ID);
|
final String sessionId = intent.getStringExtra(EXTRA_SESSION_ID);
|
||||||
if (sessionId != null) {
|
if (sessionId != null) {
|
||||||
Log.d(Config.LOGTAG, "reinitializing from onNewIntent()");
|
Log.d(Config.LOGTAG, "reinitializing from onNewIntent()");
|
||||||
initializeActivityWithRunningRtpSession(account, with, sessionId);
|
if (initializeActivityWithRunningRtpSession(account, with, sessionId)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (ACTION_ACCEPT_CALL.equals(intent.getAction())) {
|
if (ACTION_ACCEPT_CALL.equals(intent.getAction())) {
|
||||||
Log.d(Config.LOGTAG, "accepting call from onNewIntent()");
|
Log.d(Config.LOGTAG, "accepting call from onNewIntent()");
|
||||||
requestPermissionsAndAcceptCall();
|
requestPermissionsAndAcceptCall();
|
||||||
|
@ -239,8 +241,9 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
|
||||||
final Jid with = Jid.of(intent.getStringExtra(EXTRA_WITH));
|
final Jid with = Jid.of(intent.getStringExtra(EXTRA_WITH));
|
||||||
final String sessionId = intent.getStringExtra(EXTRA_SESSION_ID);
|
final String sessionId = intent.getStringExtra(EXTRA_SESSION_ID);
|
||||||
if (sessionId != null) {
|
if (sessionId != null) {
|
||||||
//TODO this should probably return true/false so we don’t continue to accept the call after calling finish()
|
if (initializeActivityWithRunningRtpSession(account, with, sessionId)) {
|
||||||
initializeActivityWithRunningRtpSession(account, with, sessionId);
|
return;
|
||||||
|
}
|
||||||
if (ACTION_ACCEPT_CALL.equals(intent.getAction())) {
|
if (ACTION_ACCEPT_CALL.equals(intent.getAction())) {
|
||||||
Log.d(Config.LOGTAG, "intent action was accept");
|
Log.d(Config.LOGTAG, "intent action was accept");
|
||||||
requestPermissionsAndAcceptCall();
|
requestPermissionsAndAcceptCall();
|
||||||
|
@ -357,18 +360,18 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeActivityWithRunningRtpSession(final Account account, Jid with, String sessionId) {
|
private boolean initializeActivityWithRunningRtpSession(final Account account, Jid with, String sessionId) {
|
||||||
final WeakReference<JingleRtpConnection> reference = xmppConnectionService.getJingleConnectionManager()
|
final WeakReference<JingleRtpConnection> reference = xmppConnectionService.getJingleConnectionManager()
|
||||||
.findJingleRtpConnection(account, with, sessionId);
|
.findJingleRtpConnection(account, with, sessionId);
|
||||||
if (reference == null || reference.get() == null) {
|
if (reference == null || reference.get() == null) {
|
||||||
finish();
|
finish();
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
this.rtpConnectionReference = reference;
|
this.rtpConnectionReference = reference;
|
||||||
final RtpEndUserState currentState = requireRtpConnection().getEndUserState();
|
final RtpEndUserState currentState = requireRtpConnection().getEndUserState();
|
||||||
if (currentState == RtpEndUserState.ENDED) {
|
if (currentState == RtpEndUserState.ENDED) {
|
||||||
finish();
|
finish();
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
if (currentState == RtpEndUserState.INCOMING_CALL) {
|
if (currentState == RtpEndUserState.INCOMING_CALL) {
|
||||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||||
|
@ -381,6 +384,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
|
||||||
updateStateDisplay(currentState);
|
updateStateDisplay(currentState);
|
||||||
updateButtonConfiguration(currentState);
|
updateButtonConfiguration(currentState);
|
||||||
updateProfilePicture(currentState);
|
updateProfilePicture(currentState);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reInitializeActivityWithRunningRapSession(final Account account, Jid with, String sessionId) {
|
private void reInitializeActivityWithRunningRapSession(final Account account, Jid with, String sessionId) {
|
||||||
|
|
Loading…
Reference in New Issue