Browse Source

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>
Daniel Calviño Sánchez 2 years ago
parent
commit
f94db44b4d

+ 3 - 2
app/src/main/java/com/nextcloud/talk/activities/CallActivity.java

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