Enforce leaving state when shutting down the activity

When the view is shutting down the call is always left, so the status
should be accordingly set.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2022-09-19 04:27:03 +02:00
parent 53e3543839
commit f94db44b4d

View File

@ -396,7 +396,6 @@ public class CallActivity extends CallBaseActivity {
binding.cameraButton.setOnClickListener(l -> onCameraClick());
binding.hangupButton.setOnClickListener(l -> {
setCallState(CallStatus.LEAVING);
hangup(true);
});
@ -1167,7 +1166,6 @@ public class CallActivity extends CallBaseActivity {
@Override
public void onDestroy() {
if (!currentCallStatus.equals(CallStatus.LEAVING)) {
setCallState(CallStatus.LEAVING);
hangup(true);
}
powerManagerUtils.updatePhoneState(PowerManagerUtils.PhoneState.IDLE);
@ -1660,6 +1658,9 @@ public class CallActivity extends CallBaseActivity {
private void hangup(boolean shutDownView) {
Log.d(TAG, "hangup! shutDownView=" + shutDownView);
if (shutDownView) {
setCallState(CallStatus.LEAVING);
}
stopCallingSound();
dispose(null);