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

Commit 211104c7 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "HFP: Suspend A2DP whenever call state is busy"

parents eed8d08a c1375b83
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -1486,13 +1486,13 @@ public class HeadsetService extends ProfileService {
            }
            }
        }
        }
        mStateMachinesThread.getThreadHandler().post(() -> {
        mStateMachinesThread.getThreadHandler().post(() -> {
            boolean shouldCallAudioBeActiveBefore = shouldCallAudioBeActive();
            boolean isCallIdleBefore = mSystemInterface.isCallIdle();
            mSystemInterface.getHeadsetPhoneState().setNumActiveCall(numActive);
            mSystemInterface.getHeadsetPhoneState().setNumActiveCall(numActive);
            mSystemInterface.getHeadsetPhoneState().setNumHeldCall(numHeld);
            mSystemInterface.getHeadsetPhoneState().setNumHeldCall(numHeld);
            mSystemInterface.getHeadsetPhoneState().setCallState(callState);
            mSystemInterface.getHeadsetPhoneState().setCallState(callState);
            // Suspend A2DP when call about is about to become active
            // Suspend A2DP when call about is about to become active
            if (callState != HeadsetHalConstants.CALL_STATE_DISCONNECTED
            if (callState != HeadsetHalConstants.CALL_STATE_DISCONNECTED
                    && shouldCallAudioBeActive() && !shouldCallAudioBeActiveBefore) {
                    && !mSystemInterface.isCallIdle() && isCallIdleBefore) {
                mSystemInterface.getAudioManager().setParameters("A2dpSuspended=true");
                mSystemInterface.getAudioManager().setParameters("A2dpSuspended=true");
            }
            }
        });
        });
@@ -1501,7 +1501,7 @@ public class HeadsetService extends ProfileService {
                        new HeadsetCallState(numActive, numHeld, callState, number, type)));
                        new HeadsetCallState(numActive, numHeld, callState, number, type)));
        mStateMachinesThread.getThreadHandler().post(() -> {
        mStateMachinesThread.getThreadHandler().post(() -> {
            if (callState == HeadsetHalConstants.CALL_STATE_IDLE
            if (callState == HeadsetHalConstants.CALL_STATE_IDLE
                    && !shouldCallAudioBeActive() && !isAudioOn()) {
                    && mSystemInterface.isCallIdle() && !isAudioOn()) {
                // Resume A2DP when call ended and SCO is not connected
                // Resume A2DP when call ended and SCO is not connected
                mSystemInterface.getAudioManager().setParameters("A2dpSuspended=false");
                mSystemInterface.getAudioManager().setParameters("A2dpSuspended=false");
            }
            }