Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5d28bc0e authored by Roshan Pius's avatar Roshan Pius Committed by Android Git Automerger
Browse files

am 45184280: am cf897fe3: am ef51640d: am 669f90b7: Abandon audioFocus only...

am 45184280: am cf897fe3: am ef51640d: am 669f90b7: Abandon audioFocus only when all the calls are disconnected.

* commit '45184280':
  Abandon audioFocus only when all the calls are disconnected.
parents 747bf6a9 45184280
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1672,4 +1672,13 @@ public class Call implements CreateConnectionResponse {
        }
        return CallState.DISCONNECTED;
    }

    /**
     * Determines if this call is in disconnected state and waiting to be destroyed.
     *
     * @return {@code true} if this call is disconected.
     */
    public boolean isDisconnected() {
        return (getState() == CallState.DISCONNECTED || getState() == CallState.ABORTED);
    }
}
+2 −3
Original line number Diff line number Diff line
@@ -520,8 +520,7 @@ final class CallAudioManager extends CallsManagerListenerBase
                Log.v(this, "updateAudioStreamAndMode : no foreground, speeding up MT audio.");
                requestAudioFocusAndSetMode(AudioManager.STREAM_VOICE_CALL,
                                                         AudioManager.MODE_IN_CALL);
            } else if (foregroundCall != null &&
                    foregroundCall.getState() != CallState.DISCONNECTED  &&
            } else if (foregroundCall != null && !foregroundCall.isDisconnected() &&
                    waitingForAccountSelectionCall == null) {
                // In the case where there is a call that is waiting for account selection,
                // this will fall back to abandonAudioFocus() below, which temporarily exits
@@ -540,7 +539,7 @@ final class CallAudioManager extends CallsManagerListenerBase
                Log.v(this, "updateAudioStreamAndMode : tone playing");
                requestAudioFocusAndSetMode(
                        AudioManager.STREAM_VOICE_CALL, mMostRecentlyUsedMode);
            } else if (!hasRingingForegroundCall()) {
            } else if (!hasRingingForegroundCall() && mCallsManager.hasOnlyDisconnectedCalls()) {
                Log.v(this, "updateAudioStreamAndMode : no ringing call");
                abandonAudioFocus();
            } else {
+9 −0
Original line number Diff line number Diff line
@@ -439,6 +439,15 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx
        return false;
    }

    boolean hasOnlyDisconnectedCalls() {
        for (Call call : mCalls) {
            if (!call.isDisconnected()) {
                return false;
            }
        }
        return true;
    }

    boolean hasVideoCall() {
        for (Call call : mCalls) {
            if (VideoProfile.isVideo(call.getVideoState())) {