Change summary
src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java | 11 +-
1 file changed, 7 insertions(+), 4 deletions(-)
Detailed changes
@@ -149,7 +149,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
@Override
public boolean onKeyDown(final int keyCode, final KeyEvent event) {
- if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN){
+ if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
if (xmppConnectionService != null) {
if (xmppConnectionService.getNotificationService().stopSoundAndVibration()) {
return true;
@@ -489,8 +489,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
return;
}
//TODO apparently this method is not getting called on Android 10 when using the task switcher
- final boolean emptyReference = rtpConnectionReference == null || rtpConnectionReference.get() == null;
- if (emptyReference && xmppConnectionService != null) {
+ if (emptyReference(rtpConnectionReference) && xmppConnectionService != null) {
retractSessionProposal();
}
}
@@ -1077,7 +1076,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
updateRtpSessionProposalState(account, with, state);
return;
}
- if (this.rtpConnectionReference == null) {
+ if (emptyReference(this.rtpConnectionReference)) {
if (END_CARD.contains(state)) {
Log.d(Config.LOGTAG, "not reinitializing session");
return;
@@ -1175,4 +1174,8 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
intent.putExtra(EXTRA_LAST_ACTION, media.contains(Media.VIDEO) ? ACTION_MAKE_VIDEO_CALL : ACTION_MAKE_VOICE_CALL);
setIntent(intent);
}
+
+ private static boolean emptyReference(final WeakReference<?> weakReference) {
+ return weakReference == null || weakReference.get() == null;
+ }
}