retract call when user presses home button or back; not on stop. fixes #3802

This commit is contained in:
Daniel Gultsch 2020-06-22 15:37:22 +02:00
parent 57135e1a59
commit a5430d5ce1
1 changed files with 12 additions and 9 deletions

View File

@ -276,7 +276,11 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
private void releaseProximityWakeLock() {
if (this.mProximityWakeLock != null && mProximityWakeLock.isHeld()) {
Log.d(Config.LOGTAG, "releasing proximity wake lock");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
this.mProximityWakeLock.release(PowerManager.RELEASE_FLAG_WAIT_FOR_NO_PROXIMITY);
} else {
this.mProximityWakeLock.release();
}
this.mProximityWakeLock = null;
}
}
@ -402,10 +406,6 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
final JingleRtpConnection jingleRtpConnection = weakReference == null ? null : weakReference.get();
if (jingleRtpConnection != null) {
releaseVideoTracks(jingleRtpConnection);
} else if (!isChangingConfigurations()) {
if (xmppConnectionService != null) {
retractSessionProposal();
}
}
releaseProximityWakeLock();
super.onStop();
@ -424,17 +424,20 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
@Override
public void onBackPressed() {
endCall();
super.onBackPressed();
endCall();
}
@Override
public void onUserLeaveHint() {
super.onUserLeaveHint();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && deviceSupportsPictureInPicture()) {
if (shouldBePictureInPicture()) {
startPictureInPicture();
return;
}
}
retractSessionProposal();
}
@RequiresApi(api = Build.VERSION_CODES.O)
@ -445,7 +448,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
.setAspectRatio(new Rational(10, 16))
.build()
);
} catch (IllegalStateException e) {
} catch (final IllegalStateException e) {
//this sometimes happens on Samsung phones (possibly when Knox is enabled)
Log.w(Config.LOGTAG, "unable to enter picture in picture mode", e);
}
@ -467,7 +470,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
RtpEndUserState.CONNECTING,
RtpEndUserState.CONNECTED
).contains(rtpConnection.getEndUserState());
} catch (IllegalStateException e) {
} catch (final IllegalStateException e) {
return false;
}
}